@pax2pay/model-banking 0.1.190 → 0.1.192
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.
|
@@ -8,14 +8,15 @@ import { Notes } from "./Notes"
|
|
|
8
8
|
export class Transactions extends rest.Collection<gracely.Error> {
|
|
9
9
|
readonly Notes = new Notes(this.client)
|
|
10
10
|
constructor(client: http.Client) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
client.postprocess = async response => {
|
|
12
|
+
let result = response
|
|
13
|
+
const body = await response.body
|
|
14
|
+
if (Array.isArray(body)) {
|
|
15
|
+
result = http.Response.create(Object.defineProperty(body, "cursor", { value: response.header.cursor }))
|
|
16
|
+
}
|
|
17
|
+
return result
|
|
18
|
+
}
|
|
19
|
+
super(client)
|
|
19
20
|
}
|
|
20
21
|
async create(account: string, transaction: Transaction.Creatable): Promise<Transaction | gracely.Error> {
|
|
21
22
|
return this.client.post<Transaction>(`/account/${account}/transaction`, transaction)
|
|
@@ -35,16 +36,9 @@ export class Transactions extends rest.Collection<gracely.Error> {
|
|
|
35
36
|
.map(([k, v]) => `${k}=${v}`)
|
|
36
37
|
.join("&")
|
|
37
38
|
const path = options?.account ? `/account/${options.account}/transaction` : `/transaction`
|
|
38
|
-
|
|
39
|
+
return await this.client.get<Transaction[] & { cursor?: string | undefined }>(
|
|
39
40
|
path + (query && "?" + query),
|
|
40
41
|
options?.limit ? { limit: options?.limit.toString() } : {}
|
|
41
42
|
)
|
|
42
|
-
let result: (Transaction[] & { cursor?: string | undefined }) | gracely.Error
|
|
43
|
-
if (!gracely.Error.is(listed)) {
|
|
44
|
-
result = listed.list
|
|
45
|
-
result.cursor = listed.cursor
|
|
46
|
-
} else
|
|
47
|
-
result = listed
|
|
48
|
-
return result
|
|
49
43
|
}
|
|
50
44
|
}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { gracely } from "gracely";
|
|
2
1
|
import { http } from "cloudly-http";
|
|
3
2
|
import * as rest from "cloudly-rest";
|
|
4
3
|
import { Notes } from "./Notes";
|
|
5
4
|
export class Transactions extends rest.Collection {
|
|
6
5
|
constructor(client) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
: response
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
client.postprocess = async (response) => {
|
|
7
|
+
let result = response;
|
|
8
|
+
const body = await response.body;
|
|
9
|
+
if (Array.isArray(body)) {
|
|
10
|
+
result = http.Response.create(Object.defineProperty(body, "cursor", { value: response.header.cursor }));
|
|
11
|
+
}
|
|
12
|
+
return result;
|
|
13
|
+
};
|
|
14
|
+
super(client);
|
|
14
15
|
this.Notes = new Notes(this.client);
|
|
15
16
|
}
|
|
16
17
|
async create(account, transaction) {
|
|
@@ -25,15 +26,7 @@ export class Transactions extends rest.Collection {
|
|
|
25
26
|
.map(([k, v]) => `${k}=${v}`)
|
|
26
27
|
.join("&");
|
|
27
28
|
const path = options?.account ? `/account/${options.account}/transaction` : `/transaction`;
|
|
28
|
-
|
|
29
|
-
let result;
|
|
30
|
-
if (!gracely.Error.is(listed)) {
|
|
31
|
-
result = listed.list;
|
|
32
|
-
result.cursor = listed.cursor;
|
|
33
|
-
}
|
|
34
|
-
else
|
|
35
|
-
result = listed;
|
|
36
|
-
return result;
|
|
29
|
+
return await this.client.get(path + (query && "?" + query), options?.limit ? { limit: options?.limit.toString() } : {});
|
|
37
30
|
}
|
|
38
31
|
}
|
|
39
32
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Client/Transactions/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Client/Transactions/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC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