salesforce

package
v1.35.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AccountBasePath = SObjectDescribePath + "Account/"
View Source
var AccountExternalIdPath = AccountBasePath + "HanzoId__c/%v"
View Source
var AccountPath = AccountBasePath + "%v/"
View Source
var AccountsUpdatedPath = AccountBasePath + "updated/?start=%v&end=%v"
View Source
var ContactBasePath = SObjectDescribePath + "Contact/"
View Source
var ContactExternalIdPath = ContactBasePath + "HanzoId__c/%v"
View Source
var ContactPath = ContactBasePath + "%v/"
View Source
var ContactsUpdatedPath = ContactBasePath + "updated/?start=%v&end=%v"
View Source
var DescribePath = "/services/data/v30.0/"
View Source
var ErrorInvalidType = errors.New("Invalid Type")
View Source
var ErrorOrderTypeRequired = errors.New("Parameter needs to be of type Order")
View Source
var ErrorRequiresId = errors.New("Requires Id")
View Source
var ErrorShouldNotCall = errors.New("Function should not be called")
View Source
var ErrorUserTypeRequired = errors.New("Parameter needs to be of type User")
View Source
var LoginUrl = "https://login.salesforce.com/services/oauth2/token"

Paths

View Source
var OrderBasePath = SObjectDescribePath + "Order/"
View Source
var OrderExternalIdPath = OrderBasePath + "HanzoId__c/%v"
View Source
var OrderPath = OrderBasePath + "%v/"
View Source
var OrderProductBasePath = SObjectDescribePath + "OrderItem/"
View Source
var OrderProductExternalIdPath = OrderProductBasePath + "HanzoId__c/%v"
View Source
var OrderProductPath = OrderProductBasePath + "%v/"
View Source
var OrderProductsUpdatedPath = OrderProductBasePath + "updated/?start=%v&end=%v"
View Source
var OrdersUpdatedPath = OrderBasePath + "updated/?start=%v&end=%v"
View Source
var PlaceOrderOrderBasePath = DescribePath + "commerce/sale/order/"

These and only these are case sensitive...

View Source
var PlaceOrderOrderPath = PlaceOrderOrderBasePath + "%v/"
View Source
var PricebookEntryBasePath = SObjectDescribePath + "PricebookEntry/"
View Source
var PricebookEntryExternalIdPath = PricebookEntryBasePath + "HanzoId__c/%v"
View Source
var PricebookEntryPath = PricebookEntryBasePath + "%v/"
View Source
var PricebookEntrysUpdatedPath = PricebookEntryBasePath + "updated/?start=%v&end=%v"
View Source
var ProductBasePath = SObjectDescribePath + "Product2/"
View Source
var ProductExternalIdPath = ProductBasePath + "HanzoId__c/%v"
View Source
var ProductPath = ProductBasePath + "%v/"
View Source
var ProductsUpdatedPath = ProductBasePath + "updated/?start=%v&end=%v"
View Source
var SObjectDescribePath = DescribePath + "sobjects/"

Functions

func FromCurrency

func FromCurrency(dollars Currency) int64

func GetUpdatedAccounts

func GetUpdatedAccounts(api *Api, start, end time.Time, response *UpdatedRecordsResponse) error

func GetUpdatedContacts

func GetUpdatedContacts(api *Api, start, end time.Time, response *UpdatedRecordsResponse) error

func GetUpdatedOrders

func GetUpdatedOrders(api *Api, start, end time.Time, response *UpdatedRecordsResponse) error

func ProcessUpdatedSObjects

func ProcessUpdatedSObjects(api SalesforceClient, response *UpdatedRecordsResponse, start time.Time, objects map[string]SObjectCompatible, createFn func() SObjectLoadable) error

Helper Functions

Types

type Account

