providers

package
v0.0.0-...-42e523d Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

nolint:lll

Package providers provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.

nolint:ireturn

Index

Constants

View Source
const (
	LabelExperimental = "experimental"
	LabelValueTrue    = "true"
)
View Source
const Apollo = "apollo"
View Source
const Insightly = "insightly"

Variables

View Source
var (
	ErrCatalogNotFound                = errors.New("catalog not found")
	ErrProviderNotFound               = errors.New("provider not found")
	ErrClient                         = errors.New("client creation failed")
	ErrRetrievingHeaderApiKeyName     = errors.New("provider information missing header name for API Key")
	ErrRetrievingQueryParamApiKeyName = errors.New("provider information missing query parameter name for API Key")
)

Functions

func Init

func Init()

func SetInfo

func SetInfo(provider Provider, info ProviderInfo)

SetInfo sets the information for a specific provider in the catalog. This is useful to enable experimental providers or to override the default provider information. This is primarily used to initialize the provider catalog. Generally speaking, once the provider catalog is initialized, it should not be modified. That having been said, there are some use cases where it is useful to override the provider information, such as when testing new configurations. This function is not thread-safe and should be called before the provider catalog is read.

func SetupMockProvider

func SetupMockProvider()

SetupMockProvider sets up the mock provider. You need to call this explicitly if you want to use the mock provider in your tests.

Types

type ApiKeyAsBasicOpts

type ApiKeyAsBasicOpts struct {
	// FieldUsed whether the API key should be used as the username or password.
	FieldUsed ApiKeyAsBasicOptsFieldUsed `json:"fieldUsed,omitempty"`

	// KeyFormat How to transform the API key in to a basic auth user:pass string. The %s is replaced with the API key value.
	KeyFormat string `json:"keyFormat,omitempty"`
}

ApiKeyAsBasicOpts when this object is present, it means that this provider uses Basic Auth to actually collect an API key

type ApiKeyAsBasicOptsFieldUsed

type ApiKeyAsBasicOptsFieldUsed string

ApiKeyAsBasicOptsFieldUsed whether the API key should be used as the username or password.

const (
	PasswordField ApiKeyAsBasicOptsFieldUsed = "password"
	UsernameField ApiKeyAsBasicOptsFieldUsed = "username"
)

Defines values for ApiKeyAsBasicOptsFieldUsed.

type ApiKeyOpts

type ApiKeyOpts struct {
	// AttachmentType How the API key should be attached to requests.
	AttachmentType ApiKeyOptsAttachmentType `json:"attachmentType" validate:"required"`

	// DocsURL URL with more information about how to get or use an API key.
	DocsURL string `json:"docsURL,omitempty"`

	// Header Configuration for API key in header. Must be provided if type is in-header.
	Header *ApiKeyOptsHeader `json:"header,omitempty"`

	// Query Configuration for API key in query parameter. Must be provided if type is in-query.
	Query *ApiKeyOptsQuery `json:"query,omitempty"`
}

ApiKeyOpts Configuration for API key. Must be provided if authType is apiKey.

type ApiKeyOptsAttachmentType

type ApiKeyOptsAttachmentType string

ApiKeyOptsAttachmentType How the API key should be attached to requests.

const (
	Header ApiKeyOptsAttachmentType = "header"
	Query  ApiKeyOptsAttachmentType = "query"
)

Defines values for ApiKeyOptsAttachmentType.

type ApiKeyOptsHeader

type ApiKeyOptsHeader struct {
	// Name The name of the header to be used for the API key.
	Name string `json:"name"`

	// ValuePrefix The prefix to be added to the API key value when it is sent in the header.
	ValuePrefix string `json:"valuePrefix,omitempty"`
}

ApiKeyOptsHeader Configuration for API key in header. Must be provided if type is in-header.

type ApiKeyOptsQuery

type ApiKeyOptsQuery struct {
	// Name The name of the query parameter to be used for the API key.
	Name string `json:"name"`
}

ApiKeyOptsQuery Configuration for API key in query parameter. Must be provided if type is in-query.

type AuthType

type AuthType string

AuthType The type of authentication required by the provider.

const (
	ApiKey AuthType = "apiKey"
	Basic  AuthType = "basic"
	Jwt    AuthType = "jwt"
	None   AuthType = "none"
	Oauth2 AuthType = "oauth2"
)

Defines values for AuthType.

type BasicAuthOpts

type BasicAuthOpts struct {
	// ApiKeyAsBasic If true, the provider uses an API key which then gets encoded as a basic auth user:pass string.
	ApiKeyAsBasic bool `json:"apiKeyAsBasic,omitempty"`

	// ApiKeyAsBasicOpts when this object is present, it means that this provider uses Basic Auth to actually collect an API key
	ApiKeyAsBasicOpts *ApiKeyAsBasicOpts `json:"apiKeyAsBasicOpts,omitempty"`

	// DocsURL URL with more information about how to get or use an API key.
	DocsURL string `json:"docsURL,omitempty"`
}

BasicAuthOpts Configuration for Basic Auth. Optional.

type BasicParams

type BasicParams struct {
	User string
	Pass string
}

BasicParams is the parameters to create a basic auth client.

type BulkWriteSupport

type BulkWriteSupport struct {
	Delete bool `json:"delete"`
	Insert bool `json:"insert"`
	Update bool `json:"update"`
	Upsert bool `json:"upsert"`
}

BulkWriteSupport defines model for BulkWriteSupport.

type CatalogOption

type CatalogOption func(params *catalogParams)

func WithCatalog

func WithCatalog(c *CatalogWrapper) CatalogOption

WithCatalog is an option that can be used to override the default catalog.

type CatalogType

type CatalogType map[string]ProviderInfo

CatalogType defines model for CatalogType.

type CatalogWrapper

type CatalogWrapper struct {
	Catalog CatalogType `json:"catalog"`

	// Timestamp An RFC3339 formatted timestamp of when the catalog was generated.
	Timestamp string `json:"timestamp" validate:"required"`
}

CatalogWrapper defines model for CatalogWrapper.

func ReadCatalog

func ReadCatalog(opts ...CatalogOption) (*CatalogWrapper, error)

ReadCatalog is used to get the catalog.

type CustomCatalog

type CustomCatalog struct {
	// contains filtered or unexported fields
}

func NewCustomCatalog

func NewCustomCatalog(opts ...CatalogOption) CustomCatalog

NewCustomCatalog allows to apply modifiers on the base catalog, to tweak its content. Just like the default catalog it supports reading data, resolves variable substitutions.

func (CustomCatalog) ReadCatalog

func (c CustomCatalog) ReadCatalog() (*CatalogWrapper, error)

func (CustomCatalog) ReadInfo

func (c CustomCatalog) ReadInfo(provider Provider, vars ...catalogreplacer.CatalogVariable) (*ProviderInfo, error)

type Labels

type Labels map[string]string

Labels defines model for Labels.

type Media

type Media struct {
	// DarkMode Media to be used in dark mode.
	DarkMode *MediaTypeDarkMode `json:"darkMode,omitempty"`

	// Regular Media for light/regular mode.
	Regular *MediaTypeRegular `json:"regular,omitempty"`
}

Media defines model for Media.

type MediaTypeDarkMode

type MediaTypeDarkMode struct {
	// IconURL URL to the icon for the provider that is to be used in dark mode.
	IconURL string `json:"iconURL,omitempty"`

	// LogoURL URL to the logo for the provider that is to be used in dark mode.
	LogoURL string `json:"logoURL,omitempty"`
}

MediaTypeDarkMode Media to be used in dark mode.

type MediaTypeRegular

type MediaTypeRegular struct {
	// IconURL URL to the icon for the provider.
	IconURL string `json:"iconURL,omitempty"`

	// LogoURL URL to the logo for the provider.
	LogoURL string `json:"logoURL,omitempty"`
}

MediaTypeRegular Media for light/regular mode.

type NewClientParams

type NewClientParams struct {
	// Debug will enable debug mode for the client.
	Debug bool

	// Client is the http client to use for the client. If
	// the value is nil, the default http client will be used.
	Client *http.Client

	// BasicCreds is the basic auth credentials to use for the client.
	// If the provider uses basic auth, this field must be set.
	BasicCreds *BasicParams

	// OAuth2ClientCreds is the client credentials to use for the client.
	// If the provider uses client credentials, this field must be set.
	OAuth2ClientCreds *OAuth2ClientCredentialsParams

	// OAuth2AuthCodeCreds is the auth code credentials to use for the client.
	// If the provider uses auth code, this field must be set.
	OAuth2AuthCodeCreds *OAuth2AuthCodeParams

	// ApiKey is the api key to use for the client. If the provider uses api-key
	// auth, this field must be set.
	ApiKey string
}

