dynamicclient

package
v0.1.55 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ComponentName = "google_api_client"
	RequestPort   = "request"
	ResponsePort  = "response"
	ErrorPort     = "error"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

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

Component implements the Google API client

func (*Component) GetInfo

func (c *Component) GetInfo() module.ComponentInfo

GetInfo returns component metadata

func (*Component) Handle

func (c *Component) Handle(ctx context.Context, handler module.Handler, port string, msg interface{}) any

Handle processes incoming messages on ports

func (*Component) Instance

func (c *Component) Instance() module.Component

Instance creates a new component instance

func (*Component) Ports

func (c *Component) Ports() []module.Port

Ports returns the component's port configuration

type DynamicSchema

type DynamicSchema struct {
	Data map[string]any
	// contains filtered or unexported fields
}

DynamicSchema wraps a dynamically generated schema from Google's discovery format

func (DynamicSchema) JSONSchema

func (d DynamicSchema) JSONSchema() (jsonschema.Schema, error)

JSONSchema returns the pre-computed schema

func (DynamicSchema) MarshalJSON

func (d DynamicSchema) MarshalJSON() ([]byte, error)

MarshalJSON serializes the Data map

func (*DynamicSchema) UnmarshalJSON

func (d *DynamicSchema) UnmarshalJSON(data []byte) error

UnmarshalJSON deserializes to the Data map

type Enum

type Enum struct {
	Value   string
	Options []string
	Labels  []string // Human-readable labels for each option
}

Enum is a special type which carries both current value and available options

func (Enum) JSONSchema

func (r Enum) JSONSchema() (jsonschema.Schema, error)

JSONSchema generates a JSON schema with enum options

func (Enum) MarshalJSON

func (r Enum) MarshalJSON() ([]byte, error)

MarshalJSON serializes only the Value field

func (*Enum) UnmarshalJSON

func (r *Enum) UnmarshalJSON(data []byte) error

UnmarshalJSON deserializes only to the Value field

type Error

type Error struct {
	Context any    `json:"context,omitempty" title:"Context"`
	Error   string `json:"error" title:"Error Message"`
	Code    int    `json:"code,omitempty" title:"Error Code"`
}

Error represents an error output

type MethodName

type MethodName struct {
	Enum
}

MethodName represents a Google API method selection

func (MethodName) JSONSchema

func (m MethodName) JSONSchema() (jsonschema.Schema, error)

func (MethodName) MarshalJSON

func (m MethodName) MarshalJSON() ([]byte, error)

func (*MethodName) UnmarshalJSON

func (m *MethodName) UnmarshalJSON(data []byte) error

type Request

type Request struct {
	Context    any           `json:"context,omitempty" configurable:"true" title:"Context" description:"Arbitrary context to pass through"`
	Token      Token         `json:"token" required:"true" title:"Token" description:"OAuth2 token for authentication"`
	Parameters RequestParams `json:"parameters" configurable:"true" title:"Parameters" description:"Request parameters based on selected API method"`
}

Request represents the input to the component

type RequestParams

type RequestParams struct {
	DynamicSchema
}

RequestParams wraps DynamicSchema for request parameters

type Response

type Response struct {
	Context    any            `json:"context,omitempty" title:"Context"`
	StatusCode int            `json:"statusCode" title:"Status Code"`
	Headers    map[string]any `json:"headers,omitempty" title:"Response Headers"`
	Body       ResponseBody   `json:"body" title:"Response Body" description:"Response data based on selected API method"`
}

Response represents the successful output

type ResponseBody

type ResponseBody struct {
	DynamicSchema
}

ResponseBody wraps DynamicSchema for response body

type SchemaConverter

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

SchemaConverter converts Google Discovery schemas to JSON schemas

func NewSchemaConverter

func NewSchemaConverter(api *googleapismodule.API) *SchemaConverter

NewSchemaConverter creates a new converter for an API

func (*SchemaConverter) BuildRequestSchema

func (c *SchemaConverter) BuildRequestSchema(method googleapismodule.Method) DynamicSchema

BuildRequestSchema creates a DynamicSchema for a method's request

func (*SchemaConverter) BuildResponseSchema

func (c *SchemaConverter) BuildResponseSchema(method googleapismodule.Method) DynamicSchema

BuildResponseSchema creates a DynamicSchema for a method's response

type ServiceName

type ServiceName struct {
	Enum
}

ServiceName represents a Google API service selection

func (ServiceName) JSONSchema

func (s ServiceName) JSONSchema() (jsonschema.Schema, error)

func (ServiceName) MarshalJSON

func (s ServiceName) MarshalJSON() ([]byte, error)

func (*ServiceName) UnmarshalJSON

func (s *ServiceName) UnmarshalJSON(data []byte) error

type Settings

type Settings struct {
	Service         ServiceName `json:"service" title:"Service" description:"Select a Google API service then save settings" tab:"API Selection"`
	Method          MethodName  `json:"method" title:"Method" description:"Select an API method" tab:"API Selection"`
	EnableErrorPort bool        `` /* 148-byte string literal not displayed */
}

Settings holds the component configuration

type Token

type Token struct {
	AccessToken  string    `json:"accessToken" required:"true" title:"Access Token" description:"OAuth2 access token" configurable:"true"`
	TokenType    string    `json:"tokenType,omitempty" title:"Token Type"`
	RefreshToken string    `json:"refreshToken,omitempty" title:"Refresh Token"`
	Expiry       time.Time `json:"expiry,omitempty" title:"Expiry"`
}

Token represents an OAuth2 access token

Jump to

Keyboard shortcuts

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