Skip to content

Commit 9e94418

Browse files
Merge pull request #172 from octokit/repository-checkrun-aliased-id
Handle subqueries where the parent ID is aliased.
2 parents 930258d + f1671be commit 9e94418

21 files changed

+709
-7
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.Linq.Expressions;
2+
3+
namespace Octokit.GraphQL.Core.UnitTests.Models
4+
{
5+
public class CheckAnnotation : QueryableValue<CheckAnnotation>
6+
{
7+
public CheckAnnotation(Expression expression) : base(expression)
8+
{
9+
}
10+
11+
public string Path { get; }
12+
13+
internal static CheckAnnotation Create(Expression expression)
14+
{
15+
return new CheckAnnotation(expression);
16+
}
17+
}
18+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System.Linq.Expressions;
2+
using Octokit.GraphQL.Core.Builders;
3+
4+
namespace Octokit.GraphQL.Core.UnitTests.Models
5+
{
6+
public class CheckAnnotationConnection : QueryableValue<CheckAnnotationConnection>, IPagingConnection<CheckAnnotation>
7+
{
8+
public CheckAnnotationConnection(Expression expression) : base(expression)
9+
{
10+
}
11+
12+
public IQueryableList<CheckAnnotationEdge> Edges => this.CreateProperty(x => x.Edges);
13+
14+
public IQueryableList<CheckAnnotation> Nodes => this.CreateProperty(x => x.Nodes);
15+
16+
public PageInfo PageInfo => this.CreateProperty(x => x.PageInfo, Models.PageInfo.Create);
17+
18+
public int TotalCount { get; }
19+
20+
IPageInfo IPagingConnection.PageInfo => PageInfo;
21+
22+
internal static CheckAnnotationConnection Create(Expression expression)
23+
{
24+
return new CheckAnnotationConnection(expression);
25+
}
26+
}
27+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System.Linq.Expressions;
2+
using Octokit.GraphQL.Core.Builders;
3+
4+
namespace Octokit.GraphQL.Core.UnitTests.Models
5+
{
6+
public class CheckAnnotationEdge : QueryableValue<CheckAnnotationEdge>
7+
{
8+
public CheckAnnotationEdge(Expression expression) : base(expression)
9+
{
10+
}
11+
12+
public string Cursor { get; }
13+
14+
public CheckAnnotation Node => this.CreateProperty(x => x.Node, CheckAnnotation.Create);
15+
16+
internal static CheckAnnotationEdge Create(Expression expression)
17+
{
18+
return new CheckAnnotationEdge(expression);
19+
}
20+
}
21+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System;
2+
using System.Linq.Expressions;
3+
using Octokit.GraphQL.Core.Builders;
4+
5+
namespace Octokit.GraphQL.Core.UnitTests.Models
6+
{
7+
public class CheckRun : QueryableValue<CheckRun>
8+
{
9+
public CheckRun(Expression expression) : base(expression)
10+
{
11+
}
12+
13+
public CheckAnnotationConnection Annotations(Arg<int>? first = null, Arg<string>? after = null, Arg<int>? last = null, Arg<string>? before = null) => this.CreateMethodCall(x => x.Annotations(first, after, last, before), CheckAnnotationConnection.Create);
14+
15+
public CheckSuite CheckSuite => this.CreateProperty(x => x.CheckSuite, Models.CheckSuite.Create);
16+
17+
public ID Id { get; }
18+
19+
public string Name { get; }
20+
21+
internal static CheckRun Create(Expression expression)
22+
{
23+
return new CheckRun(expression);
24+
}
25+
}
26+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using System.Linq.Expressions;
2+
using Octokit.GraphQL.Core.Builders;
3+
4+
namespace Octokit.GraphQL.Core.UnitTests.Models
5+
{
6+
/// <summary>
7+
/// The connection type for CheckRun.
8+
/// </summary>
9+
public class CheckRunConnection : QueryableValue<CheckRunConnection>, IPagingConnection<CheckRun>
10+
{
11+
public CheckRunConnection(Expression expression) : base(expression)
12+
{
13+
}
14+
15+
/// <summary>
16+
/// A list of edges.
17+
/// </summary>
18+
public IQueryableList<CheckRunEdge> Edges => this.CreateProperty(x => x.Edges);
19+
20+
/// <summary>
21+
/// A list of nodes.
22+
/// </summary>
23+
public IQueryableList<CheckRun> Nodes => this.CreateProperty(x => x.Nodes);
24+
25+
/// <summary>
26+
/// Information to aid in pagination.
27+
/// </summary>
28+
public PageInfo PageInfo => this.CreateProperty(x => x.PageInfo, Models.PageInfo.Create);
29+
30+
/// <summary>
31+
/// Identifies the total count of items in the connection.
32+
/// </summary>
33+
public int TotalCount { get; }
34+
35+
IPageInfo IPagingConnection.PageInfo => PageInfo;
36+
37+
internal static CheckRunConnection Create(Expression expression)
38+
{
39+
return new CheckRunConnection(expression);
40+
}
41+
}
42+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System.Linq.Expressions;
2+
using Octokit.GraphQL.Core.Builders;
3+
4+
namespace Octokit.GraphQL.Core.UnitTests.Models
5+
{
6+
/// <summary>
7+
/// An edge in a connection.
8+
/// </summary>
9+
public class CheckRunEdge : QueryableValue<CheckRunEdge>
10+
{
11+
public CheckRunEdge(Expression expression) : base(expression)
12+
{
13+
}
14+
15+
/// <summary>
16+
/// A cursor for use in pagination.
17+
/// </summary>
18+
public string Cursor { get; }
19+
20+
/// <summary>
21+
/// The item at the end of the edge.
22+
/// </summary>
23+
public CheckRun Node => this.CreateProperty(x => x.Node, CheckRun.Create);
24+
25+
internal static CheckRunEdge Create(Expression expression)
26+
{
27+
return new CheckRunEdge(expression);
28+
}
29+
}
30+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
namespace Octokit.GraphQL.Core.UnitTests.Models
2+
{
3+
/// <summary>
4+
/// The filters that are available when fetching check runs.
5+
/// </summary>
6+
public class CheckRunFilter
7+
{
8+
public CheckRunType? CheckType { get; set; }
9+
10+
public int? AppId { get; set; }
11+
12+
public string CheckName { get; set; }
13+
14+
public CheckStatusState? Status { get; set; }
15+
}
16+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System.Runtime.Serialization;
2+
using Newtonsoft.Json;
3+
using Newtonsoft.Json.Converters;
4+
5+
namespace Octokit.GraphQL.Core.UnitTests.Models
6+
{
7+
/// <summary>
8+
/// The possible types of check runs.
9+
/// </summary>
10+
[JsonConverter(typeof(StringEnumConverter))]
11+
public enum CheckRunType
12+
{
13+
/// <summary>
14+
/// Every check run available.
15+
/// </summary>
16+
[EnumMember(Value = "ALL")]
17+
All,
18+
19+
/// <summary>
20+
/// The latest check run.
21+
/// </summary>
22+
[EnumMember(Value = "LATEST")]
23+
Latest,
24+
}
25+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System.Runtime.Serialization;
2+
using Newtonsoft.Json;
3+
using Newtonsoft.Json.Converters;
4+
5+
namespace Octokit.GraphQL.Core.UnitTests.Models
6+
{
7+
/// <summary>
8+
/// The possible states for a check suite or run status.
9+
/// </summary>
10+
[JsonConverter(typeof(StringEnumConverter))]
11+
public enum CheckStatusState
12+
{
13+
/// <summary>
14+
/// The check suite or run has been queued.
15+
/// </summary>
16+
[EnumMember(Value = "QUEUED")]
17+
Queued,
18+
19+
/// <summary>
20+
/// The check suite or run is in progress.
21+
/// </summary>
22+
[EnumMember(Value = "IN_PROGRESS")]
23+
InProgress,
24+
25+
/// <summary>
26+
/// The check suite or run has been completed.
27+
/// </summary>
28+
[EnumMember(Value = "COMPLETED")]
29+
Completed,
30+
31+
/// <summary>
32+
/// The check suite or run has been requested.
33+
/// </summary>
34+
[EnumMember(Value = "REQUESTED")]
35+
Requested,
36+
}
37+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
using System.Linq.Expressions;
3+
using Octokit.GraphQL.Core.Builders;
4+
5+
namespace Octokit.GraphQL.Core.UnitTests.Models
6+
{
7+
public class CheckSuite : QueryableValue<CheckSuite>
8+
{
9+
public CheckSuite(Expression expression) : base(expression)
10+
{
11+
}
12+
13+
public CheckRunConnection CheckRuns(Arg<int>? first = null, Arg<string>? after = null, Arg<int>? last = null, Arg<string>? before = null, Arg<CheckRunFilter>? filterBy = null) => this.CreateMethodCall(x => x.CheckRuns(first, after, last, before, filterBy), CheckRunConnection.Create);
14+
15+
internal static CheckSuite Create(Expression expression)
16+
{
17+
return new CheckSuite(expression);
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)