NewClientParams is the parameters to create a new HTTP client.

type OAuth2AuthCodeParams

type OAuth2AuthCodeParams struct {
	Config  *oauth2.Config
	Token   *oauth2.Token
	Options []common.OAuthOption
}

OAuth2AuthCodeParams is the parameters to create an OAuth2 auth code client.

type OAuth2ClientCredentialsParams

type OAuth2ClientCredentialsParams struct {
	Config  *clientcredentials.Config
	Options []common.OAuthOption
}

type Oauth2Opts

type Oauth2Opts struct {
	// Audience A list of URLs that represent the audience for the token, which is needed for some client credential grant flows.
	Audience []string `json:"audience,omitempty"`

	// AuthURL The authorization URL.
	AuthURL       string            `json:"authURL,omitempty"`
	AuthURLParams map[string]string `json:"authURLParams,omitempty"`

	// DocsURL URL with more information about where to retrieve Client ID and Client Secret, etc.
	DocsURL string `json:"docsURL,omitempty"`

	// ExplicitScopesRequired Whether scopes are required to be known ahead of the OAuth flow.
	ExplicitScopesRequired bool `json:"explicitScopesRequired"`

	// ExplicitWorkspaceRequired Whether the workspace is required to be known ahead of the OAuth flow.
	ExplicitWorkspaceRequired bool                `json:"explicitWorkspaceRequired"`
	GrantType                 Oauth2OptsGrantType `json:"grantType"`

	// TokenMetadataFields Fields to be used to extract token metadata from the token response.
	TokenMetadataFields TokenMetadataFields `json:"tokenMetadataFields"`

	// TokenURL The token URL.
	TokenURL string `json:"tokenURL" validate:"required"`
}

Oauth2Opts Configuration for OAuth2.0. Must be provided if authType is oauth2.

type Oauth2OptsGrantType

type Oauth2OptsGrantType string

Oauth2OptsGrantType defines model for Oauth2Opts.GrantType.

const (
	AuthorizationCode     Oauth2OptsGrantType = "authorizationCode"
	AuthorizationCodePKCE Oauth2OptsGrantType = "authorizationCodePKCE"
	ClientCredentials     Oauth2OptsGrantType = "clientCredentials"
	Password              Oauth2OptsGrantType = "password"
)

Defines values for Oauth2OptsGrantType.

type Provider

type Provider = string

Provider defines model for Provider.

