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
{{ message }}
This repository was archived by the owner on Oct 10, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+4-8Lines changed: 4 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,6 @@
1
1
# CONTRIBUTING
2
2
3
-
Contributions are always welcome, no matter how large or small. Before contributing,
4
-
please read the [code of conduct](CODE_OF_CONDUCT.md).
3
+
Contributions are always welcome, no matter how large or small. Before contributing, please read the [code of conduct](CODE_OF_CONDUCT.md).
5
4
6
5
## Setup
7
6
@@ -18,8 +17,7 @@ You can also use yarn.
18
17
19
18
## Testing
20
19
21
-
This repo uses [ava](https://github.com/avajs/ava) for testing.
22
-
Any files in the `src` directory that have a `.test.js` file extension are automatically detected and run as tests.
20
+
This repo uses [ava](https://github.com/avajs/ava) for testing. Any files in the `src` directory that have a `.test.js` file extension are automatically detected and run as tests.
23
21
24
22
We also test for a few other variables:
25
23
@@ -30,11 +28,9 @@ We also test for a few other variables:
30
28
31
29
## Architecture
32
30
33
-
We target Node.js LTS and stable environments, and aim for basic modern browser support when possible.
34
-
In order to facilitate simple contributions, we avoided any kind of build steps.
31
+
We target Node.js LTS and stable environments, and aim for basic modern browser support when possible. In order to facilitate simple contributions, we avoided any kind of build steps.
35
32
36
-
If you need to add new API routes, please add them to the [open-api](https://github.com/netlify/open-api) repo.
37
-
This client will automatically inherent the new routes from that module.
33
+
If you need to add new API routes, please add them to the [open-api](https://github.com/netlify/open-api) repo. This client will automatically inherent the new routes from that module.
38
34
39
35
Projects that depend heavily on this client that should be taken into consideration when making changes:
Copy file name to clipboardExpand all lines: README.md
+9-19Lines changed: 9 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,31 +35,25 @@ Create a new instance of the Netlify API client with the provided `accessToken`.
35
35
36
36
### `client.accessToken`
37
37
38
-
A setter/getter that returns the `accessToken` that the client is configured to use.
39
-
You can set this after the class is instantiated, and all subsequent calls will use the newly set `accessToken`.
38
+
A setter/getter that returns the `accessToken` that the client is configured to use. You can set this after the class is instantiated, and all subsequent calls will use the newly set `accessToken`.
40
39
41
40
### `client.basePath`
42
41
43
42
A getter that returns the formatted base URL of the endpoint the client is configured to use.
44
43
45
44
### Open API Client methods
46
45
47
-
The client is dynamically generated from the [open-api](https://github.com/netlify/open-api) definition file.
48
-
Each method is is named after the `operationId` name of each endpoint action.
49
-
**To see list of available operations see the [open-api website](https://open-api.netlify.com/)**.
46
+
The client is dynamically generated from the [open-api](https://github.com/netlify/open-api) definition file. Each method is is named after the `operationId` name of each endpoint action. **To see list of available operations see the [open-api website](https://open-api.netlify.com/)**.
50
47
51
48
Every open-api method has the following signature:
Perform a call to the given endpoint corresponding with the `operationId`.
56
-
Returns promise that will resolve with the body of the response, or reject with an error with details about the request attached.
57
-
Rejects if the `status` > 400.
58
-
Successful response objects have `status` and `statusText` properties on their prototype.
52
+
Perform a call to the given endpoint corresponding with the `operationId`. Returns promise that will resolve with the body of the response, or reject with an error with details about the request attached. Rejects if the `status` > 400. Successful response objects have `status` and `statusText` properties on their prototype.
59
53
60
-
`params` is an object that includes any of the required or optional endpoint parameters.
61
-
`params.body` should be an object which gets serialized to JSON automatically.
62
-
If the endpoint accepts `binary`, `params.body` can be a Node.js readable stream.
54
+
-`params` is an object that includes any of the required or optional endpoint parameters.
55
+
-`params.body` should be an object which gets serialized to JSON automatically.
56
+
-If the endpoint accepts `binary`, `params.body` can be a Node.js readable stream.
63
57
64
58
```js
65
59
// example params
@@ -72,8 +66,7 @@ If the endpoint accepts `binary`, `params.body` can be a Node.js readable stream
72
66
}
73
67
```
74
68
75
-
Optional `opts` can include any property you want passed to `node-fetch`.
76
-
The `headers` property is merged with some `defaultHeaders`.
69
+
Optional `opts` can include any property you want passed to `node-fetch`. The `headers` property is merged with some `defaultHeaders`.
77
70
78
71
```js
79
72
// example opts
@@ -102,18 +95,15 @@ async function getSomeData () {
102
95
}
103
96
```
104
97
105
-
If the request response includes `json` in the `contentType` header, fetch will deserialize the JSON body.
106
-
Otherwise the `text` of the response is returned.
98
+
If the request response includes `json` in the `contentType` header, fetch will deserialize the JSON body. Otherwise the `text` of the response is returned.
107
99
108
100
### API Flow Methods
109
101
110
102
Some methods have been added in addition to the open API methods that make certain actions simpler to perform.
Pass in a [`ticket`](https://open-api.netlify.com/#model-ticket) and get back an `accessToken`.
115
-
Call this with the response from a `client.createTicket({ client_id })` call.
116
-
Automatically sets the `accessToken` to `this.accessToken` and returns `accessToken` for the consumer to save for later.
106
+
Pass in a [`ticket`](https://open-api.netlify.com/#model-ticket) and get back an `accessToken`. Call this with the response from a `client.createTicket({ client_id })` call. Automatically sets the `accessToken` to `this.accessToken` and returns `accessToken` for the consumer to save for later.
0 commit comments