squarefi-bff-api-module 1.5.16 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,50 @@
1
+ import { apiClientV2 } from '../utils/apiClientFactory';
2
+ import { API } from './types';
3
+
4
+ export const counterparties = {
5
+ getAll: ({ wallet_id, ...params }: API.Counterparties.List.Request) =>
6
+ apiClientV2.getRequest<API.Counterparties.List.Response>(`/counterparties/${wallet_id}`, {
7
+ params,
8
+ }),
9
+ getById: ({ wallet_id, counterparty_account_id }: API.Counterparties.GetById.Request) =>
10
+ apiClientV2.getRequest<API.Counterparties.GetById.Response>(
11
+ `/counterparties/${wallet_id}/${counterparty_account_id}`
12
+ ),
13
+ create: ({ wallet_id, ...data }: API.Counterparties.Create.Request) =>
14
+ apiClientV2.postRequest<API.Counterparties.Create.Response>(`/counterparties/${wallet_id}`, { data }),
15
+ update: ({ wallet_id, counterparty_account_id, ...data }: API.Counterparties.Update.Request) =>
16
+ apiClientV2.patchRequest<API.Counterparties.Update.Response>(
17
+ `/counterparties/${wallet_id}/${counterparty_account_id}`,
18
+ { data }
19
+ ),
20
+ destinations: {
21
+ getAll: ({ wallet_id, counterparty_account_id, ...params }: API.Counterparties.Destination.List.Request) =>
22
+ apiClientV2.getRequest<API.Counterparties.Destination.List.Response>(
23
+ `/counterparties/${wallet_id}/${counterparty_account_id}/destinations`,
24
+ { params }
25
+ ),
26
+ getById: ({
27
+ wallet_id,
28
+ counterparty_account_id,
29
+ counterparty_destination_id,
30
+ }: API.Counterparties.Destination.Detail.Request) =>
31
+ apiClientV2.getRequest<API.Counterparties.Destination.Detail.Response>(
32
+ `/counterparties/${wallet_id}/${counterparty_account_id}/destinations/${counterparty_destination_id}`
33
+ ),
34
+ create: ({ wallet_id, counterparty_account_id, ...data }: API.Counterparties.Destination.Create.Request) =>
35
+ apiClientV2.postRequest<API.Counterparties.Destination.Create.Response>(
36
+ `/counterparties/${wallet_id}/${counterparty_account_id}/destinations`,
37
+ { data }
38
+ ),
39
+ update: ({
40
+ wallet_id,
41
+ counterparty_account_id,
42
+ counterparty_destination_id,
43
+ ...data
44
+ }: API.Counterparties.Destination.Update.Request) =>
45
+ apiClientV2.patchRequest<API.Counterparties.Destination.Update.Response>(
46
+ `/counterparties/${wallet_id}/${counterparty_account_id}/destinations/${counterparty_destination_id}`,
47
+ { data }
48
+ ),
49
+ },
50
+ };
package/src/api/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { auth } from './auth';
2
+ import { counterparties } from './counterparties';
2
3
  import { developer } from './developer';
3
4
  import { exchange } from './exchange';
4
5
  import { fiat_accounts } from './fiat_accounts';
@@ -12,12 +13,14 @@ import { wallets } from './wallets';
12
13
 
13
14
  type Api = {
14
15
  auth: typeof auth;
16
+ counterparties: typeof counterparties;
15
17
  developer: typeof developer;
16
18
  exchange: typeof exchange;
17
19
  fiat_accounts: typeof fiat_accounts;
18
20
  issuing: typeof issuing;
19
21
  kyc: typeof kyc;
20
22
  list: typeof list;
23
+ location: typeof location;
21
24
  orders: typeof orders;
22
25
  tenants: typeof tenants;
23
26
  user: typeof user;
@@ -26,12 +29,14 @@ type Api = {
26
29
 
27
30
  export const squarefi_bff_api_client: Api = {
28
31
  auth,
32
+ counterparties,
29
33
  developer,
30
34
  exchange,
31
35
  fiat_accounts,
32
36
  issuing,
33
37
  kyc,
34
38
  list,
39
+ location,
35
40
  orders,
36
41
  tenants,
37
42
  user,
@@ -0,0 +1,8 @@
1
+ import { apiClientV2 } from '../utils/apiClientFactory';
2
+ import { API } from './types';
3
+
4
+ export const location = {
5
+ countries: {
6
+ list: () => apiClientV2.getRequest<API.Location.Countries.List.Response>('/location/countries'),
7
+ },
8
+ };