type Account struct {
	ModelReference `json:"-"` // Struct this sobject refers to

	// Response Only Fields
	Attributes     *Attribute `json:"attributes,omitempty"`
	Id             string     `json:"Id,omitempty"`
	IsDeleted      bool       `json:"IsDeleted,omitempty"`
	MasterRecordId string     `json:"MasterRecordId,omitempty"`

	// Unique External Id, currently using Id (max length 255)
	HanzoIdC string `json:"HanzoId__c,omitempty"`

	// Read Only
	CreatedById      string `json:"CreatedById,omitempty"`
	LastModifiedById string `json:"LastModifiedById,omitempty"`

	// You can manually specify these
	// Data Fields
	Name               string `json:"Name,omitempty"`
	Type               string `json:"Type,omitempty"`
	ParentId           string `json:"ParentId,omitempty"`
	BillingStreet      string `json:"BillingStreet,omitempty"`
	BillingCity        string `json:"BillingCity,omitempty"`
	BillingState       string `json:"BillingState,omitempty"`
	BillingPostalCode  string `json:"BillingPostalCode,omitempty"`
	BillingCountry     string `json:"BillingCountry,omitempty"`
	BillingLatitude    string `json:"BillingLatitude,omitempty"`
	BillingLongitude   string `json:"BillingLongitude,omitempty"`
	ShippingStreet     string `json:"ShippingStreet,omitempty"`
	ShippingCity       string `json:"ShippingCity,omitempty"`
	ShippingState      string `json:"ShippingState,omitempty"`
	ShippingPostalCode string `json:"ShippingPostalCode,omitempty"`
	ShippingCountry    string `json:"ShippingCountry,omitempty"`
	ShippingLatitude   string `json:"ShippingLatitude,omitempty"`
	ShippingLongitude  string `json:"ShippingLongitude,omitempty"`
	Phone              string `json:"Phone,omitempty"`
	Fax                string `json:"Fax,omitempty"`
	AccountNumber      string `json:"AccountNumber,omitempty"`
	Website            string `json:"Website,omitempty"`
	Sic                string `json:"Sic,omitempty"`
	Industry           string `json:"Industry,omitempty"`
	AnnualRevenue      string `json:"AnnualRevenue,omitempty"`
	NumberOfEmployees  string `json:"NumberOfEmployees,omitempty"`
	Ownership          string `json:"Ownership,omitempty"`
	TickerSymbol       string `json:"TickerSymbol,omitempty"`
	Description        string `json:"Description,omitempty"`
	Rating             string `json:"Rating,omitempty"`
	Site               string `json:"Site,omitempty"`
	OwnerId            string `json:"OwnerId,omitempty"`
	CreatedDate        string `json:"CreatedDate,omitempty"`
	LastModifiedDate   string `json:"LastModifiedDate,omitempty"`
	SystemModstamp     string `json:"SystemModstamp,omitempty"`
	LastActivityDate   string `json:"LastActivityDate,omitempty"`
	LastViewedDate     string `json:"LastViewedDate,omitempty"`
	LastReferencedDate string `json:"LastReferencedDate,omitempty"`
	Jigsaw             string `json:"Jigsaw,omitempty"`
	JigsawCompanyId    string `json:"JigsawCompanyId,omitempty"`
	CleanStatus        string `json:"CleanStatus,omitempty"`
	AccountSource      string `json:"AccountSource,omitempty"`
	DunsNumber         string `json:"DunsNumber,omitempty"`
	Tradestyle         string `json:"Tradestyle,omitempty"`
	NaicsCode          string `json:"NaicsCode,omitempty"`
	NaicsDesc          string `json:"NaicsDesc,omitempty"`
	YearStarted        string `json:"YearStarted,omitempty"`
	SicDesc            string `json:"SicDesc,omitempty"`
	DandbCompanyId     string `json:"DandbCompanyId,omitempty"`
	CustomerPriorityC  string `json:"CustomerPriority__c,omitempty"`
	SlaC               string `json:"SLA__c,omitempty"`
	ActiveC            string `json:"Active__c,omitempty"`
	NumberofLocationsC string `json:"NumberofLocations__c,omitempty"`
	UpsellOpportunityC string `json:"UpsellOpportunity__c,omitempty"`
	SLASerialNumberC   string `json:"SLASerialNumber__c,omitempty"`
	SLAExpirationDateC string `json:"SLAExpirationDate__c,omitempty"`
	Account            string `json:"Account,omitempty"`
	Master             string `json:"Master,omitempty"`

	// Zendesk integration items
	ZendeskCreatedUpdatedFlagC    string `json:"Zendesk__createdUpdatedFlag__c,omitempty"`
	ZendeskDomainMappingC         string `json:"Zendesk__Domain_Mapping__c,omitempty"`
	ZendeskLastSyncDataC          string `json:"Zendesk__Last_Sync_Date__c,omitempty"`
	ZendeskLastSyncStatusC        string `json:"Zendesk__Last_Sync_Status__c,omitempty"`
	ZendeskNotesC                 string `json:"Zendesk__Notes__c,omitempty"`
	ZendeskTagsC                  string `json:"Zendesk__Tags__c,omitempty"`
	ZendeskZendeskOldTagsC        string `json:"Zendesk__Zendesk_oldTags__c,omitempty"`
	ZendeskZendeskOutofSyncC      string `json:"Zendesk__Zendesk_OutofSync__c,omitempty"`
	ZendeskZendeskOrganizationC   string `json:"Zendesk__Zendesk_Organization__c,omitempty"`
	ZendeskZendeskOrganizationIdC string `json:"Zendesk__Zendesk_Organization_Id__c,omitempty"`
	ZendeskZendeskResultC         string `json:"Zendesk__Result__c,omitempty"`
}

