From ec595b90fa3e61be428d73d76398134dd580c8ab Mon Sep 17 00:00:00 2001 From: Han <56923450+waddaboo@users.noreply.github.com> Date: Fri, 29 Nov 2024 17:43:33 +0800 Subject: [PATCH] feat(api-sdk): add getMultipleCredentialsGroupJoinUrl --- apps/docs/docs/api-sdk.md | 20 ++++++++++++++++++++ libs/api-sdk/README.md | 20 ++++++++++++++++++++ libs/api-sdk/src/apiSdk.ts | 24 +++++++++++++++++++++++- libs/api-sdk/src/groups.ts | 17 +++++++++++++++++ libs/api-sdk/src/index.test.ts | 19 +++++++++++++++++++ 5 files changed, 99 insertions(+), 1 deletion(-) diff --git a/apps/docs/docs/api-sdk.md b/apps/docs/docs/api-sdk.md index 9f09dad3..30924325 100644 --- a/apps/docs/docs/api-sdk.md +++ b/apps/docs/docs/api-sdk.md @@ -467,3 +467,23 @@ const url = apiSdk.getCredentialGroupJoinUrl( redirectUri ) ``` + +## Get multiple credentials group join URL + +\# **getMultipleCredentialGroupJoinUrl**(): _string_ + +Returns a custom URL string for joining a multiple credentials group. + +```ts +import { DashboardUrl } from "@bandada/api-sdk" + +const dashboardUrl = DashboardUrl.DEV +const groupId = "10402173435763029700781503965100" +const commitment = "1" + +const url = apiSdk.getMultipleCredentialsGroupJoinUrl( + dashboardUrl, + groupId, + commitment +) +``` \ No newline at end of file diff --git a/libs/api-sdk/README.md b/libs/api-sdk/README.md index 6bb8d57e..8a1d027f 100644 --- a/libs/api-sdk/README.md +++ b/libs/api-sdk/README.md @@ -490,3 +490,23 @@ const url = apiSdk.getCredentialGroupJoinUrl( redirectUri ) ``` + +## Get multiple credentials group join URL + +\# **getMultipleCredentialGroupJoinUrl**(): _string_ + +Returns a custom URL string for joining a multiple credentials group. + +```ts +import { DashboardUrl } from "@bandada/api-sdk" + +const dashboardUrl = DashboardUrl.DEV +const groupId = "10402173435763029700781503965100" +const commitment = "1" + +const url = apiSdk.getMultipleCredentialsGroupJoinUrl( + dashboardUrl, + groupId, + commitment +) +``` diff --git a/libs/api-sdk/src/apiSdk.ts b/libs/api-sdk/src/apiSdk.ts index 18f7975b..4404d17a 100644 --- a/libs/api-sdk/src/apiSdk.ts +++ b/libs/api-sdk/src/apiSdk.ts @@ -24,7 +24,8 @@ import { removeMembersByApiKey, getGroupsByAdminId, getGroupsByMemberId, - getCredentialGroupJoinUrl + getCredentialGroupJoinUrl, + getMultipleCredentialsGroupJoinUrl } from "./groups" import { createInvite, getInvite } from "./invites" @@ -392,4 +393,25 @@ export default class ApiSdk { return url } + + /** + * Generate a custom url for joining a multiple credentials group. + * @param dashboardUrl Dashboard base url. + * @param groupId Group id. + * @param commitment Identity commitment. + * @returns Url string. + */ + getMultipleCredentialsGroupJoinUrl( + dashboardUrl: DashboardUrl, + groupId: string, + commitment: string + ): string { + const url = getMultipleCredentialsGroupJoinUrl( + dashboardUrl, + groupId, + commitment + ) + + return url + } } diff --git a/libs/api-sdk/src/groups.ts b/libs/api-sdk/src/groups.ts index 9efafea3..4cc9481f 100644 --- a/libs/api-sdk/src/groups.ts +++ b/libs/api-sdk/src/groups.ts @@ -452,3 +452,20 @@ export function getCredentialGroupJoinUrl( return resultUrl } + +/** + * Generate a custorm url for joining a multiple credentials group. + * @param dashboardUrl Dashboard url. + * @param groupId Group id. + * @param commitment Identity commitment. + * @returns Url string. + */ +export function getMultipleCredentialsGroupJoinUrl( + dashboardUrl: DashboardUrl, + groupId: string, + commitment: string +): string { + const resultUrl = `${dashboardUrl}/credentials?group=${groupId}&member=${commitment}&type=multiple` + + return resultUrl +} diff --git a/libs/api-sdk/src/index.test.ts b/libs/api-sdk/src/index.test.ts index 3cc483ea..d21ee2aa 100644 --- a/libs/api-sdk/src/index.test.ts +++ b/libs/api-sdk/src/index.test.ts @@ -857,6 +857,25 @@ describe("Bandada API SDK", () => { expect(res).toBe(url) }) }) + + describe("#getMultipleCredentialGroupJoinUrl", () => { + it("Should generate a custom url for joining a multiple credential group", async () => { + const dashboardUrl = DashboardUrl.DEV + const groupId = "10402173435763029700781503965100" + const commitment = "1" + + const apiSdk: ApiSdk = new ApiSdk(SupportedUrl.DEV) + const res = apiSdk.getMultipleCredentialsGroupJoinUrl( + dashboardUrl, + groupId, + commitment + ) + + const url = `${dashboardUrl}/credentials?group=${groupId}&member=${commitment}&type=multiple` + + expect(res).toBe(url) + }) + }) }) }) describe("Invites", () => {