client

package module
v0.0.0-...-60554f8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2022 License: MIT Imports: 9 Imported by: 1

README

go-notification-client

This is the client library for the Notification API.

Example

Refer to example for examples on how to use this library.

Error handling

Errors returned by the API are decoded into problems from the github.com/SKF/go-rest-utility package before being returned by the client functions. This makes it possible to use the standard error package to do error checking on any returned error.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithStage

func WithStage(stage string) rest.Option

Types

type API

type API interface {
	GetNotificationType(context.Context, string) (models.NotificationType, error)
	GetNotificationTypes(context.Context) ([]models.NotificationType, error)
	PostInitiatedNotification(context.Context, models.InitiatedNotification) (string, error)
	GetInitiatedNotification(context.Context, string) (models.InitiatedNotification, error)
	DeleteInitiatedNotification(context.Context, string) error
}

type Client

type Client struct {
	*rest.Client
}

func New

func New(opts ...rest.Option) *Client

func (*Client) DeleteInitiatedNotification

func (c *Client) DeleteInitiatedNotification(ctx context.Context, externalID string) error

func (*Client) GetInitiatedNotification

func (c *Client) GetInitiatedNotification(
	ctx context.Context,
	externalID string,
) (models.InitiatedNotification, error)

func (*Client) GetNotificationType

func (c *Client) GetNotificationType(ctx context.Context, name string) (models.NotificationType, error)

func (*Client) GetNotificationTypes

func (c *Client) GetNotificationTypes(ctx context.Context) ([]models.NotificationType, error)

func (*Client) PostInitiatedNotification

func (c *Client) PostInitiatedNotification(
	ctx context.Context,
	initialNotification models.InitiatedNotification,
) (string, error)

type ProblemDecoder

type ProblemDecoder struct{}

func (*ProblemDecoder) DecodeProblem

func (p *ProblemDecoder) DecodeProblem(ctx context.Context, r *http.Response) (problems.Problem, error)

Directories

Path Synopsis
example module
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL