Skip to content

Commit 0fc6f63

Browse files
authored
Merge pull request #881 from novuhq/feature/environment-and-workflow-apis
feat: add environment and workflows apis
2 parents 499c433 + 71ea737 commit 0fc6f63

24 files changed

+545
-53
lines changed

content/docs/api-reference/api-types.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
StepFilterDto,
1313
TopicSubscriptionResponseDto,
1414
SubscriberPayloadDto,
15+
EnvironmentResponseDto,
1516
} from '@novu/api/models/components';
1617

1718
// subscriber
@@ -24,7 +25,6 @@ export type TopicSubscription = TopicSubscriptionResponseDto;
2425

2526
// message
2627
export type Message = MessageResponseDto;
27-
export type Workflow = WorkflowResponse;
2828
export type Actor = SubscriberPayloadDto | string;
2929
export type MessageCTA = MessageCTAType;
3030

@@ -36,3 +36,9 @@ export type ActivityJob = ActivityNotificationJobResponseDto;
3636
export type Integration = IntegrationResponseDto;
3737
export type Credentials = CredentialsDto;
3838
export type StepFilter = StepFilterDto;
39+
40+
// environment
41+
export type Environment = EnvironmentResponseDto;
42+
43+
// workflow
44+
export type Workflow = WorkflowResponse;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: Create an environment
3+
full: true
4+
_openapi:
5+
method: POST
6+
route: /v1/environments
7+
toc: []
8+
structuredData:
9+
headings: []
10+
contents:
11+
- content: |-
12+
Creates a new environment within the current organization.
13+
Environments allow you to manage different stages of your application development lifecycle.
14+
Each environment has its own set of API keys and configurations.
15+
---
16+
17+
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
18+
19+
Creates a new environment within the current organization.
20+
Environments allow you to manage different stages of your application development lifecycle.
21+
Each environment has its own set of API keys and configurations.
22+
23+
<APIPage document={"https://spec.speakeasy.com/novu/novu/json-development-with-code-samples"} operations={[{"path":"/v1/environments","method":"post"}]} webhooks={[]} hasHead={false} />
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: Delete an environment
3+
full: true
4+
_openapi:
5+
method: DELETE
6+
route: /v1/environments/{environmentId}
7+
toc: []
8+
structuredData:
9+
headings: []
10+
contents:
11+
- content: |-
12+
Delete an environment by its unique identifier **environmentId**.
13+
This action is irreversible and will remove the environment and all its associated data.
14+
---
15+
16+
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
17+
18+
Delete an environment by its unique identifier **environmentId**.
19+
This action is irreversible and will remove the environment and all its associated data.
20+
21+
<APIPage document={"https://spec.speakeasy.com/novu/novu/json-development-with-code-samples"} operations={[{"path":"/v1/environments/{environmentId}","method":"delete"}]} webhooks={[]} hasHead={false} />
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: Environment schema
3+
---
4+
5+
### Environment
6+
7+
Environment is a collection of resources that are used to send notifications. For example, an environment can have a set of integrations, workflows, and subscribers. Read more about environments on [environments concept page](/platform/concepts/environments).
8+
9+
<TypeTable name="Environment" type={{
10+
"id": {
11+
"description": "Unique identifier of the environment",
12+
"type": "string"
13+
},
14+
"name": {
15+
"description": "Name of the environment",
16+
"type": "string"
17+
},
18+
"organizationId": {
19+
"description": "Organization ID associated with the environment",
20+
"type": "string"
21+
},
22+
"identifier": {
23+
"description": "Unique identifier for the environment",
24+
"type": "string"
25+
},
26+
"apiKeys": {
27+
"description": "List of API keys associated with the environment",
28+
"type": "ApiKeyDto[]"
29+
},
30+
"parentId": {
31+
"description": "Parent environment ID",
32+
"type": "string"
33+
},
34+
"slug": {
35+
"description": "URL-friendly slug for the environment",
36+
"type": "string"
37+
}
38+
}} />
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: Environment schema
3+
---
4+
5+
### Environment
6+
7+
Environment is a collection of resources that are used to send notifications. For example, an environment can have a set of integrations, workflows, and subscribers. Read more about environments on [environments concept page](/platform/concepts/environments).
8+
9+
---type-table---
10+
../api-types.ts#Environment
11+
---end---
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: List all environments
3+
full: true
4+
_openapi:
5+
method: GET
6+
route: /v1/environments
7+
toc: []
8+
structuredData:
9+
headings: []
10+
contents:
11+
- content: |-
12+
This API returns a list of environments for the current organization.
13+
Each environment contains its configuration, API keys (if user has access), and metadata.
14+
---
15+
16+
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
17+
18+
This API returns a list of environments for the current organization.
19+
Each environment contains its configuration, API keys (if user has access), and metadata.
20+
21+
<APIPage document={"https://spec.speakeasy.com/novu/novu/json-development-with-code-samples"} operations={[{"path":"/v1/environments","method":"get"}]} webhooks={[]} hasHead={false} />
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: Update an environment
3+
full: true
4+
_openapi:
5+
method: PUT
6+
route: /v1/environments/{environmentId}
7+
toc: []
8+
structuredData:
9+
headings: []
10+
contents:
11+
- content: |-
12+
Update an environment by its unique identifier **environmentId**.
13+
You can modify the environment name, identifier, color, and other configuration settings.
14+
---
15+
16+
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
17+
18+
Update an environment by its unique identifier **environmentId**.
19+
You can modify the environment name, identifier, color, and other configuration settings.
20+
21+
<APIPage document={"https://spec.speakeasy.com/novu/novu/json-development-with-code-samples"} operations={[{"path":"/v1/environments/{environmentId}","method":"put"}]} webhooks={[]} hasHead={false} />

