File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -49,3 +49,53 @@ var result = await connection.Run(query, vars);
4949
5050Console .WriteLine (result .Login + " & " + result .Name + " Rocks!" );
5151```
52+
53+ ``` csharp
54+ using Octokit .GraphQL ;
55+ using Octokit .GraphQL .Model ;
56+ using System ;
57+ using System .Linq ;
58+ using System .Threading .Tasks ;
59+
60+ namespace Octokit
61+ {
62+ class Program
63+ {
64+ static async Task Main (string [] args )
65+ {
66+ var productInformation = new ProductHeaderValue (" ExampleCode" , " 1.0" );
67+
68+ // Personal Access Token - needs a scope of 'read:user'
69+ var connection = new Connection (productInformation , " LOGGED_IN_GITHUB_USER_TOKEN" );
70+
71+ // A query to list out who you are actively sponsoring
72+ // That auto pages through all sponsors
73+ var query = new Query ()
74+ .Viewer
75+ .SponsorshipsAsSponsor ()
76+ .AllPages ()
77+ .Select (sponsoring => new
78+ {
79+ User = sponsoring .Sponsorable
80+ .Cast <User >()
81+ .Select (x => new {
82+ x .Login ,
83+ x .Name ,
84+ x .Id
85+ })
86+ .Single ()
87+ })
88+ .Compile ();
89+
90+ var result = await connection .Run (query );
91+
92+ // Sponsoring 'warrenbuckley' ?
93+ var activeSponsor = result .SingleOrDefault (x => x .User .Login .ToLowerInvariant () == " warrenbuckley" );
94+ if (activeSponsor != null )
95+ {
96+ Console .WriteLine (" Thanks for sponsoring Warren" );
97+ }
98+ }
99+ }
100+ }
101+ ```
You can’t perform that action at this time.
0 commit comments