jellyfin-discord-bot/server/jellyfin/apis/UserApi.ts

709 lines
29 KiB
TypeScript
Raw Permalink Normal View History

2023-05-04 23:34:53 +02:00
/* tslint:disable */
/* eslint-disable */
/**
* Jellyfin API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 10.8.9
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import * as runtime from '../runtime';
import type {
AuthenticateUserByNameRequest,
AuthenticateWithQuickConnectRequest,
AuthenticationResult,
CreateUserByNameRequest,
ForgotPasswordPinRequest,
ForgotPasswordRequest,
ForgotPasswordResult,
PinRedeemResult,
ProblemDetails,
UpdateUserConfigurationRequest,
UpdateUserEasyPasswordRequest,
UpdateUserPasswordRequest,
UpdateUserPolicyRequest,
UpdateUserRequest,
UserDto,
} from '../models';
import {
AuthenticateUserByNameRequestFromJSON,
AuthenticateUserByNameRequestToJSON,
AuthenticateWithQuickConnectRequestFromJSON,
AuthenticateWithQuickConnectRequestToJSON,
AuthenticationResultFromJSON,
AuthenticationResultToJSON,
CreateUserByNameRequestFromJSON,
CreateUserByNameRequestToJSON,
ForgotPasswordPinRequestFromJSON,
ForgotPasswordPinRequestToJSON,
ForgotPasswordRequestFromJSON,
ForgotPasswordRequestToJSON,
ForgotPasswordResultFromJSON,
ForgotPasswordResultToJSON,
PinRedeemResultFromJSON,
PinRedeemResultToJSON,
ProblemDetailsFromJSON,
ProblemDetailsToJSON,
UpdateUserConfigurationRequestFromJSON,
UpdateUserConfigurationRequestToJSON,
UpdateUserEasyPasswordRequestFromJSON,
UpdateUserEasyPasswordRequestToJSON,
UpdateUserPasswordRequestFromJSON,
UpdateUserPasswordRequestToJSON,
UpdateUserPolicyRequestFromJSON,
UpdateUserPolicyRequestToJSON,
UpdateUserRequestFromJSON,
UpdateUserRequestToJSON,
UserDtoFromJSON,
UserDtoToJSON,
} from '../models';
export interface AuthenticateUserRequest {
userId: string;
pw: string;
password?: string;
}
export interface AuthenticateUserByNameOperationRequest {
authenticateUserByNameRequest: AuthenticateUserByNameRequest;
}
export interface AuthenticateWithQuickConnectOperationRequest {
authenticateWithQuickConnectRequest: AuthenticateWithQuickConnectRequest;
}
export interface CreateUserByNameOperationRequest {
createUserByNameRequest: CreateUserByNameRequest;
}
export interface DeleteUserRequest {
userId: string;
}
export interface ForgotPasswordOperationRequest {
forgotPasswordRequest: ForgotPasswordRequest;
}
export interface ForgotPasswordPinOperationRequest {
forgotPasswordPinRequest: ForgotPasswordPinRequest;
}
export interface GetUserByIdRequest {
userId: string;
}
export interface GetUsersRequest {
isHidden?: boolean;
isDisabled?: boolean;
}
export interface UpdateUserOperationRequest {
userId: string;
updateUserRequest: UpdateUserRequest;
}
export interface UpdateUserConfigurationOperationRequest {
userId: string;
updateUserConfigurationRequest: UpdateUserConfigurationRequest;
}
export interface UpdateUserEasyPasswordOperationRequest {
userId: string;
updateUserEasyPasswordRequest: UpdateUserEasyPasswordRequest;
}
export interface UpdateUserPasswordOperationRequest {
userId: string;
updateUserPasswordRequest: UpdateUserPasswordRequest;
}
export interface UpdateUserPolicyOperationRequest {
userId: string;
updateUserPolicyRequest: UpdateUserPolicyRequest;
}
/**
*
*/
export class UserApi extends runtime.BaseAPI {
/**
* Authenticates a user.
*/
async authenticateUserRaw(requestParameters: AuthenticateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthenticationResult>> {
if (requestParameters.userId === null || requestParameters.userId === undefined) {
throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling authenticateUser.');
}
if (requestParameters.pw === null || requestParameters.pw === undefined) {
throw new runtime.RequiredError('pw','Required parameter requestParameters.pw was null or undefined when calling authenticateUser.');
}
const queryParameters: any = {};
if (requestParameters.pw !== undefined) {
queryParameters['pw'] = requestParameters.pw;
}
if (requestParameters.password !== undefined) {
queryParameters['password'] = requestParameters.password;
}
const headerParameters: runtime.HTTPHeaders = {};
const response = await this.request({
path: `/Users/{userId}/Authenticate`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => AuthenticationResultFromJSON(jsonValue));
}
/**
* Authenticates a user.
*/
async authenticateUser(requestParameters: AuthenticateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthenticationResult> {
const response = await this.authenticateUserRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Authenticates a user by name.
*/
async authenticateUserByNameRaw(requestParameters: AuthenticateUserByNameOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthenticationResult>> {
if (requestParameters.authenticateUserByNameRequest === null || requestParameters.authenticateUserByNameRequest === undefined) {
throw new runtime.RequiredError('authenticateUserByNameRequest','Required parameter requestParameters.authenticateUserByNameRequest was null or undefined when calling authenticateUserByName.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
const response = await this.request({
path: `/Users/AuthenticateByName`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: AuthenticateUserByNameRequestToJSON(requestParameters.authenticateUserByNameRequest),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => AuthenticationResultFromJSON(jsonValue));
}
/**
* Authenticates a user by name.
*/
async authenticateUserByName(requestParameters: AuthenticateUserByNameOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthenticationResult> {
const response = await this.authenticateUserByNameRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Authenticates a user with quick connect.
*/
async authenticateWithQuickConnectRaw(requestParameters: AuthenticateWithQuickConnectOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthenticationResult>> {
if (requestParameters.authenticateWithQuickConnectRequest === null || requestParameters.authenticateWithQuickConnectRequest === undefined) {
throw new runtime.RequiredError('authenticateWithQuickConnectRequest','Required parameter requestParameters.authenticateWithQuickConnectRequest was null or undefined when calling authenticateWithQuickConnect.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
const response = await this.request({
path: `/Users/AuthenticateWithQuickConnect`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: AuthenticateWithQuickConnectRequestToJSON(requestParameters.authenticateWithQuickConnectRequest),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => AuthenticationResultFromJSON(jsonValue));
}
/**
* Authenticates a user with quick connect.
*/
async authenticateWithQuickConnect(requestParameters: AuthenticateWithQuickConnectOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthenticationResult> {
const response = await this.authenticateWithQuickConnectRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Creates a user.
*/
async createUserByNameRaw(requestParameters: CreateUserByNameOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UserDto>> {
if (requestParameters.createUserByNameRequest === null || requestParameters.createUserByNameRequest === undefined) {
throw new runtime.RequiredError('createUserByNameRequest','Required parameter requestParameters.createUserByNameRequest was null or undefined when calling createUserByName.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
}
const response = await this.request({
path: `/Users/New`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: CreateUserByNameRequestToJSON(requestParameters.createUserByNameRequest),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => UserDtoFromJSON(jsonValue));
}
/**
* Creates a user.
*/
async createUserByName(requestParameters: CreateUserByNameOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UserDto> {
const response = await this.createUserByNameRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Deletes a user.
*/
async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
if (requestParameters.userId === null || requestParameters.userId === undefined) {
throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling deleteUser.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
}
const response = await this.request({
path: `/Users/{userId}`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Deletes a user.
*/
async deleteUser(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
await this.deleteUserRaw(requestParameters, initOverrides);
}
/**
* Initiates the forgot password process for a local user.
*/
async forgotPasswordRaw(requestParameters: ForgotPasswordOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ForgotPasswordResult>> {
if (requestParameters.forgotPasswordRequest === null || requestParameters.forgotPasswordRequest === undefined) {
throw new runtime.RequiredError('forgotPasswordRequest','Required parameter requestParameters.forgotPasswordRequest was null or undefined when calling forgotPassword.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
const response = await this.request({
path: `/Users/ForgotPassword`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: ForgotPasswordRequestToJSON(requestParameters.forgotPasswordRequest),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => ForgotPasswordResultFromJSON(jsonValue));
}
/**
* Initiates the forgot password process for a local user.
*/
async forgotPassword(requestParameters: ForgotPasswordOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ForgotPasswordResult> {
const response = await this.forgotPasswordRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Redeems a forgot password pin.
*/
async forgotPasswordPinRaw(requestParameters: ForgotPasswordPinOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PinRedeemResult>> {
if (requestParameters.forgotPasswordPinRequest === null || requestParameters.forgotPasswordPinRequest === undefined) {
throw new runtime.RequiredError('forgotPasswordPinRequest','Required parameter requestParameters.forgotPasswordPinRequest was null or undefined when calling forgotPasswordPin.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
const response = await this.request({
path: `/Users/ForgotPassword/Pin`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: ForgotPasswordPinRequestToJSON(requestParameters.forgotPasswordPinRequest),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => PinRedeemResultFromJSON(jsonValue));
}
/**
* Redeems a forgot password pin.
*/
async forgotPasswordPin(requestParameters: ForgotPasswordPinOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PinRedeemResult> {
const response = await this.forgotPasswordPinRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Gets the user based on auth token.
*/
async getCurrentUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UserDto>> {
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
}
const response = await this.request({
path: `/Users/Me`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => UserDtoFromJSON(jsonValue));
}
/**
* Gets the user based on auth token.
*/
async getCurrentUser(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UserDto> {
const response = await this.getCurrentUserRaw(initOverrides);
return await response.value();
}
/**
* Gets a list of publicly visible users for display on a login screen.
*/
async getPublicUsersRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<UserDto>>> {
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
const response = await this.request({
path: `/Users/Public`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(UserDtoFromJSON));
}
/**
* Gets a list of publicly visible users for display on a login screen.
*/
async getPublicUsers(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<UserDto>> {
const response = await this.getPublicUsersRaw(initOverrides);
return await response.value();
}
/**
* Gets a user by Id.
*/
async getUserByIdRaw(requestParameters: GetUserByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UserDto>> {
if (requestParameters.userId === null || requestParameters.userId === undefined) {
throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling getUserById.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
}
const response = await this.request({
path: `/Users/{userId}`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => UserDtoFromJSON(jsonValue));
}
/**
* Gets a user by Id.
*/
async getUserById(requestParameters: GetUserByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UserDto> {
const response = await this.getUserByIdRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Gets a list of users.
*/
async getUsersRaw(requestParameters: GetUsersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<UserDto>>> {
const queryParameters: any = {};
if (requestParameters.isHidden !== undefined) {
queryParameters['isHidden'] = requestParameters.isHidden;
}
if (requestParameters.isDisabled !== undefined) {
queryParameters['isDisabled'] = requestParameters.isDisabled;
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
}
const response = await this.request({
path: `/Users`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(UserDtoFromJSON));
}
/**
* Gets a list of users.
*/
async getUsers(requestParameters: GetUsersRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<UserDto>> {
const response = await this.getUsersRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Updates a user.
*/
async updateUserRaw(requestParameters: UpdateUserOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
if (requestParameters.userId === null || requestParameters.userId === undefined) {
throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling updateUser.');
}
if (requestParameters.updateUserRequest === null || requestParameters.updateUserRequest === undefined) {
throw new runtime.RequiredError('updateUserRequest','Required parameter requestParameters.updateUserRequest was null or undefined when calling updateUser.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
}
const response = await this.request({
path: `/Users/{userId}`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: UpdateUserRequestToJSON(requestParameters.updateUserRequest),
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Updates a user.
*/
async updateUser(requestParameters: UpdateUserOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
await this.updateUserRaw(requestParameters, initOverrides);
}
/**
* Updates a user configuration.
*/
async updateUserConfigurationRaw(requestParameters: UpdateUserConfigurationOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
if (requestParameters.userId === null || requestParameters.userId === undefined) {
throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling updateUserConfiguration.');
}
if (requestParameters.updateUserConfigurationRequest === null || requestParameters.updateUserConfigurationRequest === undefined) {
throw new runtime.RequiredError('updateUserConfigurationRequest','Required parameter requestParameters.updateUserConfigurationRequest was null or undefined when calling updateUserConfiguration.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
}
const response = await this.request({
path: `/Users/{userId}/Configuration`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: UpdateUserConfigurationRequestToJSON(requestParameters.updateUserConfigurationRequest),
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Updates a user configuration.
*/
async updateUserConfiguration(requestParameters: UpdateUserConfigurationOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
await this.updateUserConfigurationRaw(requestParameters, initOverrides);
}
/**
* Updates a user\'s easy password.
*/
async updateUserEasyPasswordRaw(requestParameters: UpdateUserEasyPasswordOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
if (requestParameters.userId === null || requestParameters.userId === undefined) {
throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling updateUserEasyPassword.');
}
if (requestParameters.updateUserEasyPasswordRequest === null || requestParameters.updateUserEasyPasswordRequest === undefined) {
throw new runtime.RequiredError('updateUserEasyPasswordRequest','Required parameter requestParameters.updateUserEasyPasswordRequest was null or undefined when calling updateUserEasyPassword.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
}
const response = await this.request({
path: `/Users/{userId}/EasyPassword`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: UpdateUserEasyPasswordRequestToJSON(requestParameters.updateUserEasyPasswordRequest),
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Updates a user\'s easy password.
*/
async updateUserEasyPassword(requestParameters: UpdateUserEasyPasswordOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
await this.updateUserEasyPasswordRaw(requestParameters, initOverrides);
}
/**
* Updates a user\'s password.
*/
async updateUserPasswordRaw(requestParameters: UpdateUserPasswordOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
if (requestParameters.userId === null || requestParameters.userId === undefined) {
throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling updateUserPassword.');
}
if (requestParameters.updateUserPasswordRequest === null || requestParameters.updateUserPasswordRequest === undefined) {
throw new runtime.RequiredError('updateUserPasswordRequest','Required parameter requestParameters.updateUserPasswordRequest was null or undefined when calling updateUserPassword.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
}
const response = await this.request({
path: `/Users/{userId}/Password`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: UpdateUserPasswordRequestToJSON(requestParameters.updateUserPasswordRequest),
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Updates a user\'s password.
*/
async updateUserPassword(requestParameters: UpdateUserPasswordOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
await this.updateUserPasswordRaw(requestParameters, initOverrides);
}
/**
* Updates a user policy.
*/
async updateUserPolicyRaw(requestParameters: UpdateUserPolicyOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
if (requestParameters.userId === null || requestParameters.userId === undefined) {
throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling updateUserPolicy.');
}
if (requestParameters.updateUserPolicyRequest === null || requestParameters.updateUserPolicyRequest === undefined) {
throw new runtime.RequiredError('updateUserPolicyRequest','Required parameter requestParameters.updateUserPolicyRequest was null or undefined when calling updateUserPolicy.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication
}
const response = await this.request({
path: `/Users/{userId}/Policy`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: UpdateUserPolicyRequestToJSON(requestParameters.updateUserPolicyRequest),
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Updates a user policy.
*/
async updateUserPolicy(requestParameters: UpdateUserPolicyOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
await this.updateUserPolicyRaw(requestParameters, initOverrides);
}
}