@@ -18,6 +18,7 @@ yarn add orb-billing
18
18
19
19
The full API of this library can be found in [ api.md] ( https://www.github.com/orbcorp/orb-node/blob/main/api.md ) .
20
20
21
+ <!-- prettier-ignore -->
21
22
``` js
22
23
import Orb from ' orb-billing' ;
23
24
@@ -38,6 +39,7 @@ main();
38
39
39
40
This library includes TypeScript definitions for all request params and response fields. You may import and use them like so:
40
41
42
+ <!-- prettier-ignore -->
41
43
``` ts
42
44
import Orb from ' orb-billing' ;
43
45
@@ -61,6 +63,7 @@ When the library is unable to connect to the API,
61
63
or if the API returns a non-success status code (i.e., 4xx or 5xx response),
62
64
a subclass of ` APIError ` will be thrown:
63
65
66
+ <!-- prettier-ignore -->
64
67
``` ts
65
68
async function main() {
66
69
const customer = await orb .customers
@@ -173,6 +176,7 @@ The "raw" `Response` returned by `fetch()` can be accessed through the `.asRespo
173
176
174
177
You can also use the ` .withResponse() ` method to get the raw ` Response ` along with the parsed data.
175
178
179
+ <!-- prettier-ignore -->
176
180
``` ts
177
181
const orb = new Orb ();
178
182
@@ -197,12 +201,11 @@ If you would prefer to use a global, web-standards-compliant `fetch` function ev
197
201
(for example, if you are running Node with ` --experimental-fetch ` or using NextJS which polyfills with ` undici ` ),
198
202
add the following import before your first import ` from "Orb" ` :
199
203
200
- <!-- prettier-ignore -->
201
204
``` ts
202
205
// Tell TypeScript and the package to use the global web fetch instead of node-fetch.
203
206
// Note, despite the name, this does not add any polyfills, but expects them to be provided if needed.
204
- import " orb-billing/shims/web" ;
205
- import Orb from " orb-billing" ;
207
+ import ' orb-billing/shims/web' ;
208
+ import Orb from ' orb-billing' ;
206
209
```
207
210
208
211
To do the inverse, add ` import "orb-billing/shims/node" ` (which does import polyfills).
0 commit comments