Skip to content

Commit

Permalink
add idempotency response object
Browse files Browse the repository at this point in the history
  • Loading branch information
tatarco committed Jan 16, 2025
1 parent 3791746 commit 25bfccd
Show file tree
Hide file tree
Showing 29 changed files with 1,027 additions and 42 deletions.
23 changes: 20 additions & 3 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: 063605e0a945a04df5e4c80be6f376f3
docChecksum: 716e0b0d4b1a1deb680c66ced8aaf604
docVersion: "1.0"
speakeasyVersion: 1.468.9
generationVersion: 2.493.21
releaseVersion: 0.0.2
configChecksum: ab90f07a008f94a81c3f451548235962
releaseVersion: 0.0.3
configChecksum: 7e0a31d85fba4b53ee1a0de25503f776
published: true
features:
typescript:
Expand Down Expand Up @@ -247,6 +247,8 @@ generatedFiles:
- docs/models/operations/eventscontrollertriggerbulkresponse.md
- docs/models/operations/eventscontrollertriggerrequest.md
- docs/models/operations/eventscontrollertriggerresponse.md
- docs/models/operations/healthcontrollergeneraterandomnumberrequest.md
- docs/models/operations/healthcontrollergeneraterandomnumberresponse.md
- docs/models/operations/healthcontrollerhealthcheckrequest.md
- docs/models/operations/healthcontrollerhealthcheckresponsebody.md
- docs/models/operations/healthcontrollertestidempotencyrequest.md
Expand Down Expand Up @@ -360,6 +362,7 @@ generatedFiles:
- jsr.json
- package.json
- src/core.ts
- src/funcs/adminGenerateRandomNumber.ts
- src/funcs/adminHealthControllerHealthCheck.ts
- src/funcs/adminTestIdempotency.ts
- src/funcs/cancel.ts
Expand Down Expand Up @@ -561,6 +564,7 @@ generatedFiles:
- src/models/operations/eventscontrollercancel.ts
- src/models/operations/eventscontrollertrigger.ts
- src/models/operations/eventscontrollertriggerbulk.ts
- src/models/operations/healthcontrollergeneraterandomnumber.ts
- src/models/operations/healthcontrollerhealthcheck.ts
- src/models/operations/healthcontrollertestidempotency.ts
- src/models/operations/index.ts
Expand Down Expand Up @@ -1751,6 +1755,19 @@ examples:
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"}
"201":
application/json: {"number": 1}
HealthController_generateRandomNumber:
speakeasy-default-health-controller-generate-random-number:
responses:
"201":
application/json: {"number": 1}
"400":
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"}
"414":
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"}
"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 "}}}
"500":
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"}
generatedTests:
EventsController_trigger: "2024-12-24T08:36:06+01:00"
EventsController_triggerBulk: "2024-12-24T08:36:06+01:00"
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.2
version: 0.0.3
additionalDependencies:
dependencies: {}
devDependencies: {}
Expand Down
10 changes: 5 additions & 5 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ speakeasyVersion: 1.468.9
sources:
json-development:
sourceNamespace: json-development
sourceRevisionDigest: sha256:2e8f0daa01625fca6f7998a24cd9ced9a70c0ccf44b28db8823746e3d6341c2a
sourceBlobDigest: sha256:3654c6fb51c3c34da42c6d5796f31ebdf4af7bf1f3f59f077646c1a3a07aca72
sourceRevisionDigest: sha256:4e8c9bba01d659774b24035f15b6256a6f769d542b2842ab1ded70deb136da43
sourceBlobDigest: sha256:a9cf589411b4bdd4d07d2aae07a00006c85ba5f3359bfa3931b1e929df64795a
tags:
- latest
- "1.0"
targets:
my-first-target:
source: json-development
sourceNamespace: json-development
sourceRevisionDigest: sha256:2e8f0daa01625fca6f7998a24cd9ced9a70c0ccf44b28db8823746e3d6341c2a
sourceBlobDigest: sha256:3654c6fb51c3c34da42c6d5796f31ebdf4af7bf1f3f59f077646c1a3a07aca72
sourceRevisionDigest: sha256:4e8c9bba01d659774b24035f15b6256a6f769d542b2842ab1ded70deb136da43
sourceBlobDigest: sha256:a9cf589411b4bdd4d07d2aae07a00006c85ba5f3359bfa3931b1e929df64795a
codeSamplesNamespace: code-samples-typescript
codeSamplesRevisionDigest: sha256:6988d93fb2b914d00bc2afcd79f0f869aecfd865f5be056933703f3a4908a1c3
codeSamplesRevisionDigest: sha256:1759faf6a4380f0514b4478ec36e0c11f484fe383383a0e4e4836f05d4360793
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ run();