func (*Account) ExternalId

func (a *Account) ExternalId() string

func (*Account) Load

func (*Account) LoadSalesforceId

func (a *Account) LoadSalesforceId(db *datastore.Datastore, id string) SObjectCompatible

func (*Account) PullExternalId

func (a *Account) PullExternalId(api SalesforceClient, id string) error

func (*Account) PullId

func (a *Account) PullId(api SalesforceClient, id string) error

func (*Account) Push

func (a *Account) Push(api SalesforceClient) error

func (*Account) Read

func (a *Account) Read(so SObjectCompatible) error

func (*Account) SetExternalId

func (a *Account) SetExternalId(id string)

func (*Account) Write

func (a *Account) Write(so SObjectCompatible) error

type Api

type Api struct {
	LastStatusCode int
	LastBody       []byte
	Context        context.Context

	Campaign *campaign.Campaign

	Update bool
	// contains filtered or unexported fields
}

func New

func New(c context.Context, campaign *campaign.Campaign, update bool) *Api

New creates an API from a Context and Campaign

func (*Api) Describe

func (a *Api) Describe(response *DescribeResponse) error

func (*Api) GetBody

func (a *Api) GetBody() []byte

func (*Api) GetContext

func (a *Api) GetContext() context.Context

func (*Api) GetStatusCode

func (a *Api) GetStatusCode() int

func (*Api) Pull

func (a *Api) Pull(id string, object SObjectCompatible) error

func (*Api) PullUpdated

func (a *Api) PullUpdated(start, end time.Time, objects interface{}) error

func (*Api) Push

func (a *Api) Push(object SObjectCompatible) error

func (*Api) Refresh

func (a *Api) Refresh() error

Refresh refreshes the Salesforce tokens and saves them to database

func (*Api) Request

func (a *Api) Request(method, path, data string, headers *map[string]string, retry bool) error

Request sends HTTP requests to Salesforce

func (*Api) SObjectDescribe

func (a *Api) SObjectDescribe(response *SObjectDescribeResponse) error

type Attribute

type Attribute struct {
	Type string `json:"type"`
	Url  string `json:"url"`
}

type Contact

