Skip to content

Commit a2690ff

Browse files
jillingksystem-mrmichaelpaulAleffio
authored
Update method descriptions with possible values for query params (#1288)
* Update method descriptions with possible values for query params and update readme with an example * Update README.md * add test with IRequest * add options * Update README.md Co-authored-by: Michael Paul <michael.paul@adyen.com> * Update README.md Co-authored-by: Alessio Zampatti <alessio.zampatti@adyen.com> --------- Co-authored-by: system-mr <systemmr@adyen.com> Co-authored-by: Michael Paul <michael.paul@adyen.com> Co-authored-by: Alessio Zampatti <alessio.zampatti@adyen.com>
1 parent 148e1a0 commit a2690ff

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,17 @@ checkoutApi.PaymentsApi.payments(paymentRequest)
119119
.then(paymentResponse => console.log(paymentResponse.pspReference))
120120
.catch(error => console.log(error));
121121
```
122+
If you want to pass query string parameters, you can use the `params` field from [IRequest](/src/typings/requestOptions.ts) (also used for idempotency-key and other header fields).
123+
The method descriptions contain an example of the possible values you can send to the API for the query parameters, just as stated in the API explorer.
124+
```javascript
125+
const requestOptions: IRequest.Options = {
126+
params: {
127+
limit: "5",
128+
offset: "10"
129+
}
130+
};
131+
await balancePlatformService.AccountHoldersApi.getAllBalanceAccountsOfAccountHolder("AH32272223222B5CM4MWJ892H", requestOptions);
132+
```
122133

123134
### Step 1: Require the parts of the module you want to use
124135

src/__tests__/balancePlatform.spec.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Client from "../client";
33
import { createClient } from "../__mocks__/base";
44
import BalancePlatform from "../services/balancePlatform";
55
import { balancePlatform } from "../typings";
6+
import {IRequest} from "../typings/requestOptions";
67

78
let client: Client;
89
let balancePlatformService: BalancePlatform;
@@ -166,13 +167,13 @@ describe("Balance Platform", (): void => {
166167
"hasNext": true,
167168
"hasPrevious": false
168169
});
169-
170-
const response: balancePlatform.PaginatedBalanceAccountsResponse = await balancePlatformService.AccountHoldersApi.getAllBalanceAccountsOfAccountHolder("AH32272223222B5CM4MWJ892H", {
170+
const requestOptions: IRequest.Options = {
171171
params: {
172-
"limit": "5",
173-
"offset": "10"
172+
limit: "5",
173+
offset: "10"
174174
}
175-
});
175+
};
176+
const response: balancePlatform.PaginatedBalanceAccountsResponse = await balancePlatformService.AccountHoldersApi.getAllBalanceAccountsOfAccountHolder("AH32272223222B5CM4MWJ892H", requestOptions);
176177

177178
expect(response.balanceAccounts[0].id).toBe("BA32272223222B59K6ZXHBFN6");
178179
});

templates/typescript/api_summary.mustache

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@
22
{{#summary}}
33
* @summary {{&summary}}
44
{{/summary}}
5-
{{#allParams}}
5+
{{#pathParams}}
66
* @param {{paramName}} {@link {{dataType}} } {{description}}
7-
{{/allParams}}
8-
* @param requestOptions {@link IRequest.Options}
7+
{{/pathParams}}
8+
{{#bodyParams}}
9+
* @param {{paramName}} {@link {{dataType}} } {{description}}
10+
{{/bodyParams}}
11+
* @param requestOptions {@link IRequest.Options }
12+
{{#hasQueryParams}}
13+
* @example send query parameters through requestOptions: { params: { {{#queryParams}}{{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}: "{{{dataType}}}"{{^-last}}, {{/-last}}{{/queryParams}} } }
14+
{{/hasQueryParams}}
915
{{#returnType}}
1016
* @return {@link {{.}} }
1117
{{/returnType}}

0 commit comments

Comments
 (0)