const (
	BlueshiftEU Provider = "blueshiftEU"
	Blueshift   Provider = "blueshift"
)
const (
	CustomerDataPipelines Provider = "customerDataPipelines"
	CustomerJourneysApp   Provider = "customerJourneysApp"
	CustomerJourneysTrack Provider = "customerJourneysTrack"
)
const (
	Docusign          Provider = "docusign"
	DocusignDeveloper Provider = "docusignDeveloper"
)
const (
	Dropbox     Provider = "dropbox"
	DropboxSign Provider = "dropboxSign"
)
const (
	DynamicsBusinessCentral Provider = "dynamicsBusinessCentral"
	DynamicsCRM             Provider = "dynamicsCRM"
)
const (
	Gladly   Provider = "gladly"
	GladlyQA Provider = "gladlyQA"
)
const (
	Ironclad     Provider = "ironclad"
	IroncladDemo Provider = "ironcladDemo"
	IroncladEU   Provider = "ironcladEU"
)
const (
	Lever        Provider = "lever"
	LeverSandbox Provider = "leverSandbox"
)
const (
	PaddleSandbox Provider = "paddleSandbox"
	Paddle        Provider = "paddle"
)
const (
	ZendeskChat    Provider = "zendeskChat"
	ZendeskSupport Provider = "zendeskSupport"
)
const AWeber Provider = "aWeber"
const ActiveCampaign Provider = "activeCampaign"
const AcuityScheduling Provider = "acuityScheduling"
const Adobe Provider = "adobe"
const Aha Provider = "aha"
const Aircall Provider = "aircall"
const Airtable Provider = "airtable"
const Amplitude Provider = "amplitude"
const Anthropic Provider = "anthropic"
const Asana Provider = "asana"
const Ashby Provider = "ashby"
const Atlassian Provider = "atlassian"
const Attio Provider = "attio"
const Basecamp Provider = "basecamp"
const Bird Provider = "bird"
const Box Provider = "box"
const Braintree Provider = "braintree"
const Brevo Provider = "brevo"
const Bynder Provider = "bynder"
const Calendly Provider = "calendly"
const CallRail Provider = "callRail"
const CampaignMonitor Provider = "campaignMonitor"
const Capsule Provider = "capsule"
const ChargeOver Provider = "chargeOver"
const Chargebee Provider = "chargebee"
const ChartMogul Provider = "chartMogul"
const Clari Provider = "clari"
const ClickUp Provider = "clickup"
const Close Provider = "close"
const Coda Provider = "coda"
const ConstantContact Provider = "constantContact"
const Copper Provider = "copper"
const Crunchbase Provider = "crunchbase"
const Delighted Provider = "delighted"
const Discord Provider = "discord"
const Discourse Provider = "discourse"
const Dixa Provider = "dixa"
const Domo Provider = "domo"
const Dovetail Provider = "dovetail"
const Drift Provider = "drift"
const Drip Provider = "drip"
const Facebook Provider = "facebook"
const Figma Provider = "figma"
const Formstack Provider = "formstack"
const Freshchat Provider = "freshchat"
const Freshdesk Provider = "freshdesk"
const Freshsales Provider = "freshsales"
const Freshservice Provider = "freshservice"
const Front Provider = "front"
const G2 Provider = "g2"
const Gainsight Provider = "gainsight"
const Geckoboard Provider = "geckoboard"
const GetResponse Provider = "getResponse"
const GitLab Provider = "gitLab"
const Github Provider = "github"
const GoToWebinar Provider = "goToWebinar"
const Gong Provider = "gong"
const (
	Google Provider = "google"
)
const (
	Gorgias Provider = "gorgias"
)
const Guru Provider = "guru"
const HelpScoutMailbox Provider = "helpScoutMailbox"
const Hive Provider = "hive"
const Hubspot Provider = "hubspot"
const Hunter Provider = "hunter"
const Instagram Provider = "instagram"
const Instantly Provider = "instantly"
const Intercom Provider = "intercom"
const Iterable Provider = "iterable"
const Jotform Provider = "jotform"
const Keap Provider = "keap"
const Kit Provider = "kit"
const Klaviyo Provider = "klaviyo"
const Lemlist Provider = "lemlist"
const LinkedIn Provider = "linkedIn"
const Mailgun Provider = "mailgun"
const Marketo Provider = "marketo"
const Maxio Provider = "maxio"
const Microsoft Provider = "microsoft"

Supported Microsoft Products includes OneDrive Outlook Excel Edge Extensions Sharepoint OneNote Notifications Todos Teams Insights Planner and Personal Contacts.

const Miro Provider = "miro"
const Mixmax Provider = "mixmax"
const Mock Provider = "mock"

Mock is a mock provider that can be used for testing. When the mock connector is used, it's added to the catalog manually. That is why there's no init() function in this file.

const Monday Provider = "monday"
const Mural Provider = "mural"
const Notion Provider = "notion"
const Nutshell Provider = "nutshell"
const OpenAI Provider = "openAI"
const Outreach Provider = "outreach"
const Pinterest Provider = "pinterest"
const Pipedrive Provider = "pipedrive"
const Pipeliner Provider = "pipeliner"
const Podium Provider = "podium"
const ProductBoard Provider = "productBoard"
const Rebilly Provider = "rebilly"
const Recurly Provider = "recurly"
const RedditAds Provider = "redditAds"
const RingCentral Provider = "ringCentral"
const Salesflare Provider = "salesflare"
const Salesforce Provider = "salesforce"
const SalesforceMarketing Provider = "salesforceMarketing"
const Salesloft Provider = "salesloft"
const Seismic Provider = "seismic"
const Sellsy Provider = "sellsy"
const SendGrid Provider = "sendGrid"
const ServiceNow Provider = "serviceNow"
const Shopify Provider = "shopify"
const Slack Provider = "slack"
const Smartlead Provider = "smartlead"
const Smartsheet Provider = "smartsheet"
const SnapchatAds Provider = "snapchatAds"
const StackExchange Provider = "stackExchange"
const Stripe Provider = "stripe"
const SugarCRM Provider = "sugarCRM"
const SurveyMonkey Provider = "surveyMonkey"
const Talkdesk Provider = "talkdesk"
const Teamleader Provider = "teamleader"
const Teamwork Provider = "teamwork"
const Timely Provider = "timely"
const Typeform Provider = "typeform"
const Webflow Provider = "webflow"
const WordPress Provider = "wordPress"
const Wrike Provider = "wrike"
const Zoho Provider = "zoho"
const ZohoDesk Provider = "zohoDesk"
const Zoom Provider = "zoom"
const Zuora Provider = "zuora"

