Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 3e40337

Browse files
feat: adding account membership api on account member id (#797)
re #MT-15182 Co-authored-by: Dusan Radovanovic <[email protected]>
1 parent 617dac2 commit 3e40337

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

src/endpoints/account-memberships.js

+19
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,25 @@ class AccountMembershipsEndpoint extends BaseExtend {
4848
token
4949
)
5050
}
51+
52+
AllOnAccountMember(accountMemberId, token = null) {
53+
const { limit, offset, filter, includes } = this
54+
55+
this.call = this.request.send(
56+
buildURL(`account-members/${accountMemberId}/account-memberships`, {
57+
limit,
58+
offset,
59+
filter,
60+
includes
61+
}),
62+
'GET',
63+
undefined,
64+
token,
65+
this
66+
)
67+
68+
return this.call
69+
}
5170
}
5271

5372
export default AccountMembershipsEndpoint

src/types/account-memberships.d.ts

+32
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
ResourcePage
99
} from './core'
1010
import { AccountMemberBase } from './account-members'
11+
import {AccountBase} from "./accounts";
1112

1213
/**
1314
* The Account Membership object Interface
@@ -30,6 +31,24 @@ export interface AccountMembership extends Identifiable {
3031
}
3132
}
3233

34+
export interface AccountMembershipOnAccountMember extends Identifiable {
35+
type: string
36+
meta: {
37+
timestamps: {
38+
created_at: string
39+
updated_at: string
40+
}
41+
}
42+
relationships: {
43+
account: {
44+
data: {
45+
id: string
46+
type: string
47+
}
48+
}
49+
}
50+
}
51+
3352
export interface AccountMembershipCreateBody {
3453
type: string
3554
account_member_id: string
@@ -38,14 +57,20 @@ export interface AccountMembershipCreateBody {
3857
export interface AccountMembershipsIncluded {
3958
account_members: AccountMemberBase[]
4059
}
60+
export interface AccountMembershipsIncludedAccounts{
61+
accounts: AccountBase[]
62+
}
4163

4264
export type AccountMembershipsInclude = 'account_members'
65+
export type AccountMembershipsIncludeAccounts = 'accounts'
4366

4467
export type AccountMembershipsResponse = ResourcePage<
4568
AccountMembership,
4669
AccountMembershipsIncluded
4770
>
4871

72+
export type AccountMembershipsOnAccountMember = ResourcePage<AccountMembershipOnAccountMember, AccountMembershipsIncludedAccounts>
73+
4974
/**
5075
* filter for account memberships
5176
*/
@@ -122,4 +147,11 @@ export interface AccountMembershipsEndpoint
122147
* @param filter the filter object
123148
*/
124149
Filter(filter: AccountMembershipsFilter): AccountMembershipsEndpoint
150+
151+
/**
152+
* Get all Account Memberships for an account members
153+
* @param accountMemberId
154+
* @param token
155+
*/
156+
AllOnAccountMember(accountMemberId: string, token: null): Promise<AccountMembershipsOnAccountMember>
125157
}

0 commit comments

Comments
 (0)