type Contact struct {
	ModelSecondaryReference `json:"-"` // Struct this sobject refers to

	// Response Only Fields
	Attributes     *Attribute `json:"attributes,omitempty"`
	Id             string     `json:"Id,omitempty"`
	IsDeleted      bool       `json:"IsDeleted,omitempty"`
	MasterRecordId string     `json:"MasterRecordId,omitempty"`

	// Unique External Id, currently using Id (max length 255)
	HanzoIdC string `json:"HanzoId__c,omitempty"`

	// Read Only
	Name             string `json:"Name,omitempty"`
	AccountId        string `json:"AccountId,omitempty"`
	CreatedById      string `json:"CreatedById,omitempty"`
	LastModifiedById string `json:"LastModifiedById,omitempty"`

	// Data Fields
	LastName           string     `json:"LastName,omitempty"`
	FirstName          string     `json:"FirstName,omitempty"`
	Salutation         string     `json:"Salutation,omitempty"`
	MailingStreet      string     `json:"MailingStreet,omitempty"`
	MailingCity        string     `json:"MailingCity,omitempty"`
	MailingState       string     `json:"MailingState,omitempty"`
	MailingPostalCode  string     `json:"MailingPostalCode,omitempty"`
	MailingCountry     string     `json:"MailingCountry,omitempty"`
	MailingStateCode   string     `json:"MailingStateCode,omitempty"`
	MailingCountryCode string     `json:"MailingCountryCode,omitempty"`
	MailingLatitude    string     `json:"MailingLatitude,omitempty"`
	MailingLongitude   string     `json:"MailingLongitude,omitempty"`
	Phone              string     `json:"Phone,omitempty"`
	Fax                string     `json:"Fax,omitempty"`
	MobilePhone        string     `json:"MobilePhone,omitempty"`
	ReportsToId        string     `json:"ReportsToId,omitempty"`
	Email              string     `json:"Email,omitempty"`
	Title              string     `json:"Title,omitempty"`
	Department         string     `json:"Department,omitempty"`
	OwnerId            string     `json:"OwnerId,omitempty"`
	CreatedDate        string     `json:"CreatedDate,omitempty"`
	LastModifiedDate   string     `json:"LastModifiedDate,omitempty"`
	SystemModstamp     string     `json:"SystemModstamp,omitempty"`
	LastActivityDate   string     `json:"LastActivityDate,omitempty"`
	LastCURequestDate  string     `json:"LastCURequestDate,omitempty"`
	LastCUUpdateDate   string     `json:"LastCUUpdateDate,omitempty"`
	LastViewedDate     string     `json:"LastViewedDate,omitempty"`
	LastReferencedDate string     `json:"LastReferencedDate,omitempty"`
	EmailBouncedReason string     `json:"EmailBouncedReason,omitempty"`
	EmailBouncedDate   string     `json:"EmailBouncedDate,omitempty"`
	IsEmailBounced     bool       `json:"IsEmailBounced,omitempty"`
	JigsawContactId    string     `json:"JigsawContactId,omitempty"`
	Account            ForeignKey `json:"Account,omitempty"`

	// Skully Custom fields
	UniquePreorderLinkC string `json:"Unique_Preorder_Link__c,omitempty"`
	FullfillmentStatusC string `json:"Fulfillment_Status__c,omitempty"`
	PreorderC           string `json:"Preorder__c,omitempty"`
	ShippingAddressC    string `json:"Shipping_Address__c,omitempty"`
	ShippingCityC       string `json:"Shipping_City__c,omitempty"`
	ShippingStateC      string `json:"Shipping_State__c,omitempty"`
	ShippingPostalZipC  string `json:"Shipping_Postal_Zip__c,omitempty"`
	ShippingCountryC    string `json:"Shipping_Country__c,omitempty"`
	MC4SFMCSubscriberC  string `json:"MC4SF__MC_Subscriber__c,omitempty"`

	// Zendesk Custom fields
	ZendeskLastSyncDateC         string `json:"Zendesk__Last_Sync_Date__c,omitempty"`
	ZendeskLastSyncStatusC       string `json:"Zendesk__Last_Sync_Status__c,omitempty"`
	ZendeskResultC               string `json:"Zendesk__Result__c,omitempty"`
	ZendeskTagsC                 string `json:"Zendesk__Tags__c,omitempty"`
	ZendeskZendeskOutofSyncC     string `json:"Zendesk__Zendesk_OutofSync__c,omitempty"`
	ZendeskZendeskOldTagsC       string `json:"Zendesk__Zendesk_oldTags__c,omitempty"`
	ZendeskIsCreatedUpdatedFlagC string `json:"Zendesk__isCreatedUpdatedFlag__c,omitempty"`
	ZendeskNotesC                string `json:"Zendesk__notes__c,omitempty"`
	ZendeskZendeskIdC            string `json:"Zendesk__zendesk_id__c,omitempty"`
}

SObject Definitions

func (*Contact) ExternalId

func (c *Contact) ExternalId() string

func (*Contact) Load

func (*Contact) LoadSalesforceId

func (c *Contact) LoadSalesforceId(db *datastore.Datastore, id string) SObjectCompatible

func (*Contact) PullExternalId

func (c *Contact) PullExternalId(api SalesforceClient, id string) error

func (*Contact) PullId

func (c *Contact) PullId(api SalesforceClient, id string) error

func (*Contact) Push

func (c *Contact) Push(api SalesforceClient) error

func (*Contact) Read

func (c *Contact) Read(so SObjectCompatible) error

func (*Contact) SetExternalId

func (c *Contact) SetExternalId(id string)

func (*Contact) Write

func (c *Contact) Write(so SObjectCompatible) error

type Currency

type Currency float64

func ToCurrency

func ToCurrency(centicents int64) Currency

type DescribeResponse

type DescribeResponse struct {
	SObjects     string `json:"sobjects"`
	Connect      string `json:"connect"`
	Query        string `json:"query"`
	Theme        string `json:"theme"`
	QueryAll     string `json:"queryAll"`
	Tooling      string `json:"tooling"`
	Chatter      string `json:"chatter"`
	Analytics    string `json:"analytics"`
	Recent       string `json:"recent"`
	Commerce     string `json:"commerce"`
	Licensing    string `json:"licensing"`
	Identity     string `json:"identity"`
	FlexiPage    string `json:"flexiPage"`
	Search       string `json:"search"`
	QuickActions string `json:"quickActions"`
	AppMenu      string `json:"appMenu"`
}

type ErrorFromSalesforce

type ErrorFromSalesforce struct {
	ErrorCode string `json:"errorCode"`
	Message   string `json:"message"`
}

Salesforce Structs These represent non-sobject responses received from salesforce

func (*ErrorFromSalesforce) Error

func (e *ErrorFromSalesforce) Error() string

type ErrorUnexpectedStatusCode

type ErrorUnexpectedStatusCode struct {
	StatusCode int
	Body       []byte
}

