Skip to content

Latest commit

 

History

History
317 lines (233 loc) · 19.3 KB

File metadata and controls

317 lines (233 loc) · 19.3 KB

ChannelEndpoints

Overview

Available Operations

  • list - List all channel endpoints
  • create - Create a channel endpoint
  • get - Retrieve a channel endpoint
  • update - Update a channel endpoint
  • delete - Delete a channel endpoint

list

List all channel endpoints for a resource based on query filters.

Example Usage

package hello.world;

import co.novu.Novu;
import co.novu.models.components.ProvidersIdEnum;
import co.novu.models.errors.ErrorDto;
import co.novu.models.errors.ValidationErrorDto;
import co.novu.models.operations.ChannelEndpointsControllerListChannelEndpointsRequest;
import co.novu.models.operations.ChannelEndpointsControllerListChannelEndpointsResponse;
import java.lang.Exception;
import java.util.List;

public class Application {

    public static void main(String[] args) throws ErrorDto, ValidationErrorDto, Exception {

        Novu sdk = Novu.builder()
                .secretKey("YOUR_SECRET_KEY_HERE")
            .build();

        ChannelEndpointsControllerListChannelEndpointsRequest req = ChannelEndpointsControllerListChannelEndpointsRequest.builder()
                .limit(10d)
                .subscriberId("subscriber-123")
                .contextKeys(List.of(
                    "tenant:org-123",
                    "region:us-east-1"))
                .providerId(ProvidersIdEnum.SLACK)
                .integrationIdentifier("slack-prod")
                .connectionIdentifier("slack-connection-abc123")
                .build();

        ChannelEndpointsControllerListChannelEndpointsResponse res = sdk.channelEndpoints().list()
                .request(req)
                .call();

        if (res.listChannelEndpointsResponseDto().isPresent()) {
            System.out.println(res.listChannelEndpointsResponseDto().get());
        }
    }
}

Parameters

Parameter Type Required Description
request ChannelEndpointsControllerListChannelEndpointsRequest ✔️ The request object to use for the request.

Response

ChannelEndpointsControllerListChannelEndpointsResponse

Errors

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

create

Create a new channel endpoint for a resource.

Example Usage

package hello.world;

import co.novu.Novu;
import co.novu.models.components.*;
import co.novu.models.errors.ErrorDto;
import co.novu.models.errors.ValidationErrorDto;
import co.novu.models.operations.ChannelEndpointsControllerCreateChannelEndpointResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ErrorDto, ValidationErrorDto, Exception {

        Novu sdk = Novu.builder()
                .secretKey("YOUR_SECRET_KEY_HERE")
            .build();

        ChannelEndpointsControllerCreateChannelEndpointResponse res = sdk.channelEndpoints().create()
                .body(CreateSlackChannelEndpointDto.builder()
                    .subscriberId("subscriber-123")
                    .integrationIdentifier("slack-prod")
                    .type(CreateSlackChannelEndpointDtoType.SLACK_CHANNEL)
                    .endpoint(SlackChannelEndpointDto.builder()
                        .channelId("C123456789")
                        .build())
                    .build())
                .call();

        if (res.getChannelEndpointResponseDto().isPresent()) {
            System.out.println(res.getChannelEndpointResponseDto().get());
        }
    }
}

Parameters

Parameter Type Required Description
idempotencyKey Optional<String> A header for idempotency purposes
body ChannelEndpointsControllerCreateChannelEndpointRequestBody ✔️ Channel endpoint creation request. The structure varies based on the type field.

Response

ChannelEndpointsControllerCreateChannelEndpointResponse

Errors

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

get

Retrieve a specific channel endpoint by its unique identifier.

Example Usage

package hello.world;

import co.novu.Novu;
import co.novu.models.errors.ErrorDto;
import co.novu.models.errors.ValidationErrorDto;
import co.novu.models.operations.ChannelEndpointsControllerGetChannelEndpointResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ErrorDto, ValidationErrorDto, Exception {

        Novu sdk = Novu.builder()
                .secretKey("YOUR_SECRET_KEY_HERE")
            .build();

        ChannelEndpointsControllerGetChannelEndpointResponse res = sdk.channelEndpoints().get()
                .identifier("<value>")
                .call();

        if (res.getChannelEndpointResponseDto().isPresent()) {
            System.out.println(res.getChannelEndpointResponseDto().get());
        }
    }
}

Parameters

Parameter Type Required Description
identifier String ✔️ The unique identifier of the channel endpoint
idempotencyKey Optional<String> A header for idempotency purposes

Response

ChannelEndpointsControllerGetChannelEndpointResponse

Errors

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

update

Update an existing channel endpoint by its unique identifier.

Example Usage

package hello.world;

import co.novu.Novu;
import co.novu.models.components.*;
import co.novu.models.errors.ErrorDto;
import co.novu.models.errors.ValidationErrorDto;
import co.novu.models.operations.ChannelEndpointsControllerUpdateChannelEndpointResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ErrorDto, ValidationErrorDto, Exception {

        Novu sdk = Novu.builder()
                .secretKey("YOUR_SECRET_KEY_HERE")
            .build();

        ChannelEndpointsControllerUpdateChannelEndpointResponse res = sdk.channelEndpoints().update()
                .identifier("<value>")
                .body(UpdateChannelEndpointRequestDto.builder()
                    .endpoint(UpdateChannelEndpointRequestDtoEndpoint.of(SlackUserEndpointDto.builder()
                        .userId("U123456789")
                        .build()))
                    .build())
                .call();

        if (res.getChannelEndpointResponseDto().isPresent()) {
            System.out.println(res.getChannelEndpointResponseDto().get());
        }
    }
}

Parameters

Parameter Type Required Description
identifier String ✔️ The unique identifier of the channel endpoint
idempotencyKey Optional<String> A header for idempotency purposes
body UpdateChannelEndpointRequestDto ✔️ N/A

Response

ChannelEndpointsControllerUpdateChannelEndpointResponse

Errors

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

delete

Delete a specific channel endpoint by its unique identifier.

Example Usage

package hello.world;

import co.novu.Novu;
import co.novu.models.errors.ErrorDto;
import co.novu.models.errors.ValidationErrorDto;
import co.novu.models.operations.ChannelEndpointsControllerDeleteChannelEndpointResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ErrorDto, ValidationErrorDto, Exception {

        Novu sdk = Novu.builder()
                .secretKey("YOUR_SECRET_KEY_HERE")
            .build();

        ChannelEndpointsControllerDeleteChannelEndpointResponse res = sdk.channelEndpoints().delete()
                .identifier("<value>")
                .call();

        // handle response
    }
}

Parameters

Parameter Type Required Description
identifier String ✔️ The unique identifier of the channel endpoint
idempotencyKey Optional<String> A header for idempotency purposes

Response

ChannelEndpointsControllerDeleteChannelEndpointResponse

Errors

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