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
* first commit
* Generate zod model
* Fix ajv
* Remove console.log
* Remove unused packages
* Move some deps to dev deps
* Fix build to support importing JSON
* Add generated file to prettierignore
* Drop commented out script
* add isStartOfThread
---------
Co-authored-by: Jordan Drake <jordan@plain.com>
Co-authored-by: Andrew Blaney <andrew@plain.com>
You can find out how to make an API key in our documentation: <https://docs.plain.com/core-api/authentication>
28
30
29
-
## Documentation
31
+
####Documentation
30
32
31
33
Every method in the SDK corresponds to a graphql [query](./src/graphql/queries/) or [mutation](./src/graphql/mutations/).
32
34
@@ -36,7 +38,7 @@ You can find the generated documentation here:
36
38
37
39
If you would like to add a query or mutation please open an issue and we can add it for you.
38
40
39
-
## Error handling
41
+
####Error handling
40
42
41
43
Every SDK method will return an object with either data or an error.
42
44
@@ -62,7 +64,7 @@ function doThing() {
62
64
63
65
An error can be **one of** the below:
64
66
65
-
### MutationError
67
+
######MutationError
66
68
67
69
[(view source)](./src/error.ts)
68
70
This is the richest error type. It is called `MutationError` since it maps to the `MutationError` type in our GraphQL schema and is returned as part of every mutation in our API.
@@ -80,28 +82,43 @@ Every mutation error will contain:
80
82
type: one of `VALIDATION`, `REQUIRED`, `NOT_FOUND`. See [Error codes
81
83
](https://www.plain.com/docs/graphql/error-codes) in our docs for a description of each value.
82
84
83
-
### BadRequestError
85
+
######BadRequestError
84
86
85
87
[(view source)](./src/error.ts)
86
88
Equivalent to a 400 response. If you are using typescript it's unlikely you will run into this since types will prevent this but if you are using javascript this likely means you are providing a wrong input/argument to a query or mutation.
87
89
88
-
### ForbiddenError
90
+
######ForbiddenError
89
91
90
92
[(view source)](./src/error.ts)
91
93
Equivalent to a 401 or 403 response. Normally means your API key doesn't exist or that you are trying to query something that you do not have permissions for.
92
94
93
-
### InternalServerError
95
+
######InternalServerError
94
96
95
97
[(view source)](./src/error.ts)
96
98
Equivalent to a 500 response. If this happens something unexpected within Plain happened.
97
99
98
-
### UnknownError
100
+
######UnknownError
99
101
100
102
[(view source)](./src/error.ts)
101
103
Fallback error type when something unexpected happens.
102
104
105
+
## Webhooks
106
+
107
+
This package also provides functionality to validate our [Webhook payloads](https://www.plain.com/docs/api-reference/webhooks).
When submitting a PR, remember to run `pnpm changeset` and provide an easy to understand description of the changes you're making so that the changelog is populated.
106
123
107
-
When a PR with a changelog is merged a seperate PR will be automatically raised which rolls up any merged changes, handles assigning a new version for release and publishing to NPM.
124
+
When a PR with a changelog is merged a separate PR will be automatically raised which rolls up any merged changes and handles assigning a new version for release and publishing to NPM.
0 commit comments