@pax2pay/model-banking 0.1.12 → 0.1.14

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.
@@ -10,7 +10,10 @@ export class Accounts extends rest.Collection<gracely.Error> {
10
10
  async create(account: Account.Creatable): Promise<Account | gracely.Error> {
11
11
  return this.client.post<Account>("/account", account)
12
12
  }
13
- async list(): Promise<Account.Info[] | gracely.Error> {
14
- return this.client.get<Account.Info[]>("/account")
13
+ async list(options?: {
14
+ limit?: string
15
+ cursor?: string
16
+ }): Promise<(Account.Info[] & { cursor?: string | undefined }) | gracely.Error> {
17
+ return this.client.get<Account.Info[] & { cursor?: string | undefined }>("/account", options)
15
18
  }
16
19
  }
@@ -7,8 +7,24 @@ export class Operations extends rest.Collection<gracely.Error> {
7
7
  constructor(client: http.Client) {
8
8
  super(client)
9
9
  }
10
- async list(start?: string, end?: string): Promise<Operation[] | gracely.Error> {
11
- const search = start && end ? `?start=${start}&end=${end}` : start ? `?start=${start}` : end ? `?end=${end}` : ""
12
- return this.client.get<Operation[]>(`/operation${search}`)
10
+ async list(options?: {
11
+ start?: string
12
+ end?: string
13
+ limit?: string
14
+ cursor?: string
15
+ prefix?: string
16
+ }): Promise<(Operation[] & { cursor?: string | undefined }) | gracely.Error> {
17
+ const search =
18
+ options?.start && options?.end
19
+ ? `?start=${options?.start}&end=${options?.end}`
20
+ : options?.start
21
+ ? `?start=${options?.start}`
22
+ : options?.end
23
+ ? `?end=${options?.end}`
24
+ : ""
25
+ return this.client.get<Operation[] & { cursor?: string | undefined }>(
26
+ `/operation${search}`,
27
+ options && (({ start, end, ...headers }) => headers)(options)
28
+ )
13
29
  }
14
30
  }
@@ -0,0 +1,15 @@
1
+ import * as gracely from "gracely"
2
+ import * as http from "cloudly-http"
3
+ import * as rest from "cloudly-rest"
4
+ import { Organization } from "../../Organization"
5
+
6
+ export class Rules extends rest.Collection<gracely.Error> {
7
+ constructor(client: http.Client) {
8
+ super(client)
9
+ }
10
+ async replace(organization: string, rules: Organization.Rule[]): Promise<Organization.Rule[] | gracely.Error> {
11
+ return this.client.put<Organization.Rule[]>(`/organization/rule`, rules, {
12
+ organization: organization,
13
+ })
14
+ }
15
+ }
@@ -1,14 +1,17 @@
1
1
  import * as gracely from "gracely"
2
2
  import * as http from "cloudly-http"
3
3
  import * as rest from "cloudly-rest"
4
- import { Organization } from "../Organization"
4
+ import { Organization } from "../../Organization"
5
5
 
6
6
  export class Organizations extends rest.Collection<gracely.Error> {
7
7
  constructor(client: http.Client) {
8
8
  super(client)
9
9
  }
10
- async list(): Promise<Organization[] | gracely.Error> {
11
- return this.client.get<Organization[]>(`/organization`)
10
+ async list(options?: {
11
+ limit?: string
12
+ cursor?: string
13
+ }): Promise<(Organization[] & { cursor?: string | undefined }) | gracely.Error> {
14
+ return this.client.get<Organization[] & { cursor?: string | undefined }>(`/organization`, options)
12
15
  }
13
16
  async create(organization: Organization.Creatable): Promise<Organization | gracely.Error> {
14
17
  return this.client.post<Organization>(`/organization`, organization)
@@ -22,7 +22,7 @@ export class Transactions extends rest.Collection<gracely.Error> {
22
22
  rail?: "internal"
23
23
  start?: string
24
24
  end?: string
25
- }): Promise<Transaction[] | gracely.Error> {
25
+ }): Promise<(Transaction[] & { cursor?: string | undefined }) | gracely.Error> {
26
26
  const searchOptions = options && (({ account, limit, cursor, ...search }) => search)(options)
27
27
  const query = searchOptions
28
28
  ? Object.entries(searchOptions)
@@ -30,6 +30,13 @@ export class Transactions extends rest.Collection<gracely.Error> {
30
30
  .reduce((prev, curr, i) => `${prev}${i == 0 ? "?" : "&"}${curr}`, "")
31
31
  : ""
32
32
  const path = options && options.account ? `/account/${options.account}/transaction${query}` : `/transaction${query}`
33
- return this.client.get<Transaction[]>(path) //{ limit: options?.limit ? options.limit.toString() : undefined, cursor: options?.cursor, }
33
+ return this.client.get<Transaction[] & { cursor?: string | undefined }>(
34
+ path,
35
+ options &&
36
+ (({ limit, cursor }) =>
37
+ limit || cursor
38
+ ? { ...(limit ? { limit: limit.toString() } : {}), ...(cursor ? { cursor: cursor } : {}) }
39
+ : undefined)(options)
40
+ )
34
41
  }
35
42
  }
@@ -5,5 +5,10 @@ import { Account } from "../Account";
5
5
  export declare class Accounts extends rest.Collection<gracely.Error> {
6
6
  constructor(client: http.Client);
7
7
  create(account: Account.Creatable): Promise<Account | gracely.Error>;
8
- list(): Promise<Account.Info[] | gracely.Error>;
8
+ list(options?: {
9
+ limit?: string;
10
+ cursor?: string;
11
+ }): Promise<(Account.Info[] & {
12
+ cursor?: string | undefined;
13
+ }) | gracely.Error>;
9
14
  }
@@ -6,8 +6,8 @@ export class Accounts extends rest.Collection {
6
6
  async create(account) {
7
7
  return this.client.post("/account", account);
8
8
  }
9
- async list() {
10
- return this.client.get("/account");
9
+ async list(options) {
10
+ return this.client.get("/account", options);
11
11
  }
12
12
  }
13
13
  //# sourceMappingURL=Accounts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Accounts.js","sourceRoot":"../","sources":["Client/Accounts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,cAAc,CAAA;AAGpC,MAAM,OAAO,QAAS,SAAQ,IAAI,CAAC,UAAyB;IAC3D,YAAY,MAAmB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAA;IACd,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,OAA0B;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAU,UAAU,EAAE,OAAO,CAAC,CAAA;IACtD,CAAC;IACD,KAAK,CAAC,IAAI;QACT,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAiB,UAAU,CAAC,CAAA;IACnD,CAAC;CACD"}
1
+ {"version":3,"file":"Accounts.js","sourceRoot":"../","sources":["Client/Accounts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,cAAc,CAAA;AAGpC,MAAM,OAAO,QAAS,SAAQ,IAAI,CAAC,UAAyB;IAC3D,YAAY,MAAmB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAA;IACd,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,OAA0B;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAU,UAAU,EAAE,OAAO,CAAC,CAAA;IACtD,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,OAGV;QACA,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAmD,UAAU,EAAE,OAAO,CAAC,CAAA;IAC9F,CAAC;CACD"}
@@ -4,5 +4,13 @@ import * as rest from "cloudly-rest";
4
4
  import { Operation } from "../Operation";
5
5
  export declare class Operations extends rest.Collection<gracely.Error> {
6
6
  constructor(client: http.Client);
7
- list(start?: string, end?: string): Promise<Operation[] | gracely.Error>;
7
+ list(options?: {
8
+ start?: string;
9
+ end?: string;
10
+ limit?: string;
11
+ cursor?: string;
12
+ prefix?: string;
13
+ }): Promise<(Operation[] & {
14
+ cursor?: string | undefined;
15
+ }) | gracely.Error>;
8
16
  }
@@ -3,9 +3,15 @@ export class Operations extends rest.Collection {
3
3
  constructor(client) {
4
4
  super(client);
5
5
  }
6
- async list(start, end) {
7
- const search = start && end ? `?start=${start}&end=${end}` : start ? `?start=${start}` : end ? `?end=${end}` : "";
8
- return this.client.get(`/operation${search}`);
6
+ async list(options) {
7
+ const search = options?.start && options?.end
8
+ ? `?start=${options?.start}&end=${options?.end}`
9
+ : options?.start
10
+ ? `?start=${options?.start}`
11
+ : options?.end
12
+ ? `?end=${options?.end}`
13
+ : "";
14
+ return this.client.get(`/operation${search}`, options && (({ start, end, ...headers }) => headers)(options));
9
15
  }
10
16
  }
11
17
  //# sourceMappingURL=Operations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Operations.js","sourceRoot":"../","sources":["Client/Operations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,cAAc,CAAA;AAGpC,MAAM,OAAO,UAAW,SAAQ,IAAI,CAAC,UAAyB;IAC7D,YAAY,MAAmB;QAC9B,K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D,CAAA;IACF,CAAC;CACD"}
@@ -1,9 +1,14 @@
1
1
  import * as gracely from "gracely";
2
2
  import * as http from "cloudly-http";
3
3
  import * as rest from "cloudly-rest";
4
- import { Organization } from "../Organization";
4
+ import { Organization } from "../../Organization";
5
5
  export declare class Organizations extends rest.Collection<gracely.Error> {
6
6
  constructor(client: http.Client);
7
- list(): Promise<Organization[] | gracely.Error>;
7
+ list(options?: {
8
+ limit?: string;
9
+ cursor?: string;
10
+ }): Promise<(Organization[] & {
11
+ cursor?: string | undefined;
12
+ }) | gracely.Error>;
8
13
  create(organization: Organization.Creatable): Promise<Organization | gracely.Error>;
9
14
  }
@@ -3,11 +3,11 @@ export class Organizations extends rest.Collection {
3
3
  constructor(client) {
4
4
  super(client);
5
5
  }
6
- async list() {
7
- return this.client.get(`/organization`);
6
+ async list(options) {
7
+ return this.client.get(`/organization`, options);
8
8
  }
9
9
  async create(organization) {
10
10
  return this.client.post(`/organization`, organization);
11
11
  }
12
12
  }
13
- //# sourceMappingURL=Organizations.js.map
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../","sources":["Client/Organizations/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,cAAc,CAAA;AAGpC,MAAM,OAAO,aAAc,SAAQ,IAAI,CAAC,UAAyB;IAChE,YAAY,MAAmB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAA;IACd,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,OAGV;QACA,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAmD,eAAe,EAAE,OAAO,CAAC,CAAA;IACnG,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,YAAoC;QAChD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAe,eAAe,EAAE,YAAY,CAAC,CAAA;IACrE,CAAC;CACD"}
@@ -17,5 +17,7 @@ export declare class Transactions extends rest.Collection<gracely.Error> {
17
17
  rail?: "internal";
18
18
  start?: string;
19
19
  end?: string;
20
- }): Promise<Transaction[] | gracely.Error>;
20
+ }): Promise<(Transaction[] & {
21
+ cursor?: string | undefined;
22
+ }) | gracely.Error>;
21
23
  }
@@ -16,7 +16,10 @@ export class Transactions extends rest.Collection {
16
16
  .reduce((prev, curr, i) => `${prev}${i == 0 ? "?" : "&"}${curr}`, "")
17
17
  : "";
18
18
  const path = options && options.account ? `/account/${options.account}/transaction${query}` : `/transaction${query}`;
19
- return this.client.get(path);
19
+ return this.client.get(path, options &&
20
+ (({ limit, cursor }) => limit || cursor
21
+ ? { ...(limit ? { limit: limit.toString() } : {}), ...(cursor ? { cursor: cursor } : {}) }
22
+ : undefined)(options));
20
23
  }
21
24
  }
22
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../","sources":["Client/Transactions/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,cAAc,CAAA;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,MAAM,OAAO,YAAa,SAAQ,IAAI,CAAC,UAAyB;IAE/D,YAAY,MAAmB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAA;QAFL,UAAK,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAGvC,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,OAAe,EAAE,WAAkC;QAC/D,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAc,YAAY,OAAO,cAAc,EAAE,WAAW,CAAC,CAAA;IACrF,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,OAUV;QACA,MAAM,aAAa,GAAG,OAAO,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;QAC7F,MAAM,KAAK,GAAG,aAAa;YAC1B,CAAC,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": "0.1.14",
4
4
  "description": "Library containing data model types and functions for the Pax2Pay Banking API.",
5
5
  "author": "Pax2Pay Ltd",
6
6
  "license": "MIT",
@@ -1 +0,0 @@
1
- {"version":3,"file":"Organizations.js","sourceRoot":"../","sources":["Client/Organizations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,cAAc,CAAA;AAGpC,MAAM,OAAO,aAAc,SAAQ,IAAI,CAAC,UAAyB;IAChE,YAAY,MAAmB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAA;IACd,CAAC;IACD,KAAK,CAAC,IAAI;QACT,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAiB,eAAe,CAAC,CAAA;IACxD,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,YAAoC;QAChD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAe,eAAe,EAAE,YAAY,CAAC,CAAA;IACrE,CAAC;CACD"}