Skip to content

Commit

Permalink
fix: generates models and fixes the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nickfloyd authored Nov 6, 2023
2 parents 3e6efaa + 368c325 commit eef45a9
Show file tree
Hide file tree
Showing 52 changed files with 898 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Octokit.GraphQL.UnitTests/ExpressionRewiterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public void Repository_Details_With_Viewer()
{
var query = new Query()
.Select(x => x.RepositoryOwner("foo")
.Repositories(30, null, null, null, null, null, null, null, null, null, null)
.Repositories(30, null, null, null, null, null, null, null, null, null, null, null)
.Edges
.Select(y => y.Node)
.Select(z => new
Expand Down
4 changes: 2 additions & 2 deletions Octokit.GraphQL.UnitTests/QueryBuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void RepositoryOwner_Repositories_Query_Viewer()
var expression = new Query()
.Select(root => root
.RepositoryOwner("foo")
.Repositories(30, null, null, null, null, null, null, null, null, null, null)
.Repositories(30, null, null, null, null, null, null, null, null, null, null, null)
.Edges.Select(x => x.Node)
.Select(x => new
{
Expand Down Expand Up @@ -221,7 +221,7 @@ public void Repository_Details_With_Viewer()

var expression = new Query()
.Select(x => x.RepositoryOwner("foo")
.Repositories(30, null, null, null, null, null, null, null, null, null, null)
.Repositories(30, null, null, null, null, null, null, null, null, null, null, null)
.Edges
.Select(y => y.Node)
.Select(y => new
Expand Down
21 changes: 21 additions & 0 deletions Octokit.GraphQL/Model/AbortRepositoryMigrationInput.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace Octokit.GraphQL.Model
{
using System;
using System.Collections.Generic;

/// <summary>
/// Autogenerated input type of AbortRepositoryMigration
/// </summary>
public class AbortRepositoryMigrationInput
{
/// <summary>
/// The ID of the migration to be aborted.
/// </summary>
public ID MigrationId { get; set; }

/// <summary>
/// A unique identifier for the client performing the mutation.
/// </summary>
public string ClientMutationId { get; set; }
}
}
33 changes: 33 additions & 0 deletions Octokit.GraphQL/Model/AbortRepositoryMigrationPayload.cs
Original file line number Diff line number Diff line change
@@ -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;

/// <summary>
/// Autogenerated return type of AbortRepositoryMigration
/// </summary>
public class AbortRepositoryMigrationPayload : QueryableValue<AbortRepositoryMigrationPayload>
{
internal AbortRepositoryMigrationPayload(Expression expression) : base(expression)
{
}

/// <summary>
/// A unique identifier for the client performing the mutation.
/// </summary>
public string ClientMutationId { get; }

/// <summary>
/// Did the operation succeed?
/// </summary>
public bool? Success { get; }

internal static AbortRepositoryMigrationPayload Create(Expression expression)
{
return new AbortRepositoryMigrationPayload(expression);
}
}
}
31 changes: 31 additions & 0 deletions Octokit.GraphQL/Model/AddPullRequestReviewThreadReplyInput.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
namespace Octokit.GraphQL.Model
{
using System;
using System.Collections.Generic;

/// <summary>
/// Autogenerated input type of AddPullRequestReviewThreadReply
/// </summary>
public class AddPullRequestReviewThreadReplyInput
{
/// <summary>
/// The Node ID of the pending review to which the reply will belong.
/// </summary>
public ID? PullRequestReviewId { get; set; }

/// <summary>
/// The Node ID of the thread to which this reply is being written.
/// </summary>
public ID PullRequestReviewThreadId { get; set; }

/// <summary>
/// The text of the reply.
/// </summary>
public string Body { get; set; }

/// <summary>
/// A unique identifier for the client performing the mutation.
/// </summary>
public string ClientMutationId { get; set; }
}
}
33 changes: 33 additions & 0 deletions Octokit.GraphQL/Model/AddPullRequestReviewThreadReplyPayload.cs
Original file line number Diff line number Diff line change
@@ -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;

/// <summary>
/// Autogenerated return type of AddPullRequestReviewThreadReply
/// </summary>
public class AddPullRequestReviewThreadReplyPayload : QueryableValue<AddPullRequestReviewThreadReplyPayload>
{
internal AddPullRequestReviewThreadReplyPayload(Expression expression) : base(expression)
{
}

/// <summary>
/// A unique identifier for the client performing the mutation.
/// </summary>
public string ClientMutationId { get; }

/// <summary>
/// The newly created reply.
/// </summary>
public PullRequestReviewComment Comment => this.CreateProperty(x => x.Comment, Octokit.GraphQL.Model.PullRequestReviewComment.Create);

internal static AddPullRequestReviewThreadReplyPayload Create(Expression expression)
{
return new AddPullRequestReviewThreadReplyPayload(expression);
}
}
}
38 changes: 38 additions & 0 deletions Octokit.GraphQL/Model/ContributingGuidelines.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
namespace Octokit.GraphQL.Model
{
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using Octokit.GraphQL.Core;
using Octokit.GraphQL.Core.Builders;

/// <summary>
/// The Contributing Guidelines for a repository.
/// </summary>
public class ContributingGuidelines : QueryableValue<ContributingGuidelines>
{
internal ContributingGuidelines(Expression expression) : base(expression)
{
}

/// <summary>
/// The body of the Contributing Guidelines.
/// </summary>
public string Body { get; }

/// <summary>
/// The HTTP path for the Contributing Guidelines.
/// </summary>
public string ResourcePath { get; }

/// <summary>
/// The HTTP URL for the Contributing Guidelines.
/// </summary>
public string Url { get; }

internal static ContributingGuidelines Create(Expression expression)
{
return new ContributingGuidelines(expression);
}
}
}
5 changes: 5 additions & 0 deletions Octokit.GraphQL/Model/CreateLinkedBranchPayload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ internal CreateLinkedBranchPayload(Expression expression) : base(expression)
/// </summary>
public string ClientMutationId { get; }

/// <summary>
/// The issue that was linked to.
/// </summary>
public Issue Issue => this.CreateProperty(x => x.Issue, Octokit.GraphQL.Model.Issue.Create);

/// <summary>
/// The new branch issue reference.
/// </summary>
Expand Down
5 changes: 5 additions & 0 deletions Octokit.GraphQL/Model/DeploymentProtectionRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ internal DeploymentProtectionRule(Expression expression) : base(expression)
/// </summary>
public int? DatabaseId { get; }

/// <summary>
/// Whether deployments to this environment can be approved by the user who created the deployment.
/// </summary>
public bool? PreventSelfReview { get; }

/// <summary>
/// The teams or users that can review the deployment
/// </summary>
Expand Down
5 changes: 5 additions & 0 deletions Octokit.GraphQL/Model/Discussion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ internal Discussion(Expression expression) : base(expression)
/// </summary>
public bool IncludesCreatedEdit { get; }

/// <summary>
/// Only return answered/unanswered discussions
/// </summary>
public bool? IsAnswered { get; }

/// <summary>
/// A list of labels associated with the object.
/// </summary>
Expand Down
45 changes: 45 additions & 0 deletions Octokit.GraphQL/Model/EnterpriseConnection.cs
Original file line number Diff line number Diff line change
@@ -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;

/// <summary>
/// The connection type for Enterprise.
/// </summary>
public class EnterpriseConnection : QueryableValue<EnterpriseConnection>, IPagingConnection<Enterprise>
{
internal EnterpriseConnection(Expression expression) : base(expression)
{
}

/// <summary>
/// A list of edges.
/// </summary>
public IQueryableList<EnterpriseEdge> Edges => this.CreateProperty(x => x.Edges);

/// <summary>
/// A list of nodes.
/// </summary>
public IQueryableList<Enterprise> Nodes => this.CreateProperty(x => x.Nodes);

/// <summary>
/// Information to aid in pagination.
/// </summary>
public PageInfo PageInfo => this.CreateProperty(x => x.PageInfo, Octokit.GraphQL.Model.PageInfo.Create);

/// <summary>
/// Identifies the total count of items in the connection.
/// </summary>
public int TotalCount { get; }

IPageInfo IPagingConnection.PageInfo => PageInfo;

internal static EnterpriseConnection Create(Expression expression)
{
return new EnterpriseConnection(expression);
}
}
}
33 changes: 33 additions & 0 deletions Octokit.GraphQL/Model/EnterpriseEdge.cs
Original file line number Diff line number Diff line change
@@ -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;

/// <summary>
/// An edge in a connection.
/// </summary>
public class EnterpriseEdge : QueryableValue<EnterpriseEdge>
{
internal EnterpriseEdge(Expression expression) : base(expression)
{
}

/// <summary>
/// A cursor for use in pagination.
/// </summary>
public string Cursor { get; }

/// <summary>
/// The item at the end of the edge.
/// </summary>
public Enterprise Node => this.CreateProperty(x => x.Node, Octokit.GraphQL.Model.Enterprise.Create);

internal static EnterpriseEdge Create(Expression expression)
{
return new EnterpriseEdge(expression);
}
}
}
38 changes: 38 additions & 0 deletions Octokit.GraphQL/Model/EnterpriseMembershipType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace Octokit.GraphQL.Model
{
/// <summary>
/// The possible values we have for filtering Platform::Objects::User#enterprises.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum EnterpriseMembershipType
{
/// <summary>
/// Returns all enterprises in which the user is a member, admin, or billing manager.
/// </summary>
[EnumMember(Value = "ALL")]
All,

/// <summary>
/// Returns all enterprises in which the user is an admin.
/// </summary>
[EnumMember(Value = "ADMIN")]
Admin,

/// <summary>
/// Returns all enterprises in which the user is a billing manager.
/// </summary>
[EnumMember(Value = "BILLING_MANAGER")]
BillingManager,

/// <summary>
/// Returns all enterprises in which the user is a member of an org that is owned by the enterprise.
/// </summary>
[EnumMember(Value = "ORG_MEMBERSHIP")]
OrgMembership,
}
}
21 changes: 21 additions & 0 deletions Octokit.GraphQL/Model/EnterpriseOrder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace Octokit.GraphQL.Model
{
using System;
using System.Collections.Generic;

/// <summary>
/// Ordering options for enterprises.
/// </summary>
public class EnterpriseOrder
{
/// <summary>
/// The field to order enterprises by.
/// </summary>
public EnterpriseOrderField Field { get; set; }

/// <summary>
/// The ordering direction.
/// </summary>
public OrderDirection Direction { get; set; }
}
}
20 changes: 20 additions & 0 deletions Octokit.GraphQL/Model/EnterpriseOrderField.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace Octokit.GraphQL.Model
{
/// <summary>
/// Properties by which enterprise connections can be ordered.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum EnterpriseOrderField
{
/// <summary>
/// Order enterprises by name
/// </summary>
[EnumMember(Value = "NAME")]
Name,
}
}
Loading

0 comments on commit eef45a9

Please sign in to comment.