myclubhouse

command module
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

README

myClubhouse

CLI tool

Installation

Clone the repo. Then:

go install .
Help
myclubhouse help
Config
myclubhouse set-config {authToken} {subDomain} 

API Client

Package Instantiation
import "github.com/c-m-hunt/myclubhouse/apiclient"

c := apiclient.MakeClient(subdomain, apiToken, nil)
Testing

To run unit tests, run

go test ./...

To run integration tests, connection to a service is required.

Create a file .env with the following contents subbing in the values:

ACCESS_TOKEN=xxxxxxxxxxxxxxxxxxxxxxx
SUBDOMAIN=mysubdomain

Integration tests can be run with:

go test -tags=integration ./...
Basic functionality
Users
users := []data.User{}
cr, err := c.Users(nil, &users)
User
id := 1
user, err := c.User(id)
Events
events := []data.Event{}
cr, err = c.Events(nil, &events)
Event
id := 1
event, err := c.Event(id)
Request query

All client requests accept a request query as first argument which is in the following structure which will be passed through

type RequestQuery struct {
	View         string `url:"view"`
	Sort         string `url:"sort"`
	Filter       string `url:"filter"`
	SelectedPage int    `url:"selectedPage"`
	PageSize     int    `url:"pageSize"`
}

Example:

q := apiclient.RequestQuery{
  PageSize: 200,
}
users := []data.User{}
cr, err := c.Users(&q, &users)

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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