restapi

package
v6.8.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthTypeBasic            = "basic"
	AuthTypeBearer           = "bearer"
	AuthTypeSalesforceOauth  = "SalesforceOauth"
	DefaultBatchSize         = 10
	DefaultBatchDelaySeconds = 3
	PaginationSchemeItems    = "items"
	PaginationSchemePages    = "pages"
)
View Source
const DefaultHttpTimeoutSeconds = 45

Variables

This section is empty.

Functions

func NewRestAPIDestination

func NewRestAPIDestination(destinationConfig internal.DestinationConfig) (internal.Destination, error)

NewRestAPIDestination unmarshals the destinationConfig's ExtraJson into a RestApi struct

func NewRestAPISource

func NewRestAPISource(sourceConfig internal.SourceConfig) (internal.Source, error)

NewRestAPISource unmarshals the sourceConfig's ExtraJson into a RestApi struct

Types

type Pagination

type Pagination struct {
	// If specified, must be "pages" for a page based request or "items" for an item based request.
	// If not specified, no pagination is attempted.
	Scheme string

	FirstIndex  int    // index of first item/page to fetch, default is 1
	NumberKey   string // query string key for the item index or page number, default is "page"
	PageLimit   int    // index of last page to request, default is 1000
	PageSize    int    // page size, default is 100 items per page
	PageSizeKey string // query string key the number of items per page
}

type RestAPI

type RestAPI struct {
	ListMethod           string
	CreateMethod         string
	UpdateMethod         string
	DeleteMethod         string
	IDAttribute          string
	BaseURL              string
	ResultsJSONContainer string
	AuthType             string
	Username             string
	Password             string
	ClientID             string
	ClientSecret         string
	CompareAttribute     string
	UserAgent            string
	BatchSize            int
	BatchDelaySeconds    int

	Pagination         Pagination
	Filters            internal.Filters
	HttpTimeoutSeconds int
	// contains filtered or unexported fields
}

func New

func New() RestAPI

func (*RestAPI) ApplyChangeSet

func (r *RestAPI) ApplyChangeSet(changes internal.ChangeSet, eventLog chan<- internal.EventLogItem) internal.ChangeResults

func (*RestAPI) ForSet

func (r *RestAPI) ForSet(syncSetJson json.RawMessage) error

ForSet sets this RestAPI struct's Path values to those in the umarshalled syncSetJson. It ensures the resulting Path attributes include an initial "/"

func (*RestAPI) ListUsers

func (r *RestAPI) ListUsers(desiredAttrs []string) ([]internal.Person, error)

ListUsers makes http requests and uses the responses to populate and return a slice of Person instances

type SalesforceAuthResponse

type SalesforceAuthResponse struct {
	ID          string `json:"id"`
	IssuedAt    string `json:"issued_at"`
	InstanceURL string `json:"instance_url"`
	Signature   string `json:"signature"`
	AccessToken string `json:"access_token"`
}

type SalesforceErrorResponse

type SalesforceErrorResponse struct {
	Error            string `json:"error"`
	ErrorDescription string `json:"error_description"`
}

type SetConfig

type SetConfig struct {
	Paths      []string
	CreatePath string
	UpdatePath string
	DeletePath string
}

Jump to

Keyboard shortcuts

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