client

package
v0.0.0-...-ddbfcda Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GET  = http.MethodGet
	POST = http.MethodPost
)
View Source
const AuthTokenHeader = "Whdb-Auth-Token"
View Source
const RestyKey = "client.resty"

Variables

This section is empty.

Functions

func AuthGetMe

func AuthGetMe(c context.Context, auth Auth) (out types.SingleResponse, err error)

func AuthLogout

func AuthLogout(c context.Context, auth Auth) (out types.MessageResponse, err error)

func CoerceError

func CoerceError(r *resty.Response) error

func DbMigrationsList

func DbMigrationsList(c context.Context, auth Auth, input DbOrgIdentifierInput) (out types.CollectionResponse, err error)

func DbMigrationsStart

func DbMigrationsStart(c context.Context, auth Auth, input DbMigrationsStartInput) (out types.MessageResponse, err error)

func DbRenameTable

func DbRenameTable(c context.Context, auth Auth, input DbRenameTableInput) (out types.SingleResponse, err error)

func DbRollCredentials

func DbRollCredentials(c context.Context, auth Auth, input DbOrgIdentifierInput) (out types.MessageResponse, err error)

func IntegrationsDelete

func IntegrationsDelete(c context.Context, auth Auth, input IntegrationsDeleteInput) (types.MessageResponse, error)

func IntegrationsList

func IntegrationsList(c context.Context, auth Auth, input IntegrationsListInput) (out types.CollectionResponse, err error)

func IntegrationsStats

func IntegrationsStats(c context.Context, auth Auth, input IntegrationsStatsInput) (out types.SingleResponse, err error)

func OrgChangeRoles

func OrgChangeRoles(c context.Context, auth Auth, input OrgChangeRolesInput) (out types.MessageResponse, err error)

func OrgInvite

func OrgInvite(c context.Context, auth Auth, input OrgInviteInput) (out types.MessageResponse, err error)

func OrgJoin

func OrgJoin(c context.Context, auth Auth, input OrgJoinInput) (out types.HasOrgResponse, err error)

func OrgMembers

func OrgMembers(c context.Context, auth Auth, input OrgMembersInput) (out types.CollectionResponse, err error)

func OrgRemove

func OrgRemove(c context.Context, auth Auth, input OrgRemoveInput) (out types.MessageResponse, err error)

func OrgUpdate

func OrgUpdate(c context.Context, auth Auth, input OrgUpdateInput) (out types.MessageResponse, err error)

func Replay

func Replay(c context.Context, auth Auth, input ReplayInput) (types.MessageResponse, error)

func RestyFromContext

func RestyFromContext(c context.Context) *resty.Client

func RestyInContext

func RestyInContext(c context.Context, r *resty.Client) context.Context

func SavedQueryCreate

func SavedQueryCreate(c context.Context, auth Auth, input SavedQueryCreateInput) (out types.MessageResponse, err error)

func SavedQueryDelete

func SavedQueryDelete(c context.Context, auth Auth, input SavedQueryIdentifierInput) (out types.MessageResponse, err error)

func SavedQueryList

func SavedQueryList(c context.Context, auth Auth, input SavedQueryListInput) (out types.CollectionResponse, err error)

func SavedQueryRun

func SavedQueryRun(c context.Context, auth Auth, input SavedQueryIdentifierInput) (out types.RunQueryOutput, err error)

func SavedQueryUpdate

func SavedQueryUpdate(c context.Context, auth Auth, input SavedQueryUpdateInput) (out types.MessageResponse, err error)

func SavedViewCreate

func SavedViewCreate(c context.Context, auth Auth, input SavedViewCreateInput) (out types.MessageResponse, err error)

func SavedViewDelete

func SavedViewDelete(c context.Context, auth Auth, input SavedViewDeleteInput) (out types.MessageResponse, err error)

func SavedViewList

func SavedViewList(c context.Context, auth Auth, input SavedViewListInput) (out types.CollectionResponse, err error)

func ServicesList

func ServicesList(c context.Context, auth Auth, input ServicesListInput) (out types.CollectionResponse, err error)

func StateMachineResponseRunner

func StateMachineResponseRunner(ctx context.Context, auth Auth) func(Step, error) (Step, error)