func (*ErrorUnexpectedStatusCode) Error

func (e *ErrorUnexpectedStatusCode) Error() string

type ForeignKey

type ForeignKey struct {
	Attributes *Attribute `json:"attributes,omitempty"`
	HanzoIdC   string     `json:"HanzoId__c,omitempty"`
}

SObject foreign key reference so we can use Hanzo Id instead of Salesforce ID to reference an object

type Metadata

type Metadata struct {
	Name string
	Type string
}

func GetCustomFieldMetadata

func GetCustomFieldMetadata(sobject interface{}) []Metadata

type ModelReference

type ModelReference struct {
	Ref SObjectCompatible
}

Reference to the datastore model for an SObject

func (*ModelReference) LastSync

func (s *ModelReference) LastSync() time.Time

func (*ModelReference) SalesforceId

func (s *ModelReference) SalesforceId() string

func (*ModelReference) SetLastSync

func (s *ModelReference) SetLastSync()

func (*ModelReference) SetSalesforceId

func (s *ModelReference) SetSalesforceId(id string)

type ModelSecondaryReference

type ModelSecondaryReference struct {
	Ref SObjectCompatible
}

Also a reference like above but for models that refer to multiple sobjects which need to use a second id field

func (*ModelSecondaryReference) LastSync

func (s *ModelSecondaryReference) LastSync() time.Time

func (*ModelSecondaryReference) SalesforceId

func (s *ModelSecondaryReference) SalesforceId() string

func (*ModelSecondaryReference) SetLastSync

func (s *ModelSecondaryReference) SetLastSync()

func (*ModelSecondaryReference) SetSalesforceId

func (s *ModelSecondaryReference) SetSalesforceId(id string)

type Order

type Order struct {
	ModelReference `json:"-"` // Struct this sobject refers to

	// Response Only Fields
	Attributes     *Attribute `json:"attributes,omitempty"`
	Id             string     `json:"Id,omitempty"`
	IsDeleted      bool       `json:"IsDeleted,omitempty"`
	MasterRecordId string     `json:"MasterRecordId,omitempty"`

	// Unique External Id, currently using Id (max length 255)
	HanzoIdC string `json:"HanzoId__c,omitempty"`

	// Read Only
	CreatedById      string `json:"CreatedById,omitempty"`
	LastModifiedById string `json:"LastModifiedById,omitempty"`
	AccountId        string `json:"AccountId,omitempty"`

	// You can manually specify these
	// Data Fields
	Account                *ForeignKey `json:"Account,omitempty"`
	PricebookId            string      `json:"Pricebook2Id,omitempty"`
	OriginalOrderId        string      `json:"OriginalOrderId,omitempty"`
	EffectiveDate          string      `json:"EffectiveDate,omitempty"`
	EndDate                string      `json:"EndDate,omitempty"`
	IsReductionOrder       bool        `json:"IsReductionOrder,omitempty"`
	Status                 string      `json:"Status,omitempty"`
	Description            string      `json:"Description,omitempty"`
	CustomerAuthorizedById string      `json:"CustomerAuthorizedById,omitempty"`
	CustomerAuthorizedDate string      `json:"CustomerAuthorizedDate,omitempty"`
	CompanyAuthorizedById  string      `json:"CompanyAuthorizedById,omitempty"`
	CompanyAuthorizedDate  string      `json:"CompanyAuthorizedDate,omitempty"`
	Type                   string      `json:"Type,omitempty"`
	BillingStreet          string      `json:"BillingStreet,omitempty"`
	BillingCity            string      `json:"BillingCity,omitempty"`
	BillingState           string      `json:"BillingState,omitempty"`
	BillingPostalCode      string      `json:"BillingPostalCode,omitempty"`
	BillingCountry         string      `json:"BillingCountry,omitempty"`
	BillingLatitude        string      `json:"BillingLatitude,omitempty"`
	BillingLongitude       string      `json:"BillingLongitude,omitempty"`
	ShippingStreet         string      `json:"ShippingStreet,omitempty"`
	ShippingCity           string      `json:"ShippingCity,omitempty"`
	ShippingState          string      `json:"ShippingState,omitempty"`
	ShippingPostalCode     string      `json:"ShippingPostalCode,omitempty"`
	ShippingCountry        string      `json:"ShippingCountry,omitempty"`
	ShippingLatitude       string      `json:"ShippingLatitude,omitempty"`
	ShippingLongitude      string      `json:"ShippingLongitude,omitempty"`
	//Name                   string   `json:"Name,omitempty"`
	PoDate               string   `json:"PoDate,omitempty"`
	PoNumber             string   `json:"PoNumber,omitempty"`
	OrderReferenceNumber string   `json:"OrderReferenceNumber,omitempty"`
	BillToContactId      string   `json:"BillToContactId,omitempty"`
	ShipToContactId      string   `json:"ShipToContactId,omitempty"`
	ActivatedDate        string   `json:"ActivatedDate,omitempty"`
	ActivatedById        string   `json:"ActivatedById,omitempty"`
	StatusCode           string   `json:"StatusCode,omitempty"`
	OrderNumber          string   `json:"OrderNumber,omitempty"`
	TotalAmount          Currency `json:"TotalAmount,omitempty"`
	CreatedDate          string   `json:"CreatedDate,omitempty"`
	SystemModstamp       string   `json:"SystemModstamp,omitempty"`
	LastViewedDate       string   `json:"LastViewedDate,omitempty"`
	LastReferencedDate   string   `json:"LastReferencedDate,omitempty"`
	Order                string   `json:"Order,omitempty"`
	Master               string   `json:"Master,omitempty"`

	// Custom Hanzo fields
	CancelledC     bool     `json:"Cancelled__c,omitempty"`
	DisputedC      bool     `json:"Disputed__c,omitempty"`
	LockedC        bool     `json:"Locked__c,omitempty"`
	PaymentIdC     string   `json:"PaymentId__c,omitempty"`
	PaymentTypeC   string   `json:"PaymentType__c,omitempty"`
	PreorderC      bool     `json:"Preorder__c,omitempty"`
	RefundedC      bool     `json:"Refunded__c,omitempty"`
	ShippedC       bool     `json:"Shipped__c,omitempty"`
	ShippingC      Currency `json:"Shipping__c,omitempty"`
	SubtotalC      Currency `json:"Subtotal__c,omitempty"`
	TaxC           Currency `json:"Tax__c,omitempty"`
	TotalC         Currency `json:"Total__c,omitempty"`
	UnconfirmedC   bool     `json:"Unconfirmed__c,omitempty"`
	OriginalEmailC string   `json:"OriginalEmail__c,omitempty"`

	// We don't use contracts
	ContractId string `json:"ContractId,omitempty"`

	// PlaceOrder API requirement
	OrderProducts *PlaceOrderOrderProductWrapper `json:"OrderItems,omitempty"`
	// contains filtered or unexported fields
}