* [healthControllerHealthCheck](docs/sdks/admin/README.md#healthcontrollerhealthcheck)
* [testIdempotency](docs/sdks/admin/README.md#testidempotency)
* [generateRandomNumber](docs/sdks/admin/README.md#generaterandomnumber)

### [integrations](docs/sdks/integrations/README.md)

Expand Down Expand Up @@ -331,6 +332,7 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).

<summary>Available standalone functions</summary>

- [`adminGenerateRandomNumber`](docs/sdks/admin/README.md#generaterandomnumber)
- [`adminHealthControllerHealthCheck`](docs/sdks/admin/README.md#healthcontrollerhealthcheck)
- [`adminTestIdempotency`](docs/sdks/admin/README.md#testidempotency)
- [`cancel`](docs/sdks/novu/README.md#cancel) - Cancel triggered event
Expand Down
6 changes: 3 additions & 3 deletions docs/models/components/messageresponsedto.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ let value: MessageResponseDto = {
organizationId: "<id>",
environmentId: "<id>",
deleted: false,
createdAt: "1728524602230",
updatedAt: "1736968049215",
createdAt: "1728527859643",
updatedAt: "1736971306628",
},
createdAt: "1721935030476",
createdAt: "1721938287891",
content: {
type: "button",
content: "<value>",
Expand Down
4 changes: 2 additions & 2 deletions docs/models/components/subscriberresponsedto.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ let value: SubscriberResponseDto = {
organizationId: "<id>",
environmentId: "<id>",
deleted: false,
createdAt: "1727701449903",
updatedAt: "1736961879739",
createdAt: "1727704707419",
updatedAt: "1736965137254",
};
```

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# HealthControllerGenerateRandomNumberRequest

## Example Usage

```typescript
import { HealthControllerGenerateRandomNumberRequest } from "@novu/api/models/operations";

let value: HealthControllerGenerateRandomNumberRequest = {};
```

## Fields

| Field | Type | Required | Description |
| --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- |
| `idempotencyKey` | *string* | :heavy_minus_sign: | A header for idempotency purposes |
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# HealthControllerGenerateRandomNumberResponse

## Example Usage

```typescript
import { HealthControllerGenerateRandomNumberResponse } from "@novu/api/models/operations";

let value: HealthControllerGenerateRandomNumberResponse = {
headers: {
"key": [
"<value>",
],
},
result: {
number: 1,
},
};
```

## Fields

| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| `headers` | Record<string, *string*[]> | :heavy_check_mark: | N/A |
| `result` | [components.IdempotenceTestingResponse](../../models/components/idempotencetestingresponse.md) | :heavy_check_mark: | N/A |
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ let value: SubscribersControllerCreateSubscriberResponse = {
organizationId: "<id>",
environmentId: "<id>",
deleted: false,
createdAt: "1713846645065",
updatedAt: "1737020112563",
createdAt: "1713849902505",
updatedAt: "1737023370003",
},
};
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ let value: SubscribersControllerGetSubscriberResponse = {
organizationId: "<id>",
environmentId: "<id>",
deleted: false,
createdAt: "1723429751999",
updatedAt: "1736954842975",
createdAt: "1723433009438",
updatedAt: "1736958100414",
},
};
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ let value: SubscribersControllerListSubscribersResponse = {
organizationId: "<id>",
environmentId: "<id>",
deleted: false,
createdAt: "1735294697558",
updatedAt: "1736998306707",
createdAt: "1735297955000",
updatedAt: "1737001564149",
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ let value: SubscribersControllerListSubscribersResponseBody = {
organizationId: "<id>",
environmentId: "<id>",
deleted: false,
createdAt: "1720056832229",
updatedAt: "1737020656464",
createdAt: "1720060089675",
updatedAt: "1737023913910",
},
],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ let value: SubscribersControllerMarkActionAsSeenResponse = {
organizationId: "<id>",
environmentId: "<id>",
deleted: false,
createdAt: "1731929049501",
updatedAt: "1736961522542",
createdAt: "1731932307016",
updatedAt: "1736964780058",
},
createdAt: "1736297244449",
createdAt: "1736300501967",
content: {
type: "text",
content: "<value>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ let value: SubscribersControllerMarkMessagesAsResponse = {
organizationId: "<id>",
environmentId: "<id>",
deleted: false,
createdAt: "1713491423432",
updatedAt: "1736993508492",
createdAt: "1713494680881",
updatedAt: "1736996765942",
},
createdAt: "1713211824934",
createdAt: "1713215082385",
content: {
type: "button",
content: "<value>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ let value: SubscribersControllerModifySubscriberChannelResponse = {
organizationId: "<id>",
environmentId: "<id>",
deleted: false,
createdAt: "1726530774081",
updatedAt: "1737011162050",
createdAt: "1726534031519",
updatedAt: "1737014419488",
},
};
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ let value: SubscribersControllerUpdateSubscriberChannelResponse = {
organizationId: "<id>",
environmentId: "<id>",
deleted: false,
createdAt: "1716841060390",
updatedAt: "1736990978721",
createdAt: "1716844317826",
updatedAt: "1736994236157",
},
};
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ let value: SubscribersControllerUpdateSubscriberOnlineFlagResponse = {
organizationId: "<id>",
environmentId: "<id>",
deleted: false,
createdAt: "1709569439227",
updatedAt: "1736980472327",
createdAt: "1709572696656",
updatedAt: "1736983729756",
},
};
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ let value: SubscribersControllerUpdateSubscriberResponse = {
organizationId: "<id>",
environmentId: "<id>",
deleted: false,
createdAt: "1724806669667",
updatedAt: "1737006522049",
createdAt: "1724809927103",
updatedAt: "1737009779484",
},
};
```
Expand Down
75 changes: 75 additions & 0 deletions docs/sdks/admin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

* [healthControllerHealthCheck](#healthcontrollerhealthcheck)
* [testIdempotency](#testidempotency)
* [generateRandomNumber](#generaterandomnumber)

## healthControllerHealthCheck

Expand Down Expand Up @@ -150,6 +151,80 @@ run();

### Errors

| Error Type | Status Code | Content Type |
| -------------------------------------- | -------------------------------------- | -------------------------------------- |
| errors.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
| errors.ErrorDto | 414 | application/json |
| errors.ValidationErrorDto | 422 | application/json |
| errors.ErrorDto | 500 | application/json |
| errors.SDKError | 4XX, 5XX | \*/\* |

## generateRandomNumber

### Example Usage

```typescript
import { Novu } from "@novu/api";

const novu = new Novu({
apiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
const result = await novu.admin.generateRandomNumber();

// Handle the result
console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript
import { NovuCore } from "@novu/api/core.js";
import { adminGenerateRandomNumber } from "@novu/api/funcs/adminGenerateRandomNumber.js";

// Use `NovuCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const novu = new NovuCore({
apiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
const res = await adminGenerateRandomNumber(novu);

if (!res.ok) {
throw res.error;
}

const { value: result } = res;

// Handle the result
console.log(result);
}

run();
```

### Parameters

| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `idempotencyKey` | *string* | :heavy_minus_sign: | A header for idempotency purposes |
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |

### Response

**Promise\<[operations.HealthControllerGenerateRandomNumberResponse](../../models/operations/healthcontrollergeneraterandomnumberresponse.md)\>**

### Errors

| Error Type | Status Code | Content Type |
| -------------------------------------- | -------------------------------------- | -------------------------------------- |
| errors.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
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.2",
"version": "0.0.3",
"exports": {
".": "./src/index.ts",
"./models/errors": "./src/models/errors/index.ts",
Expand Down
Loading

0 comments on commit 25bfccd

Please sign in to comment.