sfdc

package module
Version: v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: MIT Imports: 5 Imported by: 97

README

go-sfdc

This is a golang library for interfacing with Salesforce APIs.

Getting Started

Installing

To start using GO-SFDC, install GO and run go get

go get -u github.com/g8rswimmer/go-sfdc

This will retrieve the library.

Usage

To use this library, the following will need to be done.

Configuration

The configuration defines several parameters that can be used by the library. The configuration is used per session.

  • Credentials - this is an implementation of the credentials.Provider interface
  • Client - the HTTP client used by the APIs
  • Version - is the Salesforce version. Please refer to Salesforce documentation to make sure that APIs are supported in the version that is specified.
Example
config := sfdc.Configuration{
	Credentials: credentials.NewPasswordCredentials(creds),
	Client:      salesforceHTTPClient,
	Version:     44,
}

License

GO-SFDC source code is available under the MIT License

Documentation

Index

Constants

View Source
const (
	// RecordAttributes is the attribute map from the record JSON
	RecordAttributes = "attributes"
)
View Source
const SalesforceDate = "2006-01-02"

SalesforceDate is the format returned by the Salesforce Date field type.

View Source
const SalesforceDateTime = "2006-01-02T15:04:05.000+0000"

SalesforceDateTime is the format returned by Salesforce TimeDate field type.

Variables

This section is empty.

Functions

func ParseTime

func ParseTime(salesforceTime string) (time.Time, error)

ParseTime attempts to parse a JSON time string from Salesforce. It will attempt to parse the time using RFC 3339, then Salesforce DateTime format and lastly Salesforce Date format.

Types

type Configuration

type Configuration struct {
	Credentials *credentials.Credentials
	Client      *http.Client
	Version     int
}

Configuration is the structure for goforce sessions.

Credentials is the credentials that will be used to form a session.

Client is the HTTP client that will be used.

Version is the Salesforce version for the APIs.

type Error

type Error struct {
	ErrorCode string   `json:"errorCode"`
	Message   string   `json:"message"`
	Fields    []string `json:"fields"`
}

Error is the error structure defined by the Salesforce API.

func (*Error) UnmarshalJSON

func (e *Error) UnmarshalJSON(data []byte) error

UnmarshalJSON will unmarshal a JSON byte array.

type Record

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

Record is a representation of a Salesforce record.

func RecordFromJSONMap

func RecordFromJSONMap(jsonMap map[string]interface{}) (*Record, error)

RecordFromJSONMap creates a recrod from a JSON map.

func (*Record) FieldValue

func (r *Record) FieldValue(field string) (interface{}, bool)

FieldValue returns the field's value. If there is no field for the field name, then false will be returned.

func (*Record) Fields

func (r *Record) Fields() map[string]interface{}

Fields returns the map of field name to value relationships.

func (*Record) LookUp

func (r *Record) LookUp(lookUp string) (*Record, bool)

LookUp returns the look up record

func (*Record) LookUps

func (r *Record) LookUps() []*Record

LookUps returns all of the record's look ups

func (*Record) SObject

func (r *Record) SObject() string

SObject returns attribute's Salesforce object name.

func (*Record) URL

func (r *Record) URL() string

URL returns the record attribute's URL.

func (*Record) UnmarshalJSON

func (r *Record) UnmarshalJSON(data []byte) error

UnmarshalJSON provides a custom unmarshaling of a JSON byte array.

Directories

Path Synopsis
Package session provides handles creation of a Salesforce session
Package session provides handles creation of a Salesforce session
collections
Package collections is the implementation of the SObject Collections API.
Package collections is the implementation of the SObject Collections API.

Jump to

Keyboard shortcuts

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