settings20

package
v1.54.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NO_REPAIR_INPUT = os.Getenv("DT_NO_REPAIR_INPUT") == "true"

Functions

func CreateRequiresOAuth added in v1.46.0

func CreateRequiresOAuth(response Response) bool

func IsSuccess added in v1.54.0

func IsSuccess(resp *http.Response) bool

IsSuccess returns true if the response indicates a successful HTTP status code. A status code between 200 and 299 (inclusive) is considered a success.

func RequestInfo added in v1.54.0

func RequestInfo(request *http.Request) rest.RequestInfo

func Service

func Service[T settings.Settings](credentials *settings.Credentials, schemaID string, schemaVersion string, options ...*ServiceOptions[T]) settings.CRUDService[T]

func UpdateRequiresOAuth added in v1.46.0

func UpdateRequiresOAuth(response Response) bool

Types

type Client added in v1.43.0

type Client struct {
	// contains filtered or unexported fields
}

func NewClient added in v1.43.0

func NewClient(tokenClient *rest.Client, oAuthClient *rest.Client, schemaID string, option ...Option) *Client

func (Client) Create added in v1.43.0

func (c Client) Create(ctx context.Context, scope string, data []byte) (Response, error)

func (Client) Delete added in v1.43.0

func (c Client) Delete(ctx context.Context, id string) (Response, error)

func (Client) Get added in v1.43.0

func (c Client) Get(ctx context.Context, id string) (Response, error)

func (Client) List added in v1.43.0

func (c Client) List(ctx context.Context) (Response, error)

func (Client) Update added in v1.43.0

func (c Client) Update(ctx context.Context, id string, data []byte) (Response, error)

type Config

type Config interface {
	New() settings.Settings
}

type Matcher added in v1.22.0

type Matcher interface {
	Match(o any) bool
}

type Option added in v1.43.0

type Option func(*Client)

Option represents a functional Option for the Client.

func WithUpdateRetrySettings added in v1.43.0

func WithUpdateRetrySettings(maxRetries int, waitDuration time.Duration) Option

WithUpdateRetrySettings sets the maximum number of retries as well as duration between retries for Update HTTP requests

type Response added in v1.43.0

type Response struct {
	api.Response
	ID    string
	Items []struct {
		ID    string          `json:"objectId"`
		Scope string          `json:"scope"`
		Value json.RawMessage `json:"value"`
	}
}

type ServiceOptions

type ServiceOptions[T settings.Settings] struct {
	LegacyID       func(id string) string
	Name           func(id string, v T) (string, error)
	HijackOnCreate func(err error, service settings.RService[T], v T) (*api.Stub, error)
	CreateRetry    func(v T, err error) T
	UpdateRetry    func(v T, err error) T
	Duplicates     func(service settings.RService[T], v T) (*api.Stub, error)
}

type SettingsObject

type SettingsObject struct {
	SchemaVersion string          `json:"schemaVersion"`
	SchemaID      string          `json:"schemaId"`
	Scope         string          `json:"scope"`
	Value         json.RawMessage `json:"value"`
}

type SettingsObjectCreate

type SettingsObjectCreate struct {
	SchemaVersion string `json:"schemaVersion,omitempty"`
	SchemaID      string `json:"schemaId"`
	Scope         string `json:"scope,omitempty"`
	Value         any    `json:"value"`
	InsertAfter   string `json:"insertAfter,omitempty"`
}

type SettingsObjectCreateResponse

type SettingsObjectCreateResponse struct {
	ObjectID string `json:"objectId"`
}

type SettingsObjectList

type SettingsObjectList struct {
	Items       []*SettingsObjectListItem `json:"items"`
	NextPageKey *string                   `json:"nextPageKey,omitempty"`
}

type SettingsObjectListItem

type SettingsObjectListItem struct {
	ObjectID      string          `json:"objectId"`
	Scope         string          `json:"scope"`
	SchemaVersion string          `json:"schemaVersion"`
	Value         json.RawMessage `json:"value"`
}

type SettingsObjectResponse added in v1.43.0

type SettingsObjectResponse struct {
	Code  int `json:"code"`
	Error struct {
		Code    int    `json:"code"`
		Message string `json:"message"`
	} `json:"error"`
}

func (SettingsObjectResponse) RequiresOAuth added in v1.43.0

func (sor SettingsObjectResponse) RequiresOAuth() bool

type SettingsObjectUpdate

type SettingsObjectUpdate struct {
	SchemaVersion string `json:"schemaVersion,omitempty"`
	Value         any    `json:"value"`
	InsertAfter   string `json:"insertAfter,omitempty"`
}

Jump to

Keyboard shortcuts

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