/// <summary> /// The events in the calendar. Navigation property. Read-only. /// </summary> public Command BuildGetCommand() { var command = new Command("get"); command.Description = "The events in the calendar. Navigation property. Read-only."; // Create options for all the parameters var calendarIdOption = new Option <string>("--calendar-id", description: "key: id of calendar") { }; calendarIdOption.IsRequired = true; command.AddOption(calendarIdOption); var eventIdOption = new Option <string>("--event-id", description: "key: id of event") { }; eventIdOption.IsRequired = true; command.AddOption(eventIdOption); var selectOption = new Option <string[]>("--select", description: "Select properties to be returned") { Arity = ArgumentArity.ZeroOrMore }; selectOption.IsRequired = false; command.AddOption(selectOption); var outputOption = new Option <FormatterType>("--output", () => FormatterType.JSON) { IsRequired = true }; command.AddOption(outputOption); var queryOption = new Option <string>("--query"); command.AddOption(queryOption); var jsonNoIndentOption = new Option <bool>("--json-no-indent", r => { if (bool.TryParse(r.Tokens.Select(t => t.Value).LastOrDefault(), out var value)) { return(value); } return(true); }, description: "Disable indentation for the JSON output formatter."); command.AddOption(jsonNoIndentOption); command.SetHandler(async(object[] parameters) => { var calendarId = (string)parameters[0]; var eventId = (string)parameters[1]; var select = (string[])parameters[2]; var output = (FormatterType)parameters[3]; var query = (string)parameters[4]; var jsonNoIndent = (bool)parameters[5]; var outputFilter = (IOutputFilter)parameters[6]; var outputFormatterFactory = (IOutputFormatterFactory)parameters[7]; var cancellationToken = (CancellationToken)parameters[8]; var requestInfo = CreateGetRequestInformation(q => { q.QueryParameters.Select = select; }); requestInfo.PathParameters.Add("calendar%2Did", calendarId); requestInfo.PathParameters.Add("event%2Did", eventId); var errorMapping = new Dictionary <string, ParsableFactory <IParsable> > { { "4XX", ODataError.CreateFromDiscriminatorValue }, { "5XX", ODataError.CreateFromDiscriminatorValue }, }; var response = await RequestAdapter.SendPrimitiveAsync <Stream>(requestInfo, errorMapping: errorMapping, cancellationToken: cancellationToken); response = await outputFilter?.FilterOutputAsync(response, query, cancellationToken) ?? response; var formatterOptions = output.GetOutputFormatterOptions(new FormatterOptionsModel(!jsonNoIndent)); var formatter = outputFormatterFactory.GetFormatter(output); await formatter.WriteOutputAsync(response, formatterOptions, cancellationToken); }, new CollectionBinding(calendarIdOption, eventIdOption, selectOption, outputOption, queryOption, jsonNoIndentOption, new TypeBinding(typeof(IOutputFilter)), new TypeBinding(typeof(IOutputFormatterFactory)), new TypeBinding(typeof(CancellationToken)))); return(command); }
/// <summary> /// The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]. /// </summary> public Command BuildGetCommand() { var command = new Command("get"); command.Description = "The from [term] of the relation. The term from which the relationship is defined. A null value would indicate the relation is directly with the [set]."; // Create options for all the parameters var groupIdOption = new Option <string>("--group-id", description: "key: id of group") { }; groupIdOption.IsRequired = true; command.AddOption(groupIdOption); var siteIdOption = new Option <string>("--site-id", description: "key: id of site") { }; siteIdOption.IsRequired = true; command.AddOption(siteIdOption); var setIdOption = new Option <string>("--set-id", description: "key: id of set") { }; setIdOption.IsRequired = true; command.AddOption(setIdOption); var termIdOption = new Option <string>("--term-id", description: "key: id of term") { }; termIdOption.IsRequired = true; command.AddOption(termIdOption); var relationIdOption = new Option <string>("--relation-id", description: "key: id of relation") { }; relationIdOption.IsRequired = true; command.AddOption(relationIdOption); 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) { IsRequired = true }; command.AddOption(outputOption); var queryOption = new Option <string>("--query"); command.AddOption(queryOption); var jsonNoIndentOption = new Option <bool>("--json-no-indent", r => { if (bool.TryParse(r.Tokens.Select(t => t.Value).LastOrDefault(), out var value)) { return(value); } return(true); }, description: "Disable indentation for the JSON output formatter."); command.AddOption(jsonNoIndentOption); command.SetHandler(async(object[] parameters) => { var groupId = (string)parameters[0]; var siteId = (string)parameters[1]; var setId = (string)parameters[2]; var termId = (string)parameters[3]; var relationId = (string)parameters[4]; var select = (string[])parameters[5]; var expand = (string[])parameters[6]; var output = (FormatterType)parameters[7]; var query = (string)parameters[8]; var jsonNoIndent = (bool)parameters[9]; var outputFilter = (IOutputFilter)parameters[10]; var outputFormatterFactory = (IOutputFormatterFactory)parameters[11]; var cancellationToken = (CancellationToken)parameters[12]; var requestInfo = CreateGetRequestInformation(q => { q.QueryParameters.Select = select; q.QueryParameters.Expand = expand; }); requestInfo.PathParameters.Add("group%2Did", groupId); requestInfo.PathParameters.Add("site%2Did", siteId); requestInfo.PathParameters.Add("set%2Did", setId); requestInfo.PathParameters.Add("term%2Did", termId); requestInfo.PathParameters.Add("relation%2Did", relationId); var errorMapping = new Dictionary <string, ParsableFactory <IParsable> > { { "4XX", ODataError.CreateFromDiscriminatorValue }, { "5XX", ODataError.CreateFromDiscriminatorValue }, }; var response = await RequestAdapter.SendPrimitiveAsync <Stream>(requestInfo, errorMapping: errorMapping, cancellationToken: cancellationToken); response = await outputFilter?.FilterOutputAsync(response, query, cancellationToken) ?? response; var formatterOptions = output.GetOutputFormatterOptions(new FormatterOptionsModel(!jsonNoIndent)); var formatter = outputFormatterFactory.GetFormatter(output); await formatter.WriteOutputAsync(response, formatterOptions, cancellationToken); }, new CollectionBinding(groupIdOption, siteIdOption, setIdOption, termIdOption, relationIdOption, selectOption, expandOption, outputOption, queryOption, jsonNoIndentOption, new TypeBinding(typeof(IOutputFilter)), new TypeBinding(typeof(IOutputFormatterFactory)), new TypeBinding(typeof(CancellationToken)))); return(command); }
/// <summary> /// To indicate which terms are related to the current term as either pinned or reused. /// </summary> public Command BuildListCommand() { var command = new Command("list"); command.Description = "To indicate which terms are related to the current term as either pinned or reused."; // Create options for all the parameters var siteIdOption = new Option <string>("--site-id", description: "key: id of site") { }; siteIdOption.IsRequired = true; command.AddOption(siteIdOption); var groupIdOption = new Option <string>("--group-id", description: "key: id of group") { }; groupIdOption.IsRequired = true; command.AddOption(groupIdOption); var setIdOption = new Option <string>("--set-id", description: "key: id of set") { }; setIdOption.IsRequired = true; command.AddOption(setIdOption); var termIdOption = new Option <string>("--term-id", description: "key: id of term") { }; termIdOption.IsRequired = true; command.AddOption(termIdOption); var topOption = new Option <int?>("--top", description: "Show only the first n items") { }; topOption.IsRequired = false; command.AddOption(topOption); var skipOption = new Option <int?>("--skip", description: "Skip the first n items") { }; skipOption.IsRequired = false; command.AddOption(skipOption); var searchOption = new Option <string>("--search", description: "Search items by search phrases") { }; searchOption.IsRequired = false; command.AddOption(searchOption); var filterOption = new Option <string>("--filter", description: "Filter items by property values") { }; filterOption.IsRequired = false; command.AddOption(filterOption); var countOption = new Option <bool?>("--count", description: "Include count of items") { }; countOption.IsRequired = false; command.AddOption(countOption); var orderbyOption = new Option <string[]>("--orderby", description: "Order items by property values") { Arity = ArgumentArity.ZeroOrMore }; orderbyOption.IsRequired = false; command.AddOption(orderbyOption); 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) { IsRequired = true }; command.AddOption(outputOption); var queryOption = new Option <string>("--query"); command.AddOption(queryOption); var jsonNoIndentOption = new Option <bool>("--json-no-indent", r => { if (bool.TryParse(r.Tokens.Select(t => t.Value).LastOrDefault(), out var value)) { return(value); } return(true); }, description: "Disable indentation for the JSON output formatter."); command.AddOption(jsonNoIndentOption); command.SetHandler(async(object[] parameters) => { var siteId = (string)parameters[0]; var groupId = (string)parameters[1]; var setId = (string)parameters[2]; var termId = (string)parameters[3]; var top = (int?)parameters[4]; var skip = (int?)parameters[5]; var search = (string)parameters[6]; var filter = (string)parameters[7]; var count = (bool?)parameters[8]; var orderby = (string[])parameters[9]; var select = (string[])parameters[10]; var expand = (string[])parameters[11]; var output = (FormatterType)parameters[12]; var query = (string)parameters[13]; var jsonNoIndent = (bool)parameters[14]; var outputFilter = (IOutputFilter)parameters[15]; var outputFormatterFactory = (IOutputFormatterFactory)parameters[16]; var cancellationToken = (CancellationToken)parameters[17]; var requestInfo = CreateGetRequestInformation(q => { q.QueryParameters.Top = top; q.QueryParameters.Skip = skip; if (!String.IsNullOrEmpty(search)) { q.QueryParameters.Search = search; } if (!String.IsNullOrEmpty(filter)) { q.QueryParameters.Filter = filter; } q.QueryParameters.Count = count; q.QueryParameters.Orderby = orderby; q.QueryParameters.Select = select; q.QueryParameters.Expand = expand; }); requestInfo.PathParameters.Add("site%2Did", siteId); requestInfo.PathParameters.Add("group%2Did", groupId); requestInfo.PathParameters.Add("set%2Did", setId); requestInfo.PathParameters.Add("term%2Did", termId); var errorMapping = new Dictionary <string, ParsableFactory <IParsable> > { { "4XX", ODataError.CreateFromDiscriminatorValue }, { "5XX", ODataError.CreateFromDiscriminatorValue }, }; var response = await RequestAdapter.SendPrimitiveAsync <Stream>(requestInfo, errorMapping: errorMapping, cancellationToken: cancellationToken); response = await outputFilter?.FilterOutputAsync(response, query, cancellationToken) ?? response; var formatterOptions = output.GetOutputFormatterOptions(new FormatterOptionsModel(!jsonNoIndent)); var formatter = outputFormatterFactory.GetFormatter(output); await formatter.WriteOutputAsync(response, formatterOptions, cancellationToken); }, new CollectionBinding(siteIdOption, groupIdOption, setIdOption, termIdOption, topOption, skipOption, searchOption, filterOption, new NullableBooleanBinding(countOption), orderbyOption, selectOption, expandOption, outputOption, queryOption, jsonNoIndentOption, new TypeBinding(typeof(IOutputFilter)), new TypeBinding(typeof(IOutputFormatterFactory)), new TypeBinding(typeof(CancellationToken)))); return(command); }
/// <summary> /// Create new navigation property to relations for sites /// </summary> public Command BuildCreateCommand() { var command = new Command("create"); command.Description = "Create new navigation property to relations for sites"; // Create options for all the parameters var siteIdOption = new Option <string>("--site-id", description: "key: id of site") { }; siteIdOption.IsRequired = true; command.AddOption(siteIdOption); var groupIdOption = new Option <string>("--group-id", description: "key: id of group") { }; groupIdOption.IsRequired = true; command.AddOption(groupIdOption); var setIdOption = new Option <string>("--set-id", description: "key: id of set") { }; setIdOption.IsRequired = true; command.AddOption(setIdOption); var termIdOption = new Option <string>("--term-id", description: "key: id of term") { }; termIdOption.IsRequired = true; command.AddOption(termIdOption); var bodyOption = new Option <string>("--body") { }; bodyOption.IsRequired = true; command.AddOption(bodyOption); var outputOption = new Option <FormatterType>("--output", () => FormatterType.JSON) { IsRequired = true }; command.AddOption(outputOption); var queryOption = new Option <string>("--query"); command.AddOption(queryOption); var jsonNoIndentOption = new Option <bool>("--json-no-indent", r => { if (bool.TryParse(r.Tokens.Select(t => t.Value).LastOrDefault(), out var value)) { return(value); } return(true); }, description: "Disable indentation for the JSON output formatter."); command.AddOption(jsonNoIndentOption); command.SetHandler(async(object[] parameters) => { var siteId = (string)parameters[0]; var groupId = (string)parameters[1]; var setId = (string)parameters[2]; var termId = (string)parameters[3]; var body = (string)parameters[4]; var output = (FormatterType)parameters[5]; var query = (string)parameters[6]; var jsonNoIndent = (bool)parameters[7]; var outputFilter = (IOutputFilter)parameters[8]; var outputFormatterFactory = (IOutputFormatterFactory)parameters[9]; var cancellationToken = (CancellationToken)parameters[10]; using var stream = new MemoryStream(Encoding.UTF8.GetBytes(body)); var parseNode = ParseNodeFactoryRegistry.DefaultInstance.GetRootParseNode("application/json", stream); var model = parseNode.GetObjectValue <Relation>(Relation.CreateFromDiscriminatorValue); var requestInfo = CreatePostRequestInformation(model, q => { }); requestInfo.PathParameters.Add("site%2Did", siteId); requestInfo.PathParameters.Add("group%2Did", groupId); requestInfo.PathParameters.Add("set%2Did", setId); requestInfo.PathParameters.Add("term%2Did", termId); var errorMapping = new Dictionary <string, ParsableFactory <IParsable> > { { "4XX", ODataError.CreateFromDiscriminatorValue }, { "5XX", ODataError.CreateFromDiscriminatorValue }, }; var response = await RequestAdapter.SendPrimitiveAsync <Stream>(requestInfo, errorMapping: errorMapping, cancellationToken: cancellationToken); response = await outputFilter?.FilterOutputAsync(response, query, cancellationToken) ?? response; var formatterOptions = output.GetOutputFormatterOptions(new FormatterOptionsModel(!jsonNoIndent)); var formatter = outputFormatterFactory.GetFormatter(output); await formatter.WriteOutputAsync(response, formatterOptions, cancellationToken); }, new CollectionBinding(siteIdOption, groupIdOption, setIdOption, termIdOption, bodyOption, outputOption, queryOption, jsonNoIndentOption, new TypeBinding(typeof(IOutputFilter)), new TypeBinding(typeof(IOutputFormatterFactory)), new TypeBinding(typeof(CancellationToken)))); return(command); }
/// <summary> /// Invoke action copyToSection /// </summary> public Command BuildPostCommand() { var command = new Command("post"); command.Description = "Invoke action copyToSection"; // Create options for all the parameters var siteIdOption = new Option <string>("--site-id", description: "key: id of site") { }; siteIdOption.IsRequired = true; command.AddOption(siteIdOption); var sectionGroupIdOption = new Option <string>("--section-group-id", description: "key: id of sectionGroup") { }; sectionGroupIdOption.IsRequired = true; command.AddOption(sectionGroupIdOption); var onenoteSectionIdOption = new Option <string>("--onenote-section-id", description: "key: id of onenoteSection") { }; onenoteSectionIdOption.IsRequired = true; command.AddOption(onenoteSectionIdOption); var onenotePageIdOption = new Option <string>("--onenote-page-id", description: "key: id of onenotePage") { }; onenotePageIdOption.IsRequired = true; command.AddOption(onenotePageIdOption); var bodyOption = new Option <string>("--body") { }; bodyOption.IsRequired = true; command.AddOption(bodyOption); var outputOption = new Option <FormatterType>("--output", () => FormatterType.JSON) { IsRequired = true }; command.AddOption(outputOption); var queryOption = new Option <string>("--query"); command.AddOption(queryOption); var jsonNoIndentOption = new Option <bool>("--json-no-indent", r => { if (bool.TryParse(r.Tokens.Select(t => t.Value).LastOrDefault(), out var value)) { return(value); } return(true); }, description: "Disable indentation for the JSON output formatter."); command.AddOption(jsonNoIndentOption); command.SetHandler(async(object[] parameters) => { var siteId = (string)parameters[0]; var sectionGroupId = (string)parameters[1]; var onenoteSectionId = (string)parameters[2]; var onenotePageId = (string)parameters[3]; var body = (string)parameters[4]; var output = (FormatterType)parameters[5]; var query = (string)parameters[6]; var jsonNoIndent = (bool)parameters[7]; var outputFilter = (IOutputFilter)parameters[8]; var outputFormatterFactory = (IOutputFormatterFactory)parameters[9]; var cancellationToken = (CancellationToken)parameters[10]; using var stream = new MemoryStream(Encoding.UTF8.GetBytes(body)); var parseNode = ParseNodeFactoryRegistry.DefaultInstance.GetRootParseNode("application/json", stream); var model = parseNode.GetObjectValue <CopyToSectionRequestBody>(CopyToSectionRequestBody.CreateFromDiscriminatorValue); var requestInfo = CreatePostRequestInformation(model, q => { }); requestInfo.PathParameters.Add("site%2Did", siteId); requestInfo.PathParameters.Add("sectionGroup%2Did", sectionGroupId); requestInfo.PathParameters.Add("onenoteSection%2Did", onenoteSectionId); requestInfo.PathParameters.Add("onenotePage%2Did", onenotePageId); var response = await RequestAdapter.SendPrimitiveAsync <Stream>(requestInfo, errorMapping: default, cancellationToken: cancellationToken);
/// <summary> /// A collection of membership records associated with the channel. /// </summary> public Command BuildGetCommand() { var command = new Command("get"); command.Description = "A collection of membership records associated with the channel."; // Create options for all the parameters var userIdOption = new Option <string>("--user-id", description: "key: id of user") { }; userIdOption.IsRequired = true; command.AddOption(userIdOption); var teamIdOption = new Option <string>("--team-id", description: "key: id of team") { }; teamIdOption.IsRequired = true; command.AddOption(teamIdOption); var channelIdOption = new Option <string>("--channel-id", description: "key: id of channel") { }; channelIdOption.IsRequired = true; command.AddOption(channelIdOption); var conversationMemberIdOption = new Option <string>("--conversation-member-id", description: "key: id of conversationMember") { }; conversationMemberIdOption.IsRequired = true; command.AddOption(conversationMemberIdOption); 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) { IsRequired = true }; command.AddOption(outputOption); var queryOption = new Option <string>("--query"); command.AddOption(queryOption); var jsonNoIndentOption = new Option <bool>("--json-no-indent", r => { if (bool.TryParse(r.Tokens.Select(t => t.Value).LastOrDefault(), out var value)) { return(value); } return(true); }, description: "Disable indentation for the JSON output formatter."); command.AddOption(jsonNoIndentOption); command.SetHandler(async(object[] parameters) => { var userId = (string)parameters[0]; var teamId = (string)parameters[1]; var channelId = (string)parameters[2]; var conversationMemberId = (string)parameters[3]; var select = (string[])parameters[4]; var expand = (string[])parameters[5]; var output = (FormatterType)parameters[6]; var query = (string)parameters[7]; var jsonNoIndent = (bool)parameters[8]; var outputFilter = (IOutputFilter)parameters[9]; var outputFormatterFactory = (IOutputFormatterFactory)parameters[10]; var cancellationToken = (CancellationToken)parameters[11]; var requestInfo = CreateGetRequestInformation(q => { q.QueryParameters.Select = select; q.QueryParameters.Expand = expand; }); requestInfo.PathParameters.Add("user%2Did", userId); requestInfo.PathParameters.Add("team%2Did", teamId); requestInfo.PathParameters.Add("channel%2Did", channelId); requestInfo.PathParameters.Add("conversationMember%2Did", conversationMemberId); var errorMapping = new Dictionary <string, ParsableFactory <IParsable> > { { "4XX", ODataError.CreateFromDiscriminatorValue }, { "5XX", ODataError.CreateFromDiscriminatorValue }, }; var response = await RequestAdapter.SendPrimitiveAsync <Stream>(requestInfo, errorMapping: errorMapping, cancellationToken: cancellationToken); response = await outputFilter?.FilterOutputAsync(response, query, cancellationToken) ?? response; var formatterOptions = output.GetOutputFormatterOptions(new FormatterOptionsModel(!jsonNoIndent)); var formatter = outputFormatterFactory.GetFormatter(output); await formatter.WriteOutputAsync(response, formatterOptions, cancellationToken); }, new CollectionBinding(userIdOption, teamIdOption, channelIdOption, conversationMemberIdOption, selectOption, expandOption, outputOption, queryOption, jsonNoIndentOption, new TypeBinding(typeof(IOutputFilter)), new TypeBinding(typeof(IOutputFormatterFactory)), new TypeBinding(typeof(CancellationToken)))); return(command); }
/// <summary> /// The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable. /// </summary> public Command BuildListCommand() { var command = new Command("list"); command.Description = "The occurrences of a recurring series, if the event is a series master. This property includes occurrences that are part of the recurrence pattern, and exceptions that have been modified, but does not include occurrences that have been cancelled from the series. Navigation property. Read-only. Nullable."; // Create options for all the parameters var userIdOption = new Option<string>("--user-id", description: "key: id of user") { }; userIdOption.IsRequired = true; command.AddOption(userIdOption); var eventIdOption = new Option<string>("--event-id", description: "key: id of event") { }; eventIdOption.IsRequired = true; command.AddOption(eventIdOption); var topOption = new Option<int?>("--top", description: "Show only the first n items") { }; topOption.IsRequired = false; command.AddOption(topOption); var skipOption = new Option<int?>("--skip", description: "Skip the first n items") { }; skipOption.IsRequired = false; command.AddOption(skipOption); var filterOption = new Option<string>("--filter", description: "Filter items by property values") { }; filterOption.IsRequired = false; command.AddOption(filterOption); var countOption = new Option<bool?>("--count", description: "Include count of items") { }; countOption.IsRequired = false; command.AddOption(countOption); var orderbyOption = new Option<string[]>("--orderby", description: "Order items by property values") { Arity = ArgumentArity.ZeroOrMore }; orderbyOption.IsRequired = false; command.AddOption(orderbyOption); var selectOption = new Option<string[]>("--select", description: "Select properties to be returned") { Arity = ArgumentArity.ZeroOrMore }; selectOption.IsRequired = false; command.AddOption(selectOption); var outputOption = new Option<FormatterType>("--output", () => FormatterType.JSON){ IsRequired = true }; command.AddOption(outputOption); var queryOption = new Option<string>("--query"); command.AddOption(queryOption); var jsonNoIndentOption = new Option<bool>("--json-no-indent", r => { if (bool.TryParse(r.Tokens.Select(t => t.Value).LastOrDefault(), out var value)) { return value; } return true; }, description: "Disable indentation for the JSON output formatter."); command.AddOption(jsonNoIndentOption); command.SetHandler(async (object[] parameters) => { var userId = (string) parameters[0]; var eventId = (string) parameters[1]; var top = (int?) parameters[2]; var skip = (int?) parameters[3]; var filter = (string) parameters[4]; var count = (bool?) parameters[5]; var orderby = (string[]) parameters[6]; var select = (string[]) parameters[7]; var output = (FormatterType) parameters[8]; var query = (string) parameters[9]; var jsonNoIndent = (bool) parameters[10]; var outputFilter = (IOutputFilter) parameters[11]; var outputFormatterFactory = (IOutputFormatterFactory) parameters[12]; var cancellationToken = (CancellationToken) parameters[13]; var requestInfo = CreateGetRequestInformation(q => { q.QueryParameters.Top = top; q.QueryParameters.Skip = skip; if (!String.IsNullOrEmpty(filter)) q.QueryParameters.Filter = filter; q.QueryParameters.Count = count; q.QueryParameters.Orderby = orderby; q.QueryParameters.Select = select; }); requestInfo.PathParameters.Add("user%2Did", userId); requestInfo.PathParameters.Add("event%2Did", eventId); var errorMapping = new Dictionary<string, ParsableFactory<IParsable>> { {"4XX", ODataError.CreateFromDiscriminatorValue}, {"5XX", ODataError.CreateFromDiscriminatorValue}, }; var response = await RequestAdapter.SendPrimitiveAsync<Stream>(requestInfo, errorMapping: errorMapping, cancellationToken: cancellationToken); response = await outputFilter?.FilterOutputAsync(response, query, cancellationToken) ?? response; var formatterOptions = output.GetOutputFormatterOptions(new FormatterOptionsModel(!jsonNoIndent)); var formatter = outputFormatterFactory.GetFormatter(output); await formatter.WriteOutputAsync(response, formatterOptions, cancellationToken); }, new CollectionBinding(userIdOption, eventIdOption, topOption, skipOption, filterOption, new NullableBooleanBinding(countOption), orderbyOption, selectOption, outputOption, queryOption, jsonNoIndentOption, new TypeBinding(typeof(IOutputFilter)), new TypeBinding(typeof(IOutputFormatterFactory)), new TypeBinding(typeof(CancellationToken)))); return command; }
/// <summary> /// Read-only. Nullable. Used to render the task correctly in the task board view when grouped by progress. /// </summary> public Command BuildGetCommand() { var command = new Command("get"); command.Description = "Read-only. Nullable. Used to render the task correctly in the task board view when grouped by progress."; // Create options for all the parameters var groupIdOption = new Option <string>("--group-id", description: "key: id of group") { }; groupIdOption.IsRequired = true; command.AddOption(groupIdOption); var plannerPlanIdOption = new Option <string>("--planner-plan-id", description: "key: id of plannerPlan") { }; plannerPlanIdOption.IsRequired = true; command.AddOption(plannerPlanIdOption); var plannerBucketIdOption = new Option <string>("--planner-bucket-id", description: "key: id of plannerBucket") { }; plannerBucketIdOption.IsRequired = true; command.AddOption(plannerBucketIdOption); var plannerTaskIdOption = new Option <string>("--planner-task-id", description: "key: id of plannerTask") { }; plannerTaskIdOption.IsRequired = true; command.AddOption(plannerTaskIdOption); 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) { IsRequired = true }; command.AddOption(outputOption); var queryOption = new Option <string>("--query"); command.AddOption(queryOption); var jsonNoIndentOption = new Option <bool>("--json-no-indent", r => { if (bool.TryParse(r.Tokens.Select(t => t.Value).LastOrDefault(), out var value)) { return(value); } return(true); }, description: "Disable indentation for the JSON output formatter."); command.AddOption(jsonNoIndentOption); command.SetHandler(async(object[] parameters) => { var groupId = (string)parameters[0]; var plannerPlanId = (string)parameters[1]; var plannerBucketId = (string)parameters[2]; var plannerTaskId = (string)parameters[3]; var select = (string[])parameters[4]; var expand = (string[])parameters[5]; var output = (FormatterType)parameters[6]; var query = (string)parameters[7]; var jsonNoIndent = (bool)parameters[8]; var outputFilter = (IOutputFilter)parameters[9]; var outputFormatterFactory = (IOutputFormatterFactory)parameters[10]; var cancellationToken = (CancellationToken)parameters[11]; var requestInfo = CreateGetRequestInformation(q => { q.QueryParameters.Select = select; q.QueryParameters.Expand = expand; }); requestInfo.PathParameters.Add("group%2Did", groupId); requestInfo.PathParameters.Add("plannerPlan%2Did", plannerPlanId); requestInfo.PathParameters.Add("plannerBucket%2Did", plannerBucketId); requestInfo.PathParameters.Add("plannerTask%2Did", plannerTaskId); var errorMapping = new Dictionary <string, ParsableFactory <IParsable> > { { "4XX", ODataError.CreateFromDiscriminatorValue }, { "5XX", ODataError.CreateFromDiscriminatorValue }, }; var response = await RequestAdapter.SendPrimitiveAsync <Stream>(requestInfo, errorMapping: errorMapping, cancellationToken: cancellationToken); response = await outputFilter?.FilterOutputAsync(response, query, cancellationToken) ?? response; var formatterOptions = output.GetOutputFormatterOptions(new FormatterOptionsModel(!jsonNoIndent)); var formatter = outputFormatterFactory.GetFormatter(output); await formatter.WriteOutputAsync(response, formatterOptions, cancellationToken); }, new CollectionBinding(groupIdOption, plannerPlanIdOption, plannerBucketIdOption, plannerTaskIdOption, selectOption, expandOption, outputOption, queryOption, jsonNoIndentOption, new TypeBinding(typeof(IOutputFilter)), new TypeBinding(typeof(IOutputFormatterFactory)), new TypeBinding(typeof(CancellationToken)))); return(command); }
/// <summary> /// Groups and administrative units that this device is a member of. Read-only. Nullable. Supports $expand. /// </summary> public Command BuildGetCommand() { var command = new Command("get"); command.Description = "Groups and administrative units that this device is a member of. Read-only. Nullable. Supports $expand."; // Create options for all the parameters var windowsHelloForBusinessAuthenticationMethodIdOption = new Option <string>("--windows-hello-for-business-authentication-method-id", description: "key: id of windowsHelloForBusinessAuthenticationMethod") { }; windowsHelloForBusinessAuthenticationMethodIdOption.IsRequired = true; command.AddOption(windowsHelloForBusinessAuthenticationMethodIdOption); var directoryObjectIdOption = new Option <string>("--directory-object-id", description: "key: id of directoryObject") { }; directoryObjectIdOption.IsRequired = true; command.AddOption(directoryObjectIdOption); 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) { IsRequired = true }; command.AddOption(outputOption); var queryOption = new Option <string>("--query"); command.AddOption(queryOption); var jsonNoIndentOption = new Option <bool>("--json-no-indent", r => { if (bool.TryParse(r.Tokens.Select(t => t.Value).LastOrDefault(), out var value)) { return(value); } return(true); }, description: "Disable indentation for the JSON output formatter."); command.AddOption(jsonNoIndentOption); command.SetHandler(async(object[] parameters) => { var windowsHelloForBusinessAuthenticationMethodId = (string)parameters[0]; var directoryObjectId = (string)parameters[1]; var select = (string[])parameters[2]; var expand = (string[])parameters[3]; var output = (FormatterType)parameters[4]; var query = (string)parameters[5]; var jsonNoIndent = (bool)parameters[6]; var outputFilter = (IOutputFilter)parameters[7]; var outputFormatterFactory = (IOutputFormatterFactory)parameters[8]; var cancellationToken = (CancellationToken)parameters[9]; var requestInfo = CreateGetRequestInformation(q => { q.QueryParameters.Select = select; q.QueryParameters.Expand = expand; }); requestInfo.PathParameters.Add("windowsHelloForBusinessAuthenticationMethod%2Did", windowsHelloForBusinessAuthenticationMethodId); requestInfo.PathParameters.Add("directoryObject%2Did", directoryObjectId); var errorMapping = new Dictionary <string, ParsableFactory <IParsable> > { { "4XX", ODataError.CreateFromDiscriminatorValue }, { "5XX", ODataError.CreateFromDiscriminatorValue }, }; var response = await RequestAdapter.SendPrimitiveAsync <Stream>(requestInfo, errorMapping: errorMapping, cancellationToken: cancellationToken); response = await outputFilter?.FilterOutputAsync(response, query, cancellationToken) ?? response; var formatterOptions = output.GetOutputFormatterOptions(new FormatterOptionsModel(!jsonNoIndent)); var formatter = outputFormatterFactory.GetFormatter(output); await formatter.WriteOutputAsync(response, formatterOptions, cancellationToken); }, new CollectionBinding(windowsHelloForBusinessAuthenticationMethodIdOption, directoryObjectIdOption, selectOption, expandOption, outputOption, queryOption, jsonNoIndentOption, new TypeBinding(typeof(IOutputFilter)), new TypeBinding(typeof(IOutputFormatterFactory)), new TypeBinding(typeof(CancellationToken)))); return(command); }
/// <summary> /// Get the number of the resource /// </summary> public Command BuildGetCommand() { var command = new Command("get"); command.Description = "Get the number of the resource"; // Create options for all the parameters var siteIdOption = new Option <string>("--site-id", description: "key: id of site") { }; siteIdOption.IsRequired = true; command.AddOption(siteIdOption); var storeIdOption = new Option <string>("--store-id", description: "key: id of store") { }; storeIdOption.IsRequired = true; command.AddOption(storeIdOption); var setIdOption = new Option <string>("--set-id", description: "key: id of set") { }; setIdOption.IsRequired = true; command.AddOption(setIdOption); var termIdOption = new Option <string>("--term-id", description: "key: id of term") { }; termIdOption.IsRequired = true; command.AddOption(termIdOption); var termId1Option = new Option <string>("--term-id1", description: "key: id of term") { }; termId1Option.IsRequired = true; command.AddOption(termId1Option); command.SetHandler(async(object[] parameters) => { var siteId = (string)parameters[0]; var storeId = (string)parameters[1]; var setId = (string)parameters[2]; var termId = (string)parameters[3]; var termId1 = (string)parameters[4]; var outputFormatterFactory = (IOutputFormatterFactory)parameters[5]; var cancellationToken = (CancellationToken)parameters[6]; var requestInfo = CreateGetRequestInformation(q => { }); requestInfo.PathParameters.Add("site%2Did", siteId); requestInfo.PathParameters.Add("store%2Did", storeId); requestInfo.PathParameters.Add("set%2Did", setId); requestInfo.PathParameters.Add("term%2Did", termId); requestInfo.PathParameters.Add("term%2Did1", termId1); var errorMapping = new Dictionary <string, ParsableFactory <IParsable> > { { "4XX", ODataError.CreateFromDiscriminatorValue }, { "5XX", ODataError.CreateFromDiscriminatorValue }, }; var response = await RequestAdapter.SendPrimitiveAsync <Stream>(requestInfo, errorMapping: errorMapping, cancellationToken: cancellationToken); var formatter = outputFormatterFactory.GetFormatter(FormatterType.TEXT); await formatter.WriteOutputAsync(response, null, cancellationToken); }, new CollectionBinding(siteIdOption, storeIdOption, setIdOption, termIdOption, termId1Option, new TypeBinding(typeof(IOutputFormatterFactory)), new TypeBinding(typeof(CancellationToken)))); return(command); }
/// <summary> /// Invoke function getActivitiesByInterval /// </summary> public Command BuildGetCommand() { var command = new Command("get"); command.Description = "Invoke function getActivitiesByInterval"; // Create options for all the parameters var driveItemIdOption = new Option <string>("--drive-item-id", description: "key: id of driveItem") { }; driveItemIdOption.IsRequired = true; command.AddOption(driveItemIdOption); var startDateTimeOption = new Option <string>("--start-date-time", description: "Usage: startDateTime='{startDateTime}'") { }; startDateTimeOption.IsRequired = true; command.AddOption(startDateTimeOption); var endDateTimeOption = new Option <string>("--end-date-time", description: "Usage: endDateTime='{endDateTime}'") { }; endDateTimeOption.IsRequired = true; command.AddOption(endDateTimeOption); var intervalOption = new Option <string>("--interval", description: "Usage: interval='{interval}'") { }; intervalOption.IsRequired = true; command.AddOption(intervalOption); var outputOption = new Option <FormatterType>("--output", () => FormatterType.JSON) { IsRequired = true }; command.AddOption(outputOption); var queryOption = new Option <string>("--query"); command.AddOption(queryOption); var jsonNoIndentOption = new Option <bool>("--json-no-indent", r => { if (bool.TryParse(r.Tokens.Select(t => t.Value).LastOrDefault(), out var value)) { return(value); } return(true); }, description: "Disable indentation for the JSON output formatter."); command.AddOption(jsonNoIndentOption); command.SetHandler(async(object[] parameters) => { var driveItemId = (string)parameters[0]; var startDateTime = (string)parameters[1]; var endDateTime = (string)parameters[2]; var interval = (string)parameters[3]; var output = (FormatterType)parameters[4]; var query = (string)parameters[5]; var jsonNoIndent = (bool)parameters[6]; var outputFilter = (IOutputFilter)parameters[7]; var outputFormatterFactory = (IOutputFormatterFactory)parameters[8]; var cancellationToken = (CancellationToken)parameters[9]; var requestInfo = CreateGetRequestInformation(q => { }); requestInfo.PathParameters.Add("driveItem%2Did", driveItemId); requestInfo.PathParameters.Add("startDateTime", startDateTime); requestInfo.PathParameters.Add("endDateTime", endDateTime); requestInfo.PathParameters.Add("interval", interval); var response = await RequestAdapter.SendPrimitiveAsync <Stream>(requestInfo, errorMapping: default, cancellationToken: cancellationToken);
/// <summary> /// Get entities from permissionGrants /// </summary> public Command BuildListCommand() { var command = new Command("list"); command.Description = "Get entities from permissionGrants"; // Create options for all the parameters var searchOption = new Option <string>("--search", description: "Search items by search phrases") { }; searchOption.IsRequired = false; command.AddOption(searchOption); var filterOption = new Option <string>("--filter", description: "Filter items by property values") { }; filterOption.IsRequired = false; command.AddOption(filterOption); var orderbyOption = new Option <string[]>("--orderby", description: "Order items by property values") { Arity = ArgumentArity.ZeroOrMore }; orderbyOption.IsRequired = false; command.AddOption(orderbyOption); 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) { IsRequired = true }; command.AddOption(outputOption); var queryOption = new Option <string>("--query"); command.AddOption(queryOption); var jsonNoIndentOption = new Option <bool>("--json-no-indent", r => { if (bool.TryParse(r.Tokens.Select(t => t.Value).LastOrDefault(), out var value)) { return(value); } return(true); }, description: "Disable indentation for the JSON output formatter."); command.AddOption(jsonNoIndentOption); command.SetHandler(async(object[] parameters) => { var search = (string)parameters[0]; var filter = (string)parameters[1]; var orderby = (string[])parameters[2]; var select = (string[])parameters[3]; var expand = (string[])parameters[4]; var output = (FormatterType)parameters[5]; var query = (string)parameters[6]; var jsonNoIndent = (bool)parameters[7]; var outputFilter = (IOutputFilter)parameters[8]; var outputFormatterFactory = (IOutputFormatterFactory)parameters[9]; var cancellationToken = (CancellationToken)parameters[10]; var requestInfo = CreateGetRequestInformation(q => { if (!String.IsNullOrEmpty(search)) { q.QueryParameters.Search = search; } if (!String.IsNullOrEmpty(filter)) { q.QueryParameters.Filter = filter; } q.QueryParameters.Orderby = orderby; q.QueryParameters.Select = select; q.QueryParameters.Expand = expand; }); var errorMapping = new Dictionary <string, ParsableFactory <IParsable> > { { "4XX", ODataError.CreateFromDiscriminatorValue }, { "5XX", ODataError.CreateFromDiscriminatorValue }, }; var response = await RequestAdapter.SendPrimitiveAsync <Stream>(requestInfo, errorMapping: errorMapping, cancellationToken: cancellationToken); response = await outputFilter?.FilterOutputAsync(response, query, cancellationToken) ?? response; var formatterOptions = output.GetOutputFormatterOptions(new FormatterOptionsModel(!jsonNoIndent)); var formatter = outputFormatterFactory.GetFormatter(output); await formatter.WriteOutputAsync(response, formatterOptions, cancellationToken); }, new CollectionBinding(searchOption, filterOption, orderbyOption, selectOption, expandOption, outputOption, queryOption, jsonNoIndentOption, new TypeBinding(typeof(IOutputFilter)), new TypeBinding(typeof(IOutputFormatterFactory)), new TypeBinding(typeof(CancellationToken)))); return(command); }
/// <summary> /// Collection of pages with the default content to display in a user flow for a specified language. This collection does not allow any kind of modification. /// </summary> public Command BuildGetCommand() { var command = new Command("get"); command.Description = "Collection of pages with the default content to display in a user flow for a specified language. This collection does not allow any kind of modification."; // Create options for all the parameters var b2xIdentityUserFlowIdOption = new Option <string>("--b2x-identity-user-flow-id", description: "key: id of b2xIdentityUserFlow") { }; b2xIdentityUserFlowIdOption.IsRequired = true; command.AddOption(b2xIdentityUserFlowIdOption); var userFlowLanguageConfigurationIdOption = new Option <string>("--user-flow-language-configuration-id", description: "key: id of userFlowLanguageConfiguration") { }; userFlowLanguageConfigurationIdOption.IsRequired = true; command.AddOption(userFlowLanguageConfigurationIdOption); var userFlowLanguagePageIdOption = new Option <string>("--user-flow-language-page-id", description: "key: id of userFlowLanguagePage") { }; userFlowLanguagePageIdOption.IsRequired = true; command.AddOption(userFlowLanguagePageIdOption); 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) { IsRequired = true }; command.AddOption(outputOption); var queryOption = new Option <string>("--query"); command.AddOption(queryOption); var jsonNoIndentOption = new Option <bool>("--json-no-indent", r => { if (bool.TryParse(r.Tokens.Select(t => t.Value).LastOrDefault(), out var value)) { return(value); } return(true); }, description: "Disable indentation for the JSON output formatter."); command.AddOption(jsonNoIndentOption); command.SetHandler(async(object[] parameters) => { var b2xIdentityUserFlowId = (string)parameters[0]; var userFlowLanguageConfigurationId = (string)parameters[1]; var userFlowLanguagePageId = (string)parameters[2]; var select = (string[])parameters[3]; var expand = (string[])parameters[4]; var output = (FormatterType)parameters[5]; var query = (string)parameters[6]; var jsonNoIndent = (bool)parameters[7]; var outputFilter = (IOutputFilter)parameters[8]; var outputFormatterFactory = (IOutputFormatterFactory)parameters[9]; var cancellationToken = (CancellationToken)parameters[10]; var requestInfo = CreateGetRequestInformation(q => { q.QueryParameters.Select = select; q.QueryParameters.Expand = expand; }); requestInfo.PathParameters.Add("b2xIdentityUserFlow%2Did", b2xIdentityUserFlowId); requestInfo.PathParameters.Add("userFlowLanguageConfiguration%2Did", userFlowLanguageConfigurationId); requestInfo.PathParameters.Add("userFlowLanguagePage%2Did", userFlowLanguagePageId); var errorMapping = new Dictionary <string, ParsableFactory <IParsable> > { { "4XX", ODataError.CreateFromDiscriminatorValue }, { "5XX", ODataError.CreateFromDiscriminatorValue }, }; var response = await RequestAdapter.SendPrimitiveAsync <Stream>(requestInfo, errorMapping: errorMapping, cancellationToken: cancellationToken); response = await outputFilter?.FilterOutputAsync(response, query, cancellationToken) ?? response; var formatterOptions = output.GetOutputFormatterOptions(new FormatterOptionsModel(!jsonNoIndent)); var formatter = outputFormatterFactory.GetFormatter(output); await formatter.WriteOutputAsync(response, formatterOptions, cancellationToken); }, new CollectionBinding(b2xIdentityUserFlowIdOption, userFlowLanguageConfigurationIdOption, userFlowLanguagePageIdOption, selectOption, expandOption, outputOption, queryOption, jsonNoIndentOption, new TypeBinding(typeof(IOutputFilter)), new TypeBinding(typeof(IOutputFormatterFactory)), new TypeBinding(typeof(CancellationToken)))); return(command); }
/// <summary> /// The registered device on which this Windows Hello for Business key resides. Supports $expand. When you get a user's Windows Hello for Business registration information, this property is returned only on a single GET and when you specify ?$expand. For example, GET /users/[email protected]/authentication/windowsHelloForBusinessMethods/_jpuR-TGZtk6aQCLF3BQjA2?$expand=device. /// </summary> public Command BuildGetCommand() { var command = new Command("get"); command.Description = "The registered device on which this Windows Hello for Business key resides. Supports $expand. When you get a user's Windows Hello for Business registration information, this property is returned only on a single GET and when you specify ?$expand. For example, GET /users/[email protected]/authentication/windowsHelloForBusinessMethods/_jpuR-TGZtk6aQCLF3BQjA2?$expand=device."; // Create options for all the parameters var userIdOption = new Option <string>("--user-id", description: "key: id of user") { }; userIdOption.IsRequired = true; command.AddOption(userIdOption); var windowsHelloForBusinessAuthenticationMethodIdOption = new Option <string>("--windows-hello-for-business-authentication-method-id", description: "key: id of windowsHelloForBusinessAuthenticationMethod") { }; windowsHelloForBusinessAuthenticationMethodIdOption.IsRequired = true; command.AddOption(windowsHelloForBusinessAuthenticationMethodIdOption); 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) { IsRequired = true }; command.AddOption(outputOption); var queryOption = new Option <string>("--query"); command.AddOption(queryOption); var jsonNoIndentOption = new Option <bool>("--json-no-indent", r => { if (bool.TryParse(r.Tokens.Select(t => t.Value).LastOrDefault(), out var value)) { return(value); } return(true); }, description: "Disable indentation for the JSON output formatter."); command.AddOption(jsonNoIndentOption); command.SetHandler(async(object[] parameters) => { var userId = (string)parameters[0]; var windowsHelloForBusinessAuthenticationMethodId = (string)parameters[1]; var select = (string[])parameters[2]; var expand = (string[])parameters[3]; var output = (FormatterType)parameters[4]; var query = (string)parameters[5]; var jsonNoIndent = (bool)parameters[6]; var outputFilter = (IOutputFilter)parameters[7]; var outputFormatterFactory = (IOutputFormatterFactory)parameters[8]; var cancellationToken = (CancellationToken)parameters[9]; var requestInfo = CreateGetRequestInformation(q => { q.QueryParameters.Select = select; q.QueryParameters.Expand = expand; }); requestInfo.PathParameters.Add("user%2Did", userId); requestInfo.PathParameters.Add("windowsHelloForBusinessAuthenticationMethod%2Did", windowsHelloForBusinessAuthenticationMethodId); var errorMapping = new Dictionary <string, ParsableFactory <IParsable> > { { "4XX", ODataError.CreateFromDiscriminatorValue }, { "5XX", ODataError.CreateFromDiscriminatorValue }, }; var response = await RequestAdapter.SendPrimitiveAsync <Stream>(requestInfo, errorMapping: errorMapping, cancellationToken: cancellationToken); response = await outputFilter?.FilterOutputAsync(response, query, cancellationToken) ?? response; var formatterOptions = output.GetOutputFormatterOptions(new FormatterOptionsModel(!jsonNoIndent)); var formatter = outputFormatterFactory.GetFormatter(output); await formatter.WriteOutputAsync(response, formatterOptions, cancellationToken); }, new CollectionBinding(userIdOption, windowsHelloForBusinessAuthenticationMethodIdOption, selectOption, expandOption, outputOption, queryOption, jsonNoIndentOption, new TypeBinding(typeof(IOutputFilter)), new TypeBinding(typeof(IOutputFormatterFactory)), new TypeBinding(typeof(CancellationToken)))); return(command); }
/// <summary> /// The status of OneNote operations. Getting an operations collection is not supported, but you can get the status of long-running operations if the Operation-Location header is returned in the response. Read-only. Nullable. /// </summary> public Command BuildGetCommand() { var command = new Command("get"); command.Description = "The status of OneNote operations. Getting an operations collection is not supported, but you can get the status of long-running operations if the Operation-Location header is returned in the response. Read-only. Nullable."; // Create options for all the parameters var userIdOption = new Option <string>("--user-id", description: "key: id of user") { }; userIdOption.IsRequired = true; command.AddOption(userIdOption); var onenoteOperationIdOption = new Option <string>("--onenote-operation-id", description: "key: id of onenoteOperation") { }; onenoteOperationIdOption.IsRequired = true; command.AddOption(onenoteOperationIdOption); 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) { IsRequired = true }; command.AddOption(outputOption); var queryOption = new Option <string>("--query"); command.AddOption(queryOption); var jsonNoIndentOption = new Option <bool>("--json-no-indent", r => { if (bool.TryParse(r.Tokens.Select(t => t.Value).LastOrDefault(), out var value)) { return(value); } return(true); }, description: "Disable indentation for the JSON output formatter."); command.AddOption(jsonNoIndentOption); command.SetHandler(async(object[] parameters) => { var userId = (string)parameters[0]; var onenoteOperationId = (string)parameters[1]; var select = (string[])parameters[2]; var expand = (string[])parameters[3]; var output = (FormatterType)parameters[4]; var query = (string)parameters[5]; var jsonNoIndent = (bool)parameters[6]; var outputFilter = (IOutputFilter)parameters[7]; var outputFormatterFactory = (IOutputFormatterFactory)parameters[8]; var cancellationToken = (CancellationToken)parameters[9]; var requestInfo = CreateGetRequestInformation(q => { q.QueryParameters.Select = select; q.QueryParameters.Expand = expand; }); requestInfo.PathParameters.Add("user%2Did", userId); requestInfo.PathParameters.Add("onenoteOperation%2Did", onenoteOperationId); var errorMapping = new Dictionary <string, ParsableFactory <IParsable> > { { "4XX", ODataError.CreateFromDiscriminatorValue }, { "5XX", ODataError.CreateFromDiscriminatorValue }, }; var response = await RequestAdapter.SendPrimitiveAsync <Stream>(requestInfo, errorMapping: errorMapping, cancellationToken: cancellationToken); response = await outputFilter?.FilterOutputAsync(response, query, cancellationToken) ?? response; var formatterOptions = output.GetOutputFormatterOptions(new FormatterOptionsModel(!jsonNoIndent)); var formatter = outputFormatterFactory.GetFormatter(output); await formatter.WriteOutputAsync(response, formatterOptions, cancellationToken); }, new CollectionBinding(userIdOption, onenoteOperationIdOption, selectOption, expandOption, outputOption, queryOption, jsonNoIndentOption, new TypeBinding(typeof(IOutputFilter)), new TypeBinding(typeof(IOutputFormatterFactory)), new TypeBinding(typeof(CancellationToken)))); return(command); }