clients

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns true if the error indicates the resource was not found

func NewProviderConfigUsageTracker

func NewProviderConfigUsageTracker(kube client.Client) resource.Tracker

NewProviderConfigUsageTracker creates a ProviderConfigUsage tracker that works with fake clients

Types

type Client

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

Client is a Plausible API client

func NewClient

func NewClient(cfg Config) *Client

NewClient creates a new Plausible API client

func (*Client) CreateCustomProperty added in v0.2.0

func (c *Client) CreateCustomProperty(req CreateCustomPropertyRequest) (*CustomProperty, error)

CreateCustomProperty creates a custom property

func (*Client) CreateGoal

func (c *Client) CreateGoal(siteDomain string, req CreateGoalRequest) (*Goal, error)

CreateGoal creates a new goal

func (*Client) CreateGuest added in v0.2.0

func (c *Client) CreateGuest(req CreateGuestRequest) (*Guest, error)

CreateGuest invites a guest to a site

func (c *Client) CreateSharedLink(req CreateSharedLinkRequest) (*SharedLink, error)

CreateSharedLink creates or finds a shared link

func (*Client) CreateSite

func (c *Client) CreateSite(req CreateSiteRequest) (*Site, error)

CreateSite creates a new site

func (*Client) DeleteCustomProperty added in v0.2.0

func (c *Client) DeleteCustomProperty(siteDomain, key string) error

DeleteCustomProperty deletes a custom property

func (*Client) DeleteGoal

func (c *Client) DeleteGoal(goalID string) error

DeleteGoal deletes a goal

func (*Client) DeleteGuest added in v0.2.0

func (c *Client) DeleteGuest(siteDomain, email string) error

DeleteGuest removes a guest from a site

func (c *Client) DeleteSharedLink(siteDomain, name string) error

DeleteSharedLink deletes a shared link

func (*Client) DeleteSite

func (c *Client) DeleteSite(siteID string) error

DeleteSite deletes a site

func (*Client) GetCustomProperty added in v0.2.0

func (c *Client) GetCustomProperty(siteDomain, key string) (*CustomProperty, error)

GetCustomProperty retrieves a custom property by key

func (*Client) GetGoal

func (c *Client) GetGoal(siteDomain string, goalID string) (*Goal, error)

GetGoal retrieves a specific goal

func (*Client) GetGuest added in v0.2.0

func (c *Client) GetGuest(siteDomain, email string) (*Guest, error)

GetGuest retrieves a guest by email

func (c *Client) GetSharedLink(siteDomain, name string) (*SharedLink, error)

GetSharedLink retrieves a shared link by name

func (*Client) GetSite

func (c *Client) GetSite(siteID string) (*Site, error)

GetSite retrieves a site by ID

func (*Client) GetSiteByDomain

func (c *Client) GetSiteByDomain(domain string) (*Site, error)

GetSiteByDomain retrieves a site by domain

func (*Client) ListCustomProperties added in v0.2.0

func (c *Client) ListCustomProperties(siteDomain string) ([]CustomProperty, error)

ListCustomProperties retrieves all custom properties for a site

func (*Client) ListGoals

func (c *Client) ListGoals(siteDomain string) ([]Goal, error)

ListGoals retrieves all goals for a site

func (*Client) ListGuests added in v0.2.0

func (c *Client) ListGuests(siteDomain string) ([]Guest, error)

ListGuests retrieves all guests for a site

func (c *Client) ListSharedLinks(siteDomain string) ([]SharedLink, error)

ListSharedLinks retrieves all shared links for a site

func (*Client) ListSites

func (c *Client) ListSites() ([]Site, error)

ListSites retrieves all sites

func (*Client) ListTeams added in v0.2.0

func (c *Client) ListTeams() ([]Team, error)

ListTeams retrieves all teams accessible to the account

func (*Client) UpdateSite

func (c *Client) UpdateSite(siteID string, newDomain string) (*Site, error)

UpdateSite updates an existing site's domain

type Config

type Config struct {
	BaseURL string
	APIKey  string
}

Config holds the configuration for the Plausible API client

func GetConfig

func GetConfig(ctx context.Context, c client.Client, mg resource.Managed) (*Config, error)

GetConfig extracts the Plausible client configuration from a ProviderConfig

type CreateCustomPropertyRequest added in v0.2.0

type CreateCustomPropertyRequest struct {
	SiteDomain  string `json:"site_id"`
	Key         string `json:"key"`
	Description string `json:"description,omitempty"`
}

CreateCustomPropertyRequest represents a request to create a custom property

type CreateGoalRequest

type CreateGoalRequest struct {
	GoalType  string `json:"goal_type"`
	EventName string `json:"event_name,omitempty"`
	PagePath  string `json:"page_path,omitempty"`
}

