client

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package client provides an HTTP client for the PicoShare API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is an HTTP client for the PicoShare API.

func New

func New(serverURL, password string) (*Client, error)

New creates a new PicoShare API client and logs in.

func (c *Client) CreateGuestLink(label, urlExpiration, fileLifetime string, maxFileBytes *uint64, maxUploads *int) (*GuestLinkResponse, error)

CreateGuestLink creates a new guest upload link.

func (*Client) DeleteFile

func (c *Client) DeleteFile(id string) error

DeleteFile deletes a file entry by ID.

func (c *Client) DeleteGuestLink(id string) error

DeleteGuestLink deletes a guest link by ID.

func (c *Client) DisableGuestLink(id string) error

DisableGuestLink disables a guest link.

func (c *Client) EnableGuestLink(id string) error

EnableGuestLink enables a guest link.

func (*Client) ListFiles

func (c *Client) ListFiles() ([]FileEntry, error)

ListFiles retrieves the list of uploaded files by scraping the HTML file index page, since PicoShare has no JSON API for listing entries.

func (*Client) UploadFile

func (c *Client) UploadFile(filePath, expiration, note string) (*UploadResponse, error)

UploadFile uploads a file to PicoShare.

type FileEntry

type FileEntry struct {
	ID       string `json:"id"`
	Filename string `json:"filename"`
	Size     string `json:"size"`
	Uploaded string `json:"uploaded"`
	Expires  string `json:"expires"`
	Note     string `json:"note,omitempty"`
}

FileEntry represents a file entry in PicoShare.

type GuestLinkResponse

type GuestLinkResponse struct {
	ID string `json:"id"`
}

GuestLinkResponse holds the ID returned when creating a guest link.

type UploadResponse

type UploadResponse struct {
	ID string `json:"id"`
}

UploadResponse holds the ID returned after uploading a file.

Jump to

Keyboard shortcuts

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