Thanks to visit codestin.com
Credit goes to pkg.go.dev

shimo_openapi

package module
v0.0.0-...-59ee78d Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

README

shimo-openapi

GitHub license GoDoc

Documentation

Index

Constants

View Source
const Endpoint = "https://api.shimo.im"
View Source
const TokenTTL = time.Hour

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	Opts
	// contains filtered or unexported fields
}

Cache cache request data

type Client

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

Client provides a way to interact with Shimo.im using such credentials

func NewClient

func NewClient(clientId string, clientSecret string, username string, password string, scope string) *Client

NewClient initializes a new Client

func (*Client) AppendFileFromAPI

func (c *Client) AppendFileFromAPI(fileID string, opts WriteOpts) error

func (*Client) Close

func (c *Client) Close()

func (*Client) GetFileWithOpts

func (c *Client) GetFileWithOpts(fileID string, opts Opts) ([]byte, error)

GetFileWithOpts gets a file from shimo.im with the specified fileID and Opts. It returns the response io.Reader which can be used to stream responses. The one using this method SHOULD cache the file content response from this method due to the limitation of shimo.im's API.

func (*Client) UpdateFileFromAPI

func (c *Client) UpdateFileFromAPI(fileID string, opts WriteOpts) error

type Opts

type Opts struct {
	SheetName string `json:"sheet_name"`
	EndRow    int    `json:"end_row"`
	EndCol    string `json:"end_col"`
	// the suffix in the header to be removed
	HeaderSuffix string        `json:"header_suffix"`
	CacheTTL     time.Duration `json:"cache_ttl"`
}

Opts provide options for getting sheet data

type WriteObj

type WriteObj interface {
	Values() []interface{}
}

Because the map data is unordered, you need to customize the order in which the fields are stored

type WriteOpts

type WriteOpts struct {
	Range    string         `json:"range"`
	Resource *WriteResource `json:"resource"`
}

func NewWriteOpts

func NewWriteOpts(sheetName string, v WriteObj) *WriteOpts

type WriteResource

type WriteResource struct {
	Values [][]interface{} `json:"values"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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