closecrm

package
v0.0.0-...-88eb52a Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeQueryKey          = "type"
	ObjectTypeQueryKey    = "object_type"
	FieldQueryKey         = "field"
	FieldNameTypeQueryKey = "field_name"
	ConditionQueryKey     = "condition"
	ValueQueryKey         = "value"
	WhichQueryKey         = "which"
	OnOrAfterQueryKey     = "on_or_after"
)

nolint:gochecknoglobals

Variables

View Source
var ErrSkipFailure = errors.New("error: failed to create next page url")

ErrSkipFailure is an error genarated when we fails to construct the next page url.

Functions

This section is empty.

Types

type Connector

type Connector struct {
	BaseURL string
	Client  *common.JSONHTTPClient
}

Connector is a Close connector.

func NewConnector

func NewConnector(opts ...Option) (conn *Connector, outErr error)

NewConnector returns a new Close connector.

func (*Connector) HTTPClient

func (c *Connector) HTTPClient() *common.HTTPClient

func (*Connector) JSONHTTPClient

func (c *Connector) JSONHTTPClient() *common.JSONHTTPClient

JSONHTTPClient returns the underlying JSON HTTP client.

func (*Connector) ListObjectMetadata

func (c *Connector) ListObjectMetadata(ctx context.Context,
	objectNames []string,
) (*common.ListObjectMetadataResult, error)

ListObjectMetadata returns object metadata for each object name provided.

func (*Connector) Provider

func (c *Connector) Provider() string

func (*Connector) Read

func (c *Connector) Read(ctx context.Context, config common.ReadParams) (*common.ReadResult, error)

Read retrieves data based on the provided read parameters. ref: https://developer.close.com/resources/leads

func (*Connector) Search

func (c *Connector) Search(ctx context.Context, config SearchParams) (*common.ReadResult, error)

Search reads data through searching API. Supports advanced filtering using the filters field. The NextPage Token generated takes 30 seconds to expire.

doc: https://developer.close.com/resources/advanced-filtering

func (*Connector) String

func (c *Connector) String() string

String implements fmt.Stringer interface.

func (*Connector) Write

func (c *Connector) Write(ctx context.Context, config common.WriteParams) (*common.WriteResult, error)

Write creates/updates records in CloseCRM.

doc: https://developer.close.com/resources/leads/#create-a-new-lead

type Filter

type Filter struct {
	Query  Query               `json:"query"`
	Cursor any                 `json:"cursor"`
	Limit  int                 `json:"_limit"`  //nolint:tagliatelle
	Fields map[string][]string `json:"_fields"` //nolint:tagliatelle
}

type Option

type Option = func(params *parameters)

Option is a function which mutates the close connector configuration.

func WithAuthenticatedClient

func WithAuthenticatedClient(client common.AuthenticatedHTTPClient) Option

WithAuthenticatedClient sets the http client to use for the connector. Its usage is optional.

func WithClient

func WithClient(ctx context.Context, client *http.Client,
	config *oauth2.Config, token *oauth2.Token, opts ...common.OAuthOption,
) Option

WithClient sets the http client to use for the connector.

type Query

type Query struct {
	Type    string           `json:"type"`
	Queries []map[string]any `json:"queries"`
}

type SearchParams

type SearchParams struct {
	ObjectName string
	Fields     []string
	Since      time.Time
	NextPage   common.NextPageToken
	Filters    Filter
}

Jump to

Keyboard shortcuts

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