Skip to content

Commit

Permalink
subscriptions.create no longer can return 404
Browse files Browse the repository at this point in the history
  • Loading branch information
zefir-git committed Sep 1, 2023
1 parent 5a35dcc commit 89bb378
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 13 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,6 @@ Subscribe to newsletter
- `email` <code>[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)</code> Subscriber's email address.
- `data` <code>[Record](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)&lt;[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number) | [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)></code> Additional data that this newsletter requires.
- Returns: <code>[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;[Cloudnode.ApiResponse](#class-cloudnodeapiresponset)&lt;[Cloudnode.NewsletterSubscription](#interface-cloudnodenewslettersubscription)>></code>
- Throws: <code>[Cloudnode.Error](#interface-cloudnodeerror) & {code: "RESOURCE_NOT_FOUND"}</code>
- Throws: <code>[Cloudnode.Error](#interface-cloudnodeerror) & {code: "INVALID_DATA"}</code>
- Throws: <code>[Cloudnode.Error](#interface-cloudnodeerror) & {code: "CONFLICT"}</code>
- Throws: <code>[Cloudnode.Error](#interface-cloudnodeerror) & {code: "RATE_LIMITED"}</code>
Expand Down
3 changes: 1 addition & 2 deletions browser/Cloudnode.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,14 @@ class Cloudnode {
* @param newsletter The ID of the newsletter to subscribe to
* @param email Subscriber's email address
* @param data Additional data that this newsletter requires
* @throws {Cloudnode.Error & {code: "RESOURCE_NOT_FOUND"}}
* @throws {Cloudnode.Error & {code: "INVALID_DATA"}}
* @throws {Cloudnode.Error & {code: "CONFLICT"}}
* @throws {Cloudnode.Error & {code: "RATE_LIMITED"}}
* @throws {Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"}}
* @throws {Cloudnode.Error & {code: "MAINTENANCE"}}
*/
create: async (newsletter, email, data) => {
return await this.#sendRequest({ "type": "operation", "description": "Subscribe to newsletter", "method": "POST", "path": "/subscriptions", "parameters": { "body": { "newsletter": { "description": "The ID of the newsletter to subscribe to", "type": "string", "required": true }, "email": { "description": "Subscriber's email address", "type": "string", "required": true }, "data": { "description": "Additional data that this newsletter requires", "type": "Record<string, string | number | boolean>", "required": false } } }, "returns": [{ "status": 201, "type": "NewsletterSubscription" }, { "status": 404, "type": "Error & {code: \"RESOURCE_NOT_FOUND\"}" }, { "status": 422, "type": "Error & {code: \"INVALID_DATA\"}" }, { "status": 409, "type": "Error & {code: \"CONFLICT\"}" }, { "status": 429, "type": "Error & {code: \"RATE_LIMITED\"}" }, { "status": 500, "type": "Error & {code: \"INTERNAL_SERVER_ERROR\"}" }, { "status": 503, "type": "Error & {code: \"MAINTENANCE\"}" }] }, {}, {}, { newsletter, email, data });
return await this.#sendRequest({ "type": "operation", "description": "Subscribe to newsletter", "method": "POST", "path": "/subscriptions", "parameters": { "body": { "newsletter": { "description": "The ID of the newsletter to subscribe to", "type": "string", "required": true }, "email": { "description": "Subscriber's email address", "type": "string", "required": true }, "data": { "description": "Additional data that this newsletter requires", "type": "Record<string, string | number | boolean>", "required": false } } }, "returns": [{ "status": 201, "type": "NewsletterSubscription" }, { "status": 422, "type": "Error & {code: \"INVALID_DATA\"}" }, { "status": 409, "type": "Error & {code: \"CONFLICT\"}" }, { "status": 429, "type": "Error & {code: \"RATE_LIMITED\"}" }, { "status": 500, "type": "Error & {code: \"INTERNAL_SERVER_ERROR\"}" }, { "status": 503, "type": "Error & {code: \"MAINTENANCE\"}" }] }, {}, {}, { newsletter, email, data });
},
/**
* Unsubscribe from newsletter
Expand Down
2 changes: 1 addition & 1 deletion browser/Cloudnode.min.js

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -648,10 +648,6 @@
"status": 201,
"type": "NewsletterSubscription"
},
{
"status": 404,
"type": "Error & {code: \"RESOURCE_NOT_FOUND\"}"
},
{
"status": 422,
"type": "Error & {code: \"INVALID_DATA\"}"
Expand Down
1 change: 0 additions & 1 deletion src/Cloudnode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ declare class Cloudnode {
* @param newsletter The ID of the newsletter to subscribe to
* @param email Subscriber's email address
* @param data Additional data that this newsletter requires
* @throws {Cloudnode.Error & {code: "RESOURCE_NOT_FOUND"}}
* @throws {Cloudnode.Error & {code: "INVALID_DATA"}}
* @throws {Cloudnode.Error & {code: "CONFLICT"}}
* @throws {Cloudnode.Error & {code: "RATE_LIMITED"}}
Expand Down
3 changes: 1 addition & 2 deletions src/Cloudnode.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,14 @@ class Cloudnode {
* @param newsletter The ID of the newsletter to subscribe to
* @param email Subscriber's email address
* @param data Additional data that this newsletter requires
* @throws {Cloudnode.Error & {code: "RESOURCE_NOT_FOUND"}}
* @throws {Cloudnode.Error & {code: "INVALID_DATA"}}
* @throws {Cloudnode.Error & {code: "CONFLICT"}}
* @throws {Cloudnode.Error & {code: "RATE_LIMITED"}}
* @throws {Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"}}
* @throws {Cloudnode.Error & {code: "MAINTENANCE"}}
*/
create: async (newsletter, email, data) => {
return await this.#sendRequest({ "type": "operation", "description": "Subscribe to newsletter", "method": "POST", "path": "/subscriptions", "parameters": { "body": { "newsletter": { "description": "The ID of the newsletter to subscribe to", "type": "string", "required": true }, "email": { "description": "Subscriber's email address", "type": "string", "required": true }, "data": { "description": "Additional data that this newsletter requires", "type": "Record<string, string | number | boolean>", "required": false } } }, "returns": [{ "status": 201, "type": "NewsletterSubscription" }, { "status": 404, "type": "Error & {code: \"RESOURCE_NOT_FOUND\"}" }, { "status": 422, "type": "Error & {code: \"INVALID_DATA\"}" }, { "status": 409, "type": "Error & {code: \"CONFLICT\"}" }, { "status": 429, "type": "Error & {code: \"RATE_LIMITED\"}" }, { "status": 500, "type": "Error & {code: \"INTERNAL_SERVER_ERROR\"}" }, { "status": 503, "type": "Error & {code: \"MAINTENANCE\"}" }] }, {}, {}, { newsletter, email, data });
return await this.#sendRequest({ "type": "operation", "description": "Subscribe to newsletter", "method": "POST", "path": "/subscriptions", "parameters": { "body": { "newsletter": { "description": "The ID of the newsletter to subscribe to", "type": "string", "required": true }, "email": { "description": "Subscriber's email address", "type": "string", "required": true }, "data": { "description": "Additional data that this newsletter requires", "type": "Record<string, string | number | boolean>", "required": false } } }, "returns": [{ "status": 201, "type": "NewsletterSubscription" }, { "status": 422, "type": "Error & {code: \"INVALID_DATA\"}" }, { "status": 409, "type": "Error & {code: \"CONFLICT\"}" }, { "status": 429, "type": "Error & {code: \"RATE_LIMITED\"}" }, { "status": 500, "type": "Error & {code: \"INTERNAL_SERVER_ERROR\"}" }, { "status": 503, "type": "Error & {code: \"MAINTENANCE\"}" }] }, {}, {}, { newsletter, email, data });
},
/**
* Unsubscribe from newsletter
Expand Down
3 changes: 1 addition & 2 deletions src/Cloudnode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,15 +294,14 @@ class Cloudnode {
* @param newsletter The ID of the newsletter to subscribe to
* @param email Subscriber's email address
* @param data Additional data that this newsletter requires
* @throws {Cloudnode.Error & {code: "RESOURCE_NOT_FOUND"}}
* @throws {Cloudnode.Error & {code: "INVALID_DATA"}}
* @throws {Cloudnode.Error & {code: "CONFLICT"}}
* @throws {Cloudnode.Error & {code: "RATE_LIMITED"}}
* @throws {Cloudnode.Error & {code: "INTERNAL_SERVER_ERROR"}}
* @throws {Cloudnode.Error & {code: "MAINTENANCE"}}
*/
create: async (newsletter: string, email: string, data?: Record<string, string | number | boolean>): Promise<Cloudnode.ApiResponse<Cloudnode.NewsletterSubscription>> => {
return await this.#sendRequest<Cloudnode.NewsletterSubscription>({"type":"operation","description":"Subscribe to newsletter","method":"POST","path":"/subscriptions","parameters":{"body":{"newsletter":{"description":"The ID of the newsletter to subscribe to","type":"string","required":true},"email":{"description":"Subscriber's email address","type":"string","required":true},"data":{"description":"Additional data that this newsletter requires","type":"Record<string, string | number | boolean>","required":false}}},"returns":[{"status":201,"type":"NewsletterSubscription"},{"status":404,"type":"Error & {code: \"RESOURCE_NOT_FOUND\"}"},{"status":422,"type":"Error & {code: \"INVALID_DATA\"}"},{"status":409,"type":"Error & {code: \"CONFLICT\"}"},{"status":429,"type":"Error & {code: \"RATE_LIMITED\"}"},{"status":500,"type":"Error & {code: \"INTERNAL_SERVER_ERROR\"}"},{"status":503,"type":"Error & {code: \"MAINTENANCE\"}"}]}, {}, {}, {newsletter, email, data});
return await this.#sendRequest<Cloudnode.NewsletterSubscription>({"type":"operation","description":"Subscribe to newsletter","method":"POST","path":"/subscriptions","parameters":{"body":{"newsletter":{"description":"The ID of the newsletter to subscribe to","type":"string","required":true},"email":{"description":"Subscriber's email address","type":"string","required":true},"data":{"description":"Additional data that this newsletter requires","type":"Record<string, string | number | boolean>","required":false}}},"returns":[{"status":201,"type":"NewsletterSubscription"},{"status":422,"type":"Error & {code: \"INVALID_DATA\"}"},{"status":409,"type":"Error & {code: \"CONFLICT\"}"},{"status":429,"type":"Error & {code: \"RATE_LIMITED\"}"},{"status":500,"type":"Error & {code: \"INTERNAL_SERVER_ERROR\"}"},{"status":503,"type":"Error & {code: \"MAINTENANCE\"}"}]}, {}, {}, {newsletter, email, data});
},
/**
* Unsubscribe from newsletter
Expand Down

0 comments on commit 89bb378

Please sign in to comment.