StateMachineResponseRunner is a helper to wrap client calls that return (Step, error) so we can use a single line to make the API call and run the state machine.

func SubscriptionInfo

func SubscriptionInfo(c context.Context, auth Auth, input SubscriptionInfoInput) (out types.SingleResponse, err error)

func SubscriptionPlans

func SubscriptionPlans(c context.Context, auth Auth, input SubscriptionPlansInput) (out types.CollectionResponse, err error)

func SyncTargetCreate

func SyncTargetCreate(c context.Context, auth Auth, input SyncTargetCreateInput) (out types.SingleResponse, err error)

func SyncTargetDelete

func SyncTargetDelete(c context.Context, auth Auth, input SyncTargetDeleteInput) (types.MessageResponse, error)

func SyncTargetList

func SyncTargetList(c context.Context, auth Auth, input SyncTargetListInput) (out types.CollectionResponse, err error)

func SyncTargetSync

func SyncTargetSync(c context.Context, auth Auth, input SyncTargetSyncInput) (out types.SingleResponse, err error)

func SyncTargetUpdate

func SyncTargetUpdate(c context.Context, auth Auth, input SyncTargetUpdateInput) (out types.SingleResponse, err error)

func SyncTargetUpdateCreds

func SyncTargetUpdateCreds(c context.Context, auth Auth, input SyncTargetUpdateCredsInput) (out types.SingleResponse, err error)

func WebhookCreate

func WebhookCreate(c context.Context, auth Auth, input WebhookCreateInput) (out types.MessageResponse, err error)

func WebhookDelete

func WebhookDelete(c context.Context, auth Auth, input WebhookOpaqueIdInput) (out types.MessageResponse, err error)

func WebhookList

func WebhookList(c context.Context, auth Auth, input WebhookListInput) (out types.CollectionResponse, err error)

func WebhookTest

func WebhookTest(c context.Context, auth Auth, input WebhookOpaqueIdInput) (out types.MessageResponse, err error)

Types

type Auth

type Auth struct {
	Token types.AuthToken `json:"-"`
}

type AuthLoginInput

type AuthLoginInput struct {
	Username string `json:"email"`
	Token    string `json:"token"`
}

type AuthLoginOutput

type AuthLoginOutput struct {
	AuthToken  types.AuthToken
	OutputStep Step
}

type BackfillInput

type BackfillInput struct {
	IntegrationIdentifier string              `json:"-"`
	OrgIdentifier         types.OrgIdentifier `json:"-"`
}

type BackfillResetInput

type BackfillResetInput struct {
	IntegrationIdentifier string              `json:"-"`
	OrgIdentifier         types.OrgIdentifier `json:"-"`
}

type DbConnectionOutput

type DbConnectionOutput struct {
	ConnectionUrl string `json:"connection_url"`
}

func DbConnection

func DbConnection(c context.Context, auth Auth, input DbOrgIdentifierInput) (out DbConnectionOutput, err error)

type DbFdwInput

type DbFdwInput struct {
	OrgIdentifier    types.OrgIdentifier `json:"-"`
	MessageFdw       bool                `json:"message_fdw"`
	MessageViews     bool                `json:"message_views"`
	MessageAll       bool                `json:"message_all"`
	RemoteServerName string              `json:"remote_server_name"`
	FetchSize        string              `json:"fetch_size"`
	LocalSchema      string              `json:"local_schema"`
	ViewSchema       string              `json:"view_schema"`
}

type DbFdwOutput

type DbFdwOutput map[string]interface{}

func DbFdw

func DbFdw(c context.Context, auth Auth, input DbFdwInput) (out DbFdwOutput, err error)

type DbMigrationsStartInput

type DbMigrationsStartInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
	AdminUrl      string              `json:"admin_url"`
	ReadonlyUrl   *string             `json:"readonly_url,omitempty"`
}

type DbOrgIdentifierInput

type DbOrgIdentifierInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
}

type DbRenameTableInput

type DbRenameTableInput struct {
	IntegrationIdentifier string              `json:"-"`
	OrgIdentifier         types.OrgIdentifier `json:"-"`
	NewName               string              `json:"new_name"`
}

type DbSqlInput

type DbSqlInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
	Query         string              `json:"query"`
}

type DbSqlOutput

