Documentation
¶
Index ¶
- Variables
- type Client
- type Config
- type FakeClient
- func (f *FakeClient) CreateRevisionFromChan(ctx context.Context, paths <-chan string, rootDir string) (UploadResult, error)
- func (f *FakeClient) GetLastRevisionID() RevisionID
- func (f *FakeClient) GetRevisionPaths(revID RevisionID) []string
- func (f *FakeClient) GetUploadCount() int
- func (f *FakeClient) UploadOccurred() bool
- func (f *FakeClient) WithError(err error) *FakeClient
- type FileAccessError
- type FileCountLimitError
- type FilePathLengthLimitError
- type FileSizeLimitError
- type HTTPClient
- type HTTPError
- type MultipartError
- type Option
- type OrgID
- type RevisionID
- type SkippedFile
- type SpecialFileError
- type TotalPayloadSizeLimitError
- type UploadResult
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoFilesProvided = uploadrevision.ErrNoFilesUploaded ErrEmptyOrgID = uploadrevision.ErrEmptyOrgID ErrEmptyRevisionID = uploadrevision.ErrEmptyRevisionID )
Sentinel errors for common conditions.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
CreateRevisionFromChan(ctx context.Context, paths <-chan string, rootPath string) (UploadResult, error)
}
Client defines the interface for the high level file upload client.
type FakeClient ¶
type FakeClient struct {
// contains filtered or unexported fields
}
func (*FakeClient) CreateRevisionFromChan ¶
func (f *FakeClient) CreateRevisionFromChan(ctx context.Context, paths <-chan string, rootDir string) (UploadResult, error)
func (*FakeClient) GetLastRevisionID ¶
func (f *FakeClient) GetLastRevisionID() RevisionID
GetLastRevisionID returns the ID of the most recent revision created.
func (*FakeClient) GetRevisionPaths ¶
func (f *FakeClient) GetRevisionPaths(revID RevisionID) []string
func (*FakeClient) GetUploadCount ¶
func (f *FakeClient) GetUploadCount() int
GetUploadCount returns the number of uploads that have occurred.
func (*FakeClient) UploadOccurred ¶
func (f *FakeClient) UploadOccurred() bool
UploadOccurred returns true if at least one upload has been performed.
func (*FakeClient) WithError ¶
func (f *FakeClient) WithError(err error) *FakeClient
WithError configures the fake to return an error.
type FileAccessError ¶
type FileAccessError = uploadrevision.FileAccessError
FileAccessError indicates a file access permission issue.
type FileCountLimitError ¶
type FileCountLimitError = uploadrevision.FileCountLimitError
FileCountLimitError indicates too many files were provided.
type FilePathLengthLimitError ¶
type FilePathLengthLimitError = uploadrevision.FilePathLengthLimitError
FilePathLengthLimitError indicates a file's path exceeds the maximum allowed size.
type FileSizeLimitError ¶
type FileSizeLimitError = uploadrevision.FileSizeLimitError
FileSizeLimitError indicates a file exceeds the maximum allowed size.
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient provides high-level file upload functionality.
func (*HTTPClient) CreateRevisionFromChan ¶
func (c *HTTPClient) CreateRevisionFromChan(ctx context.Context, paths <-chan string, rootPath string) (UploadResult, error)
CreateRevisionFromChan uploads multiple paths from a channel (files paths only, file paths are uploaded relative to rootPath), returning a revision ID. This is a convenience method that creates, uploads, and seals a revision.
type HTTPError ¶
type HTTPError = uploadrevision.HTTPError
HTTPError indicates an HTTP request/response error.
type MultipartError ¶
type MultipartError = uploadrevision.MultipartError
MultipartError indicates an issue with multipart request handling.
type Option ¶
type Option func(*HTTPClient)
Option allows customizing the Client during construction.
func WithLogger ¶
WithLogger allows injecting a custom logger instance.
func WithUploadRevisionSealableClient ¶
func WithUploadRevisionSealableClient(client uploadrevision.SealableClient) Option
WithUploadRevisionSealableClient allows injecting a custom low-level client (primarily for testing).
type RevisionID ¶
type RevisionID = uploadrevision.RevisionID
RevisionID represents a revision identifier.
type SkippedFile ¶
SkippedFile represents a file that was skipped. It includes the skipped file's path and the reason it was skipped.
type SpecialFileError ¶
type SpecialFileError = uploadrevision.SpecialFileError
SpecialFileError indicates a path points to a special file (device, pipe, socket, etc.) instead of a regular file.
type TotalPayloadSizeLimitError ¶
type TotalPayloadSizeLimitError = uploadrevision.TotalPayloadSizeLimitError
TotalPayloadSizeLimitError indicates the total size of all files exceeds the maximum allowed payload size.
type UploadResult ¶
type UploadResult struct {
RevisionID RevisionID // The ID of the revision which was created.
UploadedFilesCount int // The number of uploaded files.
SkippedFiles []SkippedFile // The list of files which were skipped.
}
UploadResult respresents the result of the upload.