Documentation
¶
Index ¶
- Constants
- type APIError
- type Client
- func (c *Client) BaseURL() string
- func (c *Client) ClearOrganizationID()
- func (c *Client) CreateConnection(projectID uint64, req CreateConnectionRequest) (*Connection, error)
- func (c *Client) CreateDestination(projectID uint64, req CreateDestinationRequest) (*Destination, error)
- func (c *Client) CreateOrganization(req CreateOrganizationRequest) (*Organization, error)
- func (c *Client) CreateProject(req CreateProjectRequest) (*Project, error)
- func (c *Client) CreateSource(projectID uint64, req CreateSourceRequest) (*Source, error)
- func (c *Client) DeleteConnection(connectionID uint64) error
- func (c *Client) DeleteDestination(destinationID uint64) error
- func (c *Client) DeleteProject(projectID uint64) error
- func (c *Client) DeleteSource(sourceID uint64) error
- func (c *Client) GetConnection(connectionID uint64) (*Connection, error)
- func (c *Client) GetConnections(projectID uint64) ([]Connection, error)
- func (c *Client) GetDestination(destinationID uint64) (*Destination, error)
- func (c *Client) GetEvent(requestID uint64) (*Event, error)
- func (c *Client) GetOrganization(organizationID *uint64) (*Organization, error)
- func (c *Client) GetSource(sourceID uint64) (*Source, error)
- func (c *Client) ListDeliveryAttempts(projectID uint64, opts *ListDeliveryAttemptsOptions) (*ListDeliveryAttemptsResponse, error)
- func (c *Client) ListDestinations(projectID uint64) ([]Destination, error)
- func (c *Client) ListEvents(projectID uint64, opts *ListEventsOptions) (*ListEventsResponse, error)
- func (c *Client) ListOrganizations() ([]Organization, error)
- func (c *Client) ListProjects() ([]Project, error)
- func (c *Client) ListSources(projectID uint64) ([]Source, error)
- func (c *Client) OrganizationID() *uint64
- func (c *Client) ReplayEvent(req ReplayEventRequest) (*ReplayEventResponse, error)
- func (c *Client) SendWebhook(sourceID string, payload interface{}) (string, error)
- func (c *Client) SetOrganizationID(orgID uint64)
- func (c *Client) UpdateConnection(connectionID uint64, req UpdateConnectionRequest) (*Connection, error)
- func (c *Client) UpdateDestination(destinationID uint64, req UpdateDestinationRequest) (*Destination, error)
- func (c *Client) UpdateProject(projectID uint64, req UpdateProjectRequest) (*Project, error)
- func (c *Client) UpdateSource(sourceID uint64, req UpdateSourceRequest) (*Source, error)
- type ClientOption
- type Connection
- type CreateConnectionRequest
- type CreateDestinationRequest
- type CreateOrganizationRequest
- type CreateProjectRequest
- type CreateSourceRequest
- type DeliveryAttempt
- type Destination
- type Event
- type ListDeliveryAttemptsOptions
- type ListDeliveryAttemptsResponse
- type ListEventsOptions
- type ListEventsResponse
- type Organization
- type PaginatedResponse
- type Project
- type ReplayEventRequest
- type ReplayEventResponse
- type Source
- type UpdateConnectionRequest
- type UpdateDestinationRequest
- type UpdateProjectRequest
- type UpdateSourceRequest
Constants ¶
const ( // DefaultBaseURL is the default Volley API base URL DefaultBaseURL = "https://api.volleyhooks.com" // DefaultTimeout is the default HTTP client timeout DefaultTimeout = 30 * time.Second )
const Version = "1.0.1"
Version is the current version of the Volley Go SDK
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct {
ErrorMsg string `json:"error"`
Message string `json:"message,omitempty"`
Status int `json:"-"`
}
APIError represents an API error response
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the main Volley API client
func NewClient ¶
func NewClient(apiToken string, opts ...ClientOption) *Client
NewClient creates a new Volley API client
func (*Client) ClearOrganizationID ¶
func (c *Client) ClearOrganizationID()
ClearOrganizationID clears the organization ID
func (*Client) CreateConnection ¶
func (c *Client) CreateConnection(projectID uint64, req CreateConnectionRequest) (*Connection, error)
CreateConnection creates a connection between a source and destination
func (*Client) CreateDestination ¶
func (c *Client) CreateDestination(projectID uint64, req CreateDestinationRequest) (*Destination, error)
CreateDestination creates a new destination
func (*Client) CreateOrganization ¶
func (c *Client) CreateOrganization(req CreateOrganizationRequest) (*Organization, error)
CreateOrganization creates a new organization
func (*Client) CreateProject ¶
func (c *Client) CreateProject(req CreateProjectRequest) (*Project, error)
CreateProject creates a new project
func (*Client) CreateSource ¶
func (c *Client) CreateSource(projectID uint64, req CreateSourceRequest) (*Source, error)
CreateSource creates a new source
func (*Client) DeleteConnection ¶
DeleteConnection deletes a connection
func (*Client) DeleteDestination ¶
DeleteDestination deletes a destination
func (*Client) DeleteProject ¶
DeleteProject deletes a project
func (*Client) DeleteSource ¶
DeleteSource deletes a source
func (*Client) GetConnection ¶
func (c *Client) GetConnection(connectionID uint64) (*Connection, error)
GetConnection gets details and metrics for a connection
func (*Client) GetConnections ¶
func (c *Client) GetConnections(projectID uint64) ([]Connection, error)
GetConnections lists all connections in a project
func (*Client) GetDestination ¶
func (c *Client) GetDestination(destinationID uint64) (*Destination, error)
GetDestination gets details of a specific destination
func (*Client) GetEvent ¶
GetEvent gets detailed information about a specific event by its database ID
func (*Client) GetOrganization ¶
func (c *Client) GetOrganization(organizationID *uint64) (*Organization, error)
GetOrganization gets the current organization If organizationID is provided, it will be used; otherwise, the first accessible organization is returned
func (*Client) ListDeliveryAttempts ¶
func (c *Client) ListDeliveryAttempts(projectID uint64, opts *ListDeliveryAttemptsOptions) (*ListDeliveryAttemptsResponse, error)
ListDeliveryAttempts lists all delivery attempts for a project with optional filters
func (*Client) ListDestinations ¶
func (c *Client) ListDestinations(projectID uint64) ([]Destination, error)
ListDestinations lists all destinations in a project
func (*Client) ListEvents ¶
func (c *Client) ListEvents(projectID uint64, opts *ListEventsOptions) (*ListEventsResponse, error)
ListEvents lists all events/requests for a project with optional filters
func (*Client) ListOrganizations ¶
func (c *Client) ListOrganizations() ([]Organization, error)
ListOrganizations lists all organizations the user has access to
func (*Client) ListProjects ¶
ListProjects lists all projects in the current organization
func (*Client) ListSources ¶
ListSources lists all sources in a project
func (*Client) OrganizationID ¶
OrganizationID returns the organization ID (for testing)
func (*Client) ReplayEvent ¶
func (c *Client) ReplayEvent(req ReplayEventRequest) (*ReplayEventResponse, error)
ReplayEvent replays a failed event by its event_id
func (*Client) SendWebhook ¶
SendWebhook sends a webhook to a source The sourceID is the ingestion ID provided when you create a source
func (*Client) SetOrganizationID ¶
SetOrganizationID sets the organization ID for subsequent requests
func (*Client) UpdateConnection ¶
func (c *Client) UpdateConnection(connectionID uint64, req UpdateConnectionRequest) (*Connection, error)
UpdateConnection updates a connection
func (*Client) UpdateDestination ¶
func (c *Client) UpdateDestination(destinationID uint64, req UpdateDestinationRequest) (*Destination, error)
UpdateDestination updates a destination
func (*Client) UpdateProject ¶
func (c *Client) UpdateProject(projectID uint64, req UpdateProjectRequest) (*Project, error)
UpdateProject updates a project's name
func (*Client) UpdateSource ¶
func (c *Client) UpdateSource(sourceID uint64, req UpdateSourceRequest) (*Source, error)
UpdateSource updates a source
type ClientOption ¶
type ClientOption func(*Client)
ClientOption is a function that configures a Client
func WithBaseURL ¶
func WithBaseURL(baseURL string) ClientOption
WithBaseURL sets a custom base URL for the client
func WithHTTPClient ¶
func WithHTTPClient(httpClient *http.Client) ClientOption
WithHTTPClient sets a custom HTTP client
func WithOrganizationID ¶
func WithOrganizationID(orgID uint64) ClientOption
WithOrganizationID sets the organization ID for all requests
type Connection ¶
type Connection struct {
ID uint64 `json:"id"`
SourceID uint64 `json:"source_id"`
DestinationID uint64 `json:"destination_id"`
Status string `json:"status"`
EPS int `json:"eps"`
MaxRetries int `json:"max_retries"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Connection represents a connection between a source and destination
type CreateConnectionRequest ¶
type CreateConnectionRequest struct {
SourceID uint64 `json:"source_id"`
DestinationID uint64 `json:"destination_id"`
Status string `json:"status"` // "enabled" or "disabled"
EPS int `json:"eps"`
MaxRetries int `json:"max_retries"`
}
CreateConnectionRequest represents the request to create a connection
type CreateDestinationRequest ¶
type CreateDestinationRequest struct {
Name string `json:"name"`
URL string `json:"url"`
EPS int `json:"eps"`
}
CreateDestinationRequest represents the request to create a destination
type CreateOrganizationRequest ¶
type CreateOrganizationRequest struct {
Name string `json:"name"`
}
CreateOrganizationRequest represents the request to create an organization
type CreateProjectRequest ¶
type CreateProjectRequest struct {
Name string `json:"name"`
IsDefault bool `json:"is_default,omitempty"`
}
CreateProjectRequest represents the request to create a project
type CreateSourceRequest ¶
type CreateSourceRequest struct {
Name string `json:"name"`
EPS int `json:"eps"`
AuthType string `json:"auth_type"` // "none", "basic", "api_key"
}
CreateSourceRequest represents the request to create a source
type DeliveryAttempt ¶
type DeliveryAttempt struct {
ID uint64 `json:"id"`
EventID string `json:"event_id"`
ConnectionID uint64 `json:"connection_id"`
Status string `json:"status"`
StatusCode int `json:"status_code"`
ErrorReason string `json:"error_reason,omitempty"`
DurationMs int64 `json:"duration_ms"`
CreatedAt time.Time `json:"created_at"`
}
DeliveryAttempt represents a delivery attempt for an event
type Destination ¶
type Destination struct {
ID uint64 `json:"id"`
Name string `json:"name"`
URL string `json:"url"`
EPS int `json:"eps"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Destination represents a webhook destination
type Event ¶
type Event struct {
ID uint64 `json:"id"`
EventID string `json:"event_id"`
SourceID uint64 `json:"source_id"`
ProjectID uint64 `json:"project_id"`
RawBody string `json:"raw_body"`
Headers map[string]interface{} `json:"headers"`
Status string `json:"status"`
DeliveryAttempts []DeliveryAttempt `json:"delivery_attempts,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
Event represents a webhook event/request
type ListDeliveryAttemptsOptions ¶
type ListDeliveryAttemptsOptions struct {
EventID string
SourceID *uint64
DestinationID *uint64
ConnectionID *uint64
Status string // "success" or "failed"
StartTime *time.Time
EndTime *time.Time
Sort string // "time", "time_oldest", "duration", "status_code"
Limit *int
Offset *int
}
ListDeliveryAttemptsOptions represents options for listing delivery attempts
type ListDeliveryAttemptsResponse ¶
type ListDeliveryAttemptsResponse struct {
PaginatedResponse
Attempts []DeliveryAttempt `json:"attempts"`
}
ListDeliveryAttemptsResponse represents the response from listing delivery attempts
type ListEventsOptions ¶
type ListEventsOptions struct {
SourceID *uint64
ConnectionID *uint64
DestinationID *uint64
Status string // "processed", "pending", "failed", "dropped"
StartTime *time.Time
EndTime *time.Time
Search string
Limit *int
Offset *int
}
ListEventsOptions represents options for listing events
type ListEventsResponse ¶
type ListEventsResponse struct {
PaginatedResponse
Requests []Event `json:"requests"`
}
ListEventsResponse represents the response from listing events
type Organization ¶
type Organization struct {
ID uint64 `json:"id"`
Name string `json:"name"`
Slug string `json:"slug"`
AccountID uint64 `json:"account_id"`
Role string `json:"role"`
CreatedAt time.Time `json:"created_at"`
}
Organization represents a Volley organization
type PaginatedResponse ¶
type PaginatedResponse struct {
Total int64 `json:"total"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
PaginatedResponse represents a paginated API response
type Project ¶
type Project struct {
ID uint64 `json:"id"`
Name string `json:"name"`
OrganizationID uint64 `json:"organization_id"`
IsDefault bool `json:"is_default"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Project represents a Volley project
type ReplayEventRequest ¶
type ReplayEventRequest struct {
EventID string `json:"event_id"`
DestinationID *uint64 `json:"destination_id,omitempty"`
ConnectionID *uint64 `json:"connection_id,omitempty"`
}
ReplayEventRequest represents the request to replay an event
type ReplayEventResponse ¶
type ReplayEventResponse struct {
Success bool `json:"success"`
Status string `json:"status"`
StatusCode int `json:"status_code"`
ErrorReason string `json:"error_reason,omitempty"`
DurationMs int64 `json:"duration_ms"`
AttemptID uint64 `json:"attempt_id"`
}
ReplayEventResponse represents the response from replaying an event
type Source ¶
type Source struct {
ID uint64 `json:"id"`
Slug string `json:"slug"`
IngestionID string `json:"ingestion_id"`
Type string `json:"type"`
EPS int `json:"eps"`
Status string `json:"status"`
ConnectionCount int64 `json:"connection_count"`
AuthType string `json:"auth_type"`
VerifySignature bool `json:"verify_signature"`
WebhookSecretSet bool `json:"webhook_secret_set"`
AuthUsername string `json:"auth_username,omitempty"`
AuthKeyName string `json:"auth_key_name,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Source represents a webhook source
type UpdateConnectionRequest ¶
type UpdateConnectionRequest struct {
Status string `json:"status,omitempty"` // "enabled" or "disabled"
EPS *int `json:"eps,omitempty"`
MaxRetries *int `json:"max_retries,omitempty"`
}
UpdateConnectionRequest represents the request to update a connection
type UpdateDestinationRequest ¶
type UpdateDestinationRequest struct {
Name string `json:"name,omitempty"`
URL string `json:"url,omitempty"`
EPS *int `json:"eps,omitempty"`
Status string `json:"status,omitempty"`
}
UpdateDestinationRequest represents the request to update a destination
type UpdateProjectRequest ¶
type UpdateProjectRequest struct {
Name string `json:"name"`
}
UpdateProjectRequest represents the request to update a project