Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) Complete(ctx context.Context, publicID string, req CompleteRequest) (*CompleteResponse, error)
- func (c *Client) Init(ctx context.Context, req InitRequest) (*InitResponse, error)
- func (c *Client) MaxBytes() int64
- func (c *Client) Upload(ctx context.Context, filename string, size int64, ttlDays int, ...) (*Result, error)
- type CompleteRequest
- type CompleteResponse
- type CompletedPart
- type InitRequest
- type InitResponse
- type Part
- type Result
Constants ¶
const ( DefaultBaseURL = "https://www.mythicalsystems.org" PartSizeBytes = 67108864 AnonymousMaxBytes = 16106127360 APIKeyMaxBytes = 32212254720 BackgroundMinBytes = 256 << 20 // 256 MiB )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client talks to the temp uploads API and the multipart upload endpoint.
func (*Client) Complete ¶
func (c *Client) Complete(ctx context.Context, publicID string, req CompleteRequest) (*CompleteResponse, error)
Complete finalizes the multipart upload.
func (*Client) Init ¶
func (c *Client) Init(ctx context.Context, req InitRequest) (*InitResponse, error)
Init creates a multipart upload session.
type CompleteRequest ¶
type CompleteRequest struct {
Parts []CompletedPart `json:"parts"`
}
CompleteRequest is the JSON body for POST /api/temp-files/{id}/complete.
type CompleteResponse ¶
type CompleteResponse struct {
Success bool `json:"success"`
PublicID string `json:"public_id"`
PageURL string `json:"page_url"`
DownloadPath string `json:"download_path"`
ExpiresAt string `json:"expires_at"`
Size int64 `json:"size"`
OriginalName string `json:"original_name"`
PasswordProtected bool `json:"password_protected"`
DownloadURL string `json:"download_url"`
Error string `json:"error"`
Message string `json:"message"`
}
CompleteResponse is returned by complete.
type CompletedPart ¶
CompletedPart is sent to complete.
type InitRequest ¶
type InitRequest struct {
Filename string `json:"filename"`
Size int64 `json:"size"`
TTLDays int `json:"ttl_days"`
Password string `json:"password,omitempty"`
DeleteKey string `json:"delete_key,omitempty"`
}
InitRequest is the JSON body for POST /api/temp-files.
type InitResponse ¶
type InitResponse struct {
Success bool `json:"success"`
PublicID string `json:"public_id"`
PartSize int64 `json:"part_size"`
PartCount int `json:"part_count"`
Parts []Part `json:"parts"`
DeleteKey string `json:"delete_key"`
DeleteToken string `json:"delete_token"`
PasswordProtected bool `json:"password_protected"`
ExpiresAt string `json:"expires_at"`
CompleteURL string `json:"complete_url"`
PageURL string `json:"page_url"`
DownloadPath string `json:"download_path"`
Error string `json:"error"`
Message string `json:"message"`
}
InitResponse is returned by POST /api/temp-files.
type Result ¶
type Result struct {
PublicID string `json:"public_id"`
URL string `json:"url"`
DeleteKey string `json:"delete_key"`
ExpiresAt string `json:"expires_at"`
PasswordProtected bool `json:"password_protected"`
Size int64 `json:"size"`
Filename string `json:"filename"`
}
Result is the final share result returned to callers.