-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWithAccount_ItemRequestBuilder.cs
165 lines (165 loc) · 10.9 KB
/
WithAccount_ItemRequestBuilder.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
// <auto-generated/>
#pragma warning disable CS0618
using GitHub.Models;
using Microsoft.Kiota.Abstractions.Extensions;
using Microsoft.Kiota.Abstractions.Serialization;
using Microsoft.Kiota.Abstractions;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using System.Threading;
using System;
namespace GitHub.User.Item
{
/// <summary>
/// Builds and executes requests for operations under \user\{account_id}
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.19.0")]
public partial class WithAccount_ItemRequestBuilder : BaseRequestBuilder
{
/// <summary>
/// Instantiates a new <see cref="global::GitHub.User.Item.WithAccount_ItemRequestBuilder"/> and sets the default values.
/// </summary>
/// <param name="pathParameters">Path parameters for the request</param>
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
public WithAccount_ItemRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/{account_id}", pathParameters)
{
}
/// <summary>
/// Instantiates a new <see cref="global::GitHub.User.Item.WithAccount_ItemRequestBuilder"/> and sets the default values.
/// </summary>
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
public WithAccount_ItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/user/{account_id}", rawUrl)
{
}
/// <summary>
/// Provides publicly available information about someone with a GitHub account. This method takes their durable user `ID` instead of their `login`, which can change over time.The `email` key in the following response is the publicly visible email address from your GitHub Enterprise Server [profile page](https://github.com/settings/profile). When setting up your profile, you can select a primary email address to be public which provides an email entry for this endpoint. If you do not set a public email address for `email`, then it will have a value of `null`. You only see publicly visible email addresses when authenticated with GitHub Enterprise Server. For more information, see [Authentication](https://docs.github.com/[email protected]/rest/guides/getting-started-with-the-rest-api#authentication).The Emails API enables you to list all of your email addresses, and toggle a primary email to be visible publicly. For more information, see [Emails API](https://docs.github.com/[email protected]/rest/users/emails).
/// API method documentation <see href="https://docs.github.com/[email protected]/rest/users/users#get-a-user-using-their-id" />
/// </summary>
/// <returns>A <see cref="global::GitHub.User.Item.WithAccount_ItemRequestBuilder.WithAccount_GetResponse"/></returns>
/// <param name="cancellationToken">Cancellation token to use when cancelling requests</param>
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
/// <exception cref="global::GitHub.Models.BasicError">When receiving a 404 status code</exception>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public async Task<global::GitHub.User.Item.WithAccount_ItemRequestBuilder.WithAccount_GetResponse?> GetAsync(Action<RequestConfiguration<DefaultQueryParameters>>? requestConfiguration = default, CancellationToken cancellationToken = default)
{
#nullable restore
#else
public async Task<global::GitHub.User.Item.WithAccount_ItemRequestBuilder.WithAccount_GetResponse> GetAsync(Action<RequestConfiguration<DefaultQueryParameters>> requestConfiguration = default, CancellationToken cancellationToken = default)
{
#endif
var requestInfo = ToGetRequestInformation(requestConfiguration);
var errorMapping = new Dictionary<string, ParsableFactory<IParsable>>
{
{ "404", global::GitHub.Models.BasicError.CreateFromDiscriminatorValue },
};
return await RequestAdapter.SendAsync<global::GitHub.User.Item.WithAccount_ItemRequestBuilder.WithAccount_GetResponse>(requestInfo, global::GitHub.User.Item.WithAccount_ItemRequestBuilder.WithAccount_GetResponse.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// Provides publicly available information about someone with a GitHub account. This method takes their durable user `ID` instead of their `login`, which can change over time.The `email` key in the following response is the publicly visible email address from your GitHub Enterprise Server [profile page](https://github.com/settings/profile). When setting up your profile, you can select a primary email address to be public which provides an email entry for this endpoint. If you do not set a public email address for `email`, then it will have a value of `null`. You only see publicly visible email addresses when authenticated with GitHub Enterprise Server. For more information, see [Authentication](https://docs.github.com/[email protected]/rest/guides/getting-started-with-the-rest-api#authentication).The Emails API enables you to list all of your email addresses, and toggle a primary email to be visible publicly. For more information, see [Emails API](https://docs.github.com/[email protected]/rest/users/emails).
/// </summary>
/// <returns>A <see cref="RequestInformation"/></returns>
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<DefaultQueryParameters>>? requestConfiguration = default)
{
#nullable restore
#else
public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<DefaultQueryParameters>> requestConfiguration = default)
{
#endif
var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters);
requestInfo.Configure(requestConfiguration);
requestInfo.Headers.TryAdd("Accept", "application/json");
return requestInfo;
}
/// <summary>
/// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored.
/// </summary>
/// <returns>A <see cref="global::GitHub.User.Item.WithAccount_ItemRequestBuilder"/></returns>
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
public global::GitHub.User.Item.WithAccount_ItemRequestBuilder WithUrl(string rawUrl)
{
return new global::GitHub.User.Item.WithAccount_ItemRequestBuilder(rawUrl, RequestAdapter);
}
/// <summary>
/// Composed type wrapper for classes <see cref="global::GitHub.Models.PrivateUser"/>, <see cref="global::GitHub.Models.PublicUser"/>
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.19.0")]
public partial class WithAccount_GetResponse : IComposedTypeWrapper, IParsable
{
/// <summary>Composed type representation for type <see cref="global::GitHub.Models.PrivateUser"/></summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public global::GitHub.Models.PrivateUser? PrivateUser { get; set; }
#nullable restore
#else
public global::GitHub.Models.PrivateUser PrivateUser { get; set; }
#endif
/// <summary>Composed type representation for type <see cref="global::GitHub.Models.PublicUser"/></summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public global::GitHub.Models.PublicUser? PublicUser { get; set; }
#nullable restore
#else
public global::GitHub.Models.PublicUser PublicUser { get; set; }
#endif
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// </summary>
/// <returns>A <see cref="global::GitHub.User.Item.WithAccount_ItemRequestBuilder.WithAccount_GetResponse"/></returns>
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
public static global::GitHub.User.Item.WithAccount_ItemRequestBuilder.WithAccount_GetResponse CreateFromDiscriminatorValue(IParseNode parseNode)
{
_ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
var mappingValue = parseNode.GetChildNode("user_view_type")?.GetStringValue();
var result = new global::GitHub.User.Item.WithAccount_ItemRequestBuilder.WithAccount_GetResponse();
if("private".Equals(mappingValue, StringComparison.OrdinalIgnoreCase))
{
result.PrivateUser = new global::GitHub.Models.PrivateUser();
}
else if("public".Equals(mappingValue, StringComparison.OrdinalIgnoreCase))
{
result.PublicUser = new global::GitHub.Models.PublicUser();
}
return result;
}
/// <summary>
/// The deserialization information for the current model
/// </summary>
/// <returns>A IDictionary<string, Action<IParseNode>></returns>
public virtual IDictionary<string, Action<IParseNode>> GetFieldDeserializers()
{
if(PrivateUser != null)
{
return PrivateUser.GetFieldDeserializers();
}
else if(PublicUser != null)
{
return PublicUser.GetFieldDeserializers();
}
return new Dictionary<string, Action<IParseNode>>();
}
/// <summary>
/// Serializes information the current object
/// </summary>
/// <param name="writer">Serialization writer to use to serialize this model</param>
public virtual void Serialize(ISerializationWriter writer)
{
_ = writer ?? throw new ArgumentNullException(nameof(writer));
if(PrivateUser != null)
{
writer.WriteObjectValue<global::GitHub.Models.PrivateUser>(null, PrivateUser);
}
else if(PublicUser != null)
{
writer.WriteObjectValue<global::GitHub.Models.PublicUser>(null, PublicUser);
}
}
}
}
}
#pragma warning restore CS0618