//
#pragma warning disable CS0618
using Marechai.App.Models;
using Marechai.App.Users.Item.Password;
using Marechai.App.Users.Item.Roles;
using Microsoft.Kiota.Abstractions.Extensions;
using Microsoft.Kiota.Abstractions.Serialization;
using Microsoft.Kiota.Abstractions;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using System.Threading;
using System;
namespace Marechai.App.Users.Item
{
///
/// Builds and executes requests for operations under \users\{id}
///
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")]
public partial class UsersItemRequestBuilder : BaseRequestBuilder
{
/// The password property
public global::Marechai.App.Users.Item.Password.PasswordRequestBuilder Password
{
get => new global::Marechai.App.Users.Item.Password.PasswordRequestBuilder(PathParameters, RequestAdapter);
}
/// The roles property
public global::Marechai.App.Users.Item.Roles.RolesRequestBuilder Roles
{
get => new global::Marechai.App.Users.Item.Roles.RolesRequestBuilder(PathParameters, RequestAdapter);
}
///
/// Instantiates a new and sets the default values.
///
/// Path parameters for the request
/// The request adapter to use to execute the requests.
public UsersItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/users/{id}", pathParameters)
{
}
///
/// Instantiates a new and sets the default values.
///
/// The raw URL to use for the request builder.
/// The request adapter to use to execute the requests.
public UsersItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/users/{id}", rawUrl)
{
}
/// Cancellation token to use when cancelling requests
/// Configuration for the request such as headers, query parameters, and middleware options.
/// When receiving a 401 status code
/// When receiving a 403 status code
/// When receiving a 404 status code
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default)
{
#nullable restore
#else
public async Task DeleteAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default)
{
#endif
var requestInfo = ToDeleteRequestInformation(requestConfiguration);
var errorMapping = new Dictionary>
{
{ "401", global::Marechai.App.Models.ProblemDetails.CreateFromDiscriminatorValue },
{ "403", global::Marechai.App.Models.ProblemDetails.CreateFromDiscriminatorValue },
{ "404", global::Marechai.App.Models.ProblemDetails.CreateFromDiscriminatorValue },
};
await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false);
}
/// A
/// Cancellation token to use when cancelling requests
/// Configuration for the request such as headers, query parameters, and middleware options.
/// When receiving a 401 status code
/// When receiving a 403 status code
/// When receiving a 404 status code
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default)
{
#nullable restore
#else
public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default)
{
#endif
var requestInfo = ToGetRequestInformation(requestConfiguration);
var errorMapping = new Dictionary>
{
{ "401", global::Marechai.App.Models.ProblemDetails.CreateFromDiscriminatorValue },
{ "403", global::Marechai.App.Models.ProblemDetails.CreateFromDiscriminatorValue },
{ "404", global::Marechai.App.Models.ProblemDetails.CreateFromDiscriminatorValue },
};
return await RequestAdapter.SendAsync(requestInfo, global::Marechai.App.Models.UserDto.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false);
}
/// A
/// The request body
/// Cancellation token to use when cancelling requests
/// Configuration for the request such as headers, query parameters, and middleware options.
/// When receiving a 400 status code
/// When receiving a 401 status code
/// When receiving a 403 status code
/// When receiving a 404 status code
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public async Task PutAsync(global::Marechai.App.Models.UpdateUserRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default)
{
#nullable restore
#else
public async Task PutAsync(global::Marechai.App.Models.UpdateUserRequest body, Action> requestConfiguration = default, CancellationToken cancellationToken = default)
{
#endif
if(ReferenceEquals(body, null)) throw new ArgumentNullException(nameof(body));
var requestInfo = ToPutRequestInformation(body, requestConfiguration);
var errorMapping = new Dictionary>
{
{ "400", global::Marechai.App.Models.ProblemDetails.CreateFromDiscriminatorValue },
{ "401", global::Marechai.App.Models.ProblemDetails.CreateFromDiscriminatorValue },
{ "403", global::Marechai.App.Models.ProblemDetails.CreateFromDiscriminatorValue },
{ "404", global::Marechai.App.Models.ProblemDetails.CreateFromDiscriminatorValue },
};
return await RequestAdapter.SendAsync(requestInfo, global::Marechai.App.Models.UserDto.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false);
}
/// A
/// Configuration for the request such as headers, query parameters, and middleware options.
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default)
{
#nullable restore
#else
public RequestInformation ToDeleteRequestInformation(Action> requestConfiguration = default)
{
#endif
var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters);
requestInfo.Configure(requestConfiguration);
requestInfo.Headers.TryAdd("Accept", "application/json, text/plain;q=0.9");
return requestInfo;
}
/// A
/// Configuration for the request such as headers, query parameters, and middleware options.
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default)
{
#nullable restore
#else
public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default)
{
#endif
var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters);
requestInfo.Configure(requestConfiguration);
requestInfo.Headers.TryAdd("Accept", "application/json");
return requestInfo;
}
/// A
/// The request body
/// Configuration for the request such as headers, query parameters, and middleware options.
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public RequestInformation ToPutRequestInformation(global::Marechai.App.Models.UpdateUserRequest body, Action>? requestConfiguration = default)
{
#nullable restore
#else
public RequestInformation ToPutRequestInformation(global::Marechai.App.Models.UpdateUserRequest body, Action> requestConfiguration = default)
{
#endif
if(ReferenceEquals(body, null)) throw new ArgumentNullException(nameof(body));
var requestInfo = new RequestInformation(Method.PUT, UrlTemplate, PathParameters);
requestInfo.Configure(requestConfiguration);
requestInfo.Headers.TryAdd("Accept", "application/json");
requestInfo.SetContentFromParsable(RequestAdapter, "application/json", body);
return requestInfo;
}
///
/// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored.
///
/// A
/// The raw URL to use for the request builder.
public global::Marechai.App.Users.Item.UsersItemRequestBuilder WithUrl(string rawUrl)
{
return new global::Marechai.App.Users.Item.UsersItemRequestBuilder(rawUrl, RequestAdapter);
}
///
/// Configuration for the request such as headers, query parameters, and middleware options.
///
[Obsolete("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.")]
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")]
public partial class UsersItemRequestBuilderDeleteRequestConfiguration : RequestConfiguration
{
}
///
/// Configuration for the request such as headers, query parameters, and middleware options.
///
[Obsolete("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.")]
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")]
public partial class UsersItemRequestBuilderGetRequestConfiguration : RequestConfiguration
{
}
///
/// Configuration for the request such as headers, query parameters, and middleware options.
///
[Obsolete("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.")]
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")]
public partial class UsersItemRequestBuilderPutRequestConfiguration : RequestConfiguration
{
}
}
}
#pragma warning restore CS0618