salesforce

package
v0.18.2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: MIT Imports: 17 Imported by: 0

README

OAuth 2.0 for Salesforce

You can verify your credentials with the following:

$ curl https://login.salesforce.com/services/oauth2/token -d "grant_type=password" -d "client_id=myClientID" -d "client_secret=myClientSecret" -d "username=myUsername" -d "password=myPasswordMySecretToken"

Deleting Dummy Data

Here is information on deleting existing dummy data:

Documentation

Index

Constants

View Source
const (
	AuthzURL        = endpoints.SalesforceAuthzURL
	TokenURL        = endpoints.SalesforceTokenURL // #nosec G101
	RevokeURL       = endpoints.SalesforceRevokeURL
	ServerURLFormat = "https://%v.salesforce.com"
	HostFormat      = "%v.salesforce.com"
	TestServerURL   = "https://test.salesforce.com"
)

Variables

View Source
var Endpoint = oauth2.Endpoint{
	AuthURL:  AuthzURL,
	TokenURL: TokenURL}

Functions

func NewClientPassword

func NewClientPassword(oc goauth.CredentialsOAuth2) (*http.Client, error)

func NewClientPasswordSalesforceEnv

func NewClientPasswordSalesforceEnv() (*http.Client, error)

Types

type OAuth2Credentials

type OAuth2Credentials struct {
	goauth.CredentialsOAuth2
	InstanceName string
}

type SalesforceClient

type SalesforceClient struct {
	ClientMore httputilmore.ClientMore
	URLBuilder URLBuilder
}

func NewSalesforceClient

func NewSalesforceClient(client *http.Client, instanceName string) SalesforceClient

func NewSalesforceClientEnv

func NewSalesforceClientEnv() (SalesforceClient, error)

func NewSalesforceClientPassword

func NewSalesforceClientPassword(soc OAuth2Credentials) (SalesforceClient, error)

func (*SalesforceClient) CreateContact

func (sc *SalesforceClient) CreateContact(contact interface{}) (*http.Response, error)

func (*SalesforceClient) CreateSobject

func (sc *SalesforceClient) CreateSobject(sobjectName string, sobject interface{}) (*http.Response, error)

func (*SalesforceClient) DeleteAccount

func (sc *SalesforceClient) DeleteAccount(id string) (*http.Response, error)

func (*SalesforceClient) DeleteAccountsAll

func (sc *SalesforceClient) DeleteAccountsAll() error

func (*SalesforceClient) DeleteContact

func (sc *SalesforceClient) DeleteContact(id string) (*http.Response, error)

func (*SalesforceClient) DeleteContactsAll

func (sc *SalesforceClient) DeleteContactsAll() error

func (*SalesforceClient) ExecSOQL

func (sc *SalesforceClient) ExecSOQL(soql string) (*http.Response, error)

func (*SalesforceClient) GetAccountsAll

func (sc *SalesforceClient) GetAccountsAll() (sobjects.AccountSet, error)

func (*SalesforceClient) GetContactsAll

func (sc *SalesforceClient) GetContactsAll() (sobjects.ContactSet, error)

func (*SalesforceClient) GetServicesData

func (sc *SalesforceClient) GetServicesData() (*http.Response, error)

func (*SalesforceClient) UserInfo

func (sc *SalesforceClient) UserInfo() (User, error)

type URLBuilder

type URLBuilder struct {
	BaseURL url.URL
	Version string
}

func NewURLBuilder

func NewURLBuilder(instanceName string) URLBuilder

func (*URLBuilder) Build

func (b *URLBuilder) Build(path string) url.URL

func (*URLBuilder) BuildSobjectURL

func (b *URLBuilder) BuildSobjectURL(parts ...string) url.URL

type User

type User struct {
	UserID         string `json:"user_id,omitempty"`
	OrganizationID string `json:"organization_id,omitempty"`
}

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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