Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated beta models and request builders using Kiota #425

Merged
merged 1 commit into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Microsoft.Graph.Beta.BookingBusinesses.Item.CalendarView;
using Microsoft.Graph.Beta.BookingBusinesses.Item.Customers;
using Microsoft.Graph.Beta.BookingBusinesses.Item.CustomQuestions;
using Microsoft.Graph.Beta.BookingBusinesses.Item.GetStaffAvailability;
using Microsoft.Graph.Beta.BookingBusinesses.Item.Publish;
using Microsoft.Graph.Beta.BookingBusinesses.Item.Services;
using Microsoft.Graph.Beta.BookingBusinesses.Item.StaffMembers;
Expand Down Expand Up @@ -35,6 +36,10 @@ public class BookingBusinessItemRequestBuilder {
public CustomQuestionsRequestBuilder CustomQuestions { get =>
new CustomQuestionsRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>The getStaffAvailability property</summary>
public GetStaffAvailabilityRequestBuilder GetStaffAvailability { get =>
new GetStaffAvailabilityRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>Path parameters for the request</summary>
private Dictionary<string, object> PathParameters { get; set; }
/// <summary>The publish property</summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using Microsoft.Graph.Beta.Models;
using Microsoft.Kiota.Abstractions.Serialization;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace Microsoft.Graph.Beta.BookingBusinesses.Item.GetStaffAvailability {
/// <summary>Provides operations to call the getStaffAvailability method.</summary>
public class GetStaffAvailabilityRequestBody : IAdditionalDataHolder, IParsable {
/// <summary>Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.</summary>
public IDictionary<string, object> AdditionalData { get; set; }
/// <summary>The endDateTime property</summary>
public DateTimeTimeZone EndDateTime { get; set; }
/// <summary>The staffIds property</summary>
public List<string> StaffIds { get; set; }
/// <summary>The startDateTime property</summary>
public DateTimeTimeZone StartDateTime { get; set; }
/// <summary>
/// Instantiates a new getStaffAvailabilityRequestBody and sets the default values.
/// </summary>
public GetStaffAvailabilityRequestBody() {
AdditionalData = new Dictionary<string, object>();
}
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
/// </summary>
public static GetStaffAvailabilityRequestBody CreateFromDiscriminatorValue(IParseNode parseNode) {
_ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
return new GetStaffAvailabilityRequestBody();
}
/// <summary>
/// The deserialization information for the current model
/// </summary>
public IDictionary<string, Action<T, IParseNode>> GetFieldDeserializers<T>() {
return new Dictionary<string, Action<T, IParseNode>> {
{"endDateTime", (o,n) => { (o as GetStaffAvailabilityRequestBody).EndDateTime = n.GetObjectValue<DateTimeTimeZone>(DateTimeTimeZone.CreateFromDiscriminatorValue); } },
{"staffIds", (o,n) => { (o as GetStaffAvailabilityRequestBody).StaffIds = n.GetCollectionOfPrimitiveValues<string>().ToList(); } },
{"startDateTime", (o,n) => { (o as GetStaffAvailabilityRequestBody).StartDateTime = n.GetObjectValue<DateTimeTimeZone>(DateTimeTimeZone.CreateFromDiscriminatorValue); } },
};
}
/// <summary>
/// Serializes information the current object
/// <param name="writer">Serialization writer to use to serialize this model</param>
/// </summary>
public void Serialize(ISerializationWriter writer) {
_ = writer ?? throw new ArgumentNullException(nameof(writer));
writer.WriteObjectValue<DateTimeTimeZone>("endDateTime", EndDateTime);
writer.WriteCollectionOfPrimitiveValues<string>("staffIds", StaffIds);
writer.WriteObjectValue<DateTimeTimeZone>("startDateTime", StartDateTime);
writer.WriteAdditionalData(AdditionalData);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
using Microsoft.Kiota.Abstractions;
using Microsoft.Kiota.Abstractions.Serialization;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.Graph.Beta.BookingBusinesses.Item.GetStaffAvailability {
/// <summary>Provides operations to call the getStaffAvailability method.</summary>
public class GetStaffAvailabilityRequestBuilder {
/// <summary>Path parameters for the request</summary>
private Dictionary<string, object> PathParameters { get; set; }
/// <summary>The request adapter to use to execute the requests.</summary>
private IRequestAdapter RequestAdapter { get; set; }
/// <summary>Url template to use to build the URL for the current request builder</summary>
private string UrlTemplate { get; set; }
/// <summary>
/// Instantiates a new GetStaffAvailabilityRequestBuilder and sets the default values.
/// <param name="pathParameters">Path parameters for the request</param>
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
/// </summary>
public GetStaffAvailabilityRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) {
_ = pathParameters ?? throw new ArgumentNullException(nameof(pathParameters));
_ = requestAdapter ?? throw new ArgumentNullException(nameof(requestAdapter));
UrlTemplate = "{+baseurl}/bookingBusinesses/{bookingBusiness_id}/microsoft.graph.getStaffAvailability";
var urlTplParams = new Dictionary<string, object>(pathParameters);
PathParameters = urlTplParams;
RequestAdapter = requestAdapter;
}
/// <summary>
/// Instantiates a new GetStaffAvailabilityRequestBuilder and sets the default values.
/// <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>
/// </summary>
public GetStaffAvailabilityRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) {
if(string.IsNullOrEmpty(rawUrl)) throw new ArgumentNullException(nameof(rawUrl));
_ = requestAdapter ?? throw new ArgumentNullException(nameof(requestAdapter));
UrlTemplate = "{+baseurl}/bookingBusinesses/{bookingBusiness_id}/microsoft.graph.getStaffAvailability";
var urlTplParams = new Dictionary<string, object>();
urlTplParams.Add("request-raw-url", rawUrl);
PathParameters = urlTplParams;
RequestAdapter = requestAdapter;
}
/// <summary>
/// Invoke action getStaffAvailability
/// <param name="body"></param>
/// <param name="headers">Request headers</param>
/// <param name="options">Request options</param>
/// </summary>
public RequestInformation CreatePostRequestInformation(GetStaffAvailabilityRequestBody body, Action<IDictionary<string, string>> headers = default, IEnumerable<IRequestOption> options = default) {
_ = body ?? throw new ArgumentNullException(nameof(body));
var requestInfo = new RequestInformation {
HttpMethod = Method.POST,
UrlTemplate = UrlTemplate,
PathParameters = PathParameters,
};
requestInfo.SetContentFromParsable(RequestAdapter, "application/json", body);
headers?.Invoke(requestInfo.Headers);
requestInfo.AddRequestOptions(options?.ToArray());
return requestInfo;
}
/// <summary>
/// Invoke action getStaffAvailability
/// <param name="body"></param>
/// <param name="cancellationToken">Cancellation token to use when cancelling requests</param>
/// <param name="headers">Request headers</param>
/// <param name="options">Request options</param>
/// <param name="responseHandler">Response handler to use in place of the default response handling provided by the core service</param>
/// </summary>
public async Task<GetStaffAvailabilityResponse> PostAsync(GetStaffAvailabilityRequestBody body, Action<IDictionary<string, string>> headers = default, IEnumerable<IRequestOption> options = default, IResponseHandler responseHandler = default, CancellationToken cancellationToken = default) {
_ = body ?? throw new ArgumentNullException(nameof(body));
var requestInfo = CreatePostRequestInformation(body, headers, options);
return await RequestAdapter.SendAsync<GetStaffAvailabilityResponse>(requestInfo, GetStaffAvailabilityResponse.CreateFromDiscriminatorValue, responseHandler, default, cancellationToken);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using Microsoft.Graph.Beta.Models;
using Microsoft.Kiota.Abstractions.Serialization;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace Microsoft.Graph.Beta.BookingBusinesses.Item.GetStaffAvailability {
/// <summary>Provides operations to call the getStaffAvailability method.</summary>
public class GetStaffAvailabilityResponse : IAdditionalDataHolder, IParsable {
/// <summary>Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.</summary>
public IDictionary<string, object> AdditionalData { get; set; }
/// <summary>The value property</summary>
public List<StaffAvailabilityItem> Value { get; set; }
/// <summary>
/// Instantiates a new getStaffAvailabilityResponse and sets the default values.
/// </summary>
public GetStaffAvailabilityResponse() {
AdditionalData = new Dictionary<string, object>();
}
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
/// </summary>
public static GetStaffAvailabilityResponse CreateFromDiscriminatorValue(IParseNode parseNode) {
_ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
return new GetStaffAvailabilityResponse();
}
/// <summary>
/// The deserialization information for the current model
/// </summary>
public IDictionary<string, Action<T, IParseNode>> GetFieldDeserializers<T>() {
return new Dictionary<string, Action<T, IParseNode>> {
{"value", (o,n) => { (o as GetStaffAvailabilityResponse).Value = n.GetCollectionOfObjectValues<StaffAvailabilityItem>(StaffAvailabilityItem.CreateFromDiscriminatorValue).ToList(); } },
};
}
/// <summary>
/// Serializes information the current object
/// <param name="writer">Serialization writer to use to serialize this model</param>
/// </summary>
public void Serialize(ISerializationWriter writer) {
_ = writer ?? throw new ArgumentNullException(nameof(writer));
writer.WriteCollectionOfObjectValues<StaffAvailabilityItem>("value", Value);
writer.WriteAdditionalData(AdditionalData);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
using Microsoft.Graph.Beta.DeviceManagement.TelecomExpenseManagementPartners;
using Microsoft.Graph.Beta.DeviceManagement.Templates;
using Microsoft.Graph.Beta.DeviceManagement.TemplateSettings;
using Microsoft.Graph.Beta.DeviceManagement.TenantAttachRBAC;
using Microsoft.Graph.Beta.DeviceManagement.TermsAndConditions;
using Microsoft.Graph.Beta.DeviceManagement.TroubleshootingEvents;
using Microsoft.Graph.Beta.DeviceManagement.UserExperienceAnalyticsAppHealthApplicationPerformance;
Expand Down Expand Up @@ -599,6 +600,10 @@ public class DeviceManagementRequestBuilder {
public TemplateSettingsRequestBuilder TemplateSettings { get =>
new TemplateSettingsRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>The tenantAttachRBAC property</summary>
public TenantAttachRBACRequestBuilder TenantAttachRBAC { get =>
new TenantAttachRBACRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>The termsAndConditions property</summary>
public TermsAndConditionsRequestBuilder TermsAndConditions { get =>
new TermsAndConditionsRequestBuilder(PathParameters, RequestAdapter);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using Microsoft.Kiota.Abstractions.Serialization;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace Microsoft.Graph.Beta.DeviceManagement.TenantAttachRBAC.Enable {
/// <summary>Provides operations to call the enable method.</summary>
public class EnableRequestBody : IAdditionalDataHolder, IParsable {
/// <summary>Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.</summary>
public IDictionary<string, object> AdditionalData { get; set; }
/// <summary>The enable property</summary>
public bool? Enable { get; set; }
/// <summary>
/// Instantiates a new enableRequestBody and sets the default values.
/// </summary>
public EnableRequestBody() {
AdditionalData = new Dictionary<string, object>();
}
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
/// </summary>
public static EnableRequestBody CreateFromDiscriminatorValue(IParseNode parseNode) {
_ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
return new EnableRequestBody();
}
/// <summary>
/// The deserialization information for the current model
/// </summary>
public IDictionary<string, Action<T, IParseNode>> GetFieldDeserializers<T>() {
return new Dictionary<string, Action<T, IParseNode>> {
{"enable", (o,n) => { (o as EnableRequestBody).Enable = n.GetBoolValue(); } },
};
}
/// <summary>
/// Serializes information the current object
/// <param name="writer">Serialization writer to use to serialize this model</param>
/// </summary>
public void Serialize(ISerializationWriter writer) {
_ = writer ?? throw new ArgumentNullException(nameof(writer));
writer.WriteBoolValue("enable", Enable);
writer.WriteAdditionalData(AdditionalData);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
using Microsoft.Kiota.Abstractions;
using Microsoft.Kiota.Abstractions.Serialization;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.Graph.Beta.DeviceManagement.TenantAttachRBAC.Enable {
/// <summary>Provides operations to call the enable method.</summary>
public class EnableRequestBuilder {
/// <summary>Path parameters for the request</summary>
private Dictionary<string, object> PathParameters { get; set; }
/// <summary>The request adapter to use to execute the requests.</summary>
private IRequestAdapter RequestAdapter { get; set; }
/// <summary>Url template to use to build the URL for the current request builder</summary>
private string UrlTemplate { get; set; }
/// <summary>
/// Instantiates a new EnableRequestBuilder and sets the default values.
/// <param name="pathParameters">Path parameters for the request</param>
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
/// </summary>
public EnableRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) {
_ = pathParameters ?? throw new ArgumentNullException(nameof(pathParameters));
_ = requestAdapter ?? throw new ArgumentNullException(nameof(requestAdapter));
UrlTemplate = "{+baseurl}/deviceManagement/tenantAttachRBAC/microsoft.graph.enable";
var urlTplParams = new Dictionary<string, object>(pathParameters);
PathParameters = urlTplParams;
RequestAdapter = requestAdapter;
}
/// <summary>
/// Instantiates a new EnableRequestBuilder and sets the default values.
/// <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>
/// </summary>
public EnableRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) {
if(string.IsNullOrEmpty(rawUrl)) throw new ArgumentNullException(nameof(rawUrl));
_ = requestAdapter ?? throw new ArgumentNullException(nameof(requestAdapter));
UrlTemplate = "{+baseurl}/deviceManagement/tenantAttachRBAC/microsoft.graph.enable";
var urlTplParams = new Dictionary<string, object>();
urlTplParams.Add("request-raw-url", rawUrl);
PathParameters = urlTplParams;
RequestAdapter = requestAdapter;
}
/// <summary>
/// Invoke action enable
/// <param name="body"></param>
/// <param name="headers">Request headers</param>
/// <param name="options">Request options</param>
/// </summary>
public RequestInformation CreatePostRequestInformation(EnableRequestBody body, Action<IDictionary<string, string>> headers = default, IEnumerable<IRequestOption> options = default) {
_ = body ?? throw new ArgumentNullException(nameof(body));
var requestInfo = new RequestInformation {
HttpMethod = Method.POST,
UrlTemplate = UrlTemplate,
PathParameters = PathParameters,
};
requestInfo.SetContentFromParsable(RequestAdapter, "application/json", body);
headers?.Invoke(requestInfo.Headers);
requestInfo.AddRequestOptions(options?.ToArray());
return requestInfo;
}
/// <summary>
/// Invoke action enable
/// <param name="body"></param>
/// <param name="cancellationToken">Cancellation token to use when cancelling requests</param>
/// <param name="headers">Request headers</param>
/// <param name="options">Request options</param>
/// <param name="responseHandler">Response handler to use in place of the default response handling provided by the core service</param>
/// </summary>
public async Task PostAsync(EnableRequestBody body, Action<IDictionary<string, string>> headers = default, IEnumerable<IRequestOption> options = default, IResponseHandler responseHandler = default, CancellationToken cancellationToken = default) {
_ = body ?? throw new ArgumentNullException(nameof(body));
var requestInfo = CreatePostRequestInformation(body, headers, options);
await RequestAdapter.SendNoContentAsync(requestInfo, responseHandler, default, cancellationToken);
}
}
}
Loading