import type { AxiosRequestConfig } from 'axios' ; import { TeamAPI } from '../team/TeamAPI' ; import type { HttpClient } from '../../http' ; import type { LegalHoldData } from './LegalHoldData' ; import type { LegalHoldMemberData } from './LegalHoldMemberStatus' ; import type { NewLegalHoldData } from './NewLegalHoldData' ; export class LegalHoldAPI { constructor ( private readonly client ) { } public static readonly URL = { APPROVE_LEGAL_HOLD : 'approve' , LEGAL_HOLD : 'legalhold' , SETTINGS_LEGAL_HOLD : 'settings' , } ; public async getMemberLegalHold ( teamId , userId ) { const config = { method : 'get' , url : `${ TeamAPI . URL . TEAMS }/${ teamId }/${ LegalHoldAPI . URL . LEGAL_HOLD }/${ userId }` , } ; const response = await this . client . sendJSON < LegalHoldMemberData > ( config ) ; return response . data ; } public async deleteMemberLegalHold ( teamId , userId , password ) { const config = { data : { password , } , method : 'delete' , url : `${ TeamAPI . URL . TEAMS }/${ teamId }/${ LegalHoldAPI . URL . LEGAL_HOLD }/${ userId }` , } ; await this . client . sendJSON ( config ) ; } public async postMemberLegalHold ( teamId , userId ) { const config = { method : 'post' , url : `${ TeamAPI . URL . TEAMS }/${ teamId }/${ LegalHoldAPI . URL . LEGAL_HOLD }/${ userId }` , } ; await this . client . sendJSON ( config ) ; } public async putMemberApproveLegalHold ( teamId , userId , password ) { const config = { data : { password , } , method : 'put' , url : `${ TeamAPI . URL . TEAMS }/${ teamId }/${ LegalHoldAPI . URL . LEGAL_HOLD }/${ userId }/${ LegalHoldAPI . URL . APPROVE_LEGAL_HOLD }` , } ; await this . client . sendJSON ( config ) ; } public async getSettings ( teamId ) { const config = { method : 'get' , url : `${ TeamAPI . URL . TEAMS }/${ teamId }/${ LegalHoldAPI . URL . LEGAL_HOLD }/${ LegalHoldAPI . URL . SETTINGS_LEGAL_HOLD }` , } ; const response = await this . client . sendJSON < LegalHoldData > ( config ) ; return response . data ; } public async deleteSettings ( teamId , password ) { const config = { data : { password , } , method : 'delete' , url : `${ TeamAPI . URL . TEAMS }/${ teamId }/${ LegalHoldAPI . URL . LEGAL_HOLD }/${ LegalHoldAPI . URL . SETTINGS_LEGAL_HOLD }` , } ; await this . client . sendJSON ( config ) ; } public async postSettings ( teamId , legalHoldData ) { const config = { data : legalHoldData , method : 'post' , url : `${ TeamAPI . URL . TEAMS }/${ teamId }/${ LegalHoldAPI . URL . LEGAL_HOLD }/${ LegalHoldAPI . URL . SETTINGS_LEGAL_HOLD }` , } ; const response = await this . client . sendJSON < LegalHoldData > ( config ) ; return response . data ; } }