type DbSqlOutput = types.RunQueryOutput

func DbSql

func DbSql(c context.Context, auth Auth, input DbSqlInput) (out DbSqlOutput, err error)

type DbTablesOutput

type DbTablesOutput struct {
	Message    string   `json:"message"`
	TableNames []string `json:"tables"`
}

func DbTables

func DbTables(c context.Context, auth Auth, input DbOrgIdentifierInput) (out DbTablesOutput, err error)

type ErrorResponse

type ErrorResponse struct {
	Err struct {
		Message          string              `json:"message"`
		Code             string              `json:"code"`
		Status           int                 `json:"status"`
		Errors           []string            `json:"errors"`
		FieldErrors      map[string][]string `json:"field_errors"`
		StateMachineStep *Step               `json:"state_machine_step"`
	} `json:"error"`
}

func (ErrorResponse) Error

func (e ErrorResponse) Error() string

type Extra

type Extra map[string]interface{}

type GetFixturesInput

type GetFixturesInput struct {
	ServiceName string `json:"service_name"`
}

type GetFixturesOutput

type GetFixturesOutput struct {
	Message   string `json:"message"`
	SchemaSql string `json:"schema_sql"`
}

func GetFixtures

func GetFixtures(c context.Context, auth Auth, input GetFixturesInput) (out GetFixturesOutput, err error)

type IntegrationsCreateInput

type IntegrationsCreateInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
	ServiceName   string              `json:"service_name"`
	GuardConfirm  *string             `json:"guard_confirm,omitempty"`
}

type IntegrationsDeleteInput

type IntegrationsDeleteInput struct {
	IntegrationIdentifier string              `json:"-"`
	OrgIdentifier         types.OrgIdentifier `json:"-"`
	Confirm               string              `json:"confirm"`
}

type IntegrationsInfoInput

type IntegrationsInfoInput struct {
	IntegrationIdentifier string              `json:"-"`
	OrgIdentifier         types.OrgIdentifier `json:"-"`
	Field                 string              `json:"field"`
}

type IntegrationsInfoOutput

type IntegrationsInfoOutput struct {
	Blocks formatting.Blocks `json:"blocks"`
}

func IntegrationsInfo

func IntegrationsInfo(c context.Context, auth Auth, input IntegrationsInfoInput) (out IntegrationsInfoOutput, err error)

type IntegrationsListInput

type IntegrationsListInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
}

type IntegrationsResetInput

type IntegrationsResetInput struct {
	IntegrationIdentifier string              `json:"-"`
	OrgIdentifier         types.OrgIdentifier `json:"-"`
}

type IntegrationsRollKeyInput

type IntegrationsRollKeyInput struct {
	IntegrationIdentifier string              `json:"-"`
	OrgIdentifier         types.OrgIdentifier `json:"-"`
}

type IntegrationsRollKeyOutput

type IntegrationsRollKeyOutput struct {
	WebhookdbApiKey string `json:"webhookdb_api_key"`
}

func IntegrationsRollKey

func IntegrationsRollKey(c context.Context, auth Auth, input IntegrationsRollKeyInput) (out IntegrationsRollKeyOutput, err error)

type IntegrationsSetupInput

type IntegrationsSetupInput struct {
	IntegrationIdentifier string              `json:"-"`
	OrgIdentifier         types.OrgIdentifier `json:"-"`
}

type IntegrationsStatsInput

type IntegrationsStatsInput struct {
	IntegrationIdentifier string              `json:"-"`
	OrgIdentifier         types.OrgIdentifier `json:"-"`
}

type MeOrgMembershipsInput

type MeOrgMembershipsInput struct {
	ActiveOrgIdentifier types.OrgIdentifier `json:"-"`
}

type MeOrgMembershipsOutput

type MeOrgMembershipsOutput struct {
	Blocks formatting.Blocks `json:"blocks"`
}

func MeOrgMemberships

func MeOrgMemberships(c context.Context, auth Auth, input MeOrgMembershipsInput) (out MeOrgMembershipsOutput, err error)

type OrgChangeRolesInput

type OrgChangeRolesInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
	Emails        string              `json:"emails"`
	RoleName      string              `json:"role_name"`
}

type OrgCloseInput

type OrgCloseInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
}

