Version: v0.0.0-...-4dae14c Latest Latest

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

Go to latest
Published: Mar 11, 2020 License: BSD-3-Clause Imports: 13 Imported by: 0




View Source
const DefaultVersion = "40.0"


This section is empty.


This section is empty.


type Client

type Client struct {
	Version    string
	Env        Env
	HttpClient *http.Client
	Logger     *log.Logger
	// contains filtered or unexported fields

func NewClient

func NewClient(env Env, version string, logger *log.Logger) (*Client, error)

NewClient creates the new client.

func (*Client) Create

func (c *Client) Create(ctx context.Context, sObjectName string, v interface{}) (string, error)

Create creates record. Results are SObject ID and error.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, sObjectName, id string) error

Delete deletes specified record.

func (*Client) Login

func (c *Client) Login(ctx context.Context, cred *Credential) error

Login authenticates the credential.

func (*Client) Query

func (c *Client) Query(ctx context.Context, soql string, out interface{}) (string, error)

Query executes SOQL and store result to specified struct.

func (*Client) Read

func (c *Client) Read(ctx context.Context, sObjectName, id string, out interface{}) error

Read reads specified record.

func (*Client) Session

func (c *Client) Session(session *SessionID)

Session sets already authorized session to the current client.

func (*Client) Update

func (c *Client) Update(ctx context.Context, sObjectName, id string, v interface{}) error

Update updates specified record.

type Credential

type Credential struct {
	ClientID     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
	Username     string `json:"username"`
	Password     string `json:"password"`
	APIToken     string `json:"api_token"`

type Env

type Env int

Env defines target environments

const (
	Production Env = iota

Available environments

type SessionID

type SessionID struct {
	AccessToken string `json:"access_token"`
	InstanceURL string `json:"instance_url"`
	ID          string `json:"id"`
	TokenType   string `json:"token_type"`
	IssuedAt    string `json:"issued_at"`
	Signature   string `json:"signature"`
	Error       string `json:"error"`
	ErrorDesc   string `json:"error_description"`

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL