Skip to content

Latest commit

 

History

History
120 lines (89 loc) · 9.05 KB

File metadata and controls

120 lines (89 loc) · 9.05 KB

SubscribersPreferences

(SubscribersPreferences)

Overview

Available Operations

  • UpdateGlobal - Update subscriber global preferences
  • Update - Update subscriber preference

UpdateGlobal

Update subscriber global preferences

Example Usage

package main

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

func main() {
    ctx := context.Background()
    
    s := novugo.New(
        novugo.WithSecurity(os.Getenv("NOVU_API_KEY")),
    )

    res, err := s.SubscribersPreferences.UpdateGlobal(ctx, "<id>", components.UpdateSubscriberGlobalPreferencesRequestDto{})
    if err != nil {
        log.Fatal(err)
    }
    if res.UpdateSubscriberPreferenceGlobalResponseDto != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
subscriberID string ✔️ N/A
updateSubscriberGlobalPreferencesRequestDto components.UpdateSubscriberGlobalPreferencesRequestDto ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.SubscribersControllerUpdateSubscriberGlobalPreferencesResponse, error

Errors

Error Type Status Code Content Type
apierrors.ErrorDto 400, 404, 409 application/json
apierrors.ValidationErrorDto 422 application/json
apierrors.APIError 4XX, 5XX */*

Update

Update subscriber preference

Example Usage

package main

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

func main() {
    ctx := context.Background()
    
    s := novugo.New(
        novugo.WithSecurity(os.Getenv("NOVU_API_KEY")),
    )

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

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
subscriberID string ✔️ N/A
workflowID string ✔️ N/A
updateSubscriberPreferenceRequestDto components.UpdateSubscriberPreferenceRequestDto ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.SubscribersControllerUpdateSubscriberPreferenceResponse, error

Errors

Error Type Status Code Content Type
apierrors.ErrorDto 400, 404, 409 application/json
apierrors.ValidationErrorDto 422 application/json
apierrors.APIError 4XX, 5XX */*