@starsched/sdk
Version:
ABA clinic control and management service API SDK
62 lines (61 loc) • 1.79 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Accounts = void 0;
class Accounts {
httpClient;
constructor(httpClient) {
this.httpClient = httpClient;
}
async requestCompanySignUp(input, options) {
const response = await this.httpClient.post('/v1/accounts/request', input, options);
if (!response.ok) {
return {
data: null,
error: response.body
};
}
return {
data: null,
error: null
};
}
async getCompanySignUpRequest(input, options) {
try {
const response = await this.httpClient.get(`/v1/accounts/${input.token}`, options);
if (!response.ok) {
return {
data: null,
error: response.body
};
}
return {
data: response.body,
error: null
};
}
catch (error) {
return {
data: null,
error: {
code: 'internal',
message: 'Internal server error. We are unable to process your request right now, please try again later.'
}
};
}
}
async finalizeCompanySignUpRequest(input, options) {
const { token, ...inputBody } = input;
const response = await this.httpClient.post(`/v1/accounts/${token}/finalize`, inputBody, options);
if (!response.ok) {
return {
data: null,
error: response.body
};
}
return {
data: response.body,
error: null
};
}
}
exports.Accounts = Accounts;