port

package
v0.0.0-...-825b474 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessTokenResponse

type AccessTokenResponse struct {
	Ok          bool   `json:"ok"`
	AccessToken string `json:"accessToken"`
	ExpiresIn   int64  `json:"expiresIn"`
	TokenType   string `json:"tokenType"`
}

type Action

type Action struct {
	ID               string           `json:"id"`
	Identifier       string           `json:"identifier"`
	Title            string           `json:"title"`
	UserInputs       UserInputs       `json:"userInputs"`
	InvocationMethod InvocationMethod `json:"invocationMethod"`
	Trigger          string           `json:"trigger"`
	Description      string           `json:"description"`
	Blueprint        string           `json:"blueprint"`
	CreatedAt        string           `json:"createdAt"`
	CreatedBy        string           `json:"createdBy"`
	UpdatedAt        string           `json:"updatedAt"`
	UpdatedBy        string           `json:"updatedBy"`
}

type ActionBody

type ActionBody struct {
	Action       string  `json:"action"`
	ResourceType string  `json:"resource_type"`
	Status       string  `json:"status"`
	Trigger      Trigger `json:"trigger"`
	Context      Context `json:"context"`
	Payload      Payload `json:"payload"`
}

type ActionStatus

type ActionStatus = string
const (
	ActionStatusSuccess ActionStatus = "SUCCESS"
	ActionStatusFailure ActionStatus = "FAILURE"
)

type By

type By struct {
	UserID string `json:"userId"`
	OrgID  string `json:"orgId"`
}

type Client

type Client struct {
	Client   *resty.Client
	ClientID string
}

func New

func New(baseURL string, opts ...Option) *Client

func (*Client) Authenticate

func (c *Client) Authenticate(ctx context.Context, clientID, clientSecret string) (string, error)

func (*Client) PatchActionRun

func (c *Client) PatchActionRun(ctx context.Context, runID string, status ActionStatus) error

PatchActionRun updates the status of an action run

type Context

type Context struct {
	Entity    string `json:"entity,omitempty"`
	Blueprint string `json:"blueprint"`
	RunID     string `json:"runId"`
}

type Entity

type Entity struct {
	ID         string         `json:"id,omitempty"`
	Title      string         `json:"title,omitempty"`
	Blueprint  string         `json:"blueprint,omitempty"`
	CreatedAt  time.Time      `json:"createdAt,omitempty"`
	UpdatedAt  time.Time      `json:"updatedAt,omitempty"`
	Properties map[string]any `json:"properties,omitempty"`
	Relations  map[string]any `json:"relations,omitempty"`
	CreatedBy  string         `json:"createdBy,omitempty"`
	UpdatedBy  string         `json:"updatedBy,omitempty"`
}

type InvocationMethod

type InvocationMethod struct {
	Type string `json:"type"`
	URL  string `json:"url"`
}

type Option

type Option func(*Client)

func WithClientID

func WithClientID(clientID string) Option

func WithHeader

func WithHeader(key, val string) Option

func WithToken

func WithToken(token string) Option

type Payload

type Payload struct {
	Entity     Entity         `json:"entity,omitempty"`
	Action     Action         `json:"action,omitempty"`
	Properties map[string]any `json:"properties,omitempty"`
}

type Trigger

type Trigger struct {
	By     By        `json:"by"`
	At     time.Time `json:"at"`
	Origin string    `json:"origin"`
}

type UserInputs

type UserInputs struct {
	Properties map[string]any `json:"properties"`
	Required   []string       `json:"required"`
}

Jump to

Keyboard shortcuts

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