func (*Order) ExternalId

func (o *Order) ExternalId() string

func (*Order) Load

func (*Order) LoadSalesforceId

func (o *Order) LoadSalesforceId(db *datastore.Datastore, id string) SObjectCompatible

func (*Order) PullExternalId

func (o *Order) PullExternalId(api SalesforceClient, id string) error

func (*Order) PullId

func (o *Order) PullId(api SalesforceClient, id string) error

func (*Order) Push

func (o *Order) Push(api SalesforceClient) error

func (*Order) Read

func (o *Order) Read(so SObjectCompatible) error

func (*Order) SetExternalId

func (o *Order) SetExternalId(id string)

func (*Order) Write

func (o *Order) Write(so SObjectCompatible) error

type OrderProduct

type OrderProduct struct {
	ModelReference `json:"-"` // Struct this sobject refers to

	// Response Only Fields
	Attributes     *Attribute `json:"attributes,omitempty"`
	Id             string     `json:"Id,omitempty"`
	IsDeleted      bool       `json:"IsDeleted,omitempty"`
	MasterRecordId string     `json:"MasterRecordId,omitempty"`

	// Unique External Id, currently using Id (max length 255)
	HanzoIdC string `json:"HanzoId__c,omitempty"`

	// Read Only
	CreatedById        string   `json:"CreatedById,omitempty"`
	LastModifiedById   string   `json:"LastModifiedById,omitempty"`
	AccountId          string   `json:"AccountId,omitempty"`
	OrderProductNumber string   `json:"OrderItemNumber,omitempty"`
	ProductCode        string   `json:"ProductCode,omitempty"`
	ListPrice          Currency `json:"ListPrice,omitempty"`

	// You can manually specify these
	// Data Fields
	AvailableQuantity    float64     `json:"AvailableQuantity,omitempty"`
	EndDate              string      `json:"EndDate,omitempty"`
	Description          string      `json:"Description,omitempty"`
	Order                *ForeignKey `json:"Order,omitempty"`
	OriginalOrderProduct *ForeignKey `json:"OriginalOrderItem,omitempty"`
	PricebookEntry       *ForeignKey `json:"PricebookEntry,omitempty"`
	PricebookEntryId     string      `json:"PricebookEntryId,omitempty"`
	Quantity             float64     `json:"Quantity,omitempty"`
	StartDate            string      `json:"ServiceDate,omitempty"`
	TotalPrice           Currency    `json:"TotalPrice,omitempty"`
	UnitPrice            Currency    `json:"UnitPrice,omitempty"`
	// contains filtered or unexported fields
}

