api

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchOperation added in v0.0.4

type BatchOperation struct {
	Op      string      `json:"op"`
	Path    string      `json:"path"`
	Content string      `json:"content,omitempty"`
	Edits   []PatchEdit `json:"edits,omitempty"`
	OldPath string      `json:"oldPath,omitempty"`
	NewPath string      `json:"newPath,omitempty"`
}

type BatchRequest added in v0.0.4

type BatchRequest struct {
	Operations []BatchOperation `json:"operations"`
}

type BatchResponse added in v0.0.4

type BatchResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Results []BatchResult `json:"results"`
	} `json:"data"`
}

type BatchResult added in v0.0.4

type BatchResult struct {
	Op           string `json:"op"`
	Path         string `json:"path"`
	Sha256       string `json:"sha256,omitempty"`
	Replacements []int  `json:"replacements,omitempty"`
}

type CategoriesData

type CategoriesData struct {
	CurrentPage    int        `json:"currentPage"`
	Total          int        `json:"total"`
	CategoriesList []Category `json:"categoriesList"`
}

type CategoriesResponse

type CategoriesResponse struct {
	Code    int            `json:"code"`
	Message string         `json:"message"`
	Data    CategoriesData `json:"data"`
}

type Category

type Category struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Icon        string `json:"icon"`
	Sort        int    `json:"sort"`
}

type Client

type Client struct {
	BaseURL    string
	Token      string
	HTTPClient *http.Client
}

func NewClient

func NewClient(baseURL, token string) *Client

func (*Client) BatchFiles added in v0.0.4

func (c *Client) BatchFiles(skillID int, req *BatchRequest) (*BatchResponse, error)

BatchFiles 批量文件操作

func (*Client) CreateSkill added in v0.0.4

func (c *Client) CreateSkill(req *CreateSkillRequest) (*CreateSkillResponse, error)

CreateSkill 创建技能(支持初始文件)

func (*Client) DeleteFile added in v0.0.4

func (c *Client) DeleteFile(skillID int, path string) error

DeleteFile 删除单个技能文件

func (*Client) DownloadSkill

func (c *Client) DownloadSkill(id int, outputPath string) (string, error)

func (*Client) GetFile added in v0.0.4

func (c *Client) GetFile(skillID int, path string) (*FileContentResponse, error)

GetFile 读取单个技能文件

func (*Client) GetPackageDetail

func (c *Client) GetPackageDetail(id int) (*PackageDetailResponse, error)

func (*Client) GetSkillDetail

func (c *Client) GetSkillDetail(id int) (*DetailResponse, error)

func (*Client) GetSkillFiles

func (c *Client) GetSkillFiles(id int) (*FilesResponse, error)

func (*Client) HealthCheck

func (c *Client) HealthCheck() (*HealthResponse, error)

func (*Client) ImportZip

func (c *Client) ImportZip(zipPath, description string, categoryID int, overwrite bool) (*ImportZipResponse, error)

func (*Client) ListCategories

func (c *Client) ListCategories() ([]Category, error)

func (*Client) ListPackages

func (c *Client) ListPackages(pageNum, pageSize int, keyword string) (*PackageListResponse, error)

func (*Client) ListSkills

func (c *Client) ListSkills(pageNum, pageSize, categoryID int, keyword string) (*ListResponse, error)

func (*Client) Login

func (c *Client) Login(token string) (*LoginResponse, error)

func (*Client) PatchFile added in v0.0.4

func (c *Client) PatchFile(skillID int, req *PatchFileRequest) (*PatchFileResponse, error)

PatchFile 增量编辑技能文件

func (*Client) Publish added in v0.0.4

func (c *Client) Publish(skillID int, req *PublishRequest) (*PublishResponse, error)

Publish 发布技能

func (*Client) PutFile added in v0.0.4

func (c *Client) PutFile(skillID int, req *PutFileRequest) (*PutFileResponse, error)

PutFile 创建或更新单个技能文件

func (*Client) Unpublish added in v0.0.4

func (c *Client) Unpublish(skillID int) error

Unpublish 取消发布技能

func (*Client) UpdateSkill added in v0.0.4

func (c *Client) UpdateSkill(req *UpdateSkillRequest) error

UpdateSkill 更新技能元数据

func (*Client) Validate added in v0.0.4

func (c *Client) Validate(skillID int, strict bool) (*ValidateResponse, error)

Validate 校验技能文件

type CreateSkillRequest added in v0.0.4

type CreateSkillRequest struct {
	Name        string     `json:"name"`
	Description string     `json:"description,omitempty"`
	CategoryId  int        `json:"categoryId,omitempty"`
	Tags        []string   `json:"tags,omitempty"`
	Files       []FileNode `json:"files,omitempty"`
}

type CreateSkillResponse added in v0.0.4

type CreateSkillResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		SkillId int `json:"skillId"`
	} `json:"data"`
}

type DetailResponse

type DetailResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    Skill  `json:"data"`
}

type FileContent added in v0.0.4

type FileContent struct {
	Path      string `json:"path"`
	Content   string `json:"content"`
	Size      int64  `json:"size"`
	Sha256    string `json:"sha256"`
	UpdatedAt string `json:"updatedAt"`
}

单文件操作相关类型

type FileContentResponse added in v0.0.4

type FileContentResponse struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    FileContent `json:"data"`
}

type FileNode

type FileNode struct {
	ID       string     `json:"id"`
	Name     string     `json:"name"`
	Path     string     `json:"path"`
	Type     string     `json:"type"`
	Content  string     `json:"content,omitempty"`
	Size     int64      `json:"size,omitempty"`
	Sha256   string     `json:"sha256,omitempty"`
	Children []FileNode `json:"children,omitempty"`
}

type FilesData

type FilesData struct {
	Files []FileNode `json:"files"`
}

type FilesResponse

type FilesResponse struct {
	Code    int       `json:"code"`
	Message string    `json:"message"`
	Data    FilesData `json:"data"`
}

type HealthResponse

type HealthResponse struct {
	Status string `json:"status"`
}

type ImportZipResponse

type ImportZipResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		SkillID int    `json:"skillId"`
		Name    string `json:"name"`
	} `json:"data"`
}

type ListData

type ListData struct {
	CurrentPage int     `json:"currentPage"`
	Total       int     `json:"total"`
	List        []Skill `json:"skillsList"`
}

type ListResponse

type ListResponse struct {
	Code    int      `json:"code"`
	Message string   `json:"message"`
	Data    ListData `json:"data"`
}

type LoginResponse

type LoginResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Token string `json:"token"`
	} `json:"data"`
}

type PackageActionResponse

type PackageActionResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type PackageDetailResponse

type PackageDetailResponse struct {
	Code    int          `json:"code"`
	Message string       `json:"message"`
	Data    SkillPackage `json:"data"`
}

type PackageListResponse

type PackageListResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		CurrentPage int            `json:"currentPage"`
		Total       int            `json:"total"`
		List        []SkillPackage `json:"packagesList"`
	} `json:"data"`
}

type PatchEdit added in v0.0.4

type PatchEdit struct {
	OldString  string `json:"old_string,omitempty"`
	NewString  string `json:"new_string"`
	ReplaceAll bool   `json:"replace_all,omitempty"`
	LineStart  *int   `json:"line_start,omitempty"`
	LineEnd    *int   `json:"line_end,omitempty"`
}

type PatchFileRequest added in v0.0.4

type PatchFileRequest struct {
	Path           string      `json:"path"`
	ExpectedSha256 string      `json:"expectedSha256,omitempty"`
	Edits          []PatchEdit `json:"edits"`
}

type PatchFileResponse added in v0.0.4

type PatchFileResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Path              string `json:"path"`
		Replacements      []int  `json:"replacements"`
		TotalReplacements int    `json:"totalReplacements"`
		Sha256            string `json:"sha256"`
	} `json:"data"`
}

type PublishRequest added in v0.0.4

type PublishRequest struct {
	Version   string `json:"version,omitempty"`
	Changelog string `json:"changelog,omitempty"`
}

type PublishResponse added in v0.0.4

type PublishResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		SkillId int    `json:"skillId"`
		Version string `json:"version"`
		Status  string `json:"status"`
	} `json:"data"`
}

type PutFileRequest added in v0.0.4

type PutFileRequest struct {
	Path           string `json:"path"`
	Content        string `json:"content"`
	ExpectedSha256 string `json:"expectedSha256,omitempty"`
}

type PutFileResponse added in v0.0.4

type PutFileResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Path   string `json:"path"`
		Size   int64  `json:"size"`
		Sha256 string `json:"sha256"`
	} `json:"data"`
}

type Skill

type Skill struct {
	ID            int      `json:"id"`
	Name          string   `json:"name"`
	Description   string   `json:"description"`
	Version       string   `json:"version"`
	CategoryID    int      `json:"categoryId"`
	CategoryName  string   `json:"categoryName"`
	Status        int      `json:"status"`
	IsPublic      bool     `json:"isPublic"`
	IsValid       bool     `json:"isValid"`
	FilePath      string   `json:"filePath"`
	License       string   `json:"license"`
	DownloadCount int      `json:"downloadCount"`
	StarCount     int      `json:"starCount"`
	FileSize      int64    `json:"fileSize"`
	CreatedAt     string   `json:"createdAt"`
	UpdatedAt     string   `json:"updatedAt"`
	ValidatedAt   string   `json:"validatedAt"`
	Tags          []string `json:"tags"`
}

type SkillPackage

type SkillPackage struct {
	ID           int     `json:"id"`
	Name         string  `json:"name"`
	Description  string  `json:"description"`
	Color        string  `json:"color"`
	CategoryID   int     `json:"categoryId"`
	CategoryName string  `json:"categoryName"`
	IsFavorite   bool    `json:"isFavorite"`
	SkillCount   int     `json:"skillCount"`
	Skills       []Skill `json:"skills,omitempty"`
	CreatedAt    string  `json:"createdAt"`
	UpdatedAt    string  `json:"updatedAt"`
}

type UpdateSkillRequest added in v0.0.4

type UpdateSkillRequest struct {
	Id          int      `json:"id"`
	Name        string   `json:"name,omitempty"`
	Description string   `json:"description,omitempty"`
	CategoryId  int      `json:"categoryId,omitempty"`
	Tags        []string `json:"tags,omitempty"`
}

type ValidateResponse added in v0.0.4

type ValidateResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Valid    bool     `json:"valid"`
		Errors   []string `json:"errors"`
		Warnings []string `json:"warnings"`
	} `json:"data"`
}

Jump to

Keyboard shortcuts

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