Skip to content

Latest commit

 

History

History
128 lines (98 loc) · 3.73 KB

README.md

File metadata and controls

128 lines (98 loc) · 3.73 KB

Environments

(environments())

Overview

Novu uses the concept of environments to ensure logical separation of your data and configuration. This means that subscribers, and preferences created in one environment are never accessible to another.

https://docs.novu.co/platform/environments

Available Operations

  • list - Get environments
  • retrieve - Get current environment

list

Get environments

Example Usage

package hello.world;

import co.novu.co.novu.sdk.Novu;
import co.novu.co.novu.sdk.models.components.*;
import co.novu.co.novu.sdk.models.components.Security;
import co.novu.co.novu.sdk.models.operations.*;
import co.novu.co.novu.sdk.utils.EventStream;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;

public class Application {

    public static void main(String[] args) throws Exception {
        try {
            Novu sdk = Novu.builder()
                .apiKey("<YOUR_API_KEY_HERE>")
                .build();

            EnvironmentsControllerListMyEnvironmentsResponse res = sdk.environments().list()
                .call();

            if (res.environmentResponseDtos().isPresent()) {
                // handle response
            }
        } catch (co.novu.co.novu.sdk.models.errors.SDKError e) {
            // handle exception
            throw e;
        } catch (Exception e) {
            // handle exception
            throw e;
        }
    }
}

Response

Optional<? extends co.novu.co.novu.sdk.models.operations.EnvironmentsControllerListMyEnvironmentsResponse>

Errors

Error Object Status Code Content Type
models/errors/SDKError 4xx-5xx /

retrieve

Get current environment

Example Usage

package hello.world;

import co.novu.co.novu.sdk.Novu;
import co.novu.co.novu.sdk.models.components.*;
import co.novu.co.novu.sdk.models.components.Security;
import co.novu.co.novu.sdk.models.operations.*;
import co.novu.co.novu.sdk.utils.EventStream;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;

public class Application {

    public static void main(String[] args) throws Exception {
        try {
            Novu sdk = Novu.builder()
                .apiKey("<YOUR_API_KEY_HERE>")
                .build();

            EnvironmentsControllerGetCurrentEnvironmentResponse res = sdk.environments().retrieve()
                .call();

            if (res.environmentResponseDto().isPresent()) {
                // handle response
            }
        } catch (co.novu.co.novu.sdk.models.errors.SDKError e) {
            // handle exception
            throw e;
        } catch (Exception e) {
            // handle exception
            throw e;
        }
    }
}

Response

Optional<? extends co.novu.co.novu.sdk.models.operations.EnvironmentsControllerGetCurrentEnvironmentResponse>

Errors

Error Object Status Code Content Type
models/errors/SDKError 4xx-5xx /