Skip to content

Latest commit

 

History

History
320 lines (225 loc) · 22.1 KB

File metadata and controls

320 lines (225 loc) · 22.1 KB

Environments

Overview

Environments allow you to manage different stages of your application development lifecycle. Each environment has its own set of API keys and configurations, enabling you to separate development, staging, and production workflows. https://docs.novu.co/platform/environments

Available Operations

  • GetTags - List environment tags
  • Diff - Compare resources between environments
  • Publish - Publish resources to target environment
  • Create - Create an environment
  • List - List all environments
  • Update - Update an environment
  • Delete - Delete an environment

GetTags

Retrieve all unique tags used in workflows within the specified environment. These tags can be used for filtering workflows.

Example Usage

using Novu;
using Novu.Models.Components;

var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");

var res = await sdk.Environments.GetTagsAsync(environmentId: "6615943e7ace93b0540ae377");

// handle response

Parameters

Parameter Type Required Description Example
EnvironmentId string ✔️ Environment internal ID (MongoDB ObjectId) or identifier 6615943e7ace93b0540ae377
IdempotencyKey string A header for idempotency purposes

Response

EnvironmentsControllerGetEnvironmentTagsResponse

Errors

Error Type Status Code Content Type
Novu.Models.Errors.ErrorDto 414 application/json
Novu.Models.Errors.ErrorDto 400, 401, 403, 404, 405, 409, 413, 415 application/json
Novu.Models.Errors.ValidationErrorDto 422 application/json
Novu.Models.Errors.ErrorDto 500 application/json
Novu.Models.Errors.APIException 4XX, 5XX */*

Diff

Compares workflows and other resources between the source and target environments, returning detailed diff information including additions, modifications, and deletions.

Example Usage

using Novu;
using Novu.Models.Components;

var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");

var res = await sdk.Environments.DiffAsync(
    targetEnvironmentId: "6615943e7ace93b0540ae377",
    diffEnvironmentRequestDto: new DiffEnvironmentRequestDto() {
        SourceEnvironmentId = "507f1f77bcf86cd799439011",
    }
);

// handle response

Parameters

Parameter Type Required Description Example
TargetEnvironmentId string ✔️ Target environment ID (MongoDB ObjectId) to compare against 6615943e7ace93b0540ae377
DiffEnvironmentRequestDto DiffEnvironmentRequestDto ✔️ Diff request configuration
IdempotencyKey string A header for idempotency purposes

Response

EnvironmentsControllerDiffEnvironmentResponse

Errors

Error Type Status Code Content Type
Novu.Models.Errors.ErrorDto 414 application/json
Novu.Models.Errors.ErrorDto 400, 401, 403, 404, 405, 409, 413, 415 application/json
Novu.Models.Errors.ValidationErrorDto 422 application/json
Novu.Models.Errors.ErrorDto 500 application/json
Novu.Models.Errors.APIException 4XX, 5XX */*

Publish

Publishes all workflows and resources from the source environment to the target environment. Optionally specify specific resources to publish or use dryRun mode to preview changes.

Example Usage

using Novu;
using Novu.Models.Components;
using System.Collections.Generic;

var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");

var res = await sdk.Environments.PublishAsync(
    targetEnvironmentId: "6615943e7ace93b0540ae377",
    publishEnvironmentRequestDto: new PublishEnvironmentRequestDto() {
        SourceEnvironmentId = "507f1f77bcf86cd799439011",
        Resources = new List<ResourceToPublishDto>() {
            new ResourceToPublishDto() {
                ResourceType = ResourceTypeEnum.Regular,
                ResourceId = "workflow-id-1",
            },
        },
    }
);

// handle response

Parameters

Parameter Type Required Description Example
TargetEnvironmentId string ✔️ Target environment ID (MongoDB ObjectId) to publish resources to 6615943e7ace93b0540ae377
PublishEnvironmentRequestDto PublishEnvironmentRequestDto ✔️ Publish request configuration
IdempotencyKey string A header for idempotency purposes

Response

EnvironmentsControllerPublishEnvironmentResponse

Errors

