Documentation
¶
Index ¶
Constants ¶
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
type DynamicSchema ¶
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 ¶
MarshalJSON serializes only the Value field
func (*Enum) UnmarshalJSON ¶
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