CreateGoalRequest represents a request to create a goal

type CreateGuestRequest added in v0.2.0

type CreateGuestRequest struct {
	SiteDomain string `json:"site_id"`
	Email      string `json:"email"`
	Role       string `json:"role"`
}

CreateGuestRequest represents a request to invite a guest

type CreateSharedLinkRequest added in v0.2.0

type CreateSharedLinkRequest struct {
	SiteDomain string `json:"site_id"`
	Name       string `json:"name"`
	Password   string `json:"password,omitempty"`
}

CreateSharedLinkRequest represents a request to create a shared link

type CreateSiteRequest

type CreateSiteRequest struct {
	Domain   string `json:"domain"`
	TeamID   string `json:"team_id,omitempty"`
	Timezone string `json:"timezone,omitempty"`
}

CreateSiteRequest represents a request to create a site

type Credentials

type Credentials struct {
	APIKey string `json:"apiKey"`
}

Credentials holds the API key for Plausible

type CustomProperty added in v0.2.0

type CustomProperty struct {
	Key         string `json:"key"`
	Description string `json:"description,omitempty"`
	IsEnabled   bool   `json:"is_enabled"`
}

CustomProperty represents a Plausible custom property

type Goal

type Goal struct {
	ID        string `json:"id"`
	GoalType  string `json:"goal_type"`
	EventName string `json:"event_name,omitempty"`
	PagePath  string `json:"page_path,omitempty"`
}

Goal represents a Plausible goal

type Guest added in v0.2.0

type Guest struct {
	Email      string `json:"email"`
	Role       string `json:"role"`
	Status     string `json:"status"`
	InvitedAt  string `json:"invited_at,omitempty"`
	AcceptedAt string `json:"accepted_at,omitempty"`
}

Guest represents a Plausible site guest

type ListCustomPropertiesResponse added in v0.2.0

type ListCustomPropertiesResponse struct {
	CustomProperties []CustomProperty `json:"custom_properties"`
	Meta             struct {
		After  string `json:"after,omitempty"`
		Before string `json:"before,omitempty"`
		Limit  int    `json:"limit"`
	} `json:"meta"`
}

ListCustomPropertiesResponse represents the response from listing custom properties

type ListGoalsResponse

type ListGoalsResponse struct {
	Goals []Goal `json:"goals"`
	Meta  struct {
		After  string `json:"after,omitempty"`
		Before string `json:"before,omitempty"`
		Limit  int    `json:"limit"`
	} `json:"meta"`
}

ListGoalsResponse represents the response from listing goals

type ListGuestsResponse added in v0.2.0

type ListGuestsResponse struct {
	Guests []Guest `json:"guests"`
	Meta   struct {
		After  string `json:"after,omitempty"`
		Before string `json:"before,omitempty"`
		Limit  int    `json:"limit"`
	} `json:"meta"`
}

ListGuestsResponse represents the response from listing guests

type ListSharedLinksResponse added in v0.2.0

type ListSharedLinksResponse struct {
	SharedLinks []SharedLink `json:"shared_links"`
	Meta        struct {
		After  string `json:"after,omitempty"`
		Before string `json:"before,omitempty"`
		Limit  int    `json:"limit"`
	} `json:"meta"`
}

ListSharedLinksResponse represents the response from listing shared links

type ListSitesResponse

type ListSitesResponse struct {
	Sites []Site `json:"sites"`
	Meta  struct {
		After  string `json:"after,omitempty"`
		Before string `json:"before,omitempty"`
		Limit  int    `json:"limit"`
	} `json:"meta"`
}

ListSitesResponse represents the response from listing sites

type ListTeamsResponse added in v0.2.0

type ListTeamsResponse struct {
	Teams []Team `json:"teams"`
	Meta  struct {
		After  string `json:"after,omitempty"`
		Before string `json:"before,omitempty"`
		Limit  int    `json:"limit"`
	} `json:"meta"`
}

ListTeamsResponse represents the response from listing teams

type SharedLink struct {
	Name        string `json:"name"`
	URL         string `json:"url"`
	HasPassword bool   `json:"has_password"`
}

SharedLink represents a Plausible shared link

type Site

type Site struct {
	ID       string `json:"id"`
	Domain   string `json:"domain"`
	TeamID   string `json:"team_id,omitempty"`
	Timezone string `json:"timezone,omitempty"`
}

Site represents a Plausible site

type Team added in v0.2.0

type Team struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	APIEnabled bool   `json:"api_enabled"`
}

Team represents a Plausible team

type UpdateSiteRequest

type UpdateSiteRequest struct {
	Domain string `json:"domain"`
}

UpdateSiteRequest represents a request to update a site

Jump to

Keyboard shortcuts

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