type OrgCreateInput

type OrgCreateInput struct {
	OrgName string `json:"name"`
}

type OrgCreateOutput

type OrgCreateOutput struct {
	types.Organization
	types.MessageResponse
}

func OrgCreate

func OrgCreate(c context.Context, auth Auth, input OrgCreateInput) (out OrgCreateOutput, err error)

type OrgGetInput

type OrgGetInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
}

type OrgGetOutput

type OrgGetOutput struct {
	types.Organization
	types.MessageResponse
}

func OrgGet

func OrgGet(c context.Context, auth Auth, input OrgGetInput) (out OrgGetOutput, err error)

type OrgInviteInput

type OrgInviteInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
	Email         string              `json:"email"`
	Role          string              `json:"role_name,omitempty"`
}

type OrgJoinInput

type OrgJoinInput struct {
	InvitationCode string `json:"invitation_code"`
}

type OrgMembersInput

type OrgMembersInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
}

type OrgRemoveInput

type OrgRemoveInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
	Email         string              `json:"email"`
}

type OrgUpdateInput

type OrgUpdateInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
	Field         string              `json:"field"`
	Value         string              `json:"value"`
}

type OrganizationMembershipEntity

type OrganizationMembershipEntity struct {
	CustomerEmail string             `json:"email"`
	Organization  types.Organization `json:"organization"`
	Status        string             `json:"status"`
}

type ReplayInput

type ReplayInput struct {
	OrgIdentifier         types.OrgIdentifier `json:"-"`
	IntegrationIdentifier string              `json:"service_integration_identifier,omitempty"`
	Hours                 int                 `json:"hours,omitempty"`
	Before                string              `json:"before,omitempty"`
	After                 string              `json:"after,omitempty"`
}

type SavedQueryCreateInput

type SavedQueryCreateInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
	Description   string              `json:"description"`
	Sql           string              `json:"sql"`
	Public        bool                `json:"public"`
}

type SavedQueryIdentifierInput

type SavedQueryIdentifierInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
	Identifier    string              `json:"-"`
}

type SavedQueryInfoInput

type SavedQueryInfoInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
	Identifier    string              `json:"-"`
	Field         string              `json:"field"`
}

type SavedQueryInfoOutput

type SavedQueryInfoOutput struct {
	Blocks formatting.Blocks `json:"blocks"`
}

func SavedQueryInfo

func SavedQueryInfo(c context.Context, auth Auth, input SavedQueryInfoInput) (out SavedQueryInfoOutput, err error)

type SavedQueryListInput

type SavedQueryListInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
}

type SavedQueryUpdateInput

type SavedQueryUpdateInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
	Identifier    string              `json:"-"`
	Field         string              `json:"field"`
	Value         string              `json:"value"`
}

type SavedViewCreateInput

type SavedViewCreateInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
	Name          string              `json:"name"`
	Sql           string              `json:"sql"`
}

type SavedViewDeleteInput

type SavedViewDeleteInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
	Name          string              `json:"name"`
}

type SavedViewListInput

type SavedViewListInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
}

type ServiceEntity

type ServiceEntity struct {
	Name string `json:"name"`
}

type ServiceIntegrationEntity

type ServiceIntegrationEntity struct {
	OpaqueId    string `json:"opaque_id"`
	ServiceName string `json:"service_name"`
	TableName   string `json:"table_name"`
}

type ServicesListInput

type ServicesListInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
}

type StateMachine

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

func NewStateMachine

func NewStateMachine() StateMachine

func (StateMachine) Run

func (sm StateMachine) Run(c context.Context, auth Auth, startingStep Step) (Step, error)

Run processes the input step until it succeeds or the processing errors (from the API, or ctrl+c, etc).

type Step

type Step struct {
	Message            string                 `json:"message"`
	NeedsInput         bool                   `json:"needs_input"`
	Prompt             string                 `json:"prompt"`
	PromptIsSecret     bool                   `json:"prompt_is_secret"`
	PostToUrl          string                 `json:"post_to_url"`
	PostParams         map[string]interface{} `json:"post_params"`
	PostParamsValueKey string                 `json:"post_params_value_key"`
	Complete           bool                   `json:"complete"`
	Output             string                 `json:"output"`
	Extras             map[string]Extra       `json:"extras"`
	RawResponse        *resty.Response        `json:"-"`
}

