client

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blob

type Blob struct {
	SHA       string  `json:"sha"`
	Size      int64   `json:"size"`
	Content   *string `json:"content,omitempty"`
	Encoding  string  `json:"encoding"`
	IsBinary  bool    `json:"is_binary"`
	Truncated bool    `json:"truncated"`
}

Blob represents a git blob (file content).

type Client

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

Client is the HTTP client for the ephemeral API.

func New

func New(baseURL, token string) *Client

New creates a new API client.

func (*Client) AddRepoFolders

func (c *Client) AddRepoFolders(ctx context.Context, repoID string, folderIDs []string) ([]Folder, error)

AddRepoFolders adds folders to a repository.

func (*Client) AdminCreateNamespace

func (c *Client) AdminCreateNamespace(ctx context.Context, name string) (*Namespace, error)

AdminCreateNamespace creates a new namespace (admin only).

func (*Client) AdminDeleteNamespace

func (c *Client) AdminDeleteNamespace(ctx context.Context, id string) error

AdminDeleteNamespace deletes a namespace (admin only).

func (*Client) AdminDeleteToken

func (c *Client) AdminDeleteToken(ctx context.Context, id string) error

AdminDeleteToken deletes a token (admin only).

func (*Client) AdminGetToken added in v0.0.3

func (c *Client) AdminGetToken(ctx context.Context, id string) (*TokenListItem, error)

AdminGetToken retrieves a single token by ID with its grants (admin only).

func (*Client) AdminListNamespaces

func (c *Client) AdminListNamespaces(ctx context.Context) ([]Namespace, error)

AdminListNamespaces lists all namespaces (admin only).

func (*Client) AdminListTokens

func (c *Client) AdminListTokens(ctx context.Context) ([]TokenListItem, error)

AdminListTokens lists all tokens (admin only).

func (*Client) BaseURL

func (c *Client) BaseURL() string

BaseURL returns the base URL of the API.

func (*Client) CreateFolder

func (c *Client) CreateFolder(ctx context.Context, name string) (*Folder, error)

CreateFolder creates a new folder.

func (*Client) CreateRepo

func (c *Client) CreateRepo(ctx context.Context, name string, description *string, public bool) (*Repo, error)

CreateRepo creates a new repository.

func (*Client) DeleteFolder

func (c *Client) DeleteFolder(ctx context.Context, id string, force bool) error

DeleteFolder deletes a folder.

func (*Client) DeleteRepo

func (c *Client) DeleteRepo(ctx context.Context, id string) error

DeleteRepo deletes a repository.

func (*Client) GetBlob

func (c *Client) GetBlob(ctx context.Context, repoID, ref, path string) (*Blob, error)

GetBlob retrieves the content of a file at a given ref and path.

func (*Client) GetNamespaceInfo

func (c *Client) GetNamespaceInfo(ctx context.Context) (*Namespace, error)

GetNamespaceInfo retrieves information about the current namespace.

func (*Client) GetReadme

func (c *Client) GetReadme(ctx context.Context, repoID, ref string) (*Readme, error)

GetReadme retrieves the README file for a repository.

func (*Client) GetTree

func (c *Client) GetTree(ctx context.Context, repoID, ref, path string) ([]TreeEntry, error)

GetTree retrieves the tree for a repository at a given ref and path.

func (*Client) GetTreeWithDepth

func (c *Client) GetTreeWithDepth(ctx context.Context, repoID, ref, path string, depth int) ([]TreeEntry, error)

GetTreeWithDepth retrieves the tree with a specified depth for recursive expansion.

func (*Client) ListCommits

func (c *Client) ListCommits(ctx context.Context, repoID, ref, cursor string, limit int) ([]Commit, bool, error)

ListCommits lists commits for a repository.

func (*Client) ListFolders

func (c *Client) ListFolders(ctx context.Context, cursor string, limit int) ([]Folder, bool, error)

ListFolders lists folders in the current namespace.

func (*Client) ListNamespaces

func (c *Client) ListNamespaces(ctx context.Context) ([]NamespaceWithAccess, error)

ListNamespaces lists all namespaces the current token has access to.

func (*Client) ListRefs

func (c *Client) ListRefs(ctx context.Context, repoID string) ([]Ref, error)

ListRefs lists all refs (branches and tags) for a repository.

func (*Client) ListRepoFolders

func (c *Client) ListRepoFolders(ctx context.Context, repoID string) ([]Folder, error)

ListRepoFolders lists folders associated with a repository.

func (*Client) ListRepos

func (c *Client) ListRepos(ctx context.Context, cursor string, limit int) ([]Repo, bool, error)

ListRepos lists repositories in the current namespace.

func (*Client) ListReposWithFolders

func (c *Client) ListReposWithFolders(ctx context.Context, cursor string, limit int) ([]RepoWithFolders, bool, error)

ListReposWithFolders lists repositories with their folder associations.

func (*Client) Namespace

func (c *Client) Namespace() string

Namespace returns the currently configured namespace.

func (*Client) RemoveRepoFolder

func (c *Client) RemoveRepoFolder(ctx context.Context, repoID, folderID string) error

RemoveRepoFolder removes a folder from a repository.

func (*Client) Token