type ProviderInfo

type ProviderInfo struct {
	// ApiKeyOpts Configuration for API key. Must be provided if authType is apiKey.
	ApiKeyOpts *ApiKeyOpts `json:"apiKeyOpts,omitempty"`

	// AuthType The type of authentication required by the provider.
	AuthType AuthType `json:"authType" validate:"required"`

	// BaseURL The base URL for making API requests.
	BaseURL string `json:"baseURL" validate:"required"`

	// BasicOpts Configuration for Basic Auth. Optional.
	BasicOpts *BasicAuthOpts `json:"basicOpts,omitempty"`

	// DisplayName The display name of the provider, if omitted, defaults to provider name.
	DisplayName string  `json:"displayName,omitempty"`
	Labels      *Labels `json:"labels,omitempty"`
	Media       *Media  `json:"media,omitempty"`
	Name        string  `json:"name"`

	// Oauth2Opts Configuration for OAuth2.0. Must be provided if authType is oauth2.
	Oauth2Opts *Oauth2Opts `json:"oauth2Opts,omitempty"`

	// PostAuthInfoNeeded If true, we require additional information after auth to start making requests.
	PostAuthInfoNeeded bool `json:"postAuthInfoNeeded,omitempty"`

	// ProviderOpts Additional provider-specific metadata.
	ProviderOpts ProviderOpts `json:"providerOpts"`

	// Support The supported features for the provider.
	Support Support `json:"support" validate:"required"`
}

ProviderInfo defines model for ProviderInfo.

func ReadInfo

func ReadInfo(provider Provider, vars ...catalogreplacer.CatalogVariable) (*ProviderInfo, error)

ReadInfo reads the information from the catalog for specific provider. It also performs string substitution on the values in the config that are surrounded by {{}}, if vars are provided. The catalog variable will be applied such that `{{.VAR_NAME}}` string will be replaced with `VAR_VALUE`.

func (*ProviderInfo) GetApiKeyHeader

func (i *ProviderInfo) GetApiKeyHeader(apiKey string) (string, string, error)

func (*ProviderInfo) GetApiKeyQueryParamName

func (i *ProviderInfo) GetApiKeyQueryParamName() (string, error)

func (*ProviderInfo) GetOption

func (i *ProviderInfo) GetOption(key string) (string, bool)

func (*ProviderInfo) NewClient

NewClient will create a new authenticated client based on the provider's auth type.

func (*ProviderInfo) Override

func (i *ProviderInfo) Override(override *ProviderInfo) *ProviderInfo

Override can be used to override the base URL of the provider, and could be used for other fields in the future.

func (*ProviderInfo) SubstituteWith

func (i *ProviderInfo) SubstituteWith(vars []catalogreplacer.CatalogVariable) error

type ProviderOpts

type ProviderOpts map[string]string

ProviderOpts Additional provider-specific metadata.

type Support

type Support struct {
	BulkWrite BulkWriteSupport `json:"bulkWrite" validate:"required"`
	Proxy     bool             `json:"proxy"`
	Read      bool             `json:"read"`
	Subscribe bool             `json:"subscribe"`
	Write     bool             `json:"write"`
}

Support The supported features for the provider.

type TokenMetadataFields

type TokenMetadataFields struct {
	ConsumerRefField  string `json:"consumerRefField,omitempty"`
	ScopesField       string `json:"scopesField,omitempty"`
	WorkspaceRefField string `json:"workspaceRefField,omitempty"`
}

TokenMetadataFields Fields to be used to extract token metadata from the token response.

Source Files

Directories

Path Synopsis
nolint
nolint
kit
nolint
nolint
Package salesforce This file has bulk related functionality that is internal to this package.
Package salesforce This file has bulk related functionality that is internal to this package.

Jump to

Keyboard shortcuts

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