Skip to content

Commit eb9d34b

Browse files
committed
New updates to generated code
1 parent 6a54101 commit eb9d34b

13 files changed

+695
-5
lines changed

src/GitHub/Models/RulesetVersion.cs

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// <auto-generated/>
2+
#pragma warning disable CS0618
3+
using Microsoft.Kiota.Abstractions.Extensions;
4+
using Microsoft.Kiota.Abstractions.Serialization;
5+
using System.Collections.Generic;
6+
using System.IO;
7+
using System;
8+
namespace GitHub.Models
9+
{
10+
/// <summary>
11+
/// The historical version of a ruleset
12+
/// </summary>
13+
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.19.0")]
14+
public partial class RulesetVersion : IAdditionalDataHolder, IParsable
15+
{
16+
/// <summary>The actor who updated the ruleset</summary>
17+
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
18+
#nullable enable
19+
public global::GitHub.Models.RulesetVersion_actor? Actor { get; set; }
20+
#nullable restore
21+
#else
22+
public global::GitHub.Models.RulesetVersion_actor Actor { get; set; }
23+
#endif
24+
/// <summary>Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.</summary>
25+
public IDictionary<string, object> AdditionalData { get; set; }
26+
/// <summary>The updated_at property</summary>
27+
public DateTimeOffset? UpdatedAt { get; set; }
28+
/// <summary>The ID of the previous version of the ruleset</summary>
29+
public int? VersionId { get; set; }
30+
/// <summary>
31+
/// Instantiates a new <see cref="global::GitHub.Models.RulesetVersion"/> and sets the default values.
32+
/// </summary>
33+
public RulesetVersion()
34+
{
35+
AdditionalData = new Dictionary<string, object>();
36+
}
37+
/// <summary>
38+
/// Creates a new instance of the appropriate class based on discriminator value
39+
/// </summary>
40+
/// <returns>A <see cref="global::GitHub.Models.RulesetVersion"/></returns>
41+
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
42+
public static global::GitHub.Models.RulesetVersion CreateFromDiscriminatorValue(IParseNode parseNode)
43+
{
44+
_ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
45+
return new global::GitHub.Models.RulesetVersion();
46+
}
47+
/// <summary>
48+
/// The deserialization information for the current model
49+
/// </summary>
50+
/// <returns>A IDictionary&lt;string, Action&lt;IParseNode&gt;&gt;</returns>
51+
public virtual IDictionary<string, Action<IParseNode>> GetFieldDeserializers()
52+
{
53+
return new Dictionary<string, Action<IParseNode>>
54+
{
55+
{ "actor", n => { Actor = n.GetObjectValue<global::GitHub.Models.RulesetVersion_actor>(global::GitHub.Models.RulesetVersion_actor.CreateFromDiscriminatorValue); } },
56+
{ "updated_at", n => { UpdatedAt = n.GetDateTimeOffsetValue(); } },
57+
{ "version_id", n => { VersionId = n.GetIntValue(); } },
58+
};
59+
}
60+
/// <summary>
61+
/// Serializes information the current object
62+
/// </summary>
63+
/// <param name="writer">Serialization writer to use to serialize this model</param>
64+
public virtual void Serialize(ISerializationWriter writer)
65+
{
66+
_ = writer ?? throw new ArgumentNullException(nameof(writer));
67+
writer.WriteObjectValue<global::GitHub.Models.RulesetVersion_actor>("actor", Actor);
68+
writer.WriteDateTimeOffsetValue("updated_at", UpdatedAt);
69+
writer.WriteIntValue("version_id", VersionId);
70+
writer.WriteAdditionalData(AdditionalData);
71+
}
72+
}
73+
}
74+
#pragma warning restore CS0618
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// <auto-generated/>
2+
#pragma warning disable CS0618
3+
using Microsoft.Kiota.Abstractions.Extensions;
4+
using Microsoft.Kiota.Abstractions.Serialization;
5+
using System.Collections.Generic;
6+
using System.IO;
7+
using System;
8+
namespace GitHub.Models
9+
{
10+
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.19.0")]
11+
#pragma warning disable CS1591
12+
public partial class RulesetVersionWithState : global::GitHub.Models.RulesetVersion, IParsable
13+
#pragma warning restore CS1591
14+
{
15+
/// <summary>The state of the ruleset version</summary>
16+
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
17+
#nullable enable
18+
public global::GitHub.Models.RulesetVersionWithState_state? State { get; set; }
19+
#nullable restore
20+
#else
21+
public global::GitHub.Models.RulesetVersionWithState_state State { get; set; }
22+
#endif
23+
/// <summary>
24+
/// Creates a new instance of the appropriate class based on discriminator value
25+
/// </summary>
26+
/// <returns>A <see cref="global::GitHub.Models.RulesetVersionWithState"/></returns>
27+
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
28+
public static new global::GitHub.Models.RulesetVersionWithState CreateFromDiscriminatorValue(IParseNode parseNode)
29+
{
30+
_ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
31+
return new global::GitHub.Models.RulesetVersionWithState();
32+
}
33+
/// <summary>
34+
/// The deserialization information for the current model
35+
/// </summary>
36+
/// <returns>A IDictionary&lt;string, Action&lt;IParseNode&gt;&gt;</returns>
37+
public override IDictionary<string, Action<IParseNode>> GetFieldDeserializers()
38+
{
39+
return new Dictionary<string, Action<IParseNode>>(base.GetFieldDeserializers())
40+
{
41+
{ "state", n => { State = n.GetObjectValue<global::GitHub.Models.RulesetVersionWithState_state>(global::GitHub.Models.RulesetVersionWithState_state.CreateFromDiscriminatorValue); } },
42+
};
43+
}
44+
/// <summary>
45+
/// Serializes information the current object
46+
/// </summary>
47+
/// <param name="writer">Serialization writer to use to serialize this model</param>
48+
public override void Serialize(ISerializationWriter writer)
49+
{
50+
_ = writer ?? throw new ArgumentNullException(nameof(writer));
51+
base.Serialize(writer);
52+
writer.WriteObjectValue<global::GitHub.Models.RulesetVersionWithState_state>("state", State);
53+
}
54+
}
55+
}
56+
#pragma warning restore CS0618
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// <auto-generated/>
2+
#pragma warning disable CS0618
3+
using Microsoft.Kiota.Abstractions.Extensions;
4+
using Microsoft.Kiota.Abstractions.Serialization;
5+
using System.Collections.Generic;
6+
using System.IO;
7+
using System;
8+
namespace GitHub.Models
9+
{
10+
/// <summary>
11+
/// The state of the ruleset version
12+
/// </summary>
13+
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.19.0")]
14+
public partial class RulesetVersionWithState_state : IAdditionalDataHolder, IParsable
15+
{
16+
/// <summary>Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.</summary>
17+
public IDictionary<string, object> AdditionalData { get; set; }
18+
/// <summary>
19+
/// Instantiates a new <see cref="global::GitHub.Models.RulesetVersionWithState_state"/> and sets the default values.
20+
/// </summary>
21+
public RulesetVersionWithState_state()
22+
{
23+
AdditionalData = new Dictionary<string, object>();
24+
}
25+
/// <summary>
26+
/// Creates a new instance of the appropriate class based on discriminator value
27+
/// </summary>
28+
/// <returns>A <see cref="global::GitHub.Models.RulesetVersionWithState_state"/></returns>
29+
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
30+
public static global::GitHub.Models.RulesetVersionWithState_state CreateFromDiscriminatorValue(IParseNode parseNode)
31+
{
32+
_ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
33+
return new global::GitHub.Models.RulesetVersionWithState_state();
34+
}
35+
/// <summary>
36+
/// The deserialization information for the current model
37+
/// </summary>
38+
/// <returns>A IDictionary&lt;string, Action&lt;IParseNode&gt;&gt;</returns>
39+
public virtual IDictionary<string, Action<IParseNode>> GetFieldDeserializers()
40+
{
41+
return new Dictionary<string, Action<IParseNode>>
42+
{
43+
};
44+
}
45+
/// <summary>
46+
/// Serializes information the current object
47+
/// </summary>
48+
/// <param name="writer">Serialization writer to use to serialize this model</param>
49+
public virtual void Serialize(ISerializationWriter writer)
50+
{
51+
_ = writer ?? throw new ArgumentNullException(nameof(writer));
52+
writer.WriteAdditionalData(AdditionalData);
53+
}
54+
}
55+
}
56+
#pragma warning restore CS0618
+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// <auto-generated/>
2+
#pragma warning disable CS0618
3+
using Microsoft.Kiota.Abstractions.Extensions;
4+
using Microsoft.Kiota.Abstractions.Serialization;
5+
using System.Collections.Generic;
6+
using System.IO;
7+
using System;
8+
namespace GitHub.Models
9+
{
10+
/// <summary>
11+
/// The actor who updated the ruleset
12+
/// </summary>
13+
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.19.0")]
14+
public partial class RulesetVersion_actor : IAdditionalDataHolder, IParsable
15+
{
16+
/// <summary>Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.</summary>
17+
public IDictionary<string, object> AdditionalData { get; set; }
18+
/// <summary>The id property</summary>
19+
public int? Id { get; set; }
20+
/// <summary>The type property</summary>
21+
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
22+
#nullable enable
23+
public string? Type { get; set; }
24+
#nullable restore
25+
#else
26+
public string Type { get; set; }
27+
#endif
28+
/// <summary>
29+
/// Instantiates a new <see cref="global::GitHub.Models.RulesetVersion_actor"/> and sets the default values.
30+
/// </summary>
31+
public RulesetVersion_actor()
32+
{
33+
AdditionalData = new Dictionary<string, object>();
34+
}
35+
/// <summary>
36+
/// Creates a new instance of the appropriate class based on discriminator value
37+
/// </summary>
38+
/// <returns>A <see cref="global::GitHub.Models.RulesetVersion_actor"/></returns>
39+
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
40+
public static global::GitHub.Models.RulesetVersion_actor CreateFromDiscriminatorValue(IParseNode parseNode)
41+
{
42+
_ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
43+
return new global::GitHub.Models.RulesetVersion_actor();
44+
}
45+
/// <summary>
46+
/// The deserialization information for the current model
47+
/// </summary>
48+
/// <returns>A IDictionary&lt;string, Action&lt;IParseNode&gt;&gt;</returns>
49+
public virtual IDictionary<string, Action<IParseNode>> GetFieldDeserializers()
50+
{
51+
return new Dictionary<string, Action<IParseNode>>
52+
{
53+
{ "id", n => { Id = n.GetIntValue(); } },
54+
{ "type", n => { Type = n.GetStringValue(); } },
55+
};
56+
}
57+
/// <summary>
58+
/// Serializes information the current object
59+
/// </summary>
60+
/// <param name="writer">Serialization writer to use to serialize this model</param>
61+
public virtual void Serialize(ISerializationWriter writer)
62+
{
63+
_ = writer ?? throw new ArgumentNullException(nameof(writer));
64+
writer.WriteIntValue("id", Id);
65+
writer.WriteStringValue("type", Type);
66+
writer.WriteAdditionalData(AdditionalData);
67+
}
68+
}
69+
}
70+
#pragma warning restore CS0618
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
// <auto-generated/>
2+
#pragma warning disable CS0618
3+
using GitHub.Models;
4+
using GitHub.Orgs.Item.Rulesets.Item.History.Item;
5+
using Microsoft.Kiota.Abstractions.Extensions;
6+
using Microsoft.Kiota.Abstractions.Serialization;
7+
using Microsoft.Kiota.Abstractions;
8+
using System.Collections.Generic;
9+
using System.IO;
10+
using System.Threading.Tasks;
11+
using System.Threading;
12+
using System;
13+
namespace GitHub.Orgs.Item.Rulesets.Item.History
14+
{
15+
/// <summary>
16+
/// Builds and executes requests for operations under \orgs\{org}\rulesets\{ruleset_id}\history
17+
/// </summary>
18+
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.19.0")]
19+
public partial class HistoryRequestBuilder : BaseRequestBuilder
20+
{
21+
/// <summary>Gets an item from the GitHub.orgs.item.rulesets.item.history.item collection</summary>
22+
/// <param name="position">The ID of the version</param>
23+
/// <returns>A <see cref="global::GitHub.Orgs.Item.Rulesets.Item.History.Item.WithVersion_ItemRequestBuilder"/></returns>
24+
public global::GitHub.Orgs.Item.Rulesets.Item.History.Item.WithVersion_ItemRequestBuilder this[int position]
25+
{
26+
get
27+
{
28+
var urlTplParams = new Dictionary<string, object>(PathParameters);
29+
urlTplParams.Add("version_id", position);
30+
return new global::GitHub.Orgs.Item.Rulesets.Item.History.Item.WithVersion_ItemRequestBuilder(urlTplParams, RequestAdapter);
31+
}
32+
}
33+
/// <summary>
34+
/// Instantiates a new <see cref="global::GitHub.Orgs.Item.Rulesets.Item.History.HistoryRequestBuilder"/> and sets the default values.
35+
/// </summary>
36+
/// <param name="pathParameters">Path parameters for the request</param>
37+
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
38+
public HistoryRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/orgs/{org}/rulesets/{ruleset_id}/history{?page*,per_page*}", pathParameters)
39+
{
40+
}
41+
/// <summary>
42+
/// Instantiates a new <see cref="global::GitHub.Orgs.Item.Rulesets.Item.History.HistoryRequestBuilder"/> and sets the default values.
43+
/// </summary>
44+
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
45+
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
46+
public HistoryRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/orgs/{org}/rulesets/{ruleset_id}/history{?page*,per_page*}", rawUrl)
47+
{
48+
}
49+
/// <summary>
50+
/// Get the history of an organization ruleset.
51+
/// API method documentation <see href="https://docs.github.com/rest/orgs/rules#get-organization-ruleset-history" />
52+
/// </summary>
53+
/// <returns>A List&lt;global::GitHub.Models.RulesetVersion&gt;</returns>
54+
/// <param name="cancellationToken">Cancellation token to use when cancelling requests</param>
55+
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
56+
/// <exception cref="global::GitHub.Models.BasicError">When receiving a 404 status code</exception>
57+
/// <exception cref="global::GitHub.Models.BasicError">When receiving a 500 status code</exception>
58+
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
59+
#nullable enable
60+
public async Task<List<global::GitHub.Models.RulesetVersion>?> GetAsync(Action<RequestConfiguration<global::GitHub.Orgs.Item.Rulesets.Item.History.HistoryRequestBuilder.HistoryRequestBuilderGetQueryParameters>>? requestConfiguration = default, CancellationToken cancellationToken = default)
61+
{
62+
#nullable restore
63+
#else
64+
public async Task<List<global::GitHub.Models.RulesetVersion>> GetAsync(Action<RequestConfiguration<global::GitHub.Orgs.Item.Rulesets.Item.History.HistoryRequestBuilder.HistoryRequestBuilderGetQueryParameters>> requestConfiguration = default, CancellationToken cancellationToken = default)
65+
{
66+
#endif
67+
var requestInfo = ToGetRequestInformation(requestConfiguration);
68+
var errorMapping = new Dictionary<string, ParsableFactory<IParsable>>
69+
{
70+
{ "404", global::GitHub.Models.BasicError.CreateFromDiscriminatorValue },
71+
{ "500", global::GitHub.Models.BasicError.CreateFromDiscriminatorValue },
72+
};
73+
var collectionResult = await RequestAdapter.SendCollectionAsync<global::GitHub.Models.RulesetVersion>(requestInfo, global::GitHub.Models.RulesetVersion.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false);
74+
return collectionResult?.AsList();
75+
}
76+
/// <summary>
77+
/// Get the history of an organization ruleset.
78+
/// </summary>
79+
/// <returns>A <see cref="RequestInformation"/></returns>
80+
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
81+
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
82+
#nullable enable
83+
public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<global::GitHub.Orgs.Item.Rulesets.Item.History.HistoryRequestBuilder.HistoryRequestBuilderGetQueryParameters>>? requestConfiguration = default)
84+
{
85+
#nullable restore
86+
#else
87+
public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<global::GitHub.Orgs.Item.Rulesets.Item.History.HistoryRequestBuilder.HistoryRequestBuilderGetQueryParameters>> requestConfiguration = default)
88+
{
89+
#endif
90+
var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters);
91+
requestInfo.Configure(requestConfiguration);
92+
requestInfo.Headers.TryAdd("Accept", "application/json");
93+
return requestInfo;
94+
}
95+
/// <summary>
96+
/// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored.
97+
/// </summary>
98+
/// <returns>A <see cref="global::GitHub.Orgs.Item.Rulesets.Item.History.HistoryRequestBuilder"/></returns>
99+
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
100+
public global::GitHub.Orgs.Item.Rulesets.Item.History.HistoryRequestBuilder WithUrl(string rawUrl)
101+
{
102+
return new global::GitHub.Orgs.Item.Rulesets.Item.History.HistoryRequestBuilder(rawUrl, RequestAdapter);
103+
}
104+
/// <summary>
105+
/// Get the history of an organization ruleset.
106+
/// </summary>
107+
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.19.0")]
108+
public partial class HistoryRequestBuilderGetQueryParameters
109+
{
110+
/// <summary>The page number of the results to fetch. For more information, see &quot;[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).&quot;</summary>
111+
[QueryParameter("page")]
112+
public int? Page { get; set; }
113+
/// <summary>The number of results per page (max 100). For more information, see &quot;[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).&quot;</summary>
114+
[QueryParameter("per_page")]
115+
public int? PerPage { get; set; }
116+
}
117+
}
118+
}
119+
#pragma warning restore CS0618

0 commit comments

Comments
 (0)