Skip to content

Latest commit

 

History

History
218 lines (171 loc) · 11.1 KB

README.md

File metadata and controls

218 lines (171 loc) · 11.1 KB

Credentials

(subscribers().credentials())

Available Operations

  • append - Modify subscriber credentials
  • delete - Delete subscriber credentials by providerId
  • update - Update subscriber credentials

append

Subscriber credentials associated to the delivery methods such as slack and push tokens. This endpoint appends provided credentials and deviceTokens to the existing ones.

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();

            SubscribersControllerModifySubscriberChannelResponse res = sdk.subscribers().credentials().append()
                .subscriberId("<value>")
                .updateSubscriberChannelRequestDto(UpdateSubscriberChannelRequestDto.builder()
                    .credentials(ChannelCredentials.builder()
                            .webhookUrl("<value>")
                            .build())
                    .providerId(UpdateSubscriberChannelRequestDtoProviderId.ZULIP)
                    .build())
                .call();

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

Parameters

Parameter Type Required Description
subscriberId String ✔️ N/A
updateSubscriberChannelRequestDto co.novu.co.novu.sdk.models.components.UpdateSubscriberChannelRequestDto ✔️ N/A

Response

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

Errors

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

delete

Delete subscriber credentials such as slack and expo tokens.

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();

            SubscribersControllerDeleteSubscriberCredentialsResponse res = sdk.subscribers().credentials().delete()
                .subscriberId("<value>")
                .providerId("<value>")
                .call();

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

Parameters

Parameter Type Required Description
subscriberId String ✔️ N/A
providerId String ✔️ N/A

Response

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

Errors

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

update

Subscriber credentials associated to the delivery methods such as slack and push tokens.

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();

            SubscribersControllerUpdateSubscriberChannelResponse res = sdk.subscribers().credentials().update()
                .subscriberId("<value>")
                .updateSubscriberChannelRequestDto(UpdateSubscriberChannelRequestDto.builder()
                    .credentials(ChannelCredentials.builder()
                            .webhookUrl("<value>")
                            .build())
                    .providerId(UpdateSubscriberChannelRequestDtoProviderId.PUSHPAD)
                    .build())
                .call();

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

Parameters

Parameter Type Required Description
subscriberId String ✔️ N/A
updateSubscriberChannelRequestDto co.novu.co.novu.sdk.models.components.UpdateSubscriberChannelRequestDto ✔️ N/A

Response

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

Errors

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