Skip to content

Commit

Permalink
Add businessService.replaceOne for PUT /businesses/:id
Browse files Browse the repository at this point in the history
Signed-off-by: Hung-Han (Henry) Chen <[email protected]>
  • Loading branch information
chenhunghan committed Apr 2, 2024
1 parent 3504adb commit 7d7dedd
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/BusinessService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,12 @@ export type BusinessUpdate = Partial<
}
>;

export type BusinessReplace = BusinessUpdate & {
verifiedDomains: Array<{
domain: string;
}>;
};

export type BusinessInvitation = {
/**
* The business invitation ID
Expand Down Expand Up @@ -717,6 +723,22 @@ class BusinessService extends Base {
return json as unknown as Business;
}

/**
* Replace an existing business ("Lens Business ID").
*/
async replaceOne(id: string, business: BusinessReplace): Promise<Business> {
const { apiEndpointAddress, fetch } = this.lensPlatformClient;
const url = `${apiEndpointAddress}/businesses/${id}`;
const json = await throwExpected(async () => fetch.put(url, business), {
400: (error) => new BadRequestException(error?.body.message),
401: (error) => new UnauthorizedException(error?.body.message),
403: (error) => new ForbiddenException(error?.body.message),
409: (error) => new ForbiddenException(error?.body.message),
});

return json as unknown as Business;
}

/**
* Disable business light activation link
*/
Expand Down

0 comments on commit 7d7dedd

Please sign in to comment.