Skip to content

Commit

Permalink
Merge pull request #607 from bandada-infra/feat/api-sdk/generate-mult…
Browse files Browse the repository at this point in the history
…iple-credentials-group-join-url

feat(api-sdk): add getMultipleCredentialsGroupJoinUrl
  • Loading branch information
vplasencia authored Nov 29, 2024
2 parents a23aa10 + ec595b9 commit 77144d1
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 1 deletion.
20 changes: 20 additions & 0 deletions apps/docs/docs/api-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
```
20 changes: 20 additions & 0 deletions libs/api-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
```
24 changes: 23 additions & 1 deletion libs/api-sdk/src/apiSdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import {
removeMembersByApiKey,
getGroupsByAdminId,
getGroupsByMemberId,
getCredentialGroupJoinUrl
getCredentialGroupJoinUrl,
getMultipleCredentialsGroupJoinUrl
} from "./groups"
import { createInvite, getInvite } from "./invites"

Expand Down Expand Up @@ -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
}
}
17 changes: 17 additions & 0 deletions libs/api-sdk/src/groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
19 changes: 19 additions & 0 deletions libs/api-sdk/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down

0 comments on commit 77144d1

Please sign in to comment.