client

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 15 Imported by: ? 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 AlpaconClient

type AlpaconClient struct {
	HTTPClient  *http.Client
	BaseURL     string
	Token       string
	AccessToken string
	Privileges  string
	Username    string
	UserAgent   string
}

func NewAlpaconAPIClient

func NewAlpaconAPIClient() (*AlpaconClient, error)

func (*AlpaconClient) IsUsingHTTPS

func (ac *AlpaconClient) IsUsingHTTPS() (bool, error)

func (*AlpaconClient) RefreshToken added in v1.3.0

func (ac *AlpaconClient) RefreshToken() error

RefreshToken refreshes the access token using the stored refresh token. Uses ac.BaseURL (not config's WorkspaceURL) to stay consistent with the client's target.

func (*AlpaconClient) SendDeleteRequest

func (ac *AlpaconClient) SendDeleteRequest(url string) ([]byte, error)

func (*AlpaconClient) SendGetRequest

func (ac *AlpaconClient) SendGetRequest(url string) ([]byte, error)

Get Request to Alpacon Server

func (*AlpaconClient) SendGetRequestForDownload

func (ac *AlpaconClient) SendGetRequestForDownload(url string) (*http.Response, error)

This function returns response for custom error handling in each function, unlike direct error throwing in sendRequest.

func (*AlpaconClient) SendGetRequestToURL added in v1.4.2

func (ac *AlpaconClient) SendGetRequestToURL(absoluteURL string) ([]byte, error)

SendGetRequestToURL sends a GET request to an absolute URL (e.g., an external service) using the client's authentication headers.

func (*AlpaconClient) SendMultipartRequest

func (ac *AlpaconClient) SendMultipartRequest(url string, multiPartWriter *multipart.Writer, body bytes.Buffer) ([]byte, error)

func (*AlpaconClient) SendPatchRequest

func (ac *AlpaconClient) SendPatchRequest(url string, body any) ([]byte, error)

func (*AlpaconClient) SendPostRequest

func (ac *AlpaconClient) SendPostRequest(url string, body any) ([]byte, error)

POST Request to Alpacon Server

func (*AlpaconClient) SetWebsocketHeader

func (ac *AlpaconClient) SetWebsocketHeader() http.Header

type CheckAuthResponse

type CheckAuthResponse struct {
	Authenticated bool `json:"authenticated"`
}

type CheckPrivilegesResponse

type CheckPrivilegesResponse struct {
	Username    string `json:"username"`
	IsStaff     bool   `json:"is_staff"`
	IsSuperuser bool   `json:"is_superuser"`
}

Jump to

Keyboard shortcuts

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