Error Type Status Code Content Type
Novu.Models.Errors.ErrorDto 414 application/json
Novu.Models.Errors.ErrorDto 400, 401, 403, 404, 405, 409, 413, 415 application/json
Novu.Models.Errors.ValidationErrorDto 422 application/json
Novu.Models.Errors.ErrorDto 500 application/json
Novu.Models.Errors.APIException 4XX, 5XX */*

Create

Creates a new environment within the current organization. Environments allow you to manage different stages of your application development lifecycle. Each environment has its own set of API keys and configurations.

Example Usage

using Novu;
using Novu.Models.Components;

var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");

var res = await sdk.Environments.CreateAsync(createEnvironmentRequestDto: new CreateEnvironmentRequestDto() {
    Name = "Production Environment",
    ParentId = "60d5ecb8b3b3a30015f3e1a1",
    Color = "#3498db",
});

// handle response

Parameters

Parameter Type Required Description
CreateEnvironmentRequestDto CreateEnvironmentRequestDto ✔️ N/A
IdempotencyKey string A header for idempotency purposes

Response

EnvironmentsControllerV1CreateEnvironmentResponse

Errors

Error Type Status Code Content Type
Novu.Models.Errors.ErrorDto 402, 414 application/json
Novu.Models.Errors.ErrorDto 400, 401, 403, 404, 405, 409, 413, 415 application/json
Novu.Models.Errors.ValidationErrorDto 422 application/json
Novu.Models.Errors.ErrorDto 500 application/json
Novu.Models.Errors.APIException 4XX, 5XX */*

List

This API returns a list of environments for the current organization. Each environment contains its configuration, API keys (if user has access), and metadata.

Example Usage

using Novu;
using Novu.Models.Components;

var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");

var res = await sdk.Environments.ListAsync();

// handle response

Parameters

Parameter Type Required Description
IdempotencyKey string A header for idempotency purposes

Response

EnvironmentsControllerV1ListMyEnvironmentsResponse

Errors

Error Type Status Code Content Type
Novu.Models.Errors.ErrorDto 414 application/json
Novu.Models.Errors.ErrorDto 400, 401, 403, 404, 405, 409, 413, 415 application/json
Novu.Models.Errors.ValidationErrorDto 422 application/json
Novu.Models.Errors.ErrorDto 500 application/json
Novu.Models.Errors.APIException 4XX, 5XX */*

Update

Update an environment by its unique identifier environmentId. You can modify the environment name, identifier, color, and other configuration settings.

Example Usage

using Novu;
using Novu.Models.Components;

var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");

var res = await sdk.Environments.UpdateAsync(
    environmentId: "<id>",
    updateEnvironmentRequestDto: new UpdateEnvironmentRequestDto() {}
);

// handle response

Parameters

Parameter Type Required Description
EnvironmentId string ✔️ The unique identifier of the environment
UpdateEnvironmentRequestDto UpdateEnvironmentRequestDto ✔️ N/A
IdempotencyKey string A header for idempotency purposes

Response

EnvironmentsControllerV1UpdateMyEnvironmentResponse

Errors

Error Type Status Code Content Type
Novu.Models.Errors.ErrorDto 414 application/json
Novu.Models.Errors.ErrorDto 400, 401, 403, 404, 405, 409, 413, 415 application/json
Novu.Models.Errors.ValidationErrorDto 422 application/json
Novu.Models.Errors.ErrorDto 500 application/json
Novu.Models.Errors.APIException 4XX, 5XX */*

Delete

Delete an environment by its unique identifier environmentId. This action is irreversible and will remove the environment and all its associated data.

Example Usage

using Novu;
using Novu.Models.Components;

var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");

var res = await sdk.Environments.DeleteAsync(environmentId: "<id>");

// handle response

Parameters

Parameter Type Required Description
EnvironmentId string ✔️ The unique identifier of the environment
IdempotencyKey string A header for idempotency purposes

Response

EnvironmentsControllerV1DeleteEnvironmentResponse

Errors

Error Type Status Code Content Type
Novu.Models.Errors.ErrorDto 414 application/json
Novu.Models.Errors.ErrorDto 400, 401, 403, 404, 405, 409, 413, 415 application/json
Novu.Models.Errors.ValidationErrorDto 422 application/json
Novu.Models.Errors.ErrorDto 500 application/json
Novu.Models.Errors.APIException 4XX, 5XX */*