Skip to content

Commit

Permalink
change add error definition
Browse files Browse the repository at this point in the history
  • Loading branch information
tatarco committed Dec 19, 2024
1 parent 3a14f9f commit 5129aa9
Show file tree
Hide file tree
Showing 17 changed files with 197 additions and 45 deletions.
20 changes: 14 additions & 6 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
lockVersion: 2.0.0
id: 6bff3a53-3f0b-40b4-942f-ff70dc583ae5
management:
docChecksum: 638752126a119d018ef8df6f0469c2d5
docChecksum: 16dd020f6df7a2248312d6e6929c5bd8
docVersion: "1.0"
speakeasyVersion: 1.456.0
speakeasyVersion: 1.456.1
generationVersion: 2.481.0
releaseVersion: 0.0.1-alpha.126
configChecksum: 321610cbe190b4daaf2a167aaf872e83
releaseVersion: 0.0.1-alpha.128
configChecksum: 81be7c124849006891a1ec2be722fec7
published: true
features:
typescript:
Expand Down Expand Up @@ -56,6 +56,7 @@ generatedFiles:
- docs/models/components/addsubscribersrequestdto.md
- docs/models/components/assignsubscribertotopicdto.md
- docs/models/components/backoffunit.md
- docs/models/components/bulkcreatesubscriberresponsedto.md
- docs/models/components/bulksubscribercreatedto.md
- docs/models/components/bulktriggereventdto.md
- docs/models/components/channel.md
Expand All @@ -68,6 +69,7 @@ generatedFiles:
- docs/models/components/channelsettingsproviderid.md
- docs/models/components/channeltypeenum.md
- docs/models/components/content.md
- docs/models/components/createdsubscriberdto.md
- docs/models/components/createintegrationrequestdto.md
- docs/models/components/createintegrationrequestdtochannel.md
- docs/models/components/createsubscriberrequestdto.md
Expand Down Expand Up @@ -96,6 +98,7 @@ generatedFiles:
- docs/models/components/emailblockstyles.md
- docs/models/components/emailblocktype.md
- docs/models/components/failedassignmentsdto.md
- docs/models/components/failedoperationdto.md
- docs/models/components/feedid.md
- docs/models/components/feedidentifier.md
- docs/models/components/feedresponsedto.md
Expand Down Expand Up @@ -182,6 +185,7 @@ generatedFiles:
- docs/models/components/type.md
- docs/models/components/unit.md
- docs/models/components/unseencountresponse.md
- docs/models/components/updatedsubscriberdto.md
- docs/models/components/updateintegrationrequestdto.md
- docs/models/components/updatesubscriberchannelrequestdto.md
- docs/models/components/updatesubscriberchannelrequestdtoproviderid.md
Expand Down Expand Up @@ -385,13 +389,15 @@ generatedFiles:
- src/models/components/actortypeenum.ts
- src/models/components/addsubscribersrequestdto.ts
- src/models/components/assignsubscribertotopicdto.ts
- src/models/components/bulkcreatesubscriberresponsedto.ts
- src/models/components/bulksubscribercreatedto.ts
- src/models/components/bulktriggereventdto.ts
- src/models/components/channelcredentials.ts
- src/models/components/channelcredentialsdto.ts
- src/models/components/channelpreference.ts
- src/models/components/channelsettings.ts
- src/models/components/channeltypeenum.ts
- src/models/components/createdsubscriberdto.ts
- src/models/components/createintegrationrequestdto.ts
- src/models/components/createsubscriberrequestdto.ts
- src/models/components/createtopicrequestdto.ts
Expand All @@ -407,6 +413,7 @@ generatedFiles:
- src/models/components/emailblock.ts
- src/models/components/emailblockstyles.ts
- src/models/components/failedassignmentsdto.ts
- src/models/components/failedoperationdto.ts
- src/models/components/feedresponsedto.ts
- src/models/components/filtertopicsresponsedto.ts
- src/models/components/getsubscriberpreferencesresponsedto.ts
Expand Down Expand Up @@ -453,6 +460,7 @@ generatedFiles:
- src/models/components/triggereventtoallrequestdto.ts
- src/models/components/triggerrecipientstypeenum.ts
- src/models/components/unseencountresponse.ts
- src/models/components/updatedsubscriberdto.ts
- src/models/components/updateintegrationrequestdto.ts
- src/models/components/updatesubscriberchannelrequestdto.ts
- src/models/components/updatesubscriberglobalpreferencesrequestdto.ts
Expand Down Expand Up @@ -876,14 +884,14 @@ examples:
SubscribersController_bulkCreateSubscribers:
speakeasy-default-subscribers-controller-bulk-create-subscribers:
requestBody:
application/json: {"subscribers": ["<value>"]}
application/json: {"subscribers": [{"subscriberId": "<id>", "email": "[email protected]"}]}
responses:
"400":
application/json: {"statusCode": 404, "timestamp": "2024-12-12T13:00:00Z", "path": "/api/v1/resource", "message": "Resource not found."}
"404":
application/json: {"data": {"statusCode": 404, "timestamp": "2024-12-12T13:00:00Z", "path": "/api/v1/resource", "message": "Resource not found.", "ctx": {"workflowId": "some_wf_id", "stepId": "some_wf_id"}, "errorId": "abc123"}}
"200":
application/json: {"statusCode": 404, "timestamp": "2024-12-12T13:00:00Z", "path": "/api/v1/resource", "message": "Resource not found.", "ctx": {"workflowId": "some_wf_id", "stepId": "some_wf_id"}, "errorId": "abc123", "errors": {"fieldName1": {"messages": ["Field is required", "Invalid format"], "value": "xx xx xx "}, "fieldName2": {"messages": ["Field is required", "Invalid format"], "value": "xx xx xx "}, "fieldName3": {"messages": ["Field is required", "Invalid format"], "value": "xx xx xx "}, "fieldName4": {"messages": ["Field is required", "Invalid format"], "value": "xx xx xx "}}}
application/json: {"updated": [{"subscriberId": "<id>"}], "created": [{"subscriberId": "<id>"}, {"subscriberId": "<id>"}, {"subscriberId": "<id>"}]}
"422":
application/json: {"statusCode": 404, "timestamp": "2024-12-12T13:00:00Z", "path": "/api/v1/resource", "message": "Resource not found.", "ctx": {"workflowId": "some_wf_id", "stepId": "some_wf_id"}, "errorId": "abc123", "errors": {"fieldName1": {"messages": ["Field is required", "Invalid format"], "value": "xx xx xx "}, "fieldName2": {"messages": ["Field is required", "Invalid format"], "value": "xx xx xx "}, "fieldName3": {"messages": ["Field is required", "Invalid format"], "value": "xx xx xx "}, "fieldName4": {"messages": ["Field is required", "Invalid format"], "value": "xx xx xx "}}}
SubscribersController_updateSubscriberChannel:
Expand Down
2 changes: 1 addition & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ generation:
oAuth2ClientCredentialsEnabled: false
oAuth2PasswordEnabled: false
typescript:
version: 0.0.1-alpha.126
version: 0.0.1-alpha.128
additionalDependencies:
dependencies: {}
devDependencies: {}
Expand Down
12 changes: 6 additions & 6 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
speakeasyVersion: 1.456.0
speakeasyVersion: 1.456.1
sources:
json-development:
sourceNamespace: json-development
sourceRevisionDigest: sha256:d2461f9ae88ae296caaf15a81766e0dbd9c104d62cb696d5662f37fcbcbfba71
sourceBlobDigest: sha256:3f431ed8f87f961890f780119e9a75f57f720b9217d80bcac563bbdfef6a5719
sourceRevisionDigest: sha256:6b7ea4e46ae0d4f85455a1a54b82bf1a14fa9a7490515c236363c785828cb980
sourceBlobDigest: sha256:21bc64671ffeff3df38a52c03aac7dc087a209a4eb011ceec5f07aa225bc2f52
tags:
- latest
- "1.0"
targets:
my-first-target:
source: json-development
sourceNamespace: json-development
sourceRevisionDigest: sha256:d2461f9ae88ae296caaf15a81766e0dbd9c104d62cb696d5662f37fcbcbfba71
sourceBlobDigest: sha256:3f431ed8f87f961890f780119e9a75f57f720b9217d80bcac563bbdfef6a5719
sourceRevisionDigest: sha256:6b7ea4e46ae0d4f85455a1a54b82bf1a14fa9a7490515c236363c785828cb980
sourceBlobDigest: sha256:21bc64671ffeff3df38a52c03aac7dc087a209a4eb011ceec5f07aa225bc2f52
codeSamplesNamespace: code-samples-typescript
codeSamplesRevisionDigest: sha256:30742994c9c6ed431f0862e1cadee78f62cd52bac3a8f687c6c2d6e595df7f4b
codeSamplesRevisionDigest: sha256:111aa8a6c742b4454476dbe0f0fc892684bcfb4a56814f7a3422e9d2bc5b9b0e
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
Expand Down
11 changes: 7 additions & 4 deletions docs/models/components/bulksubscribercreatedto.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ import { BulkSubscriberCreateDto } from "@novu/api/models/components";