func (*OrderProduct) ExternalId

func (o *OrderProduct) ExternalId() string

func (*OrderProduct) PullExternalId

func (o *OrderProduct) PullExternalId(api SalesforceClient, id string) error

func (*OrderProduct) PullId

func (o *OrderProduct) PullId(api SalesforceClient, id string) error

func (*OrderProduct) Push

func (o *OrderProduct) Push(api SalesforceClient) error

func (*OrderProduct) Read

func (o *OrderProduct) Read(so SObjectCompatible) error

func (*OrderProduct) SetExternalId

func (o *OrderProduct) SetExternalId(id string)

func (*OrderProduct) Write

func (o *OrderProduct) Write(so SObjectCompatible) error

type PlaceOrderOrderProductWrapper

type PlaceOrderOrderProductWrapper struct {
	PlaceOrderWrapper
	Records []*OrderProduct `json:records`
}

type PlaceOrderOrderWrapper

type PlaceOrderOrderWrapper struct {
	PlaceOrderWrapper
	Records []*Order `json:records`
}

type PlaceOrderWrapper

type PlaceOrderWrapper struct {
	TotalSize int64 `json:"totalSize"`
	Done      bool  `json:"done"`
}

Place Order metadata junk things

type PricebookEntry

type PricebookEntry struct {
	ModelSecondaryReference `json:"-"` // Struct this sobject refers to

	// Response Only Fields
	Attributes     *Attribute `json:"attributes,omitempty"`
	Id             string     `json:"Id,omitempty"`
	IsDeleted      bool       `json:"IsDeleted,omitempty"`
	MasterRecordId string     `json:"MasterRecordId,omitempty"`

	// Unique External Id, currently using Id (max length 255)
	HanzoIdC string `json:"HanzoId__c,omitempty"`

	// Read Only
	CreatedById      string `json:"CreatedById,omitempty"`
	LastModifiedById string `json:"LastModifiedById,omitempty"`
	Name             string `json:"Name,omitempty"`
	ProductCode      string `json:"ProductCode,omitempty"`

	// You can manually specify these
	// Data Fields
	CurrencyIsoCode  string      `json:"CurrencyIsoCode,omitempty"`
	PricebookId      string      `json:"Pricebook2Id,omitempty"`
	Product          *ForeignKey `json:"Product2,omitempty"`
	UnitPrice        Currency    `json:"UnitPrice,omitempty`
	UseStandardPrice bool        `json:"UseStandardPrice,omitempty"`
	IsActive         bool        `json:"IsActive,omitempty"`
}

func (*PricebookEntry) ExternalId

func (p *PricebookEntry) ExternalId() string

func (*PricebookEntry) PullExternalId

func (p *PricebookEntry) PullExternalId(api SalesforceClient, id string) error

func (*PricebookEntry) PullId

func (p *PricebookEntry) PullId(api SalesforceClient, id string) error

func (*PricebookEntry) Push

func (p *PricebookEntry) Push(api SalesforceClient) error

func (*PricebookEntry) Read

func (*PricebookEntry) SetExternalId

func (p *PricebookEntry) SetExternalId(id string)

func (*PricebookEntry) Write

func (p *PricebookEntry) Write(so SObjectCompatible) error

type Product

type Product struct {
	ModelReference `json:"-"` // Struct this sobject refers to

	// Response Only Fields
	Attributes     *Attribute `json:"attributes,omitempty"`
	Id             string     `json:"Id,omitempty"`
	IsDeleted      bool       `json:"IsDeleted,omitempty"`
	MasterRecordId string     `json:"MasterRecordId,omitempty"`

	// Unique External Id, currently using Id (max length 255)
	HanzoIdC string `json:"HanzoId__c,omitempty"`

	// Read Only
	CreatedById      string `json:"CreatedById,omitempty"`
	LastModifiedById string `json:"LastModifiedById,omitempty"`

	// You can manually specify these
	// Data Fields
	Name        string `json:"Name,omitempty"`
	Description string `json:"Description,omitempty"`
	ProductCode string `json:"ProductCode,omitempty"`
	IsActive    bool   `json:"IsActive,omitempty"`
	Family      string `json:"Family,omitempty"`
}

func (*Product) ExternalId

func (p *Product) ExternalId() string

func (*Product) PullExternalId

func (p *Product) PullExternalId(api SalesforceClient, id string) error

func (*Product) PullId

func (p *Product) PullId(api SalesforceClient, id string) error

