attachas

package module
v0.0.0-...-16370fe Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2021 License: MIT Imports: 11 Imported by: 0

README

go-attach

Go Reference

Attach.as API client written in Go (golang).

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	as.Client
}

Client is used to interact with the Attach.as API.

func NewClient

func NewClient(token string) *Client

NewClient creates a new API client. All requests must be authenticated, so you should supply a user access token returned from the Write.as API library (github.com/writeas/go-writeas/v2)

wc := writeas.NewClient()
u, err := wc.LogIn("username", "password")
if err != nil {
    // Handle error...
}
sc := attachas.NewClient(u.AccessToken)

func NewClientWith

func NewClientWith(cfg *as.ClientConfig, token string) *Client

NewClientWith builds a new API client with the provided configuration.

func NewDevClient

func NewDevClient(token string) *Client

NewDevClient creates a new API client for development and testing. It will communicate with our development servers, and SHOULD NOT be used in production.

func (*Client) UploadFile

func (c *Client) UploadFile(sp *FileParams) (*File, error)

UploadFile uploads a photo, and returns an Attach.as File.

type File

type File struct {
	ID       string    `json:"id"`
	Created  time.Time `json:"created"`
	Filename string    `json:"filename"`
	Size     int64     `json:"size"`
	URL      string    `json:"url"`
}

File represents a photo on Snap.as.

type FileParams

type FileParams struct {
	FileName string
	Body     string

	// OrgAlias is the alias of the organization to upload to.
	OrgAlias string
}

FileParams holds valid values for uploading files.

Jump to

Keyboard shortcuts

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