dynamicscrm

package
v0.0.0-...-6939ead Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// DefaultPageSize is number of elements per page.
	DefaultPageSize = 100
)
View Source
const UnderscoreFieldFormat = "_%v_value"

UnderscoreFieldFormat is used to format field names that will be present in Read response. These fields are references used for search.

Variables

View Source
var (
	ErrObjectNotFound          = errors.New("object not found")
	ErrObjectMissingAttributes = errors.New("object missing metadata attributes")
)

Functions

This section is empty.

Types

type CRMError

type CRMError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	*EnhancedCRMError
}

type CRMResponseError

type CRMResponseError struct {
	Err CRMError `json:"error"`
}

func (CRMResponseError) CombineErr

func (r CRMResponseError) CombineErr(base error) error

type Connector

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

func NewConnector

func NewConnector(opts ...Option) (conn *Connector, outErr 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)

ListObjectMetadata returns list of fields that can be queried during Read operation. The searched object will be considered not found by returning ErrObjectNotFound error. This will happen if API calls for schema/attributes fail. In an unlikely event it may happen if MS server's response format would change.

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)

nolint:lll Microsoft API supports other capabilities like filtering, grouping, and sorting which we can potentially tap into later. See https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/query-data-web-api#odata-query-options

func (*Connector) String

func (c *Connector) String() string

func (*Connector) Write

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

Write data will be used to Create or Update entity. Return: common.WriteResult, where only the Success flag will be set.

type EnhancedCRMError

type EnhancedCRMError struct {
	HelpLink     string `json:"@Microsoft.PowerApps.CDS.HelpLink"`           // nolint:tagliatelle
	TraceText    string `json:"@Microsoft.PowerApps.CDS.TraceText"`          // nolint:tagliatelle
	InnerMessage string `json:"@Microsoft.PowerApps.CDS.InnerError.Message"` // nolint:tagliatelle
}

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 WithWorkspace

func WithWorkspace(workspaceRef string) Option

Jump to

Keyboard shortcuts

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