Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api-sdk): add getMultipleCredentialsGroupJoinUrl #607

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading