client

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int
	Message    string
}

APIError is returned when the server responds with a non-2xx status code.

func (*APIError) Error

func (e *APIError) Error() string

type ActivationSummary added in v0.7.0

type ActivationSummary struct {
	TotalCount    int            `json:"total_count"`
	UniqueDevs    int            `json:"unique_devs"`
	LastTriggered *time.Time     `json:"last_triggered"`
	ByAgent       map[string]int `json:"by_agent"`
}

ActivationSummary holds the activation analytics for a single skill.

type Client

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

Client communicates with the skael platform API. Every request includes the X-API-Key header for authentication.

func New

func New(endpoint, apiKey string) *Client

New creates a Client with a 30-second HTTP timeout.

func (*Client) CreateSkill

func (c *Client) CreateSkill(name, description string) (*Skill, error)

CreateSkill calls POST /api/skills to create a new skill record.

func (*Client) DownloadVersion

func (c *Client) DownloadVersion(name string, version int) ([]byte, error)

DownloadVersion calls GET /api/skills/{name}/versions/{v}/download and returns the raw archive bytes.

func (*Client) GetActivations added in v0.7.0

func (c *Client) GetActivations(name string) (*ActivationSummary, error)

GetActivations calls GET /api/skills/{name}/activations and returns the activation summary for the given skill. Returns a zero-value summary when the server responds with 404.

func (*Client) GetManifest

func (c *Client) GetManifest() ([]ManifestEntry, error)

GetManifest calls GET /api/sync/manifest and returns the list of manifest entries used for client-side sync diffing.

func (*Client) GetSkill

func (c *Client) GetSkill(name string) (*Skill, error)

GetSkill calls GET /api/skills/{name}. It returns (nil, nil) when the server responds with 404.

func (*Client) Health

func (c *Client) Health() error

Health calls GET /api/health and returns an error if the server is not reachable or returns a non-ok status.

func (*Client) ImportResolve

func (c *Client) ImportResolve(url string) (*ResolveResponse, error)

func (*Client) ImportSkills

func (c *Client) ImportSkills(source ImportSource, skillNames []string, namespace string) (*ImportResponse, error)

func (*Client) ImportSources

func (c *Client) ImportSources() ([]ImportSourceEntry, error)

func (*Client) ImportUpload

func (c *Client) ImportUpload(archive []byte) (*ResolveResponse, error)

func (*Client) ListSkills

func (c *Client) ListSkills(limit, offset int) ([]Skill, int, error)

ListSkills calls GET /api/skills?limit=&offset= and returns the slice of skills together with the total count reported by the server.

func (*Client) ListVersions added in v0.7.0

func (c *Client) ListVersions(name string) ([]Version, error)

ListVersions calls GET /api/skills/{name}/versions and returns all versions for the skill in ascending order.

func (*Client) PublishVersion

func (c *Client) PublishVersion(name string, archive []byte) (*Version, json.RawMessage, error)

PublishVersion uploads archive (a gzip-compressed tar) to POST /api/skills/{name}/versions.

On success it returns the new Version record. On 422 (critical security scan) it returns (nil, scanBody, err) where scanBody is the raw JSON scan report embedded in the error response.

func (*Client) SearchSkills

func (c *Client) SearchSkills(query string, limit int) ([]Skill, error)

SearchSkills calls GET /api/search?q=&limit= and returns the matching skills.

type DiscoveredSkill

type DiscoveredSkill struct {
	Name              string      `json:"name"`
	Description       string      `json:"description"`
	Path              string      `json:"path"`
	Files             []FileEntry `json:"files"`
	ScanStatus        string      `json:"scan_status"`
	ScanFindingsCount int         `json:"scan_findings_count"`
	ExistingVersion   int         `json:"existing_version"`
}

type FailedSkill

type FailedSkill struct {
	Name  string `json:"name"`
	Error string `json:"error"`
}

type FileEntry

type FileEntry struct {
	Path string `json:"path"`
	Size int64  `json:"size"`
}

type ImportResponse

type ImportResponse struct {
	Imported []ImportedSkill `json:"imported"`
	Failed   []FailedSkill   `json:"failed"`
}

type ImportSource

type ImportSource struct {
	Type      string `json:"type"`
	Owner     string `json:"owner"`
	Repo      string `json:"repo"`
	Ref       string `json:"ref"`
	Path      string `json:"path"`
	CommitSHA string `json:"commit_sha"`
}

type ImportSourceEntry

type ImportSourceEntry struct {
	SkillName  string `json:"skill_name"`
	SourceType string `json:"source_type"`
	SourceURL  string `json:"source_url"`
	SourcePath string `json:"source_path"`
	SourceRef  string `json:"source_ref"`
	CommitSHA  string `json:"commit_sha"`
	ImportedAt string `json:"imported_at"`
}

type ImportedSkill

type ImportedSkill struct {
	Name       string `json:"name"`
	Version    int    `json:"version"`
	ScanStatus string `json:"scan_status"`
	Created    bool   `json:"created"`
}

type ManifestEntry

type ManifestEntry struct {
	Name     string `json:"name"`
	Version  int    `json:"version"`
	Checksum string `json:"checksum"`
}

ManifestEntry holds the sync metadata for a single skill.

type ResolveResponse

type ResolveResponse struct {
	Source     ImportSource      `json:"source"`
	Skills     []DiscoveredSkill `json:"skills"`
	PluginName string            `json:"plugin_name,omitempty"`
}

type Skill

type Skill struct {
	Name           string          `json:"name"`
	DisplayName    string          `json:"display_name,omitempty"`
	Description    string          `json:"description"`
	LatestVersion  int             `json:"latest_version"`
	Author         string          `json:"author"`
	License        string          `json:"license"`
	Compatibility  string          `json:"compatibility"`
	Tags           []string        `json:"tags"`
	SpecCompliance string          `json:"spec_compliance"`
	CreatedAt      time.Time       `json:"created_at"`
	UpdatedAt      time.Time       `json:"updated_at"`
	Frontmatter    json.RawMessage `json:"frontmatter"`
}

Skill is the client-side representation of a skill returned by the API.

type Version

type Version struct {
	Version    int             `json:"version"`
	Checksum   string          `json:"checksum"`
	Changelog  string          `json:"changelog"`
	ScanResult json.RawMessage `json:"scan_result,omitempty"`
	CreatedAt  time.Time       `json:"created_at"`
	Created    bool            `json:"created"`
}

Version is the client-side representation of a published skill version.

Jump to

Keyboard shortcuts

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