uploads

package
v0.0.41 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ErrUploadStart    = whatsapp.Error("resumable upload start failed")
	ErrUploadContinue = whatsapp.Error("resumable upload continue failed")
	ErrUploadStatus   = whatsapp.Error("resumable upload status check failed")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseClient

type BaseClient struct {
	ConfReader config.Reader
	Sender     whttp.AnySender
}

func NewBaseClient

func NewBaseClient(confReader config.Reader, sender whttp.AnySender) *BaseClient

func (*BaseClient) GetUploadStatus

func (c *BaseClient) GetUploadStatus(ctx context.Context, uploadSessionID string) (*UploadStatusResponse, error)

func (*BaseClient) InitUploadSession

func (c *BaseClient) InitUploadSession(
	ctx context.Context,
	req *InitUploadSessionRequest,
) (*InitUploadSessionResponse, error)

func (*BaseClient) UploadChunk

func (c *BaseClient) UploadChunk(ctx context.Context, req *UploadChunkRequest) (*UploadChunkResponse, error)

type InitUploadSessionRequest

type InitUploadSessionRequest struct {
	FileName   string `json:"file_name"`
	FileLength int64  `json:"file_length"`
	FileType   string `json:"file_type"`
}

type InitUploadSessionResponse

type InitUploadSessionResponse struct {
	ID string `json:"id"` // format: upload:<UPLOAD_SESSION_ID>
}

type UploadChunkRequest

type UploadChunkRequest struct {
	UploadSessionID string
	FileOffset      int64
	FileReader      io.ReadSeeker
}

type UploadChunkResponse

type UploadChunkResponse struct {
	FileHandle string `json:"h"` // "h": "uploaded file handle"
}

type UploadStatusResponse

type UploadStatusResponse struct {
	ID         string `json:"id"`          // upload:<UPLOAD_SESSION_ID>
	FileOffset int64  `json:"file_offset"` // bytes uploaded so far
}

Jump to

Keyboard shortcuts

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