import * as Utils from '@datocms/rest-client-utils'; import BaseResource from '../../BaseResource.js'; import type * as ApiTypes from '../ApiTypes.js'; import type * as RawApiTypes from '../RawApiTypes.js'; export default class TfaDeactivateRequest extends BaseResource { static readonly TYPE = 'tfa_deactivate_request' as const; /** * Request the belonging organization to deactivate two-factor authentication * * @throws {ApiError} * @throws {TimeoutError} * * @deprecated This API call is to be considered private and might change without notice */ create(body: ApiTypes.TfaDeactivateRequestCreateSchema) { return this.rawCreate( Utils.serializeRequestBody( body, { type: 'tfa_deactivate_request', attributes: ['email', 'password'], relationships: [], }, ), ).then((body) => Utils.deserializeResponseBody( body, ), ); } /** * Request the belonging organization to deactivate two-factor authentication * * @throws {ApiError} * @throws {TimeoutError} * * @deprecated This API call is to be considered private and might change without notice */ rawCreate( body: RawApiTypes.TfaDeactivateRequestCreateSchema, ): Promise { return this.client.request( { method: 'POST', url: '/tfa-deactivate-requests', body, }, ); } /** * List all two-factor authentication deactivate requests * * @throws {ApiError} * @throws {TimeoutError} * * @deprecated This API call is to be considered private and might change without notice */ list() { return this.rawList().then((body) => Utils.deserializeResponseBody( body, ), ); } /** * List all two-factor authentication deactivate requests * * @throws {ApiError} * @throws {TimeoutError} * * @deprecated This API call is to be considered private and might change without notice */ rawList(): Promise { return this.client.request( { method: 'GET', url: '/tfa-deactivate-requests', }, ); } /** * Approve a two-factor authentication deactivate request * * @throws {ApiError} * @throws {TimeoutError} * * @deprecated This API call is to be considered private and might change without notice */ approve(tfaDeactivateRequestId: string | ApiTypes.TfaDeactivateRequestData) { return this.rawApprove(Utils.toId(tfaDeactivateRequestId)); } /** * Approve a two-factor authentication deactivate request * * @throws {ApiError} * @throws {TimeoutError} * * @deprecated This API call is to be considered private and might change without notice */ rawApprove(tfaDeactivateRequestId: string): Promise { return this.client.request({ method: 'PUT', url: `/tfa-deactivate-requests/${tfaDeactivateRequestId}/approve`, }); } /** * Reject a two-factor authentication deactivate request * * @throws {ApiError} * @throws {TimeoutError} * * @deprecated This API call is to be considered private and might change without notice */ reject(tfaDeactivateRequestId: string | ApiTypes.TfaDeactivateRequestData) { return this.rawReject(Utils.toId(tfaDeactivateRequestId)); } /** * Reject a two-factor authentication deactivate request * * @throws {ApiError} * @throws {TimeoutError} * * @deprecated This API call is to be considered private and might change without notice */ rawReject(tfaDeactivateRequestId: string): Promise { return this.client.request({ method: 'PUT', url: `/tfa-deactivate-requests/${tfaDeactivateRequestId}/reject`, }); } }