|
4 | 4 |
|
5 | 5 | This library provides convenient access to the Orb REST API from server-side TypeScript or JavaScript. |
6 | 6 |
|
7 | | -The REST API documentation can be found [on docs.withorb.com](https://docs.withorb.com/reference/api-reference). The full API of this library can be found in [api.md](https://www.github.com/orbcorp/orb-node/blob/main/api.md). |
| 7 | +The REST API documentation can be found [on docs.withorb.com](https://docs.withorb.com/reference/api-reference). The full API of this library can be found in [api.md](api.md). |
8 | 8 |
|
9 | 9 | ## Installation |
10 | 10 |
|
11 | 11 | ```sh |
12 | | -npm install --save orb-billing |
13 | | -# or |
14 | | -yarn add orb-billing |
| 12 | +npm install orb-billing |
15 | 13 | ``` |
16 | 14 |
|
17 | 15 | ## Usage |
18 | 16 |
|
19 | | -The full API of this library can be found in [api.md](https://www.github.com/orbcorp/orb-node/blob/main/api.md). |
| 17 | +The full API of this library can be found in [api.md](api.md). |
20 | 18 |
|
21 | 19 | <!-- prettier-ignore --> |
22 | 20 | ```js |
@@ -68,7 +66,7 @@ a subclass of `APIError` will be thrown: |
68 | 66 | async function main() { |
69 | 67 | const customer = await orb.customers |
70 | 68 | .create({ email: 'example-customer@withorb.com', name: 'My Customer' }) |
71 | | - .catch((err) => { |
| 69 | + .catch(async (err) => { |
72 | 70 | if (err instanceof Orb.APIError) { |
73 | 71 | console.log(err.status); // 400 |
74 | 72 | console.log(err.name); // BadRequestError |
@@ -209,7 +207,7 @@ import Orb from 'orb-billing'; |
209 | 207 | ``` |
210 | 208 |
|
211 | 209 | To do the inverse, add `import "orb-billing/shims/node"` (which does import polyfills). |
212 | | -This can also be useful if you are getting the wrong TypeScript types for `Response` - more details [here](https://github.com/orbcorp/orb-node/tree/main/src/_shims#readme). |
| 210 | +This can also be useful if you are getting the wrong TypeScript types for `Response` ([more details](https://github.com/orbcorp/orb-node/tree/main/src/_shims#readme)). |
213 | 211 |
|
214 | 212 | You may also provide a custom `fetch` function when instantiating the client, |
215 | 213 | which can be used to inspect or alter the `Request` or `Response` before/after each request: |
@@ -240,18 +238,20 @@ If you would like to disable or customize this behavior, for example to use the |
240 | 238 | <!-- prettier-ignore --> |
241 | 239 | ```ts |
242 | 240 | import http from 'http'; |
243 | | -import HttpsProxyAgent from 'https-proxy-agent'; |
| 241 | +import { HttpsProxyAgent } from 'https-proxy-agent'; |
244 | 242 |
|
245 | 243 | // Configure the default for all requests: |
246 | 244 | const orb = new Orb({ |
247 | 245 | httpAgent: new HttpsProxyAgent(process.env.PROXY_URL), |
248 | 246 | }); |
249 | 247 |
|
250 | 248 | // Override per-request: |
251 | | -await orb.customers.create({ email: 'example-customer@withorb.com', name: 'My Customer' }, { |
252 | | - baseURL: 'http://localhost:8080/test-api', |
253 | | - httpAgent: new http.Agent({ keepAlive: false }), |
254 | | -}) |
| 249 | +await orb.customers.create( |
| 250 | + { email: 'example-customer@withorb.com', name: 'My Customer' }, |
| 251 | + { |
| 252 | + httpAgent: new http.Agent({ keepAlive: false }), |
| 253 | + }, |
| 254 | +); |
255 | 255 | ``` |
256 | 256 |
|
257 | 257 | ## Semantic Versioning |
|
0 commit comments