keap

package
v0.0.0-...-a63b747 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 18 Imported by: 0

README

Custom Fields

The Read and ListObjectMetadata operations will return custom fields alongside other native properties. Keap API indexes custom fields using numbered identifiers without including human-readable names. This issue is addressed in the implementation.

Original record

{
  "id": 22,
  "given_name": "Erica",
  "jobtitle": "Product Owner" // custom field
} 

Normal response

List Contacts When requesting the contacts resource, the response includes custom fields as follows:

{
  "contacts": [
    {
      "id": 22,
      "given_name": "Erica",
      "custom_fields": [
        {
          "id": 6, // Obscure field name.
          "content": "Product Owner"
        },
      ]
    }
  ]
}

Contacts Model To determine the meaning of "id": 6, you can query the contacts model, which provides additional details:

{
  "custom_fields": [
    {
      "id": 6,
      "label": "title",
      "options": [],
      "record_type": "CONTACT",
      "field_type": "Text",
      "field_name": "jobtitle", // Prefered field name.
      "default_value": null
    },
  ],
  "optional_properties": []
}

Combining both results, the connector's Read will return the following:

{
  "id": 22,
  "given_name": "Erica",
  "jobtitle": "Product Owner"
} 

Documentation

Index

Constants

View Source
const (
	// ModuleV1 is a grouping of V1 API endpoints.
	// https://developer.keap.com/docs/rest/
	ModuleV1 common.ModuleID = "version1"
	// ModuleV2 is a grouping of V2 API endpoints.
	// https://developer.keap.com/docs/restv2/
	ModuleV2 common.ModuleID = "version2"
)
View Source
const ApiPathPrefix = "crm/rest"
View Source
const DefaultPageSize = 50

DefaultPageSize is number of elements per page.

Variables

View Source
var ErrResolvingCustomFields = errors.New("cannot resolve custom fields")
View Source
var SupportedModules = metadata.Schemas.ModuleRegistry() // nolint: gochecknoglobals

SupportedModules represents currently working and supported modules within the Keap connector. Modules are added to schema.json file using OpenAPI script.

Functions

This section is empty.

Types

type Connector

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

func NewConnector

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

func (*Connector) Close

func (c *Connector) Close() error

func (*Connector) Delete

func (c *Connector) Delete(ctx context.Context, config common.DeleteParams) (*common.DeleteResult, error)

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)

func (*Connector) Provider

func (c *Connector) Provider() providers.Provider

func (*Connector) Read

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

func (*Connector) String

func (c *Connector) String() string

func (*Connector) Write

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

type Option

type Option = func(params *parameters)

Option is a function which mutates the connector configuration.

func WithAuthenticatedClient

func WithAuthenticatedClient(client common.AuthenticatedHTTPClient) Option

func WithClient

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

func WithModule

func WithModule(module common.ModuleID) Option

type ResponseError

type ResponseError struct {
	Detail string `json:"message"`
}

func (ResponseError) CombineErr

func (r ResponseError) CombineErr(base error) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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