import type { AxiosRequestConfig } from 'axios' ; import type { HttpClient } from '../../http' ; import { NewScimToken } from './NewScimToken' ; import { ScimTokenInfoList } from './ScimTokenInfoList' ; export class ScimAPI { constructor ( private readonly client ) { } public static readonly URL = { AUTH_TOKENS : 'auth-tokens' , SCIM : '/scim' , } ; public async getTokens ( ) { const config = { method : 'get' , url : `${ ScimAPI . URL . SCIM }/${ ScimAPI . URL . AUTH_TOKENS }` , } ; const response = await this . client . sendJSON < ScimTokenInfoList > ( config ) ; return response . data ; } public async deleteToken ( scimTokenId ) { const config = { method : 'delete' , params : { id : scimTokenId } , url : `${ ScimAPI . URL . SCIM }/${ ScimAPI . URL . AUTH_TOKENS }` , } ; await this . client . sendJSON ( config ) ; } public async postToken ( description , password ? ) { const config = { data : { description , password } , method : 'post' , url : `${ ScimAPI . URL . SCIM }/${ ScimAPI . URL . AUTH_TOKENS }` , } ; const response = await this . client . sendJSON < NewScimToken > ( config ) ; return response . data ; } }