Skip to content

Files

Latest commit

 

History

History
350 lines (262 loc) · 20.1 KB

README.md

File metadata and controls

350 lines (262 loc) · 20.1 KB

Integrations

(Integrations)

Overview

With the help of the Integration Store, you can easily integrate your favorite delivery provider. During the runtime of the API, the Integrations Store is responsible for storing the configurations of all the providers. https://docs.novu.co/channels-and-providers/integration-store

Available Operations

List

Return all the integrations the user has created for that organization. Review v.0.17.0 changelog for a breaking change

Example Usage

package main

import(
	"context"
	novugo "github.com/novuhq/novu-go"
	"log"
)

func main() {
    ctx := context.Background()

    s := novugo.New(
        novugo.WithSecurity("YOUR_SECRET_KEY_HERE"),
    )

    res, err := s.Integrations.List(ctx, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res.IntegrationResponseDtos != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
idempotencyKey *string A header for idempotency purposes
opts []operations.Option The options for this request.

Response

*operations.IntegrationsControllerListIntegrationsResponse, error

Errors

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

Create

Create an integration for the current environment the user is based on the API key provided

Example Usage

package main

import(
	"context"
	novugo "github.com/novuhq/novu-go"
	"github.com/novuhq/novu-go/models/components"
	"log"
)

func main() {
    ctx := context.Background()

    s := novugo.New(
        novugo.WithSecurity("YOUR_SECRET_KEY_HERE"),
    )

    res, err := s.Integrations.Create(ctx, components.CreateIntegrationRequestDto{
        ProviderID: "<id>",
        Channel: components.CreateIntegrationRequestDtoChannelSms,
    }, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res.IntegrationResponseDto != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
createIntegrationRequestDto components.CreateIntegrationRequestDto ✔️ N/A
idempotencyKey *string A header for idempotency purposes
opts []operations.Option The options for this request.

Response

*operations.IntegrationsControllerCreateIntegrationResponse, error

Errors

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

Update

Update integration

Example Usage

package main

import(
	"context"
	novugo "github.com/novuhq/novu-go"
	"github.com/novuhq/novu-go/models/components"
	"log"
)

func main() {
    ctx := context.Background()

    s := novugo.New(
        novugo.WithSecurity("YOUR_SECRET_KEY_HERE"),
    )

    res, err := s.Integrations.Update(ctx, "<id>", components.UpdateIntegrationRequestDto{}, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res.IntegrationResponseDto != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
integrationID string ✔️ N/A
updateIntegrationRequestDto components.UpdateIntegrationRequestDto ✔️ N/A
idempotencyKey *string A header for idempotency purposes
opts []operations.Option The options for this request.

Response

*operations.IntegrationsControllerUpdateIntegrationByIDResponse, error

Errors

Error Type Status Code Content Type
apierrors.ErrorDto 414 application/json
apierrors.ErrorDto 400, 401, 403, 405, 409, 413, 415 application/json
apierrors.ValidationErrorDto 422 application/json
apierrors.ErrorDto 500 application/json
apierrors.APIError 4XX, 5XX */*

Delete

Delete integration

Example Usage

package main

import(
	"context"
	novugo "github.com/novuhq/novu-go"
	"log"
)

func main() {
    ctx := context.Background()

    s := novugo.New(
        novugo.WithSecurity("YOUR_SECRET_KEY_HERE"),
    )

    res, err := s.Integrations.Delete(ctx, "<id>", nil)
    if err != nil {
        log.Fatal(err)
    }
    if res.IntegrationResponseDtos != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
integrationID string ✔️ N/A
idempotencyKey *string A header for idempotency purposes
opts []operations.Option The options for this request.

Response

*operations.IntegrationsControllerRemoveIntegrationResponse, error

Errors

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

SetAsPrimary

Set integration as primary

Example Usage

package main

import(
	"context"
	novugo "github.com/novuhq/novu-go"
	"log"
)

func main() {
    ctx := context.Background()

    s := novugo.New(
        novugo.WithSecurity("YOUR_SECRET_KEY_HERE"),
    )

    res, err := s.Integrations.SetAsPrimary(ctx, "<id>", nil)
    if err != nil {
        log.Fatal(err)
    }
    if res.IntegrationResponseDto != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
integrationID string ✔️ N/A
idempotencyKey *string A header for idempotency purposes
opts []operations.Option The options for this request.

Response

*operations.IntegrationsControllerSetIntegrationAsPrimaryResponse, error

Errors

Error Type Status Code Content Type
apierrors.ErrorDto 414 application/json
apierrors.ErrorDto 400, 401, 403, 405, 409, 413, 415 application/json
apierrors.ValidationErrorDto 422 application/json
apierrors.ErrorDto 500 application/json
apierrors.APIError 4XX, 5XX */*

ListActive

Return all the active integrations the user has created for that organization. Review v.0.17.0 changelog for a breaking change

Example Usage

package main

import(
	"context"
	novugo "github.com/novuhq/novu-go"
	"log"
)

func main() {
    ctx := context.Background()

    s := novugo.New(
        novugo.WithSecurity("YOUR_SECRET_KEY_HERE"),
    )

    res, err := s.Integrations.ListActive(ctx, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res.IntegrationResponseDtos != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
idempotencyKey *string A header for idempotency purposes
opts []operations.Option The options for this request.

Response

*operations.IntegrationsControllerGetActiveIntegrationsResponse, error

Errors

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