Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Commit 8ef50d0

Browse files
authored
Merge pull request #10 from microsoftgraph/chore/update_generated_code
Update generated code
2 parents 5140968 + 10b7be9 commit 8ef50d0

File tree

676 files changed

+24211
-2824
lines changed

Some content is hidden

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

676 files changed

+24211
-2824
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ DocProject/Help/Html2
371371
DocProject/Help/html
372372

373373
# Click-Once directory
374-
publish/
374+
bin/**/publish/
375375

376376
# Publish Web Output
377377
*.[Pp]ublish.xml
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
using ApiSdk.Admin.ServiceAnnouncement.Messages.Item.Attachments.Item;
2+
using ApiSdk.Models.Microsoft.Graph;
3+
using Microsoft.Kiota.Abstractions;
4+
using Microsoft.Kiota.Abstractions.Serialization;
5+
using System;
6+
using System.Collections.Generic;
7+
using System.CommandLine;
8+
using System.CommandLine.Invocation;
9+
using System.IO;
10+
using System.Linq;
11+
using System.Text;
12+
using System.Threading;
13+
using System.Threading.Tasks;
14+
namespace ApiSdk.Admin.ServiceAnnouncement.Messages.Item.Attachments {
15+
/// <summary>Builds and executes requests for operations under \admin\serviceAnnouncement\messages\{serviceUpdateMessage-id}\attachments</summary>
16+
public class AttachmentsRequestBuilder {
17+
/// <summary>Path parameters for the request</summary>
18+
private Dictionary<string, object> PathParameters { get; set; }
19+
/// <summary>The request adapter to use to execute the requests.</summary>
20+
private IRequestAdapter RequestAdapter { get; set; }
21+
/// <summary>Url template to use to build the URL for the current request builder</summary>
22+
private string UrlTemplate { get; set; }
23+
public List<Command> BuildCommand() {
24+
var builder = new ServiceAnnouncementAttachmentRequestBuilder(PathParameters, RequestAdapter);
25+
var commands = new List<Command> {
26+
builder.BuildContentCommand(),
27+
builder.BuildDeleteCommand(),
28+
builder.BuildGetCommand(),
29+
builder.BuildPatchCommand(),
30+
};
31+
return commands;
32+
}
33+
/// <summary>
34+
/// Create new navigation property to attachments for admin
35+
/// </summary>
36+
public Command BuildCreateCommand() {
37+
var command = new Command("create");
38+
command.Description = "Create new navigation property to attachments for admin";
39+
// Create options for all the parameters
40+
var serviceUpdateMessageIdOption = new Option<string>("--serviceupdatemessage-id", description: "key: id of serviceUpdateMessage");
41+
serviceUpdateMessageIdOption.IsRequired = true;
42+
command.AddOption(serviceUpdateMessageIdOption);
43+
var bodyOption = new Option<string>("--body");
44+
bodyOption.IsRequired = true;
45+
command.AddOption(bodyOption);
46+
command.Handler = CommandHandler.Create<string, string>(async (serviceUpdateMessageId, body) => {
47+
using var stream = new MemoryStream(Encoding.UTF8.GetBytes(body));
48+
var parseNode = ParseNodeFactoryRegistry.DefaultInstance.GetRootParseNode("application/json", stream);
49+
var model = parseNode.GetObjectValue<ServiceAnnouncementAttachment>();
50+
var requestInfo = CreatePostRequestInformation(model, q => {
51+
});
52+
var result = await RequestAdapter.SendAsync<ServiceAnnouncementAttachment>(requestInfo);
53+
// Print request output. What if the request has no return?
54+
using var serializer = RequestAdapter.SerializationWriterFactory.GetSerializationWriter("application/json");
55+
serializer.WriteObjectValue(null, result);
56+
using var content = serializer.GetSerializedContent();
57+
using var reader = new StreamReader(content);
58+
var strContent = await reader.ReadToEndAsync();
59+
Console.Write(strContent + "\n");
60+
});
61+
return command;
62+
}
63+
/// <summary>
64+
/// Get attachments from admin
65+
/// </summary>
66+
public Command BuildListCommand() {
67+
var command = new Command("list");
68+
command.Description = "Get attachments from admin";
69+
// Create options for all the parameters
70+
var serviceUpdateMessageIdOption = new Option<string>("--serviceupdatemessage-id", description: "key: id of serviceUpdateMessage");
71+
serviceUpdateMessageIdOption.IsRequired = true;
72+
command.AddOption(serviceUpdateMessageIdOption);
73+
var topOption = new Option<int?>("--top", description: "Show only the first n items");
74+
topOption.IsRequired = false;
75+
command.AddOption(topOption);
76+
var skipOption = new Option<int?>("--skip", description: "Skip the first n items");
77+
skipOption.IsRequired = false;
78+
command.AddOption(skipOption);
79+
var searchOption = new Option<string>("--search", description: "Search items by search phrases");
80+
searchOption.IsRequired = false;
81+
command.AddOption(searchOption);
82+
var filterOption = new Option<string>("--filter", description: "Filter items by property values");
83+
filterOption.IsRequired = false;
84+
command.AddOption(filterOption);
85+
var countOption = new Option<bool?>("--count", description: "Include count of items");
86+
countOption.IsRequired = false;
87+
command.AddOption(countOption);
88+
var orderbyOption = new Option<string[]>("--orderby", description: "Order items by property values");
89+
orderbyOption.IsRequired = false;
90+
orderbyOption.Arity = ArgumentArity.ZeroOrMore;
91+
command.AddOption(orderbyOption);
92+
var selectOption = new Option<string[]>("--select", description: "Select properties to be returned");
93+
selectOption.IsRequired = false;
94+
selectOption.Arity = ArgumentArity.ZeroOrMore;
95+
command.AddOption(selectOption);
96+
var expandOption = new Option<string[]>("--expand", description: "Expand related entities");
97+
expandOption.IsRequired = false;
98+
expandOption.Arity = ArgumentArity.ZeroOrMore;
99+
command.AddOption(expandOption);
100+
command.Handler = CommandHandler.Create<string, int?, int?, string, string, bool?, string[], string[], string[]>(async (serviceUpdateMessageId, top, skip, search, filter, count, orderby, select, expand) => {
101+
var requestInfo = CreateGetRequestInformation(q => {
102+
q.Top = top;
103+
q.Skip = skip;
104+
if (!String.IsNullOrEmpty(search)) q.Search = search;
105+
if (!String.IsNullOrEmpty(filter)) q.Filter = filter;
106+
q.Count = count;
107+
q.Orderby = orderby;
108+
q.Select = select;
109+
q.Expand = expand;
110+
});
111+
var result = await RequestAdapter.SendAsync<AttachmentsResponse>(requestInfo);
112+
// Print request output. What if the request has no return?
113+
using var serializer = RequestAdapter.SerializationWriterFactory.GetSerializationWriter("application/json");
114+
serializer.WriteObjectValue(null, result);
115+
using var content = serializer.GetSerializedContent();
116+
using var reader = new StreamReader(content);
117+
var strContent = await reader.ReadToEndAsync();
118+
Console.Write(strContent + "\n");
119+
});
120+
return command;
121+
}
122+
/// <summary>
123+
/// Instantiates a new AttachmentsRequestBuilder and sets the default values.
124+
/// <param name="pathParameters">Path parameters for the request</param>
125+
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
126+
/// </summary>
127+
public AttachmentsRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) {
128+
_ = pathParameters ?? throw new ArgumentNullException(nameof(pathParameters));
129+
_ = requestAdapter ?? throw new ArgumentNullException(nameof(requestAdapter));
130+
UrlTemplate = "{+baseurl}/admin/serviceAnnouncement/messages/{serviceUpdateMessage_id}/attachments{?top,skip,search,filter,count,orderby,select,expand}";
131+
var urlTplParams = new Dictionary<string, object>(pathParameters);
132+
PathParameters = urlTplParams;
133+
RequestAdapter = requestAdapter;
134+
}
135+
/// <summary>
136+
/// Get attachments from admin
137+
/// <param name="h">Request headers</param>
138+
/// <param name="o">Request options</param>
139+
/// <param name="q">Request query parameters</param>
140+
/// </summary>
141+
public RequestInformation CreateGetRequestInformation(Action<GetQueryParameters> q = default, Action<IDictionary<string, string>> h = default, IEnumerable<IRequestOption> o = default) {
142+
var requestInfo = new RequestInformation {
143+
HttpMethod = HttpMethod.GET,
144+
UrlTemplate = UrlTemplate,
145+
PathParameters = PathParameters,
146+
};
147+
if (q != null) {
148+
var qParams = new GetQueryParameters();
149+
q.Invoke(qParams);
150+
qParams.AddQueryParameters(requestInfo.QueryParameters);
151+
}
152+
h?.Invoke(requestInfo.Headers);
153+
requestInfo.AddRequestOptions(o?.ToArray());
154+
return requestInfo;
155+
}
156+
/// <summary>
157+
/// Create new navigation property to attachments for admin
158+
/// <param name="body"></param>
159+
/// <param name="h">Request headers</param>
160+
/// <param name="o">Request options</param>
161+
/// </summary>
162+
public RequestInformation CreatePostRequestInformation(ServiceAnnouncementAttachment body, Action<IDictionary<string, string>> h = default, IEnumerable<IRequestOption> o = default) {
163+
_ = body ?? throw new ArgumentNullException(nameof(body));
164+
var requestInfo = new RequestInformation {
165+
HttpMethod = HttpMethod.POST,
166+
UrlTemplate = UrlTemplate,
167+
PathParameters = PathParameters,
168+
};
169+
requestInfo.SetContentFromParsable(RequestAdapter, "application/json", body);
170+
h?.Invoke(requestInfo.Headers);
171+
requestInfo.AddRequestOptions(o?.ToArray());
172+
return requestInfo;
173+
}
174+
/// <summary>
175+
/// Get attachments from admin
176+
/// <param name="cancellationToken">Cancellation token to use when cancelling requests</param>
177+
/// <param name="h">Request headers</param>
178+
/// <param name="o">Request options</param>
179+
/// <param name="q">Request query parameters</param>
180+
/// <param name="responseHandler">Response handler to use in place of the default response handling provided by the core service</param>
181+
/// </summary>
182+
public async Task<AttachmentsResponse> GetAsync(Action<GetQueryParameters> q = default, Action<IDictionary<string, string>> h = default, IEnumerable<IRequestOption> o = default, IResponseHandler responseHandler = default, CancellationToken cancellationToken = default) {
183+
var requestInfo = CreateGetRequestInformation(q, h, o);
184+
return await RequestAdapter.SendAsync<AttachmentsResponse>(requestInfo, responseHandler, cancellationToken);
185+
}
186+
/// <summary>
187+
/// Create new navigation property to attachments for admin
188+
/// <param name="cancellationToken">Cancellation token to use when cancelling requests</param>
189+
/// <param name="h">Request headers</param>
190+
/// <param name="model"></param>
191+
/// <param name="o">Request options</param>
192+
/// <param name="responseHandler">Response handler to use in place of the default response handling provided by the core service</param>
193+
/// </summary>
194+
public async Task<ServiceAnnouncementAttachment> PostAsync(ServiceAnnouncementAttachment model, Action<IDictionary<string, string>> h = default, IEnumerable<IRequestOption> o = default, IResponseHandler responseHandler = default, CancellationToken cancellationToken = default) {
195+
_ = model ?? throw new ArgumentNullException(nameof(model));
196+
var requestInfo = CreatePostRequestInformation(model, h, o);
197+
return await RequestAdapter.SendAsync<ServiceAnnouncementAttachment>(requestInfo, responseHandler, cancellationToken);
198+
}
199+
/// <summary>Get attachments from admin</summary>
200+
public class GetQueryParameters : QueryParametersBase {
201+
/// <summary>Include count of items</summary>
202+
public bool? Count { get; set; }
203+
/// <summary>Expand related entities</summary>
204+
public string[] Expand { get; set; }
205+
/// <summary>Filter items by property values</summary>
206+
public string Filter { get; set; }
207+
/// <summary>Order items by property values</summary>
208+
public string[] Orderby { get; set; }
209+
/// <summary>Search items by search phrases</summary>
210+
public string Search { get; set; }
211+
/// <summary>Select properties to be returned</summary>
212+
public string[] Select { get; set; }
213+
/// <summary>Skip the first n items</summary>
214+
public int? Skip { get; set; }
215+
/// <summary>Show only the first n items</summary>
216+
public int? Top { get; set; }
217+
}
218+
}
219+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using ApiSdk.Models.Microsoft.Graph;
2+
using Microsoft.Kiota.Abstractions.Serialization;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.IO;
6+
using System.Linq;
7+
namespace ApiSdk.Admin.ServiceAnnouncement.Messages.Item.Attachments {
8+
public class AttachmentsResponse : IParsable {
9+
/// <summary>Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.</summary>
10+
public IDictionary<string, object> AdditionalData { get; set; }
11+
public string NextLink { get; set; }
12+
public List<ServiceAnnouncementAttachment> Value { get; set; }
13+
/// <summary>
14+
/// Instantiates a new attachmentsResponse and sets the default values.
15+
/// </summary>
16+
public AttachmentsResponse() {
17+
AdditionalData = new Dictionary<string, object>();
18+
}
19+
/// <summary>
20+
/// The deserialization information for the current model
21+
/// </summary>
22+
public IDictionary<string, Action<T, IParseNode>> GetFieldDeserializers<T>() {
23+
return new Dictionary<string, Action<T, IParseNode>> {
24+
{"@odata.nextLink", (o,n) => { (o as AttachmentsResponse).NextLink = n.GetStringValue(); } },
25+
{"value", (o,n) => { (o as AttachmentsResponse).Value = n.GetCollectionOfObjectValues<ServiceAnnouncementAttachment>().ToList(); } },
26+
};
27+
}
28+
/// <summary>
29+
/// Serializes information the current object
30+
/// <param name="writer">Serialization writer to use to serialize this model</param>
31+
/// </summary>
32+
public void Serialize(ISerializationWriter writer) {
33+
_ = writer ?? throw new ArgumentNullException(nameof(writer));
34+
writer.WriteStringValue("@odata.nextLink", NextLink);
35+
writer.WriteCollectionOfObjectValues<ServiceAnnouncementAttachment>("value", Value);
36+
writer.WriteAdditionalData(AdditionalData);
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)