func (c *Client) Token() string

Token returns the authentication token.

func (*Client) UpdateFolder

func (c *Client) UpdateFolder(ctx context.Context, id string, name *string) (*Folder, error)

UpdateFolder updates a folder's metadata.

func (*Client) UpdateRepo

func (c *Client) UpdateRepo(ctx context.Context, id string, name *string, description *string, public *bool) (*Repo, error)

UpdateRepo updates a repository's metadata.

func (*Client) WithNamespace

func (c *Client) WithNamespace(namespace string) *Client

WithNamespace returns a new client configured to use the specified namespace.

type Commit

type Commit struct {
	SHA        string       `json:"sha"`
	Message    string       `json:"message"`
	Author     GitAuthor    `json:"author"`
	Committer  GitAuthor    `json:"committer"`
	ParentSHAs []string     `json:"parent_shas"`
	TreeSHA    string       `json:"tree_sha"`
	Stats      *CommitStats `json:"stats,omitempty"`
}

Commit represents a git commit.

type CommitStats

type CommitStats struct {
	FilesChanged int `json:"files_changed"`
	Additions    int `json:"additions"`
	Deletions    int `json:"deletions"`
}

CommitStats represents statistics for a commit.

type Folder

type Folder struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	Color     *string   `json:"color,omitempty"`
	CreatedAt time.Time `json:"created_at"`
}

Folder represents a folder for organizing repositories.

type GitAuthor

type GitAuthor struct {
	Name  string    `json:"name"`
	Email string    `json:"email"`
	Date  time.Time `json:"date"`
}

GitAuthor represents a git author or committer.

type Namespace

type Namespace struct {
	ID                string    `json:"id"`
	Name              string    `json:"name"`
	CreatedAt         time.Time `json:"created_at"`
	RepoLimit         *int      `json:"repo_limit,omitempty"`
	StorageLimitBytes *int      `json:"storage_limit_bytes,omitempty"`
}

Namespace represents a namespace in the system.

type NamespaceGrantResponse

type NamespaceGrantResponse struct {
	NamespaceID string   `json:"namespace_id"`
	Allow       []string `json:"allow"`
	Deny        []string `json:"deny,omitempty"`
	IsPrimary   bool     `json:"is_primary"`
}

NamespaceGrantResponse represents a namespace grant in API responses.

type NamespaceWithAccess

type NamespaceWithAccess struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	CreatedAt time.Time `json:"created_at"`
	IsPrimary bool      `json:"is_primary"`
}

NamespaceWithAccess represents a namespace with access information.

type Readme

type Readme struct {
	Filename  string `json:"filename"`
	Content   string `json:"content"`
	Size      int64  `json:"size"`
	SHA       string `json:"sha"`
	IsBinary  bool   `json:"is_binary"`
	Truncated bool   `json:"truncated"`
}

Readme represents a repository's README file.

type Ref

type Ref struct {
	Name      string `json:"name"`
	Type      string `json:"type"`
	CommitSHA string `json:"commit_sha"`
	IsDefault bool   `json:"is_default"`
}

Ref represents a git reference (branch or tag).

type Repo

type Repo struct {
	ID          string     `json:"id"`
	NamespaceID string     `json:"namespace_id"`
	Name        string     `json:"name"`
	Description *string    `json:"description,omitempty"`
	Public      bool       `json:"public"`
	SizeBytes   int        `json:"size_bytes"`
	LastPushAt  *time.Time `json:"last_push_at,omitempty"`
	CreatedAt   time.Time  `json:"created_at"`
	UpdatedAt   time.Time  `json:"updated_at"`
}

Repo represents a repository.

type RepoGrantResponse

type RepoGrantResponse struct {
	RepoID string   `json:"repo_id"`
	Allow  []string `json:"allow"`
	Deny   []string `json:"deny,omitempty"`
}

RepoGrantResponse represents a repo grant in API responses.

type RepoWithFolders

type RepoWithFolders struct {
	Repo
	Folders []Folder `json:"folders,omitempty"`
}

RepoWithFolders is a repository with its associated folders.

type TokenListItem

type TokenListItem struct {
	ID              string                   `json:"id"`
	Name            *string                  `json:"name,omitempty"`
	IsAdmin         bool                     `json:"is_admin"`
	CreatedAt       time.Time                `json:"created_at"`
	ExpiresAt       *time.Time               `json:"expires_at,omitempty"`
	LastUsedAt      *time.Time               `json:"last_used_at,omitempty"`
	NamespaceGrants []NamespaceGrantResponse `json:"namespace_grants,omitempty"`
	RepoGrants      []RepoGrantResponse      `json:"repo_grants,omitempty"`
}

TokenListItem represents a token in list responses (without the secret).

type TreeEntry

type TreeEntry struct {
	Name        string      `json:"name"`
	Path        string      `json:"path"`
	Type        string      `json:"type"`
	Mode        string      `json:"mode"`
	SHA         string      `json:"sha"`
	Size        *int64      `json:"size,omitempty"`
	HasChildren *bool       `json:"has_children,omitempty"`
	Children    []TreeEntry `json:"children,omitempty"`
}

TreeEntry represents an entry in a git tree.

Jump to

Keyboard shortcuts

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