sdk

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingResponseBody = errors.New("missing response body")
)

List of errors that can be returned by the SDK

Functions

This section is empty.

Types

type APIError added in v1.14.0

type APIError struct {
	StatusCode int
	Errors     *api.JSONErrors
}

APIError represents an error returned by the files API

func (*APIError) Error added in v1.14.0

func (e *APIError) Error() string

Error implements the error interface for APIError

type Client

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

Client is the SDK client for dp-files-api

func New

func New(filesAPIURL, authToken string) *Client

New creates a new instance of Client for the service

func NewWithHealthClient

func NewWithHealthClient(hcCli *health.Client, authToken string) *Client

NewWithHealthClient creates a new instance of Client, reusing the URL and Clienter from the provided health check client

func (*Client) Checker

func (c *Client) Checker(ctx context.Context, check *healthcheck.CheckState) error

Checker calls files api health endpoint and returns a check object to the caller

func (*Client) CreateFileEvent

func (c *Client) CreateFileEvent(ctx context.Context, event files.FileEvent) (*files.FileEvent, error)

CreateFileEvent creates a new file event in the audit log and returns the created event

func (*Client) DeleteFile added in v1.14.0

func (c *Client) DeleteFile(ctx context.Context, filePath string) error

DeleteFile deletes a file at the specified filePath

func (*Client) GetFile added in v1.14.0

func (c *Client) GetFile(ctx context.Context, filePath string) (*files.StoredRegisteredMetaData, error)

GetFile retrieves the metadata for a file at the specified path

func (*Client) Health

func (c *Client) Health() *health.Client

Health returns the underlying Healthcheck Client for this API client

func (*Client) MarkFilePublished added in v1.14.0

func (c *Client) MarkFilePublished(ctx context.Context, filePath string) error

MarkFilePublished makes a PATCH request using patchFile to set the file state to "PUBLISHED"

func (*Client) URL

func (c *Client) URL() string

URL returns the URL used by this client

type Clienter added in v1.14.0

type Clienter interface {
	Checker(ctx context.Context, check *healthcheck.CheckState) error
	Health() *health.Client
	URL() string

	CreateFileEvent(ctx context.Context, event files.FileEvent) (*files.FileEvent, error)
	DeleteFile(ctx context.Context, filePath string) error
	GetFile(ctx context.Context, filePath string) (*files.StoredRegisteredMetaData, error)
	MarkFilePublished(ctx context.Context, filePath string) error
}

type Error

type Error struct {
	Code        string `json:"code"`
	Description string `json:"description"`
}

Error represents a single error in the error response

type ErrorResponse

type ErrorResponse struct {
	Errors []Error `json:"errors"`
}

ErrorResponse represents an error response from the API

type FilePatchRequest added in v1.14.0

type FilePatchRequest struct {
	api.StateMetadata
	ETag string `json:"etag,omitempty"`
}

FilePatchRequest represents the request payload for a PATCH request to "/files/{path:.*}" It includes StateMetadata and an optional ETag as some handlers require it

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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