-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #409 from microsoftgraph/kiota/v1.0/pipelinebuild/…
…130446 Generated models and request builders
- Loading branch information
Showing
142 changed files
with
1,990 additions
and
560 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
183 changes: 183 additions & 0 deletions
183
src/generated/Admin/People/Pronouns/PronounsRequestBuilder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
// <auto-generated/> | ||
using ApiSdk.Models.ODataErrors; | ||
using ApiSdk.Models; | ||
using Microsoft.Kiota.Abstractions.Serialization; | ||
using Microsoft.Kiota.Abstractions; | ||
using Microsoft.Kiota.Cli.Commons.Extensions; | ||
using Microsoft.Kiota.Cli.Commons.IO; | ||
using Microsoft.Kiota.Cli.Commons; | ||
using System.Collections.Generic; | ||
using System.CommandLine; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Threading; | ||
using System; | ||
namespace ApiSdk.Admin.People.Pronouns { | ||
/// <summary> | ||
/// Provides operations to manage the pronouns property of the microsoft.graph.peopleAdminSettings entity. | ||
/// </summary> | ||
public class PronounsRequestBuilder : BaseCliRequestBuilder { | ||
/// <summary> | ||
/// Get the properties of the pronounsSettings resource for an organization. For more information on settings to manage pronouns support, see Manage pronouns settings for an organization using the Microsoft Graph API. | ||
/// Find more info here <see href="https://learn.microsoft.com/graph/api/peopleadminsettings-list-pronouns?view=graph-rest-1.0" /> | ||
/// </summary> | ||
public Command BuildGetCommand() { | ||
var command = new Command("get"); | ||
command.Description = "Get the properties of the pronounsSettings resource for an organization. For more information on settings to manage pronouns support, see Manage pronouns settings for an organization using the Microsoft Graph API.\n\nFind more info here:\n https://learn.microsoft.com/graph/api/peopleadminsettings-list-pronouns?view=graph-rest-1.0"; | ||
var selectOption = new Option<string[]>("--select", description: "Select properties to be returned") { | ||
Arity = ArgumentArity.ZeroOrMore | ||
}; | ||
selectOption.IsRequired = false; | ||
command.AddOption(selectOption); | ||
var expandOption = new Option<string[]>("--expand", description: "Expand related entities") { | ||
Arity = ArgumentArity.ZeroOrMore | ||
}; | ||
expandOption.IsRequired = false; | ||
command.AddOption(expandOption); | ||
var outputOption = new Option<FormatterType>("--output", () => FormatterType.JSON); | ||
command.AddOption(outputOption); | ||
var queryOption = new Option<string>("--query"); | ||
command.AddOption(queryOption); | ||
command.SetHandler(async (invocationContext) => { | ||
var select = invocationContext.ParseResult.GetValueForOption(selectOption); | ||
var expand = invocationContext.ParseResult.GetValueForOption(expandOption); | ||
var output = invocationContext.ParseResult.GetValueForOption(outputOption); | ||
var query = invocationContext.ParseResult.GetValueForOption(queryOption); | ||
IOutputFilter outputFilter = invocationContext.BindingContext.GetService(typeof(IOutputFilter)) as IOutputFilter ?? throw new ArgumentNullException("outputFilter"); | ||
IOutputFormatterFactory outputFormatterFactory = invocationContext.BindingContext.GetService(typeof(IOutputFormatterFactory)) as IOutputFormatterFactory ?? throw new ArgumentNullException("outputFormatterFactory"); | ||
var cancellationToken = invocationContext.GetCancellationToken(); | ||
var reqAdapter = invocationContext.GetRequestAdapter(); | ||
var requestInfo = ToGetRequestInformation(q => { | ||
q.QueryParameters.Select = select; | ||
q.QueryParameters.Expand = expand; | ||
}); | ||
var errorMapping = new Dictionary<string, ParsableFactory<IParsable>> { | ||
{"4XX", ODataError.CreateFromDiscriminatorValue}, | ||
{"5XX", ODataError.CreateFromDiscriminatorValue}, | ||
}; | ||
var response = await reqAdapter.SendPrimitiveAsync<Stream>(requestInfo, errorMapping: errorMapping, cancellationToken: cancellationToken) ?? Stream.Null; | ||
response = (response != Stream.Null) ? await outputFilter.FilterOutputAsync(response, query, cancellationToken) : response; | ||
var formatter = outputFormatterFactory.GetFormatter(output); | ||
await formatter.WriteOutputAsync(response, cancellationToken); | ||
}); | ||
return command; | ||
} | ||
/// <summary> | ||
/// Update the properties of a pronounsSettings object in an organization. For more information on settings to manage pronouns support, see Manage pronouns settings for an organization using the Microsoft Graph API. | ||
/// Find more info here <see href="https://learn.microsoft.com/graph/api/pronounssettings-update?view=graph-rest-1.0" /> | ||
/// </summary> | ||
public Command BuildPatchCommand() { | ||
var command = new Command("patch"); | ||
command.Description = "Update the properties of a pronounsSettings object in an organization. For more information on settings to manage pronouns support, see Manage pronouns settings for an organization using the Microsoft Graph API.\n\nFind more info here:\n https://learn.microsoft.com/graph/api/pronounssettings-update?view=graph-rest-1.0"; | ||
var bodyOption = new Option<string>("--body", description: "The request body") { | ||
}; | ||
bodyOption.IsRequired = true; | ||
command.AddOption(bodyOption); | ||
var outputOption = new Option<FormatterType>("--output", () => FormatterType.JSON); | ||
command.AddOption(outputOption); | ||
var queryOption = new Option<string>("--query"); | ||
command.AddOption(queryOption); | ||
command.SetHandler(async (invocationContext) => { | ||
var body = invocationContext.ParseResult.GetValueForOption(bodyOption) ?? string.Empty; | ||
var output = invocationContext.ParseResult.GetValueForOption(outputOption); | ||
var query = invocationContext.ParseResult.GetValueForOption(queryOption); | ||
IOutputFilter outputFilter = invocationContext.BindingContext.GetService(typeof(IOutputFilter)) as IOutputFilter ?? throw new ArgumentNullException("outputFilter"); | ||
IOutputFormatterFactory outputFormatterFactory = invocationContext.BindingContext.GetService(typeof(IOutputFormatterFactory)) as IOutputFormatterFactory ?? throw new ArgumentNullException("outputFormatterFactory"); | ||
var cancellationToken = invocationContext.GetCancellationToken(); | ||
var reqAdapter = invocationContext.GetRequestAdapter(); | ||
using var stream = new MemoryStream(Encoding.UTF8.GetBytes(body)); | ||
var parseNode = ParseNodeFactoryRegistry.DefaultInstance.GetRootParseNode("application/json", stream); | ||
var model = parseNode.GetObjectValue<PronounsSettings>(PronounsSettings.CreateFromDiscriminatorValue); | ||
if (model is null) { | ||
Console.Error.WriteLine("No model data to send."); | ||
return; | ||
} | ||
var requestInfo = ToPatchRequestInformation(model, q => { | ||
}); | ||
requestInfo.SetContentFromParsable(reqAdapter, "application/json", model); | ||
var errorMapping = new Dictionary<string, ParsableFactory<IParsable>> { | ||
{"4XX", ODataError.CreateFromDiscriminatorValue}, | ||
{"5XX", ODataError.CreateFromDiscriminatorValue}, | ||
}; | ||
var response = await reqAdapter.SendPrimitiveAsync<Stream>(requestInfo, errorMapping: errorMapping, cancellationToken: cancellationToken) ?? Stream.Null; | ||
response = (response != Stream.Null) ? await outputFilter.FilterOutputAsync(response, query, cancellationToken) : response; | ||
var formatter = outputFormatterFactory.GetFormatter(output); | ||
await formatter.WriteOutputAsync(response, cancellationToken); | ||
}); | ||
return command; | ||
} | ||
/// <summary> | ||
/// Instantiates a new PronounsRequestBuilder and sets the default values. | ||
/// </summary> | ||
/// <param name="pathParameters">Path parameters for the request</param> | ||
public PronounsRequestBuilder(Dictionary<string, object> pathParameters) : base("{+baseurl}/admin/people/pronouns{?%24select,%24expand}", pathParameters) { | ||
} | ||
/// <summary> | ||
/// Instantiates a new PronounsRequestBuilder and sets the default values. | ||
/// </summary> | ||
/// <param name="rawUrl">The raw URL to use for the request builder.</param> | ||
public PronounsRequestBuilder(string rawUrl) : base("{+baseurl}/admin/people/pronouns{?%24select,%24expand}", rawUrl) { | ||
} | ||
/// <summary> | ||
/// Get the properties of the pronounsSettings resource for an organization. For more information on settings to manage pronouns support, see Manage pronouns settings for an organization using the Microsoft Graph API. | ||
/// </summary> | ||
/// <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<PronounsRequestBuilderGetQueryParameters>>? requestConfiguration = default) { | ||
#nullable restore | ||
#else | ||
public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<PronounsRequestBuilderGetQueryParameters>> requestConfiguration = default) { | ||
#endif | ||
var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); | ||
requestInfo.Configure(requestConfiguration); | ||
requestInfo.Headers.TryAdd("Accept", "application/json"); | ||
return requestInfo; | ||
} | ||
/// <summary> | ||
/// Update the properties of a pronounsSettings object in an organization. For more information on settings to manage pronouns support, see Manage pronouns settings for an organization using the Microsoft Graph API. | ||
/// </summary> | ||
/// <param name="body">The request body</param> | ||
/// <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 ToPatchRequestInformation(PronounsSettings body, Action<RequestConfiguration<DefaultQueryParameters>>? requestConfiguration = default) { | ||
#nullable restore | ||
#else | ||
public RequestInformation ToPatchRequestInformation(PronounsSettings body, Action<RequestConfiguration<DefaultQueryParameters>> requestConfiguration = default) { | ||
#endif | ||
_ = body ?? throw new ArgumentNullException(nameof(body)); | ||
var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); | ||
requestInfo.Configure(requestConfiguration); | ||
requestInfo.Headers.TryAdd("Accept", "application/json"); | ||
return requestInfo; | ||
} | ||
/// <summary> | ||
/// Get the properties of the pronounsSettings resource for an organization. For more information on settings to manage pronouns support, see Manage pronouns settings for an organization using the Microsoft Graph API. | ||
/// </summary> | ||
public class PronounsRequestBuilderGetQueryParameters { | ||
/// <summary>Expand related entities</summary> | ||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER | ||
#nullable enable | ||
[QueryParameter("%24expand")] | ||
public string[]? Expand { get; set; } | ||
#nullable restore | ||
#else | ||
[QueryParameter("%24expand")] | ||
public string[] Expand { get; set; } | ||
#endif | ||
/// <summary>Select properties to be returned</summary> | ||
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER | ||
#nullable enable | ||
[QueryParameter("%24select")] | ||
public string[]? Select { get; set; } | ||
#nullable restore | ||
#else | ||
[QueryParameter("%24select")] | ||
public string[] Select { get; set; } | ||
#endif | ||
} | ||
} | ||
} |
Oops, something went wrong.