Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
BaseURL string // BaseURL is the base endpoint for WriftAI's API.
// contains filtered or unexported fields
}
API represents the struct used to interact with WriftAI's API v1.
func NewAPI ¶
NewAPI creates a new instance of the API client.
baseURL is the base endpoint for WriftAI's API. client is an instance of http.Client, which handles HTTP communication.
Returns a pointer to an API struct that can be used to interact with WriftAI's API.
func (*API) CreateVersion ¶
func (api *API) CreateVersion(token, modelOwner, modelName, containerImageDigest, releaseNotes string, schemas map[string]any) (*Version, error)
CreateVersion creates a new model version.
token is a string representing the authorization access token used to authenticate the request. modelOwner is a string representing the username of the owner of the model. modelName is a string representing the name of the model. containerImageDigest is the sha256 hash digest of the version's Docker container image in WriftAI's registry. schemas is the schemas of the version. releaseNotes is a string representing the release notes for the new version.
This function sends an HTTP POST request to the "/models/{model_owner}/{model_name}/versions" endpoint of WriftAI's API. The token is included in the Authorization header as a Bearer token.
If successful, CreateVersion returns a pointer to a Version struct containing the version's details. If an error occurs, it returns a nil version and an error describing the failure.
func (*API) GetModel ¶
GetModel retrieves a model from WriftAI's API.
token is a string representing the authorization access token used to authenticate the request. owner is a string representing the username of the owner of the model. name is a string representing the name of the model.
This function sends an HTTP GET request to the "/models/{model_owner}/{model_name}" endpoint of WriftAI's API. The token is included in the Authorization header as a Bearer token.
If successful, GetModel returns a pointer to a Model struct containing the model's details. If an error occurs, it returns a nil model and an error describing the failure.
func (*API) GetUser ¶
GetUser retrieves a user from WriftAI's API using the provided token.
token is a string representing the authorization access token used to authenticate the request.
This function sends an HTTP GET request to the "/user" endpoint of WriftAI's API. The token is included in the Authorization header as a Bearer token.
If successful, GetUser returns a pointer to a User struct containing the user's details. If an error occurs, it returns a nil user and an error describing the failure.
type Model ¶
type Model struct {
ID string `json:"id"` // ID is the unique identifier of the model.
Owner User `json:"owner"` // Owner is the object containing details of the model owner.
}
Model represents a model object returned by WriftAI's API.