content/docs/api-reference/events/broadcast-event-to-all.mdx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,28 @@ _openapi:
1111
- content: >-
1212
Trigger a broadcast event to all existing subscribers, could be used
1313
to send announcements, etc.
14+
15+
16+
17+
18+
19+
20+
21+
1422
In the future could be used to trigger events to a subset of subscribers based on defined filters.
1523
---
1624

1725
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
1826

1927
Trigger a broadcast event to all existing subscribers, could be used to send announcements, etc.
28+
29+
30+
31+
32+
33+
34+
35+
2036
In the future could be used to trigger events to a subset of subscribers based on defined filters.
2137

2238
<APIPage document={"https://spec.speakeasy.com/novu/novu/json-development-with-code-samples"} operations={[{"path":"/v1/events/trigger/broadcast","method":"post"}]} webhooks={[]} hasHead={false} />

content/docs/api-reference/meta.json

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@
3232
"...subscribers/retrieve-subscriber-unseen-count",
3333
"...subscribers/update-subscriber-online-status",
3434

35-
"---Notifications---",
36-
"...notifications/notification-event-schema",
37-
"...notifications/list-all-events",
38-
"...notifications/retrieve-an-event",
39-
4035
"---Topics---",
4136
"...topics/topic-schema",
4237
"...topics/create-a-topic",
@@ -49,6 +44,28 @@
4944
"...topics/list-topic-subscriptions",
5045
"...topics/check-topic-subscriber",
5146

47+
"---Notifications---",
48+
"...notifications/notification-event-schema",
49+
"...notifications/list-all-events",
50+
"...notifications/retrieve-an-event",
51+
52+
"---Workflows---",
53+
"...workflows/workflow-schema",
54+
"...workflows/create-a-workflow",
55+
"...workflows/retrieve-a-workflow",
56+
"...workflows/update-a-workflow",
57+
"...workflows/delete-a-workflow",
58+
"...workflows/list-all-workflows",
59+
"...workflows/sync-a-workflow",
60+
"...workflows/retrieve-workflow-step",
61+
62+
"---Environments---",
63+
"...environments/environment-schema",
64+
"...environments/create-an-environment",
65+
"...environments/update-an-environment",
66+
"...environments/delete-an-environment",
67+
"...environments/list-all-environments",
68+
5269
"---Messages---",
5370
"...messages/message-schema",
5471
"...messages/list-all-messages",

content/docs/api-reference/subscribers/subscriber-schema.mdx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,27 @@ Subscriber is the end user that receives notifications. Subscriber has subscribe
1212
},
1313
"firstName": {
1414
"description": "The first name of the subscriber.",
15-
"type": "string"
15+
"type": "string | null"
1616
},
1717
"lastName": {
1818
"description": "The last name of the subscriber.",
19-
"type": "string"
19+
"type": "string | null"
2020
},
2121
"email": {
2222
"description": "The email address of the subscriber.",
23-
"type": "string"
23+
"type": "string | null"
2424
},
2525
"phone": {
2626
"description": "The phone number of the subscriber.",
27-
"type": "string"
27+
"type": "string | null"
2828
},
2929
"avatar": {
3030
"description": "The URL of the subscriber's avatar image.",
31-
"type": "string"
31+
"type": "string | null"
3232
},
3333
"locale": {
3434
"description": "The locale setting of the subscriber, indicating their preferred language or region.",
35-
"type": "string"
35+
"type": "string | null"
3636
},
3737
"channels": {
3838
"description": "An array of channel settings associated with the subscriber.",
@@ -44,11 +44,11 @@ Subscriber is the end user that receives notifications. Subscriber has subscribe
4444
},
4545
"isOnline": {
4646
"description": "Indicates whether the subscriber is currently online.",
47-
"type": "boolean"
47+
"type": "boolean | null"
4848
},
4949
"lastOnlineAt": {
5050
"description": "The timestamp indicating when the subscriber was last online, in ISO 8601 format.",
51-
"type": "string"
51+
"type": "string | null"
5252
},
5353
"v": {
5454
"description": "The version of the subscriber document.",
@@ -60,7 +60,7 @@ Subscriber is the end user that receives notifications. Subscriber has subscribe
6060
},
6161
"timezone": {
6262
"description": "Timezone of the subscriber",
63-
"type": "string"
63+
"type": "string | null"
6464
},
6565
"subscriberId": {
6666
"description": "The identifier used to create this subscriber, which typically corresponds to the user ID in your system.",

0 commit comments

Comments
 (0)