gosalesforce

package module
v0.0.0-...-0fec5b9 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2015 License: Apache-2.0 Imports: 7 Imported by: 0

README

Gosalesforce

Golang Salesforce REST API library. This library is inspired by the excellent "Simple-Salesforce" Python library. Currently only OAuth2 is supported and an interface{} object is returned to keep things simple.

API documentation can be found at the Godoc page

Examples

package main

import (
  "fmt"
  "encoding/json"
  "github.com/tux0010/gosalesforce"
)

func main() {
  instanceURL := "https://na23.salesforce.com"
  sessionID := "deadbeefbeefcafe"
  
  client := NewSalesforceClient(instanceURL, sessionID)
  data, err := client.Get("Someobject__C", "somerecordID")
  if err != nil {
    panic(err)
  }
  
  j, _ := json.MarshalIndent(data, "", " ")
  fmt.Println(string(j))
}

Documentation

Overview

Package salesforce is based on the Python "Simple-Salesforce" library. It provides the basic CRUD operations for Salesforce. Currently only OAuth2 authentication is supported

Index

Constants

View Source
const Version = "31.0"

Variables

This section is empty.

Functions

This section is empty.

Types

type SalesforceClient

type SalesforceClient struct {
	InstanceURL string
	SessionID   string
	BaseURL     string
	ObjectName  string
	Header      map[string]string
	HttpClient  *http.Client
}

SalesforceClient struct contains information about a salesforce OAuth 2 session

func NewSalesforceClient

func NewSalesforceClient(instanceURL string, sessionID string) *SalesforceClient

NewSalesforceClient returns an instance of SalesforceClient initialied with the required fields

func (*SalesforceClient) Create

func (s *SalesforceClient) Create(objectName string,
	data interface{}) (interface{}, error)

Create will create an object and it's corresponding data with the POST method

func (*SalesforceClient) Delete

func (s *SalesforceClient) Delete(objectName string,
	recordID string) error

Delete will delete an object's metadata with the DELETE method

func (*SalesforceClient) Describe

func (s *SalesforceClient) Describe() (interface{}, error)

Describe returns all the objects present for the Salesforce instance

func (*SalesforceClient) Get

func (s *SalesforceClient) Get(objectName string,
	recordID string) (interface{}, error)

Get will retrieve the data for an object using the GET method

func (*SalesforceClient) Search

func (s *SalesforceClient) Search(query string) (interface{}, error)

Search returns the result from a raw SOQL query string

func (*SalesforceClient) Update

func (s *SalesforceClient) Update(objectName string, recordID string,
	data interface{}) (interface{}, error)

Update will update an object's metadata with the PATCH method

func (*SalesforceClient) Upsert

func (s *SalesforceClient) Upsert(objectName string, recordID string,
	data interface{}) (interface{}, error)

Upsert will update an existing object's data with the PATCH method

Jump to

Keyboard shortcuts

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