batcging
This commit is contained in:
parent
93a1504aa3
commit
46c863721b
12 changed files with 2772 additions and 2605 deletions
|
|
@ -494,4 +494,15 @@ export default (params: ClientParams) => ({
|
|||
},
|
||||
GetLiveUserOperations: async (cb: (v:ResultError | ({ status: 'OK' }& Types.LiveUserOperation)) => void): Promise<void> => { throw new Error('http streams are not supported')},
|
||||
GetMigrationUpdate: async (cb: (v:ResultError | ({ status: 'OK' }& Types.MigrationUpdate)) => void): Promise<void> => { throw new Error('http streams are not supported')},
|
||||
BatchUser: async (requests:Types.UserMethodInputs): Promise<ResultError | ({ status: 'OK', responses:Types.UserMethodOutputs })> => {
|
||||
const auth = await params.retrieveUserAuth()
|
||||
if (auth === null) throw new Error('retrieveUserAuth() returned null')
|
||||
let finalRoute = '/api/user/batch'
|
||||
const { data } = await axios.post(params.baseUrl + finalRoute, {requests}, { headers: { 'authorization': auth } })
|
||||
if (data.status === 'ERROR' && typeof data.reason === 'string') return data
|
||||
if (data.status === 'OK') {
|
||||
return { status: 'OK', ...data }
|
||||
}
|
||||
return { status: 'ERROR', reason: 'invalid response' }
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue