kii

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const BestEffortLimit = "200"

Variables

View Source
var StrLoginError = "\nIf you don't sign up for the dcenv resistry yet. Please sign up on [ https://nak1114.github.io/dcenv/sign_up.html ]."

Functions

func Logout

func Logout(fname string)

Types

type App

type App struct {
	User
	Site string
}

func NewApp

func NewApp(appID string, appKey string, site string, buckets string) (a App)

func (App) Login

func (a App) Login(user string, pass string) (u User, e error)

func (App) Relogin

func (a App) Relogin(fname string) (User, error)

type ObjBase added in v0.0.3

type ObjBase struct {
	ID      string `json:"_id,omitempty"`
	Owner   string `json:"_owner,omitempty"`
	Created int64  `json:"_created,omitempty"`
	Updated int64  `json:"_modified,omitempty"`
	Version string `json:"_version,omitempty"`
}

type Query

type Query struct {
	R   []interface{}
	L   int
	U   *User
	K   string
	Q   string
	EoQ bool
}

func (*Query) Next

func (q *Query) Next(v interface{}) error

type ResCreateObj added in v0.0.3

type ResCreateObj struct {
	ID         string `json:"objectID"`  //   string  The ID of the object.
	CcreatedAt int64  `json:"createdAt"` //   long  The creation date of the object in Unix epoch (milliseconds in UTC).
	DataType   string `json:"dataType"`  //   string  The data type of the object.
}

type ResError added in v0.0.3

type ResError struct {
	ErrorCode string `json:"errorCode"` //Error code "QUERY_NOT_SUPPORTED".
	Message   string `json:"message"`   //The error message.
}

type ResLogin added in v0.0.3

type ResLogin struct {
	ID     string `json:"id,omitempty"`           //" : "*************************************",
	Token  string `json:"access_token,omitempty"` //
	Expire int64  `json:"expires_in,omitempty"`   //" : 2147483639,
	TType  string `json:"token_type,omitempty"`   //" : "bearer"
}

type ResLoginError added in v0.0.3

type ResLoginError struct {
	ECode string `json:"errorCode,omitempty"`         //" : "invalid_grant",
	EDesc string `json:"error_description,omitempty"` //" : "The user was not found or a wrong password was provided",
	Error string `json:"error,omitempty"`             //" : "invalid_grant"
}

type ResQuery added in v0.0.3

type ResQuery struct {
	QueryDescription  string
	Results           []interface{}
	NextPaginationKey string
}

type User

type User struct {
	ID      string
	Name    string
	Token   string
	TType   string
	Expire  int64
	Ap      *App
	Buckets string
}

func (*User) ACLObj

func (u *User) ACLObj(objID string) (e error)
curl -v -X DELETE \
  -H "Authorization: Bearer *******************************************" \
  "https://api-jp.kii.com/api/apps/efo16zkedmd7/buckets/dcenv/objects/e130c620-fc1d-11e6-865e-22000b07265b/acl/WRITE_EXISTING_OBJECT/UserID:ANY_AUTHENTICATED_USER"

func (User) AuthHeader

func (u User) AuthHeader() (s string)

func (*User) CB

func (u *User) CB(backets string) *User

func (*User) CreateObj

func (u *User) CreateObj(obj string) (res ResCreateObj, e error)

func (*User) DeleteObj

func (u *User) DeleteObj(id string) (e error)

func (User) ExistObj

func (u User) ExistObj(obj string, res interface{}) (e error)

func (User) Query

func (u User) Query(query string) (Query, error)

func (*User) UpdateObj

func (u *User) UpdateObj(id string, obj string) (res ResCreateObj, e error)
curl -v -X PUT \
  -H "Authorization: Bearer *******************************************" \
  -H "Content-Type: application/json" \
  "https://api-jp.kii.com/api/apps/efo16zkedmd7/buckets/dcenv/objects/defcf5d0-fbd3-11e6-865e-22000b07265b" \
  -d '{"score": 100, "name": "game3"}'

func (*User) WriteToFile

func (u *User) WriteToFile(fname string) error

Jump to

Keyboard shortcuts

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