From 9670c5f332d3fbcfe71a5aaba763b9626ae50f77 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 9 Jul 2018 18:49:31 -0400 Subject: [PATCH 1/5] Adding a usage example to the main page readme --- .../Queries/RepositoryTests.cs | 30 +++++++++++++++- docs/variables.md | 8 ++--- readme.md | 36 ++++++++++++++++++- 3 files changed, 68 insertions(+), 6 deletions(-) diff --git a/Octokit.GraphQL.IntegrationTests/Queries/RepositoryTests.cs b/Octokit.GraphQL.IntegrationTests/Queries/RepositoryTests.cs index b2049dc0..c86be78f 100644 --- a/Octokit.GraphQL.IntegrationTests/Queries/RepositoryTests.cs +++ b/Octokit.GraphQL.IntegrationTests/Queries/RepositoryTests.cs @@ -25,6 +25,34 @@ public void Should_Query_All_RepositoryOwner_Repositories() Assert.Contains("go-octokit", repositoryNames); } + [IntegrationTest] + public void Should_Run_Readme_Query() + { + var query = new Query() + .RepositoryOwner(Var("owner")) + .Repository(Var("name")) + .Select(repo => new + { + repo.Id, + repo.Name, + repo.Owner.Login, + repo.IsFork, + repo.IsPrivate, + }); + + var compiledQuery = query.Compile(); + + var vars = new Dictionary + { + { "owner", "octokit" }, + { "name", "octokit.graphql.net" }, + }; + + var result = Connection.Run(compiledQuery, vars).Result; + Assert.Equal(result.Login, "octokit"); + Assert.Equal(result.Name, "octokit.graphql.net"); + } + [IntegrationTest] public void Should_Query_Repository_ByName() { @@ -94,7 +122,7 @@ public void Should_Query_Repository_With_Variables() Assert.Equal("octokit.net", repositoryName); } - + [IntegrationTest] public async Task Should_Query_Repository_Issues_PullRequests_With_Variables_AutoPaging() { diff --git a/docs/variables.md b/docs/variables.md index 8f1fa925..92b46fb1 100644 --- a/docs/variables.md +++ b/docs/variables.md @@ -10,7 +10,7 @@ To define a variable, you should: For example: ``` -using static Octokit.GraphQL.Variable +using static Octokit.GraphQL.Variable; var query = new Query() .Repository(Var("owner"), Var("name")) @@ -26,9 +26,9 @@ You can now use those variables by passing an `IDictionary` into ``` var vars = new Dictionary { - { "owner": "octokit" }, - { "name": "Octokit.GraphQL.net" }, + { "owner", "octokit" }, + { "name", "Octokit.GraphQL.net" }, }; var result = await connection.Run(query, vars); -``` \ No newline at end of file +``` diff --git a/readme.md b/readme.md index 21cd93dc..17b57e13 100644 --- a/readme.md +++ b/readme.md @@ -6,4 +6,38 @@ Octokit.GraphQL gives you access to the GitHub GraphQL API from .NET. It exposes ## Documentation -You can find our documentation [here](docs/readme.md). \ No newline at end of file +You can find our documentation [here](docs/readme.md). + +## Usage Example + +```csharp +using Octokit.GraphQL; +using Octokit.GraphQL.Core; +using static Octokit.GraphQL.Variable; + +var connection = new Connection("https://api.github.com/graphql", YOUR_OAUTH_TOKEN); + +var query = new Query() + .RepositoryOwner(Var("owner")) + .Repository(Var("name")) + .Select(repo => new + { + repo.Id, + repo.Name, + repo.Owner.Login, + repo.IsFork, + repo.IsPrivate, + }); + +var compiledQuery = query.Compile(); + +var vars = new Dictionary +{ + { "owner", "octokit" }, + { "name", "octokit.graphql.net" }, +}; + +var result = await Connection.Run(compiledQuery, vars); + +Console.WriteLine(result.Owner + " & " + result.Name + " Rocks!"); +``` From 4e296ce3b61b3814d26120952384e50cbf99297b Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Wed, 11 Jul 2018 10:04:09 -0400 Subject: [PATCH 2/5] Refactoring example --- Octokit.GraphQL.IntegrationTests/Queries/RepositoryTests.cs | 6 ++---- readme.md | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Octokit.GraphQL.IntegrationTests/Queries/RepositoryTests.cs b/Octokit.GraphQL.IntegrationTests/Queries/RepositoryTests.cs index c86be78f..f3c60356 100644 --- a/Octokit.GraphQL.IntegrationTests/Queries/RepositoryTests.cs +++ b/Octokit.GraphQL.IntegrationTests/Queries/RepositoryTests.cs @@ -38,9 +38,7 @@ public void Should_Run_Readme_Query() repo.Owner.Login, repo.IsFork, repo.IsPrivate, - }); - - var compiledQuery = query.Compile(); + }).Compile(); var vars = new Dictionary { @@ -48,7 +46,7 @@ public void Should_Run_Readme_Query() { "name", "octokit.graphql.net" }, }; - var result = Connection.Run(compiledQuery, vars).Result; + var result = Connection.Run(query, vars).Result; Assert.Equal(result.Login, "octokit"); Assert.Equal(result.Name, "octokit.graphql.net"); } diff --git a/readme.md b/readme.md index 17b57e13..262ca074 100644 --- a/readme.md +++ b/readme.md @@ -27,9 +27,7 @@ var query = new Query() repo.Owner.Login, repo.IsFork, repo.IsPrivate, - }); - -var compiledQuery = query.Compile(); + }).Compile(); var vars = new Dictionary { @@ -37,7 +35,7 @@ var vars = new Dictionary { "name", "octokit.graphql.net" }, }; -var result = await Connection.Run(compiledQuery, vars); +var result = await Connection.Run(query, vars); Console.WriteLine(result.Owner + " & " + result.Name + " Rocks!"); ``` From cd5a3a0944e0e6291d9a15f132181544e430ddce Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Wed, 11 Jul 2018 10:34:03 -0400 Subject: [PATCH 3/5] Fixing the usage example --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 262ca074..a5aa4173 100644 --- a/readme.md +++ b/readme.md @@ -37,5 +37,5 @@ var vars = new Dictionary var result = await Connection.Run(query, vars); -Console.WriteLine(result.Owner + " & " + result.Name + " Rocks!"); +Console.WriteLine(result.Login + " & " + result.Name + " Rocks!"); ``` From d1d07cea7d6cb5f8359e5a6c0263eda8cea7b6a9 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Wed, 11 Jul 2018 10:36:52 -0400 Subject: [PATCH 4/5] Updating Resharper settings to R#2018.1.3 --- Octokit.GraphQL.sln.DotSettings | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Octokit.GraphQL.sln.DotSettings b/Octokit.GraphQL.sln.DotSettings index f92befdb..7acf74fb 100644 --- a/Octokit.GraphQL.sln.DotSettings +++ b/Octokit.GraphQL.sln.DotSettings @@ -1,5 +1,11 @@  + NEVER False + True + True + True + True True + True True True \ No newline at end of file From 7f0c954bad11d74a5fb9e8da3d16243624d8bcc0 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Wed, 11 Jul 2018 10:59:15 -0400 Subject: [PATCH 5/5] Updating schema --- Octokit.GraphQL/Model/CheckAnnotation.cs | 68 ++++++++++ .../Model/CheckAnnotationConnection.cs | 45 +++++++ Octokit.GraphQL/Model/CheckAnnotationEdge.cs | 33 +++++ Octokit.GraphQL/Model/CheckAnnotationLevel.cs | 32 +++++ Octokit.GraphQL/Model/CheckConclusionState.cs | 50 ++++++++ Octokit.GraphQL/Model/CheckRun.cs | 119 ++++++++++++++++++ Octokit.GraphQL/Model/CheckRunConnection.cs | 45 +++++++ Octokit.GraphQL/Model/CheckRunEdge.cs | 33 +++++ Octokit.GraphQL/Model/CheckRunFilter.cs | 19 +++ Octokit.GraphQL/Model/CheckRunType.cs | 26 ++++ Octokit.GraphQL/Model/CheckStatusState.cs | 38 ++++++ Octokit.GraphQL/Model/CheckSuite.cs | 94 ++++++++++++++ Octokit.GraphQL/Model/CheckSuiteConnection.cs | 45 +++++++ Octokit.GraphQL/Model/CheckSuiteEdge.cs | 33 +++++ Octokit.GraphQL/Model/CheckSuiteFilter.cs | 15 +++ Octokit.GraphQL/Model/Commit.cs | 10 ++ Octokit.GraphQL/Model/Deployment.cs | 10 ++ Octokit.GraphQL/Model/Push.cs | 50 ++++++++ 18 files changed, 765 insertions(+) create mode 100644 Octokit.GraphQL/Model/CheckAnnotation.cs create mode 100644 Octokit.GraphQL/Model/CheckAnnotationConnection.cs create mode 100644 Octokit.GraphQL/Model/CheckAnnotationEdge.cs create mode 100644 Octokit.GraphQL/Model/CheckAnnotationLevel.cs create mode 100644 Octokit.GraphQL/Model/CheckConclusionState.cs create mode 100644 Octokit.GraphQL/Model/CheckRun.cs create mode 100644 Octokit.GraphQL/Model/CheckRunConnection.cs create mode 100644 Octokit.GraphQL/Model/CheckRunEdge.cs create mode 100644 Octokit.GraphQL/Model/CheckRunFilter.cs create mode 100644 Octokit.GraphQL/Model/CheckRunType.cs create mode 100644 Octokit.GraphQL/Model/CheckStatusState.cs create mode 100644 Octokit.GraphQL/Model/CheckSuite.cs create mode 100644 Octokit.GraphQL/Model/CheckSuiteConnection.cs create mode 100644 Octokit.GraphQL/Model/CheckSuiteEdge.cs create mode 100644 Octokit.GraphQL/Model/CheckSuiteFilter.cs create mode 100644 Octokit.GraphQL/Model/Push.cs diff --git a/Octokit.GraphQL/Model/CheckAnnotation.cs b/Octokit.GraphQL/Model/CheckAnnotation.cs new file mode 100644 index 00000000..1ef72b17 --- /dev/null +++ b/Octokit.GraphQL/Model/CheckAnnotation.cs @@ -0,0 +1,68 @@ +namespace Octokit.GraphQL.Model +{ + using System; + using System.Collections.Generic; + using System.Linq.Expressions; + using Octokit.GraphQL.Core; + using Octokit.GraphQL.Core.Builders; + + /// + /// A single check annotation. + /// + public class CheckAnnotation : QueryableValue + { + public CheckAnnotation(Expression expression) : base(expression) + { + } + + /// + /// The path to the file that this annotation was made on. + /// + public string BlobUrl { get; } + + /// + /// Identifies the primary key from the database. + /// + public int? DatabaseId { get; } + + /// + /// The ending line for this annotation. + /// + public int EndLine { get; } + + /// + /// The filename that this annotation was made on. + /// + public string Filename { get; } + + /// + /// The annotation's message. + /// + public string Message { get; } + + /// + /// Additional information about the annotation. + /// + public string RawDetails { get; } + + /// + /// The starting line for this annotation. + /// + public int StartLine { get; } + + /// + /// The annotation's title + /// + public string Title { get; } + + /// + /// The annotation's severity level. + /// + public CheckAnnotationLevel? WarningLevel { get; } + + internal static CheckAnnotation Create(Expression expression) + { + return new CheckAnnotation(expression); + } + } +} \ No newline at end of file diff --git a/Octokit.GraphQL/Model/CheckAnnotationConnection.cs b/Octokit.GraphQL/Model/CheckAnnotationConnection.cs new file mode 100644 index 00000000..ab5a4015 --- /dev/null +++ b/Octokit.GraphQL/Model/CheckAnnotationConnection.cs @@ -0,0 +1,45 @@ +namespace Octokit.GraphQL.Model +{ + using System; + using System.Collections.Generic; + using System.Linq.Expressions; + using Octokit.GraphQL.Core; + using Octokit.GraphQL.Core.Builders; + + /// + /// The connection type for CheckAnnotation. + /// + public class CheckAnnotationConnection : QueryableValue, IPagingConnection + { + public CheckAnnotationConnection(Expression expression) : base(expression) + { + } + + /// + /// A list of edges. + /// + public IQueryableList Edges => this.CreateProperty(x => x.Edges); + + /// + /// A list of nodes. + /// + public IQueryableList Nodes => this.CreateProperty(x => x.Nodes); + + /// + /// Information to aid in pagination. + /// + public PageInfo PageInfo => this.CreateProperty(x => x.PageInfo, Octokit.GraphQL.Model.PageInfo.Create); + + /// + /// Identifies the total count of items in the connection. + /// + public int TotalCount { get; } + + IPageInfo IPagingConnection.PageInfo => PageInfo; + + internal static CheckAnnotationConnection Create(Expression expression) + { + return new CheckAnnotationConnection(expression); + } + } +} \ No newline at end of file diff --git a/Octokit.GraphQL/Model/CheckAnnotationEdge.cs b/Octokit.GraphQL/Model/CheckAnnotationEdge.cs new file mode 100644 index 00000000..ca3dc8f5 --- /dev/null +++ b/Octokit.GraphQL/Model/CheckAnnotationEdge.cs @@ -0,0 +1,33 @@ +namespace Octokit.GraphQL.Model +{ + using System; + using System.Collections.Generic; + using System.Linq.Expressions; + using Octokit.GraphQL.Core; + using Octokit.GraphQL.Core.Builders; + + /// + /// An edge in a connection. + /// + public class CheckAnnotationEdge : QueryableValue + { + public CheckAnnotationEdge(Expression expression) : base(expression) + { + } + + /// + /// A cursor for use in pagination. + /// + public string Cursor { get; } + + /// + /// The item at the end of the edge. + /// + public CheckAnnotation Node => this.CreateProperty(x => x.Node, Octokit.GraphQL.Model.CheckAnnotation.Create); + + internal static CheckAnnotationEdge Create(Expression expression) + { + return new CheckAnnotationEdge(expression); + } + } +} \ No newline at end of file diff --git a/Octokit.GraphQL/Model/CheckAnnotationLevel.cs b/Octokit.GraphQL/Model/CheckAnnotationLevel.cs new file mode 100644 index 00000000..e17c1f72 --- /dev/null +++ b/Octokit.GraphQL/Model/CheckAnnotationLevel.cs @@ -0,0 +1,32 @@ +using System; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Octokit.GraphQL.Model +{ + /// + /// Represents an annotation's information level. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum CheckAnnotationLevel + { + /// + /// An annotation indicating an inescapable error. + /// + [EnumMember(Value = "FAILURE")] + Failure, + + /// + /// An annotation indicating some information. + /// + [EnumMember(Value = "NOTICE")] + Notice, + + /// + /// An annotation indicating an ignorable error. + /// + [EnumMember(Value = "WARNING")] + Warning, + } +} \ No newline at end of file diff --git a/Octokit.GraphQL/Model/CheckConclusionState.cs b/Octokit.GraphQL/Model/CheckConclusionState.cs new file mode 100644 index 00000000..1555cb1c --- /dev/null +++ b/Octokit.GraphQL/Model/CheckConclusionState.cs @@ -0,0 +1,50 @@ +using System; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Octokit.GraphQL.Model +{ + /// + /// The possible states for a check suite or run conclusion. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum CheckConclusionState + { + /// + /// The check suite or run requires action. + /// + [EnumMember(Value = "ACTION_REQUIRED")] + ActionRequired, + + /// + /// The check suite or run has timed out. + /// + [EnumMember(Value = "TIMED_OUT")] + TimedOut, + + /// + /// The check suite or run has been cancelled. + /// + [EnumMember(Value = "CANCELLED")] + Cancelled, + + /// + /// The check suite or run has failed. + /// + [EnumMember(Value = "FAILURE")] + Failure, + + /// + /// The check suite or run has succeeded. + /// + [EnumMember(Value = "SUCCESS")] + Success, + + /// + /// The check suite or run was neutral. + /// + [EnumMember(Value = "NEUTRAL")] + Neutral, + } +} \ No newline at end of file diff --git a/Octokit.GraphQL/Model/CheckRun.cs b/Octokit.GraphQL/Model/CheckRun.cs new file mode 100644 index 00000000..cd840248 --- /dev/null +++ b/Octokit.GraphQL/Model/CheckRun.cs @@ -0,0 +1,119 @@ +namespace Octokit.GraphQL.Model +{ + using System; + using System.Collections.Generic; + using System.Linq.Expressions; + using Octokit.GraphQL.Core; + using Octokit.GraphQL.Core.Builders; + + /// + /// A check run. + /// + public class CheckRun : QueryableValue + { + public CheckRun(Expression expression) : base(expression) + { + } + + /// + /// The check run's annotations + /// + /// Returns the first _n_ elements from the list. + /// Returns the elements in the list that come after the specified cursor. + /// Returns the last _n_ elements from the list. + /// Returns the elements in the list that come before the specified cursor. + public CheckAnnotationConnection Annotations(Arg? first = null, Arg? after = null, Arg? last = null, Arg? before = null) => this.CreateMethodCall(x => x.Annotations(first, after, last, before), Octokit.GraphQL.Model.CheckAnnotationConnection.Create); + + /// + /// The check suite that this run is a part of. + /// + public CheckSuite CheckSuite => this.CreateProperty(x => x.CheckSuite, Octokit.GraphQL.Model.CheckSuite.Create); + + /// + /// Identifies the date and time when the check run was completed. + /// + public DateTimeOffset? CompletedAt { get; } + + /// + /// The conclusion of the check run. + /// + public CheckConclusionState? Conclusion { get; } + + /// + /// The GitHub App bot associated with the check run. + /// + public Bot Creator => this.CreateProperty(x => x.Creator, Octokit.GraphQL.Model.Bot.Create); + + /// + /// Identifies the primary key from the database. + /// + public int? DatabaseId { get; } + + /// + /// The URL from which to find full details of the check run on the integrator's site. + /// + public string DetailsUrl { get; } + + /// + /// A reference for the check run on the integrator's system. + /// + public string ExternalId { get; } + + public ID Id { get; } + + /// + /// The name of the check for this check run. + /// + public string Name { get; } + + /// + /// The permalink to the check run summary. + /// + public string Permalink { get; } + + /// + /// The repository associated with this check run. + /// + public Repository Repository => this.CreateProperty(x => x.Repository, Octokit.GraphQL.Model.Repository.Create); + + /// + /// The HTTP path for this check run. + /// + public string ResourcePath { get; } + + /// + /// Identifies the date and time when the check run was started. + /// + public DateTimeOffset? StartedAt { get; } + + /// + /// The current status of the check run. + /// + public CheckStatusState Status { get; } + + /// + /// A string representing the check run's summary + /// + public string Summary { get; } + + /// + /// A string representing the check run's text + /// + public string Text { get; } + + /// + /// A string representing the check run + /// + public string Title { get; } + + /// + /// The HTTP URL for this check run. + /// + public string Url { get; } + + internal static CheckRun Create(Expression expression) + { + return new CheckRun(expression); + } + } +} \ No newline at end of file diff --git a/Octokit.GraphQL/Model/CheckRunConnection.cs b/Octokit.GraphQL/Model/CheckRunConnection.cs new file mode 100644 index 00000000..dba4cd51 --- /dev/null +++ b/Octokit.GraphQL/Model/CheckRunConnection.cs @@ -0,0 +1,45 @@ +namespace Octokit.GraphQL.Model +{ + using System; + using System.Collections.Generic; + using System.Linq.Expressions; + using Octokit.GraphQL.Core; + using Octokit.GraphQL.Core.Builders; + + /// + /// The connection type for CheckRun. + /// + public class CheckRunConnection : QueryableValue, IPagingConnection + { + public CheckRunConnection(Expression expression) : base(expression) + { + } + + /// + /// A list of edges. + /// + public IQueryableList Edges => this.CreateProperty(x => x.Edges); + + /// + /// A list of nodes. + /// + public IQueryableList Nodes => this.CreateProperty(x => x.Nodes); + + /// + /// Information to aid in pagination. + /// + public PageInfo PageInfo => this.CreateProperty(x => x.PageInfo, Octokit.GraphQL.Model.PageInfo.Create); + + /// + /// Identifies the total count of items in the connection. + /// + public int TotalCount { get; } + + IPageInfo IPagingConnection.PageInfo => PageInfo; + + internal static CheckRunConnection Create(Expression expression) + { + return new CheckRunConnection(expression); + } + } +} \ No newline at end of file diff --git a/Octokit.GraphQL/Model/CheckRunEdge.cs b/Octokit.GraphQL/Model/CheckRunEdge.cs new file mode 100644 index 00000000..44587835 --- /dev/null +++ b/Octokit.GraphQL/Model/CheckRunEdge.cs @@ -0,0 +1,33 @@ +namespace Octokit.GraphQL.Model +{ + using System; + using System.Collections.Generic; + using System.Linq.Expressions; + using Octokit.GraphQL.Core; + using Octokit.GraphQL.Core.Builders; + + /// + /// An edge in a connection. + /// + public class CheckRunEdge : QueryableValue + { + public CheckRunEdge(Expression expression) : base(expression) + { + } + + /// + /// A cursor for use in pagination. + /// + public string Cursor { get; } + + /// + /// The item at the end of the edge. + /// + public CheckRun Node => this.CreateProperty(x => x.Node, Octokit.GraphQL.Model.CheckRun.Create); + + internal static CheckRunEdge Create(Expression expression) + { + return new CheckRunEdge(expression); + } + } +} \ No newline at end of file diff --git a/Octokit.GraphQL/Model/CheckRunFilter.cs b/Octokit.GraphQL/Model/CheckRunFilter.cs new file mode 100644 index 00000000..a52962ac --- /dev/null +++ b/Octokit.GraphQL/Model/CheckRunFilter.cs @@ -0,0 +1,19 @@ +namespace Octokit.GraphQL.Model +{ + using System; + using System.Collections.Generic; + + /// + /// The filters that are available when fetching check runs. + /// + public class CheckRunFilter + { + public CheckRunType? CheckType { get; set; } + + public int? AppId { get; set; } + + public string CheckName { get; set; } + + public CheckStatusState? Status { get; set; } + } +} \ No newline at end of file diff --git a/Octokit.GraphQL/Model/CheckRunType.cs b/Octokit.GraphQL/Model/CheckRunType.cs new file mode 100644 index 00000000..93b35361 --- /dev/null +++ b/Octokit.GraphQL/Model/CheckRunType.cs @@ -0,0 +1,26 @@ +using System; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Octokit.GraphQL.Model +{ + /// + /// The possible types of check runs. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum CheckRunType + { + /// + /// Every check run available. + /// + [EnumMember(Value = "ALL")] + All, + + /// + /// The latest check run. + /// + [EnumMember(Value = "LATEST")] + Latest, + } +} \ No newline at end of file diff --git a/Octokit.GraphQL/Model/CheckStatusState.cs b/Octokit.GraphQL/Model/CheckStatusState.cs new file mode 100644 index 00000000..7ec8045b --- /dev/null +++ b/Octokit.GraphQL/Model/CheckStatusState.cs @@ -0,0 +1,38 @@ +using System; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Octokit.GraphQL.Model +{ + /// + /// The possible states for a check suite or run status. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum CheckStatusState + { + /// + /// The check suite or run has been requested. + /// + [EnumMember(Value = "REQUESTED")] + Requested, + + /// + /// The check suite or run has been queued. + /// + [EnumMember(Value = "QUEUED")] + Queued, + + /// + /// The check suite or run is in progress. + /// + [EnumMember(Value = "IN_PROGRESS")] + InProgress, + + /// + /// The check suite or run has been completed. + /// + [EnumMember(Value = "COMPLETED")] + Completed, + } +} \ No newline at end of file diff --git a/Octokit.GraphQL/Model/CheckSuite.cs b/Octokit.GraphQL/Model/CheckSuite.cs new file mode 100644 index 00000000..76c534f5 --- /dev/null +++ b/Octokit.GraphQL/Model/CheckSuite.cs @@ -0,0 +1,94 @@ +namespace Octokit.GraphQL.Model +{ + using System; + using System.Collections.Generic; + using System.Linq.Expressions; + using Octokit.GraphQL.Core; + using Octokit.GraphQL.Core.Builders; + + /// + /// A check suite. + /// + public class CheckSuite : QueryableValue + { + public CheckSuite(Expression expression) : base(expression) + { + } + + /// + /// The name of the branch for this check suite. + /// + public Ref Branch => this.CreateProperty(x => x.Branch, Octokit.GraphQL.Model.Ref.Create); + + /// + /// The check runs associated with a check suite. + /// + /// Returns the first _n_ elements from the list. + /// Returns the elements in the list that come after the specified cursor. + /// Returns the last _n_ elements from the list. + /// Returns the elements in the list that come before the specified cursor. + /// Filters the check runs by this type. + public CheckRunConnection CheckRuns(Arg? first = null, Arg? after = null, Arg? last = null, Arg? before = null, Arg? filterBy = null) => this.CreateMethodCall(x => x.CheckRuns(first, after, last, before, filterBy), Octokit.GraphQL.Model.CheckRunConnection.Create); + + /// + /// The commit for this check suite + /// + public Commit Commit => this.CreateProperty(x => x.Commit, Octokit.GraphQL.Model.Commit.Create); + + /// + /// The conclusion of this check suite. + /// + public CheckConclusionState? Conclusion { get; } + + /// + /// Identifies the date and time when the object was created. + /// + public DateTimeOffset CreatedAt { get; } + + /// + /// Identifies the primary key from the database. + /// + public int? DatabaseId { get; } + + public ID Id { get; } + + /// + /// A list of open pull requests matching the check suite. + /// + /// Returns the first _n_ elements from the list. + /// Returns the elements in the list that come after the specified cursor. + /// Returns the last _n_ elements from the list. + /// Returns the elements in the list that come before the specified cursor. + /// A list of states to filter the pull requests by. + /// A list of label names to filter the pull requests by. + /// The head ref name to filter the pull requests by. + /// The base ref name to filter the pull requests by. + /// Ordering options for pull requests returned from the connection. + public PullRequestConnection MatchingPullRequests(Arg? first = null, Arg? after = null, Arg? last = null, Arg? before = null, Arg>? states = null, Arg>? labels = null, Arg? headRefName = null, Arg? baseRefName = null, Arg? orderBy = null) => this.CreateMethodCall(x => x.MatchingPullRequests(first, after, last, before, states, labels, headRefName, baseRefName, orderBy), Octokit.GraphQL.Model.PullRequestConnection.Create); + + /// + /// The push that triggered this check suite. + /// + public Push Push => this.CreateProperty(x => x.Push, Octokit.GraphQL.Model.Push.Create); + + /// + /// The repository associated with this check suite. + /// + public Repository Repository => this.CreateProperty(x => x.Repository, Octokit.GraphQL.Model.Repository.Create); + + /// + /// The status of this check suite. + /// + public CheckStatusState Status { get; } + + /// + /// Identifies the date and time when the object was last updated. + /// + public DateTimeOffset UpdatedAt { get; } + + internal static CheckSuite Create(Expression expression) + { + return new CheckSuite(expression); + } + } +} \ No newline at end of file diff --git a/Octokit.GraphQL/Model/CheckSuiteConnection.cs b/Octokit.GraphQL/Model/CheckSuiteConnection.cs new file mode 100644 index 00000000..14be724c --- /dev/null +++ b/Octokit.GraphQL/Model/CheckSuiteConnection.cs @@ -0,0 +1,45 @@ +namespace Octokit.GraphQL.Model +{ + using System; + using System.Collections.Generic; + using System.Linq.Expressions; + using Octokit.GraphQL.Core; + using Octokit.GraphQL.Core.Builders; + + /// + /// The connection type for CheckSuite. + /// + public class CheckSuiteConnection : QueryableValue, IPagingConnection + { + public CheckSuiteConnection(Expression expression) : base(expression) + { + } + + /// + /// A list of edges. + /// + public IQueryableList Edges => this.CreateProperty(x => x.Edges); + + /// + /// A list of nodes. + /// + public IQueryableList Nodes => this.CreateProperty(x => x.Nodes); + + /// + /// Information to aid in pagination. + /// + public PageInfo PageInfo => this.CreateProperty(x => x.PageInfo, Octokit.GraphQL.Model.PageInfo.Create); + + /// + /// Identifies the total count of items in the connection. + /// + public int TotalCount { get; } + + IPageInfo IPagingConnection.PageInfo => PageInfo; + + internal static CheckSuiteConnection Create(Expression expression) + { + return new CheckSuiteConnection(expression); + } + } +} \ No newline at end of file diff --git a/Octokit.GraphQL/Model/CheckSuiteEdge.cs b/Octokit.GraphQL/Model/CheckSuiteEdge.cs new file mode 100644 index 00000000..19795b8f --- /dev/null +++ b/Octokit.GraphQL/Model/CheckSuiteEdge.cs @@ -0,0 +1,33 @@ +namespace Octokit.GraphQL.Model +{ + using System; + using System.Collections.Generic; + using System.Linq.Expressions; + using Octokit.GraphQL.Core; + using Octokit.GraphQL.Core.Builders; + + /// + /// An edge in a connection. + /// + public class CheckSuiteEdge : QueryableValue + { + public CheckSuiteEdge(Expression expression) : base(expression) + { + } + + /// + /// A cursor for use in pagination. + /// + public string Cursor { get; } + + /// + /// The item at the end of the edge. + /// + public CheckSuite Node => this.CreateProperty(x => x.Node, Octokit.GraphQL.Model.CheckSuite.Create); + + internal static CheckSuiteEdge Create(Expression expression) + { + return new CheckSuiteEdge(expression); + } + } +} \ No newline at end of file diff --git a/Octokit.GraphQL/Model/CheckSuiteFilter.cs b/Octokit.GraphQL/Model/CheckSuiteFilter.cs new file mode 100644 index 00000000..a72f8a5e --- /dev/null +++ b/Octokit.GraphQL/Model/CheckSuiteFilter.cs @@ -0,0 +1,15 @@ +namespace Octokit.GraphQL.Model +{ + using System; + using System.Collections.Generic; + + /// + /// The filters that are available when fetching check suites. + /// + public class CheckSuiteFilter + { + public int? AppId { get; set; } + + public string CheckName { get; set; } + } +} \ No newline at end of file diff --git a/Octokit.GraphQL/Model/Commit.cs b/Octokit.GraphQL/Model/Commit.cs index fd4dac99..a38d4f21 100644 --- a/Octokit.GraphQL/Model/Commit.cs +++ b/Octokit.GraphQL/Model/Commit.cs @@ -51,6 +51,16 @@ public Commit(Expression expression) : base(expression) /// public int ChangedFiles { get; } + /// + /// The check suites associated with a commit. + /// + /// Returns the first _n_ elements from the list. + /// Returns the elements in the list that come after the specified cursor. + /// Returns the last _n_ elements from the list. + /// Returns the elements in the list that come before the specified cursor. + /// Filters the check suites by this type. + public CheckSuiteConnection CheckSuites(Arg? first = null, Arg? after = null, Arg? last = null, Arg? before = null, Arg? filterBy = null) => this.CreateMethodCall(x => x.CheckSuites(first, after, last, before, filterBy), Octokit.GraphQL.Model.CheckSuiteConnection.Create); + /// /// Comments made on the commit. /// diff --git a/Octokit.GraphQL/Model/Deployment.cs b/Octokit.GraphQL/Model/Deployment.cs index 40c18101..84c43b27 100644 --- a/Octokit.GraphQL/Model/Deployment.cs +++ b/Octokit.GraphQL/Model/Deployment.cs @@ -35,6 +35,11 @@ public Deployment(Expression expression) : base(expression) /// public int? DatabaseId { get; } + /// + /// The deployment description. + /// + public string Description { get; } + /// /// The environment to which this deployment was made. /// @@ -71,6 +76,11 @@ public Deployment(Expression expression) : base(expression) /// Returns the elements in the list that come before the specified cursor. public DeploymentStatusConnection Statuses(Arg? first = null, Arg? after = null, Arg? last = null, Arg? before = null) => this.CreateMethodCall(x => x.Statuses(first, after, last, before), Octokit.GraphQL.Model.DeploymentStatusConnection.Create); + /// + /// Identifies the date and time when the object was last updated. + /// + public DateTimeOffset UpdatedAt { get; } + internal static Deployment Create(Expression expression) { return new Deployment(expression); diff --git a/Octokit.GraphQL/Model/Push.cs b/Octokit.GraphQL/Model/Push.cs new file mode 100644 index 00000000..f528ba7a --- /dev/null +++ b/Octokit.GraphQL/Model/Push.cs @@ -0,0 +1,50 @@ +namespace Octokit.GraphQL.Model +{ + using System; + using System.Collections.Generic; + using System.Linq.Expressions; + using Octokit.GraphQL.Core; + using Octokit.GraphQL.Core.Builders; + + /// + /// A Git push. + /// + public class Push : QueryableValue + { + public Push(Expression expression) : base(expression) + { + } + + public ID Id { get; } + + /// + /// The SHA after the push + /// + public string NextSha { get; } + + /// + /// The permalink for this push. + /// + public string Permalink { get; } + + /// + /// The SHA before the push + /// + public string PreviousSha { get; } + + /// + /// The user who pushed + /// + public User Pusher => this.CreateProperty(x => x.Pusher, Octokit.GraphQL.Model.User.Create); + + /// + /// The repository that was pushed to + /// + public Repository Repository => this.CreateProperty(x => x.Repository, Octokit.GraphQL.Model.Repository.Create); + + internal static Push Create(Expression expression) + { + return new Push(expression); + } + } +} \ No newline at end of file