func AuthLogin

func AuthLogin(c context.Context, input AuthLoginInput) (Step, error)

func Backfill

func Backfill(c context.Context, auth Auth, input BackfillInput) (Step, error)

func BackfillReset

func BackfillReset(c context.Context, auth Auth, input BackfillResetInput) (Step, error)

func IntegrationsCreate

func IntegrationsCreate(c context.Context, auth Auth, input IntegrationsCreateInput) (out Step, err error)

func IntegrationsReset

func IntegrationsReset(c context.Context, auth Auth, input IntegrationsResetInput) (Step, error)

func IntegrationsSetup

func IntegrationsSetup(c context.Context, auth Auth, input IntegrationsSetupInput) (Step, error)

func OrgClose

func OrgClose(c context.Context, auth Auth, input OrgCloseInput) (Step, error)

func TransitionStep

func TransitionStep(c context.Context, auth Auth, input TransitionStepInput) (Step, error)

type SubscriptionEditInput

type SubscriptionEditInput struct {
	OrgIdentifier types.OrgIdentifier `json:"identifier"`
	Plan          string              `json:"plan"`
}

type SubscriptionEditOutput

type SubscriptionEditOutput struct {
	SessionUrl string `json:"url"`
}

func SubscriptionEdit

func SubscriptionEdit(c context.Context, auth Auth, input SubscriptionEditInput) (out SubscriptionEditOutput, err error)

type SubscriptionInfoInput

type SubscriptionInfoInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
}

type SubscriptionPlansInput

type SubscriptionPlansInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
}

type SyncTargetCreateInput

type SyncTargetCreateInput struct {
	OrgIdentifier         types.OrgIdentifier `json:"-"`
	IntegrationIdentifier string              `json:"service_integration_identifier"`
	ConnectionUrl         string              `json:"connection_url"`
	PageSize              int                 `json:"page_size,omitempty"`
	Period                int                 `json:"period_seconds,omitempty"`
	Schema                string              `json:"schema"`
	Table                 string              `json:"table"`
	SyncTypeSlug          string              `json:"-"`
}

type SyncTargetDeleteInput

type SyncTargetDeleteInput struct {
	OpaqueId      string              `json:"-"`
	OrgIdentifier types.OrgIdentifier `json:"-"`
	Confirm       string              `json:"confirm"`
	SyncTypeSlug  string              `json:"-"`
}

type SyncTargetListInput

type SyncTargetListInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
	SyncTypeSlug  string              `json:"-"`
}

type SyncTargetSyncInput

type SyncTargetSyncInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
	OpaqueId      string              `json:"-"`
	SyncTypeSlug  string              `json:"-"`
}

type SyncTargetUpdateCredsInput

type SyncTargetUpdateCredsInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
	OpaqueId      string              `json:"-"`
	Username      string              `json:"user"`
	Password      string              `json:"password"`
	SyncTypeSlug  string              `json:"-"`
}

type SyncTargetUpdateInput

type SyncTargetUpdateInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
	OpaqueId      string              `json:"-"`
	PageSize      int                 `json:"page_size,omitempty"`
	Period        int                 `json:"period_seconds,omitempty"`
	Schema        string              `json:"schema"`
	Table         string              `json:"table"`
	SyncTypeSlug  string              `json:"-"`
}

type TransitionStepInput

type TransitionStepInput struct {
	PostUrl            string
	PostParams         map[string]interface{}
	PostParamsValueKey string
	Value              string
}

type WebhookCreateInput

type WebhookCreateInput struct {
	OrgIdentifier         types.OrgIdentifier `json:"-"`
	WebhookSecret         string              `json:"webhook_secret"`
	Url                   string              `json:"url"`
	IntegrationIdentifier string              `json:"service_integration_identifier"`
}

type WebhookListInput

type WebhookListInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
}

type WebhookOpaqueIdInput

type WebhookOpaqueIdInput struct {
	OrgIdentifier types.OrgIdentifier `json:"-"`
	// this is the opaque id of the *webhook subscription*
	OpaqueId string `json:"-"`
}

Jump to

Keyboard shortcuts

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