func (*Product) Push

func (p *Product) Push(api SalesforceClient) error

func (*Product) Read

func (p *Product) Read(so SObjectCompatible) error

func (*Product) SetExternalId

func (p *Product) SetExternalId(id string)

func (*Product) Write

func (p *Product) Write(so SObjectCompatible) error

type QueryAttributes

type QueryAttributes struct {
	Id         string    `json:"Id"`
	Attributes Attribute `json:"attributes"`
}

type QueryResponse

type QueryResponse struct {
	TotalSize int               `json:"totalSize"`
	Done      bool              `json:"done"`
	Records   []QueryAttributes `json:"attributes"`
}

type SObject

type SObject interface {
	// Send model to salesforce
	Push(SalesforceClient) error

	// Get Model from salesforce
	PullId(SalesforceClient, string) error

	// Get Model using HanzoId from salesforce
	PullExternalId(SalesforceClient, string) error
}

SObjects represent Salesforce SObjects that can be pushed and pull from/to Salesforce

type SObjectCompatible

type SObjectCompatible interface {
	SetSalesforceId(string)
	SalesforceId() string
	SetSalesforceId2(string)
	SalesforceId2() string
	SetLastSync()
	LastSync() time.Time
}

For hanzo models/mixins to be salesforce compatible in future

type SObjectDescribeResponse

type SObjectDescribeResponse struct {
	Encoding     string    `json:"encoding"`
	MaxBatchSize string    `json:"maxBatchSize"`
	SObjects     []SObject `json:"sobjects"`
}

type SObjectIDable

type SObjectIDable interface {
	// Set HanzoId
	SetExternalId(string)
	// Get HanzoId
	ExternalId() string
}

type SObjectLoadable

type SObjectLoadable interface {
	SObject
	SObjectSyncable

	LoadSalesforceId(*datastore.Datastore, string) SObjectCompatible
	Load(*datastore.Datastore) SObjectCompatible
}

type SObjectMetaData

type SObjectMetaData struct {
	Name        string `json:"name"`
	Label       string `json:"label"`
	KeyPrefix   string `json:"keyPrefix"`
	LabelPlural string `json:"labelPlural"`

	Urls SObjectUrls `json:"urls"`

	// grammatically annoying bools
	Custom              bool `json:"custom"`
	Layoutable          bool `json:"layoutable"`
	Activateable        bool `json:"activateable"`
	Searchable          bool `json:"searchable"`
	Updateable          bool `json:"updateable"`
	Createable          bool `json:"createable"`
	DeprecatedAndHidden bool `json:"deprecatedAndHidden"`
	CustomSetting       bool `json:"customSetting"`
	Deletable           bool `json:"deletable"`
	FeedEnable          bool `json:"feedEnabled"`
	Mergeable           bool `json:"mergeable"`
	Queryable           bool `json:"queryable"`
	Replicateable       bool `json:"replicateable"`
	Retrieveable        bool `json:"retrieveable"`
	Undeleteable        bool `json:"undeleteable"`
	Triggerable         bool `json:"triggerable"`
}

type SObjectSerializeable

type SObjectSerializeable interface {
	// Loads data from an SObjectCompatible
	Read(SObjectCompatible) error
	// Writes its data into an SObjectCompatible
	Write(SObjectCompatible) error
}

type SObjectSyncable

type SObjectSyncable interface {
	SObjectIDable
	SObjectSerializeable

	// SObjectCompatible proxies
	SetSalesforceId(string)
	SalesforceId() string
	SetLastSync()
	LastSync() time.Time
}

type SObjectUrls

type SObjectUrls struct {
	SObjectMetadata string `json:"sobject"`
	Describe        string `json:"describe"`
	RowTemplate     string `json:"rowTemplate"`
}

type SalesforceClient

type SalesforceClient interface {
	GetBody() []byte
	GetStatusCode() int
	GetContext() context.Context
	Request(string, string, string, *map[string]string, bool) error
}

type SalesforceTokenResponse

type SalesforceTokenResponse struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	InstanceUrl  string `json:"instance_url"`
	Id           string `json:"id"`
	IssuedAt     string `json:"issued_at"`
	Signature    string `json:"signature"`

	ErrorDescription string `json:"error_description"`
	Error            string `json:"error"`
}

Api Data Container

type UpdatedRecordsResponse

type UpdatedRecordsResponse struct {
	Ids               []string `json:"ids"`
	LatestDateCovered string   `json:"latestDateCovered"`
}

type UpsertResponse

type UpsertResponse struct {
	Id      string                `json:"id"`
	Success bool                  `json:"success"`
	Errors  []ErrorFromSalesforce `json:"errors"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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