Skip to content

Commit 3923872

Browse files
Added a new overload of CreateMethodCall that accepts Expression<Func<TObject, IEnumerable<TValue>>> selector
Implemented public static List<TValue> ToList<TValue>(this IQueryableList<TValue> source)
1 parent 744a202 commit 3923872

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+767
-125
lines changed

Octokit.GraphQL.Core/Core/Builders/QueryEntityBuilders.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
using System;
2+
using System.Collections;
23
using System.Collections.Generic;
4+
using System.Linq;
35
using System.Linq.Expressions;
46
using System.Reflection;
7+
using Octokit.GraphQL.Core.Utilities;
58

69
namespace Octokit.GraphQL.Core.Builders
710
{
@@ -51,6 +54,26 @@ public static IQueryableValue<TValue> CreateMethodCall<TObject, TValue>(
5154
arguments));
5255
}
5356

57+
public static IEnumerable<TValue> CreateMethodCall<TObject, TValue>(
58+
this TObject o,
59+
Expression<Func<TObject, IEnumerable<TValue>>> selector)
60+
where TObject : IQueryableValue
61+
{
62+
var methodCall = (MethodCallExpression)selector.Body;
63+
var arguments = new List<ConstantExpression>();
64+
65+
foreach (MemberExpression arg in methodCall.Arguments)
66+
{
67+
var expression = (ConstantExpression)arg.Expression;
68+
var value = ((FieldInfo)arg.Member).GetValue(expression.Value);
69+
arguments.Add(Expression.Constant(value, arg.Type));
70+
}
71+
72+
return (IEnumerable<TValue>)(Expression.Call(Expression.Constant(o),
73+
methodCall.Method,
74+
arguments));
75+
}
76+
5477
public static TValue CreateMethodCall<TObject, TValue>(
5578
this TObject o,
5679
Expression<Func<TObject, TValue>> selector,

Octokit.GraphQL.Core/QueryableListExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ public static IDictionary<TKey, TElement> ToDictionary<TSource, TKey, TElement>(
7070
[MethodId(nameof(ToListMethod))]
7171
public static List<TValue> ToList<TValue>(this IQueryableList<TValue> source)
7272
{
73-
throw new NotImplementedException();
73+
return source.ToList<TValue>();
74+
7475
}
7576

7677
public static ICompiledQuery<IEnumerable<T>> Compile<T>(this IQueryableList<T> expression)

Octokit.GraphQL.sln.DotSettings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
66
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
77
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpRenamePlacementToArrangementMigration/@EntryIndexedValue">True</s:Boolean>
8+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
89
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
910
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
1011
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>

Octokit.GraphQL/Model/ActionExecutionCapabilitySetting.cs

Lines changed: 0 additions & 38 deletions
This file was deleted.

Octokit.GraphQL/Model/BaseRefChangedEvent.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,28 @@ internal BaseRefChangedEvent(Expression expression) : base(expression)
2525
/// </summary>
2626
public DateTimeOffset CreatedAt { get; }
2727

28+
/// <summary>
29+
/// Identifies the name of the base ref for the pull request after it was changed.
30+
/// </summary>
31+
public string CurrentRefName { get; }
32+
2833
/// <summary>
2934
/// Identifies the primary key from the database.
3035
/// </summary>
3136
public int? DatabaseId { get; }
3237

3338
public ID Id { get; }
3439

40+
/// <summary>
41+
/// Identifies the name of the base ref for the pull request before it was changed.
42+
/// </summary>
43+
public string PreviousRefName { get; }
44+
45+
/// <summary>
46+
/// PullRequest referenced by event.
47+
/// </summary>
48+
public PullRequest PullRequest => this.CreateProperty(x => x.PullRequest, Octokit.GraphQL.Model.PullRequest.Create);
49+
3550
internal static BaseRefChangedEvent Create(Expression expression)
3651
{
3752
return new BaseRefChangedEvent(expression);

Octokit.GraphQL/Model/CommentAuthorAssociation.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ public enum CommentAuthorAssociation
2323
[EnumMember(Value = "OWNER")]
2424
Owner,
2525

26+
/// <summary>
27+
/// Author is a placeholder for an unclaimed user.
28+
/// </summary>
29+
[EnumMember(Value = "MANNEQUIN")]
30+
Mannequin,
31+
2632
/// <summary>
2733
/// Author has been invited to collaborate on the repository.
2834
/// </summary>

Octokit.GraphQL/Model/CommentDeletedEvent.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ internal CommentDeletedEvent(Expression expression) : base(expression)
3030
/// </summary>
3131
public int? DatabaseId { get; }
3232

33+
/// <summary>
34+
/// The user who authored the deleted comment.
35+
/// </summary>
36+
public IActor DeletedCommentAuthor => this.CreateProperty(x => x.DeletedCommentAuthor, Octokit.GraphQL.Model.Internal.StubIActor.Create);
37+
3338
public ID Id { get; }
3439

3540
internal static CommentDeletedEvent Create(Expression expression)

Octokit.GraphQL/Model/Commit.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ internal Commit(Expression expression) : base(expression)
5050
/// </summary>
5151
public DateTimeOffset AuthoredDate { get; }
5252

53+
/// <summary>
54+
/// The list of authors for this commit based on the git author and the Co-authored-by
55+
/// message trailer. The git author will always be first.
56+
/// </summary>
57+
/// <param name="first">Returns the first _n_ elements from the list.</param>
58+
/// <param name="after">Returns the elements in the list that come after the specified cursor.</param>
59+
/// <param name="last">Returns the last _n_ elements from the list.</param>
60+
/// <param name="before">Returns the elements in the list that come before the specified cursor.</param>
61+
public GitActorConnection Authors(Arg<int>? first = null, Arg<string>? after = null, Arg<int>? last = null, Arg<string>? before = null) => this.CreateMethodCall(x => x.Authors(first, after, last, before), Octokit.GraphQL.Model.GitActorConnection.Create);
62+
5363
/// <summary>
5464
/// Fetches `git blame` information.
5565
/// </summary>
@@ -121,6 +131,12 @@ internal Commit(Expression expression) : base(expression)
121131
/// <param name="orderBy">Ordering options for deployments returned from the connection.</param>
122132
public DeploymentConnection Deployments(Arg<int>? first = null, Arg<string>? after = null, Arg<int>? last = null, Arg<string>? before = null, Arg<IEnumerable<string>>? environments = null, Arg<DeploymentOrder>? orderBy = null) => this.CreateMethodCall(x => x.Deployments(first, after, last, before, environments, orderBy), Octokit.GraphQL.Model.DeploymentConnection.Create);
123133

134+
/// <summary>
135+
/// The tree entry representing the file located at the given path.
136+
/// </summary>
137+
/// <param name="path">The path for the file</param>
138+
public TreeEntry File(Arg<string> path) => this.CreateMethodCall(x => x.File(path), Octokit.GraphQL.Model.TreeEntry.Create);
139+
124140
/// <summary>
125141
/// The linear commit history starting from (and including) this commit, in the same order as `git log`.
126142
/// </summary>

Octokit.GraphQL/Model/CreateBranchProtectionRuleInput.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@ public class CreateBranchProtectionRuleInput
3333
/// </summary>
3434
public bool? RequiresCommitSignatures { get; set; }
3535

36+
/// <summary>
37+
/// Are merge commits prohibited from being pushed to this branch.
38+
/// </summary>
39+
public bool? RequiresLinearHistory { get; set; }
40+
41+
/// <summary>
42+
/// Are force pushes allowed on this branch.
43+
/// </summary>
44+
public bool? AllowsForcePushes { get; set; }
45+
46+
/// <summary>
47+
/// Can this branch be deleted.
48+
/// </summary>
49+
public bool? AllowsDeletions { get; set; }
50+
3651
/// <summary>
3752
/// Can admins overwrite branch protection.
3853
/// </summary>

Octokit.GraphQL/Model/CreateIssueInput.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ public class CreateIssueInput
4343
/// </summary>
4444
public IEnumerable<ID> ProjectIds { get; set; }
4545

46+
/// <summary>
47+
/// The name of an issue template in the repository, assigns labels and assignees from the template to the issue
48+
/// </summary>
49+
public string IssueTemplate { get; set; }
50+
4651
/// <summary>
4752
/// A unique identifier for the client performing the mutation.
4853
/// </summary>

0 commit comments

Comments
 (0)