You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most tests will require you to [setup a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
68
+
Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
69
69
70
70
```bash
71
71
npx prism path/to/your/openapi.yml
@@ -99,7 +99,7 @@ the changes aren't made through the automated pipeline, you may want to make rel
99
99
100
100
### Publish with a GitHub workflow
101
101
102
-
You can release to package managers by using [the `Publish NPM` GitHub action](https://www.github.com/cloudflare/cloudflare-sdk-node/actions/workflows/publish-npm.yml). This will require a setup organization or repository secret to be set up.
102
+
You can release to package managers by using [the `Publish NPM` GitHub action](https://www.github.com/cloudflare/cloudflare-typescript/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up.
Copy file name to clipboardExpand all lines: README.md
+56-19Lines changed: 56 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,12 @@
4
4
5
5
This library provides convenient access to the Cloudflare REST API from server-side TypeScript or JavaScript.
6
6
7
-
The REST API documentation can be found [on developers.cloudflare.com](https://developers.cloudflare.com/api/). The full API of this library can be found in [api.md](api.md).
7
+
The REST API documentation can be found [on developers.cloudflare.com](https://developers.cloudflare.com/api). 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 cloudflare
13
-
# or
14
-
yarn add cloudflare
12
+
npm install cloudflare
15
13
```
16
14
17
15
## Usage
@@ -22,7 +20,10 @@ The full API of this library can be found in [api.md](api.md).
22
20
```js
23
21
importCloudflarefrom'cloudflare';
24
22
25
-
constcloudflare=newCloudflare();
23
+
constcloudflare=newCloudflare({
24
+
apiEmail:process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted
25
+
apiKey:process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted
Alternatively, you can make request a single page at a time:
165
+
166
+
```ts
167
+
let page =awaitcloudflare.accounts.list();
168
+
for (const accountListResponse ofpage.result) {
169
+
console.log(accountListResponse);
170
+
}
171
+
172
+
// Convenience methods are provided for manually paginating:
173
+
while (page.hasNextPage()) {
174
+
page=page.getNextPage();
175
+
// ...
176
+
}
177
+
```
178
+
144
179
## Advanced Usage
145
180
146
181
### Accessing raw Response data (e.g., headers)
@@ -182,7 +217,7 @@ import Cloudflare from 'cloudflare';
182
217
```
183
218
184
219
To do the inverse, add `import "cloudflare/shims/node"` (which does import polyfills).
185
-
This can also be useful if you are getting the wrong TypeScript types for `Response`- more details[here](https://github.com/cloudflare/cloudflare-sdk-node/tree/main/src/_shims#readme).
220
+
This can also be useful if you are getting the wrong TypeScript types for `Response`([more details](https://github.com/cloudflare/cloudflare-typescript/tree/main/src/_shims#readme)).
186
221
187
222
You may also provide a custom `fetch` function when instantiating the client,
188
223
which can be used to inspect or alter the `Request` or `Response` before/after each request:
@@ -192,7 +227,7 @@ import { fetch } from 'undici'; // as one example
@@ -237,7 +274,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con
237
274
238
275
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
239
276
240
-
We are keen for your feedback; please open an [issue](https://www.github.com/cloudflare/cloudflare-sdk-node/issues) with questions, bugs, or suggestions.
277
+
We are keen for your feedback; please open an [issue](https://www.github.com/cloudflare/cloudflare-typescript/issues) with questions, bugs, or suggestions.
0 commit comments