jexiasdkgo

package module
v0.0.0-...-f65a94c Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: MIT Imports: 9 Imported by: 2

README

Notice

Unfortunately Jexia has ceased operations and no longer provides their services. Therefore this repository has been archived, and the project abandoned.

Is the Jexia platform going offline?

Yes, we will be taking down the platform and all it’s contents by April 30th 2021. All user agreements also end on that date.

Why is the Jexia platform going offline?

Over the past few years we’ve poured our hearts into this platform. And although we consider it to be a technological success, we unfortunately haven’t been able match this commercially. As a result we have decided to call it quits.

Until when can I access my account/projects?

Your account and projects will be accessible until the 30th of April 2021.

Retrieved from Jexia's FAQ.

Jexia Jexia SDK Go

Go Report Card Go Doc GitHub go.mod Go version GitHub code size in bytes Maintainability Code Climate issues Code Climate technical debt codecov

Jexia SDK Go is an unofficial multi-level API wrapper for Jexia's API written in Go for interacting with Jexia projects. The aims of this project are to support everything Jexia's JavaScript SDK currently does, but in a way friendly to the Go eco-system.

This project is still in the very early stages, breaking changes may be introduced until v1.0.0 stable. After this, new features and bug fixes will be implemented. We aim to follow the Semantic Versioning specification.

Table of contents

Roadmap

This is the order we are trying to implement features in.

  • Authentication
  • Datasets
  • Filesets
  • Project Users (UMS)
  • Realtime events (PubSub)

You can view the v1.0.0 roadmap for more detailed progress and to see what features have been completed.

Features

Still early development

Getting Started

We will get back to this once we have released a more stable package.

Contributing

Thank you for your interest in contributing to this repo! ❤

Everyone is welcome to contribute, whether it's in the form of code, documentation, bug reports, feature requests, or anything else. We encourage you to experiment with the project and make contributions to help evolve it to meet your needs!

See Jexia's Semaphore contributing guide for more details.

Documentation

Index

Constants

View Source
const API = "API"

API signifies the error was send from the Jexia API directly

View Source
const (
	// DefaultLifetime is 2 hours minus 2 minutes to ensure we never lose the token
	DefaultLifetime = 118 * time.Minute
)
View Source
const Internal = "Internal"

Internal signifies the error was send from an internal source

Variables

This section is empty.

Functions

This section is empty.

Types

type APKTokenRequest

type APKTokenRequest struct {
	Method string `json:"method"`
	Key    string `json:"key"`
	Secret string `json:"secret"`
}

APKTokenRequest is the JSON data sent to the /auth endpoint when authenticating with the API key

type Client

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

Client contains most data needed for each request

func NewClient

func NewClient(id, zone string, opts ...Option) *Client

NewClient is used to generate a new client for interacting with the API

func (*Client) AutoRefreshToken

func (c *Client) AutoRefreshToken()

AutoRefreshToken sets the token to refresh at a certain interval based on token lifetime

func (*Client) ForgetSecrets

func (c *Client) ForgetSecrets()

ForgetSecrets removes the secret from the APKTokenRequest or the password from the UMSTokenRequest

func (*Client) GetDataset

func (c *Client) GetDataset(name string) *Dataset

GetDataset returns a dataset instance that can be used to perform actions against

func (*Client) GetToken

func (c *Client) GetToken() Token

GetToken passes the current token

func (*Client) GetTokenRequest

func (c *Client) GetTokenRequest() interface{}

GetTokenRequest passes the current token request

func (*Client) RefreshToken

func (c *Client) RefreshToken()

RefreshToken triggers a token refresh once called

func (*Client) SetToken

func (c *Client) SetToken(token Token)

SetToken assigns the user token to the client for future use

func (*Client) SetTokenLifetime

func (c *Client) SetTokenLifetime(duration time.Duration)

SetTokenLifetime sets the duration before a token refresh is called Note: This currently only applies after the first 118 minute loop TODO: Ensure that this new duration is set immediately and not after the current loop

func (*Client) SetTokenRequest

func (c *Client) SetTokenRequest(tokenRequest interface{})

SetTokenRequest assigns the user token to the client for future use

func (*Client) UseAPKToken

func (c *Client) UseAPKToken(apiKey, apiSecret string) error

UseAPKToken assigns the user token to the client for future use

func (*Client) UseUMSToken

func (c *Client) UseUMSToken(email, password string) error

UseUMSToken assigns the user token to the client for future use

type Dataset

type Dataset struct {
	Name   string
	Client *Client
	// contains filtered or unexported fields
}

Dataset a struct containing the name of the dataset and the client memory pointer As the client is a memory pointer, any changes made to the client will be reflected within the dataset, therefore token refreshes will still work

func (*Dataset) GetClient

func (d *Dataset) GetClient() *Client

GetClient fetches the current client

func (*Dataset) GetName

func (d *Dataset) GetName() string

GetName fetches the dataset name

func (*Dataset) Insert

func (d *Dataset) Insert(dataArray []interface{}) ([]interface{}, error)

Insert allows you to add sets of data to the dataset If you are inputing a single interface you must wrap it in an array: []interface{}{yourStruct}

func (*Dataset) Select

func (d *Dataset) Select(target interface{}) error

Select allows you to select the data from a dataset You should pass an array of types you are expecting to receive: *[]interface{}

type Error

type Error struct {
	ID        string `json:"request_id"`
	Message   string `json:"message"`
	Origin    string `json:"origin"`
	Temporary bool   `json:"temporary"`
}

Error is the error returned, allows for retry scenarios

func (*Error) Error

func (e *Error) Error() string

type Option

type Option func(*Client)

Option allows the client to be configured with different options.

func SetHTTPClient

func SetHTTPClient(http *http.Client) Option

SetHTTPClient allows for a custom client to be set

func SetProjectURL

func SetProjectURL(url string) Option

SetProjectURL allows for a custom url to be set which does not match that of the standard pattern Note: If such url contains strings such as the project ID, this needs to be computed before being passed through

type Token

type Token struct {
	Access   string `json:"access_token"`
	Refresh  string `json:"refresh_token"`
	Lifetime time.Duration
}

Token is the response from the /auth request which contains the access and refresh tokens Currently, each token lasts 2 hours. https://docs.jexia.com/auth/#:~:text=token%20is%20valid%20for

type UMSTokenRequest

type UMSTokenRequest struct {
	Method   string `json:"method"`
	Email    string `json:"email"`
	Password string `json:"password"`
}

UMSTokenRequest is the JSON data sent to the /auth endpoint when authenticating with user credentials

Jump to

Keyboard shortcuts

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