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: add redirect uri to getMultipleCredentialsGroupJoinUrl #629

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
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
6 changes: 4 additions & 2 deletions apps/client/src/utils/api.ts
Original file line number Diff line number Diff line change
@@ -106,13 +106,15 @@ export function getCredentialGroupJoinUrl(
export function getMultipleCredentialsGroupJoinUrl(
dashboardUrl: DashboardUrl,
groupId: string,
commitment: string
commitment: string,
redirectUri?: string
): string | null {
try {
return api.getMultipleCredentialsGroupJoinUrl(
dashboardUrl,
groupId,
commitment
commitment,
redirectUri
)
} catch (error: any) {
console.error(error)
4 changes: 3 additions & 1 deletion apps/docs/docs/api-sdk.md
Original file line number Diff line number Diff line change
@@ -494,10 +494,12 @@ import { DashboardUrl } from "@bandada/api-sdk"
const dashboardUrl = DashboardUrl.DEV
const groupId = "10402173435763029700781503965100"
const commitment = "1"
const redirectUri = "http://localhost:3003"

const url = apiSdk.getMultipleCredentialsGroupJoinUrl(
dashboardUrl,
groupId,
commitment
commitment,
redirectUri
)
```
4 changes: 3 additions & 1 deletion apps/docs/docs/tutorials/api-sdk/groups.md
Original file line number Diff line number Diff line change
@@ -273,11 +273,13 @@ import { DashboardUrl } from "@bandada/api-sdk"
const dashboardUrl = DashboardUrl.DEV
const groupId = "your-group-id"
const commitment = "commitment-value"
const redirectUri = "http://localhost:3003"

const url = apiSdk.getMultipleCredentialsGroupJoinUrl(
dashboardUrl,
groupId,
commitment
commitment,
redirectUri
)
```

4 changes: 3 additions & 1 deletion libs/api-sdk/README.md
Original file line number Diff line number Diff line change
@@ -517,10 +517,12 @@ import { DashboardUrl } from "@bandada/api-sdk"
const dashboardUrl = DashboardUrl.DEV
const groupId = "10402173435763029700781503965100"
const commitment = "1"
const redirectUri = "http://localhost:3003"

const url = apiSdk.getMultipleCredentialsGroupJoinUrl(
dashboardUrl,
groupId,
commitment
commitment,
redirectUri
)
```
7 changes: 5 additions & 2 deletions libs/api-sdk/src/apiSdk.ts
Original file line number Diff line number Diff line change
@@ -421,17 +421,20 @@ export default class ApiSdk {
* @param dashboardUrl Dashboard base url.
* @param groupId Group id.
* @param commitment Identity commitment.
* @param redirectUri Redirect uri.
* @returns Url string.
*/
getMultipleCredentialsGroupJoinUrl(
dashboardUrl: DashboardUrl,
groupId: string,
commitment: string
commitment: string,
redirectUri?: string
): string {
const url = getMultipleCredentialsGroupJoinUrl(
dashboardUrl,
groupId,
commitment
commitment,
redirectUri
)

return url
10 changes: 8 additions & 2 deletions libs/api-sdk/src/groups.ts
Original file line number Diff line number Diff line change
@@ -458,14 +458,20 @@ export function getCredentialGroupJoinUrl(
* @param dashboardUrl Dashboard url.
* @param groupId Group id.
* @param commitment Identity commitment.
* @param redirectUri Redirect uri.
* @returns Url string.
*/
export function getMultipleCredentialsGroupJoinUrl(
dashboardUrl: DashboardUrl,
groupId: string,
commitment: string
commitment: string,
redirectUri?: string
): string {
const resultUrl = `${dashboardUrl}/credentials?group=${groupId}&member=${commitment}&type=multiple`
let resultUrl = `${dashboardUrl}/credentials?group=${groupId}&member=${commitment}&type=multiple`

if (redirectUri) {
resultUrl += `&redirect_uri=${redirectUri}?redirect=true`
}

return resultUrl
}
6 changes: 4 additions & 2 deletions libs/api-sdk/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -863,15 +863,17 @@ describe("Bandada API SDK", () => {
const dashboardUrl = DashboardUrl.DEV
const groupId = "10402173435763029700781503965100"
const commitment = "1"
const redirectUri = "http://localhost:3003"

const apiSdk: ApiSdk = new ApiSdk(SupportedUrl.DEV)
const res = apiSdk.getMultipleCredentialsGroupJoinUrl(
dashboardUrl,
groupId,
commitment
commitment,
redirectUri
)

const url = `${dashboardUrl}/credentials?group=${groupId}&member=${commitment}&type=multiple`
const url = `${dashboardUrl}/credentials?group=${groupId}&member=${commitment}&type=multiple&redirect_uri=${redirectUri}?redirect=true`

expect(res).toBe(url)
})