let value: BulkSubscriberCreateDto = {
subscribers: [
"<value>",
{
subscriberId: "<id>",
email: "[email protected]",
},
],
};
```

## Fields

| Field | Type | Required | Description |
| ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- |
| `subscribers` | *string*[] | :heavy_check_mark: | An array of subscribers to be created in bulk. |
| Field | Type | Required | Description | Example |
| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ |
| `subscribers` | [components.CreateSubscriberRequestDto](../../models/components/createsubscriberrequestdto.md)[] | :heavy_check_mark: | An array of subscribers to be created in bulk. | [<br/>{<br/>"email": "[email protected]",<br/>"name": "John Doe"<br/>}<br/>] |
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,27 @@ let value: SubscribersControllerBulkCreateSubscribersResponse = {
"<value>",
],
},
result: {
updated: [
{
subscriberId: "<id>",
},
],
created: [
{
subscriberId: "<id>",
},
],
failed: [
{},
],
},
};
```

## Fields

| Field | Type | Required | Description |
| -------------------------- | -------------------------- | -------------------------- | -------------------------- |
| `headers` | Record<string, *string*[]> | :heavy_check_mark: | N/A |
| Field | Type | Required | Description |
| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `headers` | Record<string, *string*[]> | :heavy_check_mark: | N/A |
| `result` | [components.BulkCreateSubscriberResponseDto](../../models/components/bulkcreatesubscriberresponsedto.md) | :heavy_check_mark: | N/A |
10 changes: 8 additions & 2 deletions docs/sdks/subscribers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,10 @@ const novu = new Novu({
async function run() {
const result = await novu.subscribers.createBulk({
subscribers: [
"<value>",
{
subscriberId: "<id>",
email: "[email protected]",
},
],
});

Expand Down Expand Up @@ -443,7 +446,10 @@ const novu = new NovuCore({
async function run() {
const res = await subscribersCreateBulk(novu, {
subscribers: [
"<value>",
{
subscriberId: "<id>",
email: "[email protected]",
},
],
});

Expand Down
2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{
"name": "@novu/api",
"version": "0.0.1-alpha.126",
"version": "0.0.1-alpha.128",
"exports": {
".": "./src/index.ts",
"./models/errors": "./src/models/errors/index.ts",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@novu/api",
"version": "0.0.1-alpha.126",
"version": "0.0.1-alpha.128",
"author": "Novu",
"main": "./index.js",
"sideEffects": false,
Expand Down
2 changes: 1 addition & 1 deletion sources/code-samples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ actions:
"x-codeSamples":
- "lang": "typescript"
"label": "TypeScript"
"source": "import { Novu } from \"@novu/api\";\n\nconst novu = new Novu({\n apiKey: \"<YOUR_API_KEY_HERE>\",\n});\n\nasync function run() {\n const result = await novu.subscribers.createBulk({\n subscribers: [\n \"<value>\",\n ],\n });\n\n // Handle the result\n console.log(result);\n}\n\nrun();"
"source": "import { Novu } from \"@novu/api\";\n\nconst novu = new Novu({\n apiKey: \"<YOUR_API_KEY_HERE>\",\n});\n\nasync function run() {\n const result = await novu.subscribers.createBulk({\n subscribers: [\n {\n subscriberId: \"<id>\",\n email: \"[email protected]\",\n },\n ],\n });\n\n // Handle the result\n console.log(result);\n}\n\nrun();"
- target: $["paths"]["/v1/subscribers/{subscriberId}"]["delete"]
update:
"x-codeSamples":
Expand Down
110 changes: 107 additions & 3 deletions sources/json-development.json
Original file line number Diff line number Diff line change
Expand Up @@ -5518,8 +5518,38 @@
}
},
"responses": {
"201": {
"description": ""
"200": {
"description": "OK",
"headers": {
"Content-Type": {
"$ref": "#/components/headers/Content-Type"
},
"RateLimit-Limit": {
"$ref": "#/components/headers/RateLimit-Limit"
},
"RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimit-Remaining"
},
"RateLimit-Reset": {
"$ref": "#/components/headers/RateLimit-Reset"
},
"RateLimit-Policy": {
"$ref": "#/components/headers/RateLimit-Policy"
},
"Idempotency-Key": {
"$ref": "#/components/headers/Idempotency-Key"
},
"Idempotency-Replay": {
"$ref": "#/components/headers/Idempotency-Replay"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BulkCreateSubscriberResponseDto"
}
}
}
},
"400": {
"description": "Bad Request",
Expand Down Expand Up @@ -14907,14 +14937,88 @@
"subscriberId"
]
},
"UpdatedSubscriberDto": {
"type": "object",
"properties": {
"subscriberId": {
"type": "string",
"description": "The ID of the subscriber that was updated."
}
},
"required": [
"subscriberId"
]
},
"CreatedSubscriberDto": {
"type": "object",
"properties": {
"subscriberId": {
"type": "string",
"description": "The ID of the subscriber that was created."
}
},
"required": [
"subscriberId"
]
},
"FailedOperationDto": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The error message associated with the failed operation."
},
"subscriberId": {
"type": "string",
"description": "The subscriber ID associated with the failed operation. This field is optional."
}
}
},
"BulkCreateSubscriberResponseDto": {
"type": "object",
"properties": {
"updated": {
"description": "An array of subscribers that were successfully updated.",
"type": "array",
"items": {
"$ref": "#/components/schemas/UpdatedSubscriberDto"
}
},
"created": {
"description": "An array of subscribers that were successfully created.",
"type": "array",
"items": {
"$ref": "#/components/schemas/CreatedSubscriberDto"
}
},
"failed": {
"description": "An array of failed operations with error messages and optional subscriber IDs.",
"type": "array",
"items": {
"$ref": "#/components/schemas/FailedOperationDto"
}
}
},
"required": [
"updated",
"created",
"failed"
]
},
"BulkSubscriberCreateDto": {
"type": "object",
"properties": {
"subscribers": {
"description": "An array of subscribers to be created in bulk.",
"example": [
{
"email": "[email protected]",
"name": "John Doe"
}
],
"type": "array",
"items": {
"type": "string"
"$ref": "#/components/schemas/CreateSubscriberRequestDto"
}
}
},
Expand Down
Loading

0 comments on commit 5129aa9

Please sign in to comment.