Documentation
¶
Index ¶
- Variables
- func GameTraitHookFunc(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error)
- func IsAPIError(err error) bool
- func ParseAPIResponse(dst interface{}, res *http.Response) error
- func UploadTraitHookFunc(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error)
- type APIError
- type APIKey
- type Build
- type BuildEvent
- type BuildEventData
- type BuildEventType
- type BuildFile
- type BuildFileState
- type BuildFileSubType
- type BuildFileType
- type BuildState
- type Channel
- type Client
- func (c *Client) CreateBuild(p *CreateBuildParams) (*CreateBuildResponse, error)
- func (c *Client) CreateBuildEvent(p *CreateBuildEventParams) (*CreateBuildEventResponse, error)
- func (c *Client) CreateBuildFailure(p *CreateBuildFailureParams) (*CreateBuildFailureResponse, error)
- func (c *Client) CreateBuildFile(p *CreateBuildFileParams) (*CreateBuildFileResponse, error)
- func (c *Client) CreateRediffBuildFailure(p *CreateRediffBuildFailureParams) (*CreateRediffBuildFailureResponse, error)
- func (c *Client) Do(req *http.Request) (*http.Response, error)
- func (c *Client) FinalizeBuildFile(p *FinalizeBuildFileParams) (*FinalizeBuildFileResponse, error)
- func (c *Client) Get(url string) (*http.Response, error)
- func (c *Client) GetBuild(p *GetBuildParams) (*GetBuildResponse, error)
- func (c *Client) GetBuildUpgradePath(p *GetBuildUpgradePathParams) (*GetBuildUpgradePathResponse, error)
- func (c *Client) GetChannel(target string, channel string) (*GetChannelResponse, error)
- func (c *Client) GetCollection(params *GetCollectionParams) (*GetCollectionResponse, error)
- func (c *Client) GetCollectionGames(params *GetCollectionGamesParams) (*GetCollectionGamesResponse, error)
- func (c *Client) GetGame(p *GetGameParams) (*GetGameResponse, error)
- func (c *Client) GetProfile() (*GetProfileResponse, error)
- func (c *Client) GetResponse(url string, dst interface{}) error
- func (c *Client) GetUpload(params *GetUploadParams) (*GetUploadResponse, error)
- func (c *Client) ListBuildEvents(buildID int64) (*ListBuildEventsResponse, error)
- func (c *Client) ListBuildFiles(buildID int64) (*ListBuildFilesResponse, error)
- func (c *Client) ListChannels(target string) (*ListChannelsResponse, error)
- func (c *Client) ListGameUploads(p *ListGameUploadsParams) (*ListGameUploadsResponse, error)
- func (c *Client) ListProfileCollections() (*ListProfileCollectionsResponse, error)
- func (c *Client) ListProfileGames() (*ListProfileGamesResponse, error)
- func (c *Client) ListProfileOwnedKeys() (*ListProfileOwnedKeysResponse, error)
- func (c *Client) ListUploadBuilds(params *ListUploadBuildsParams) (*ListUploadBuildsResponse, error)
- func (c *Client) LoginWithPassword(params *LoginWithPasswordParams) (*LoginWithPasswordResponse, error)
- func (c *Client) MakeBuildDownloadURL(p *MakeBuildDownloadParams) string
- func (c *Client) MakeBuildFileDownloadURL(p *MakeBuildFileDownloadURLParams) string
- func (c *Client) MakePath(format string, a ...interface{}) string
- func (c *Client) MakeUploadDownloadURL(p *MakeUploadDownloadParams) string
- func (c *Client) MakeValuesPath(values url.Values, format string, a ...interface{}) string
- func (c *Client) NewDownloadSession(p *NewDownloadSessionParams) (*NewDownloadSessionResponse, error)
- func (c *Client) PostForm(url string, data url.Values) (*http.Response, error)
- func (c *Client) PostFormResponse(url string, data url.Values, dst interface{}) error
- func (c *Client) SearchGames(params *SearchGamesParams) (*SearchGamesResponse, error)
- func (c *Client) SearchUsers(params *SearchUsersParams) (*SearchUsersResponse, error)
- func (c *Client) SetServer(itchioServer string) *Client
- func (c *Client) Subkey(params *SubkeyParams) (*SubkeyResponse, error)
- func (c *Client) TOTPVerify(params *TOTPVerifyParams) (*TOTPVerifyResponse, error)
- func (c *Client) WharfStatus() (*WharfStatusResponse, error)
- type Collection
- type CollectionGame
- type Cookie
- type CreateBuildEventParams
- type CreateBuildEventResponse
- type CreateBuildFailureParams
- type CreateBuildFailureResponse
- type CreateBuildFileParams
- type CreateBuildFileResponse
- type CreateBuildParams
- type CreateBuildResponse
- type CreateRediffBuildFailureParams
- type CreateRediffBuildFailureResponse
- type DownloadBuildFileResponse
- type DownloadKey
- type DownloadUploadBuildResponse
- type DownloadUploadBuildResponseItem
- type FileUploadSpec
- type FileUploadType
- type FinalizeBuildFileParams
- type FinalizeBuildFileResponse
- type Game
- type GameClassification
- type GameCredentials
- type GameEmbedData
- type GameTraits
- type GameType
- type GetBuildParams
- type GetBuildResponse
- type GetBuildUpgradePathParams
- type GetBuildUpgradePathResponse
- type GetChannelResponse
- type GetCollectionGamesParams
- type GetCollectionGamesResponse
- type GetCollectionParams
- type GetCollectionResponse
- type GetGameParams
- type GetGameResponse
- type GetProfileResponse
- type GetUploadParams
- type GetUploadResponse
- type ListBuildEventsResponse
- type ListBuildFilesResponse
- type ListChannelsResponse
- type ListGameUploadsParams
- type ListGameUploadsResponse
- type ListProfileCollectionsResponse
- type ListProfileGamesResponse
- type ListProfileOwnedKeysResponse
- type ListUploadBuildsParams
- type ListUploadBuildsResponse
- type LoginWithPasswordParams
- type LoginWithPasswordResponse
- type MakeBuildDownloadParams
- type MakeBuildFileDownloadURLParams
- type MakeUploadDownloadParams
- type NewDownloadSessionParams
- type NewDownloadSessionResponse
- type Query
- func (q *Query) AddAPICredentials()
- func (q *Query) AddBoolIfTrue(key string, value bool)
- func (q *Query) AddGameCredentials(gc GameCredentials)
- func (q *Query) AddInt64(key string, value int64)
- func (q *Query) AddInt64IfNonZero(key string, value int64)
- func (q *Query) AddString(key string, value string)
- func (q *Query) AddStringIfNonEmpty(key string, value string)
- func (q *Query) AddValues(values url.Values)
- func (q *Query) Get(r interface{}) error
- func (q *Query) Post(r interface{}) error
- func (q *Query) URL() string
- type Sale
- type SearchGamesParams
- type SearchGamesResponse
- type SearchUsersParams
- type SearchUsersResponse
- type Spec
- type SubkeyParams
- type SubkeyResponse
- type TOTPVerifyParams
- type TOTPVerifyResponse
- type UpgradePath
- type Upload
- type UploadDownloadResponse
- type UploadTraits
- type UploadType
- type User
- type WharfStatusResponse
Constants ¶
This section is empty.
Variables ¶
var ( // ErrBuildFileNotFound is returned when someone is asking for a non-existent file ErrBuildFileNotFound = errors.New("build file not found in storage") )
Functions ¶
func GameTraitHookFunc ¶
func IsAPIError ¶
IsApiError returns true if an error is an itch.io API error, even if it's wrapped with github.com/pkg/errors
func ParseAPIResponse ¶
ParseAPIResponse unmarshals an HTTP response into one of out response data structures
Types ¶
type APIKey ¶
type APIKey struct {
// Site-wide unique identifier generated by itch.io
ID int64 `json:"id"`
// ID of the user to which the key belongs
UserID int64 `json:"userId"`
// Actual API key value
Key string `json:"key"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
SourceVersion string `json:"sourceVersion"`
}
An API key grants access to the itch.io API within a certain scope.
type Build ¶
type Build struct {
// Site-wide unique identifier generated by itch.io
ID int64 `json:"id"`
// Identifier of the build before this one on the same channel,
// or 0 if this is the initial build.
ParentBuildID int64 `json:"parentBuildId"`
// State of the build: started, processing, etc.
State BuildState `json:"state"`
// Automatically-incremented version number, starting with 1
Version int64 `json:"version"`
// Value specified by developer with `--userversion` when pushing a build
// Might not be unique across builds of a given channel.
UserVersion string `json:"userVersion"`
// Files associated with this build - often at least an archive,
// a signature, and a patch. Some might be missing while the build
// is still processing or if processing has failed.
Files []*BuildFile `json:"files"`
// User who pushed the build
User *User `json:"user"`
// Timestamp the build was created at
CreatedAt *time.Time `json:"createdAt"`
// Timestamp the build was last updated at
UpdatedAt *time.Time `json:"updatedAt"`
}
Build contains information about a specific build
type BuildEvent ¶
type BuildEvent struct {
Type BuildEventType `json:"type"`
Message string `json:"message"`
Data BuildEventData `json:"data"`
}
A BuildEvent describes something that happened while we were processing a build.
type BuildEventData ¶
type BuildEventData map[string]interface{}
BuildEventData is a JSON object associated with a build event
type BuildEventType ¶
type BuildEventType string
BuildEventType specifies what kind of event a build event is - could be a log message, etc.
const ( // BuildEventLog is for build events of type log message BuildEventLog BuildEventType = "log" )
type BuildFile ¶
type BuildFile struct {
// Site-wide unique identifier generated by itch.io
ID int64 `json:"id"`
// Size of this build file
Size int64 `json:"size"`
// State of this file: created, uploading, uploaded, etc.
State BuildFileState `json:"state"`
// Type of this build file: archive, signature, patch, etc.
Type BuildFileType `json:"type"`
// Subtype of this build file, usually indicates compression
SubType BuildFileSubType `json:"subType"`
// Date this build file was created at
CreatedAt *time.Time `json:"createdAt"`
// Date this build file was last updated at
UpdatedAt *time.Time `json:"updatedAt"`
}
BuildFile contains information about a build's "file", which could be its archive, its signature, its patch, etc.
func FindBuildFile ¶
func FindBuildFile(fileType BuildFileType, files []*BuildFile) *BuildFile
FindBuildFile looks for an uploaded file of the right type in a list of file. Returns nil if it can't find one.
type BuildFileState ¶
type BuildFileState string
BuildFileState describes the state of a specific file for a build
const ( // BuildFileStateCreated means the file entry exists on itch.io BuildFileStateCreated BuildFileState = "created" // BuildFileStateUploading means the file is currently being uploaded to storage BuildFileStateUploading BuildFileState = "uploading" // BuildFileStateUploaded means the file is ready BuildFileStateUploaded BuildFileState = "uploaded" // BuildFileStateFailed means the file failed uploading BuildFileStateFailed BuildFileState = "failed" )
type BuildFileSubType ¶
type BuildFileSubType string
BuildFileSubType describes the subtype of a build file: mostly its compression level. For example, rediff'd patches are "optimized", whereas initial patches are "default"
const ( // BuildFileSubTypeDefault describes default compression (rsync patches) BuildFileSubTypeDefault BuildFileSubType = "default" // BuildFileSubTypeGzip is reserved BuildFileSubTypeGzip BuildFileSubType = "gzip" // BuildFileSubTypeOptimized describes optimized compression (rediff'd / bsdiff patches) BuildFileSubTypeOptimized BuildFileSubType = "optimized" )
type BuildFileType ¶
type BuildFileType string
BuildFileType describes the type of a build file: patch, archive, signature, etc.
const ( // BuildFileTypePatch describes wharf patch files (.pwr) BuildFileTypePatch BuildFileType = "patch" // BuildFileTypeArchive describes canonical archive form (.zip) BuildFileTypeArchive BuildFileType = "archive" // BuildFileTypeSignature describes wharf signature files (.pws) BuildFileTypeSignature BuildFileType = "signature" // BuildFileTypeManifest is reserved BuildFileTypeManifest BuildFileType = "manifest" // BuildFileTypeUnpacked describes the single file that is in the build (if it was just a single file) BuildFileTypeUnpacked BuildFileType = "unpacked" )
type BuildState ¶
type BuildState string
BuildState describes the state of a build, relative to its initial upload, and its processing.
const ( // BuildStateStarted is the state of a build from its creation until the initial upload is complete BuildStateStarted BuildState = "started" // BuildStateProcessing is the state of a build from the initial upload's completion to its fully-processed state. // This state does not mean the build is actually being processed right now, it's just queued for processing. BuildStateProcessing BuildState = "processing" // BuildStateCompleted means the build was successfully processed. Its patch hasn't necessarily been // rediff'd yet, but we have the holy (patch,signature,archive) trinity. BuildStateCompleted BuildState = "completed" // BuildStateFailed means something went wrong with the build. A failing build will not update the channel // head and can be requeued by the itch.io team, although if a new build is pushed before they do, // that new build will "win". BuildStateFailed BuildState = "failed" )
type Channel ¶
type Channel struct {
// Name of the channel, usually something like `windows-64-beta` or `osx-universal`
Name string `json:"name"`
Tags string `json:"tags"`
Upload *Upload `json:"upload"`
Head *Build `json:"head"`
Pending *Build `json:"pending"`
}
Channel contains information about a channel and its current status
type Client ¶
type Client struct {
Key string
HTTPClient *http.Client
BaseURL string
RetryPatterns []time.Duration
UserAgent string
}
A Client allows consuming the itch.io API
func ClientWithKey ¶
ClientWithKey creates a new itch.io API client with a given API key
func (*Client) CreateBuild ¶
func (c *Client) CreateBuild(p *CreateBuildParams) (*CreateBuildResponse, error)
CreateBuild creates a new build for a given user/game:channel, with an optional user version
func (*Client) CreateBuildEvent ¶
func (c *Client) CreateBuildEvent(p *CreateBuildEventParams) (*CreateBuildEventResponse, error)
CreateBuildEvent associates a new build event to a build
func (*Client) CreateBuildFailure ¶
func (c *Client) CreateBuildFailure(p *CreateBuildFailureParams) (*CreateBuildFailureResponse, error)
CreateBuildFailure marks a given build as failed. We get to specify an error message and if it's a fatal error (if not, the build can be retried after a bit)
func (*Client) CreateBuildFile ¶
func (c *Client) CreateBuildFile(p *CreateBuildFileParams) (*CreateBuildFileResponse, error)
CreateBuildFile creates a new build file for a build
func (*Client) CreateRediffBuildFailure ¶
func (c *Client) CreateRediffBuildFailure(p *CreateRediffBuildFailureParams) (*CreateRediffBuildFailureResponse, error)
CreateRediffBuildFailure marks a given build as having failed to rediff (optimize)
func (*Client) Do ¶
Do performs a request (any method). It takes care of JWT or API key authentication, sets the propre user agent, has built-in retry,
func (*Client) FinalizeBuildFile ¶
func (c *Client) FinalizeBuildFile(p *FinalizeBuildFileParams) (*FinalizeBuildFileResponse, error)
FinalizeBuildFile marks the end of the upload for a build file, it validates
func (*Client) GetBuild ¶
func (c *Client) GetBuild(p *GetBuildParams) (*GetBuildResponse, error)
func (*Client) GetBuildUpgradePath ¶
func (c *Client) GetBuildUpgradePath(p *GetBuildUpgradePathParams) (*GetBuildUpgradePathResponse, error)
func (*Client) GetChannel ¶
func (c *Client) GetChannel(target string, channel string) (*GetChannelResponse, error)
GetChannel returns information about a given channel for a given game
func (*Client) GetCollection ¶
func (c *Client) GetCollection(params *GetCollectionParams) (*GetCollectionResponse, error)
func (*Client) GetCollectionGames ¶
func (c *Client) GetCollectionGames(params *GetCollectionGamesParams) (*GetCollectionGamesResponse, error)
func (*Client) GetGame ¶
func (c *Client) GetGame(p *GetGameParams) (*GetGameResponse, error)
func (*Client) GetProfile ¶
func (c *Client) GetProfile() (*GetProfileResponse, error)
GetProfile returns information about the user the current credentials belong to
func (*Client) GetResponse ¶
func (*Client) GetUpload ¶
func (c *Client) GetUpload(params *GetUploadParams) (*GetUploadResponse, error)
func (*Client) ListBuildEvents ¶
func (c *Client) ListBuildEvents(buildID int64) (*ListBuildEventsResponse, error)
ListBuildEvents returns a series of events associated with a given build
func (*Client) ListBuildFiles ¶
func (c *Client) ListBuildFiles(buildID int64) (*ListBuildFilesResponse, error)
ListBuildFiles returns a list of files associated to a build
func (*Client) ListChannels ¶
func (c *Client) ListChannels(target string) (*ListChannelsResponse, error)
ListChannels returns a list of the channels for a game
func (*Client) ListGameUploads ¶
func (c *Client) ListGameUploads(p *ListGameUploadsParams) (*ListGameUploadsResponse, error)
ListGameUploads lists the uploads for a game that we have access to with our API key
func (*Client) ListProfileCollections ¶
func (c *Client) ListProfileCollections() (*ListProfileCollectionsResponse, error)
ListProfileCollections lists the collections associated to a profile
func (*Client) ListProfileGames ¶
func (c *Client) ListProfileGames() (*ListProfileGamesResponse, error)
ListProfileGames lists the games one develops (ie. can edit)
func (*Client) ListProfileOwnedKeys ¶
func (c *Client) ListProfileOwnedKeys() (*ListProfileOwnedKeysResponse, error)
ListProfileOwnedKeys lists the download keys one owns
func (*Client) ListUploadBuilds ¶
func (c *Client) ListUploadBuilds(params *ListUploadBuildsParams) (*ListUploadBuildsResponse, error)
func (*Client) LoginWithPassword ¶
func (c *Client) LoginWithPassword(params *LoginWithPasswordParams) (*LoginWithPasswordResponse, error)
func (*Client) MakeBuildDownloadURL ¶
func (c *Client) MakeBuildDownloadURL(p *MakeBuildDownloadParams) string
func (*Client) MakeBuildFileDownloadURL ¶
func (c *Client) MakeBuildFileDownloadURL(p *MakeBuildFileDownloadURLParams) string
GetBuildFileDownloadURL returns a download URL for a given build file
func (*Client) MakeUploadDownloadURL ¶
func (c *Client) MakeUploadDownloadURL(p *MakeUploadDownloadParams) string
func (*Client) MakeValuesPath ¶
MakePath crafts an API url from our configured base URL
func (*Client) NewDownloadSession ¶
func (c *Client) NewDownloadSession(p *NewDownloadSessionParams) (*NewDownloadSessionResponse, error)
func (*Client) PostForm ¶
PostForm performs an HTTP POST request to the API, with url-encoded parameters
func (*Client) PostFormResponse ¶
func (*Client) SearchGames ¶
func (c *Client) SearchGames(params *SearchGamesParams) (*SearchGamesResponse, error)
func (*Client) SearchUsers ¶
func (c *Client) SearchUsers(params *SearchUsersParams) (*SearchUsersResponse, error)
func (*Client) SetServer ¶
SetServer allows changing the server to which we're making API requests (which defaults to the reference itch.io server)
func (*Client) Subkey ¶
func (c *Client) Subkey(params *SubkeyParams) (*SubkeyResponse, error)
func (*Client) TOTPVerify ¶
func (c *Client) TOTPVerify(params *TOTPVerifyParams) (*TOTPVerifyResponse, error)
func (*Client) WharfStatus ¶
func (c *Client) WharfStatus() (*WharfStatusResponse, error)
WharfStatus requests the status of the wharf infrastructure
type Collection ¶
type Collection struct {
// Site-wide unique identifier generated by itch.io
ID int64 `json:"id"`
// Human-friendly title for collection, for example `Couch coop games`
Title string `json:"title"`
// Date this collection was created at
CreatedAt *time.Time `json:"createdAt"`
// Date this collection was last updated at (item added, title set, etc.)
UpdatedAt *time.Time `json:"updatedAt"`
// Number of games in the collection. This might not be accurate
// as some games might not be accessible to whoever is asking (project
// page deleted, visibility level changed, etc.)
GamesCount int64 `json:"gamesCount"`
// Games in this collection, with additional info
CollectionGames []*CollectionGame `json:"collectionGames,omitempty"`
UserID int64 `json:"userId"`
User *User `json:"user,omitempty"`
}
A Collection is a set of games, curated by humans.
type CollectionGame ¶
type CollectionGame struct {
CollectionID int64 `json:"collectionId" gorm:"primary_key;auto_increment:false"`
Collection *Collection `json:"collection,omitempty"`
GameID int64 `json:"gameId" gorm:"primary_key;auto_increment:false"`
Game *Game `json:"game,omitempty"`
Position int64 `json:"position"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
Blurb string `json:"blurb"`
UserID int64 `json:"userId"`
}
type CreateBuildEventParams ¶
type CreateBuildEventParams struct {
BuildID int64
Type BuildEventType
Message string
Data BuildEventData
}
type CreateBuildEventResponse ¶
type CreateBuildEventResponse struct{}
CreateBuildEventResponse is what the API responds with when you create a new build event
type CreateBuildFailureResponse ¶
type CreateBuildFailureResponse struct{}
CreateBuildFailureResponse is what the API responds with when we mark a build as failed
type CreateBuildFileParams ¶
type CreateBuildFileParams struct {
BuildID int64
Type BuildFileType
SubType BuildFileSubType
FileUploadType FileUploadType
Filename string
}
type CreateBuildFileResponse ¶
type CreateBuildFileResponse struct {
File *FileUploadSpec `json:"file"`
}
CreateBuildFileResponse is what the API responds when we create a new build file
type CreateBuildParams ¶
type CreateBuildResponse ¶
type CreateBuildResponse struct {
Build struct {
ID int64 `json:"id"`
UploadID int64 `json:"uploadId"`
ParentBuild struct {
ID int64 `json:"id"`
} `json:"parentBuild"`
}
}
CreateBuildResponse is what the API replies with when we create a new build
type CreateRediffBuildFailureResponse ¶
type CreateRediffBuildFailureResponse struct{}
type DownloadBuildFileResponse ¶
type DownloadBuildFileResponse struct {
URL string `json:"url"`
}
DownloadBuildFileResponse is what the API responds with when we ask to download an upload
type DownloadKey ¶
type DownloadKey struct {
// Site-wide unique identifier generated by itch.io
ID int64 `json:"id"`
// Identifier of the game to which this download key grants access
GameID int64 `json:"gameId"`
// Game to which this download key grants access
Game *Game `json:"game,omitempty"`
// Date this key was created at (often coincides with purchase time)
CreatedAt *time.Time `json:"createdAt"`
// Date this key was last updated at
UpdatedAt *time.Time `json:"updatedAt"`
// Identifier of the itch.io user to which this key belongs
OwnerID int64 `json:"ownerId"`
}
A download key is often generated when a purchase is made, it allows downloading uploads for a game that are not available for free.
type DownloadUploadBuildResponse ¶
type DownloadUploadBuildResponse struct {
// Patch is the download info for the wharf patch, if any
Patch *DownloadUploadBuildResponseItem `json:"patch"`
// Signature is the download info for the wharf signature, if any
Signature *DownloadUploadBuildResponseItem `json:"signature"`
// Manifest is reserved
Manifest *DownloadUploadBuildResponseItem `json:"manifest"`
// Archive is the download info for the .zip archive, if any
Archive *DownloadUploadBuildResponseItem `json:"archive"`
// Unpacked is the only file of the build, if it's a single file
Unpacked *DownloadUploadBuildResponseItem `json:"unpacked"`
}
DownloadUploadBuildResponse is what the API responds when we want to download a build
type DownloadUploadBuildResponseItem ¶
type DownloadUploadBuildResponseItem struct {
URL string `json:"url"`
}
DownloadUploadBuildResponseItem contains download information for a specific build file
type FileUploadSpec ¶
type FileUploadSpec struct {
ID int64 `json:"id"`
UploadURL string `json:"uploadUrl"`
UploadParams map[string]string `json:"uploadParams"`
UploadHeaders map[string]string `json:"uploadHeaders"`
}
FileUploadSpec contains the info needed to upload one specific build file
type FileUploadType ¶
type FileUploadType string
FileUploadType describes which strategy is used for uploading to storage some types allow for uploading in blocks (which is resumable), some expect the whole payload in one request.
const ( // FileUploadTypeMultipart lets you send metadata + all the content in a single request FileUploadTypeMultipart FileUploadType = "multipart" // FileUploadTypeResumable lets you send blocks of N*128KB at a time. The upload session is // started from the API server, so the ingest point will be anchored wherever the API server is. FileUploadTypeResumable FileUploadType = "resumable" // FileUploadTypeDeferredResumable also lets you send blocks of N*128KB at a time, but it // lets you start the upload session from the client, which means you might get a closer ingest point. FileUploadTypeDeferredResumable FileUploadType = "deferred_resumable" )
type FinalizeBuildFileParams ¶
type FinalizeBuildFileResponse ¶
type FinalizeBuildFileResponse struct{}
FinalizeBuildFileResponse is what the API responds when we finalize a build file
type Game ¶
type Game struct {
// Site-wide unique identifier generated by itch.io
ID int64 `json:"id"`
// Canonical address of the game's page on itch.io
URL string `json:"url"`
// Human-friendly title (may contain any character)
Title string `json:"title"`
// Human-friendly short description
ShortText string `json:"shortText"`
// Downloadable game, html game, etc.
Type GameType `json:"type"`
// Classification: game, tool, comic, etc.
Classification GameClassification `json:"classification"`
// Configuration for embedded (HTML5) games
// @optional
Embed *GameEmbedData `json:"embed,omitempty"`
// Cover url (might be a GIF)
CoverURL string `json:"coverUrl"`
// Non-gif cover url, only set if main cover url is a GIF
StillCoverURL string `json:"stillCoverUrl"`
// Date the game was created
CreatedAt *time.Time `json:"createdAt"`
// Date the game was published, empty if not currently published
PublishedAt *time.Time `json:"publishedAt"`
// Price in cents of a dollar
MinPrice int64 `json:"minPrice"`
// Traits describes the platforms a game is available for,
// pricing information, etc.
Traits GameTraits `json:"traits"`
// The user account this game is associated to
// @optional
User *User `json:"user,omitempty"`
// ID of the user account this game is associated to
UserID int64 `json:"userId"`
// The best current sale for this game
// @optional
Sale *Sale `json:"sale,omitempty"`
ViewsCount int64 `json:"viewsCount,omitempty" gorm:"-"`
DownloadsCount int64 `json:"downloadsCount,omitempt" gorm:"-"`
PurchasesCount int64 `json:"purchasesCount,omitempt" gorm:"-"`
Published bool `json:"published,omitempty" gorm:"-"`
}
Game represents a page on itch.io, it could be a game, a tool, a comic, etc.
type GameClassification ¶
type GameClassification string
Creator-picked classification for a page
const ( // something you can play GameClassificationGame GameClassification = "game" // all software pretty much GameClassificationTool GameClassification = "tool" // assets: graphics, sounds, etc. GameClassificationAssets GameClassification = "assets" // game mod (no link to game, purely creator tagging) GameClassificationGameMod GameClassification = "game_mod" // printable / board / card game GameClassificationPhysicalGame GameClassification = "physical_game" // bunch of music files GameClassificationSoundtrack GameClassification = "soundtrack" // anything that creators think don't fit in any other category GameClassificationOther GameClassification = "other" // comic book (pdf, jpg, specific comic formats, etc.) GameClassificationComic GameClassification = "comic" // book (pdf, jpg, specific e-book formats, etc.) GameClassificationBook GameClassification = "book" )
type GameCredentials ¶
type GameEmbedData ¶
type GameEmbedData struct {
// Game this embed info is for
GameID int64 `json:"gameId" gorm:"primary_key;auto_increment:false"`
// width of the initial viewport, in pixels
Width int64 `json:"width"`
// height of the initial viewport, in pixels
Height int64 `json:"height"`
// for itch.io website, whether or not a fullscreen button should be shown
Fullscreen bool `json:"fullscreen"`
}
Presentation information for embed games
type GameTraits ¶
type GameTraits struct {
PlatformWindows bool `trait:"p_windows"`
PlatformLinux bool `trait:"p_linux"`
PlatformOSX bool `trait:"p_osx"`
PlatformAndroid bool `trait:"p_android"`
CanBeBought bool `trait:"can_be_bought"`
HasDemo bool `trait:"has_demo"`
InPressSystem bool `trait:"in_press_system"`
}
func (GameTraits) MarshalJSON ¶
func (tt GameTraits) MarshalJSON() ([]byte, error)
func (*GameTraits) UnmarshalJSON ¶
func (tt *GameTraits) UnmarshalJSON(data []byte) error
type GameType ¶
type GameType string
Type of an itch.io game page, mostly related to how it should be presented on web (downloadable or embed)
type GetBuildParams ¶
type GetBuildParams struct {
BuildID int64
// Optional
Credentials GameCredentials
}
type GetBuildResponse ¶
type GetBuildResponse struct {
Build *Build `json:"build"`
}
type GetBuildUpgradePathParams ¶
type GetBuildUpgradePathParams struct {
CurrentBuildID int64
TargetBuildID int64
// Optional
Credentials GameCredentials
}
type GetBuildUpgradePathResponse ¶
type GetBuildUpgradePathResponse struct {
UpgradePath *UpgradePath `json:"upgradePath"`
}
type GetChannelResponse ¶
type GetChannelResponse struct {
Channel *Channel `json:"channel"`
}
GetChannelResponse is what the API responds with when we ask info about a channel
type GetCollectionGamesResponse ¶
type GetCollectionGamesResponse struct {
Page int64 `json:"page"`
PerPage int64 `json:"perPage"`
CollectionGames []*CollectionGame `json:"collection_games"`
}
type GetCollectionParams ¶
type GetCollectionParams struct {
CollectionID int64 `json:"collectionId"`
}
type GetCollectionResponse ¶
type GetCollectionResponse struct {
Collection *Collection `json:"collection"`
}
GetCollectionResponse is what the API server responds when we ask for a collection's info
type GetGameParams ¶
type GetGameParams struct {
GameID int64
Credentials GameCredentials
}
type GetGameResponse ¶
type GetGameResponse struct {
Game *Game `json:"game"`
}
GetGameResponse is what the API server responds when we ask for a game's info
type GetProfileResponse ¶
type GetProfileResponse struct {
User *User `json:"user"`
}
GetProfileResponse is what the API server responds when we ask for the user's profile
type GetUploadParams ¶
type GetUploadParams struct {
UploadID int64
// Optional
Credentials GameCredentials
}
type GetUploadResponse ¶
type GetUploadResponse struct {
Upload *Upload `json:"upload"`
}
type ListBuildEventsResponse ¶
type ListBuildEventsResponse struct {
Events []*BuildEvent `json:"events"`
}
ListBuildEventsResponse is what the API responds with when we ask for the list of events for a build
type ListBuildFilesResponse ¶
type ListBuildFilesResponse struct {
Files []*BuildFile `json:"files"`
}
ListBuildFilesResponse is what the API responds with when we ask for the files in a specific build
type ListChannelsResponse ¶
ListChannelsResponse is what the API responds with when we ask for all the channels of a particular game
type ListGameUploadsParams ¶
type ListGameUploadsParams struct {
GameID int64
// Optional
Credentials GameCredentials
}
type ListGameUploadsResponse ¶
type ListGameUploadsResponse struct {
Uploads []*Upload `json:"uploads"`
}
ListGameUploadsResponse is what the server replies with when asked for a game's uploads
type ListProfileCollectionsResponse ¶
type ListProfileCollectionsResponse struct {
Collections []*Collection `json:"collections"`
}
ListProfileCollectionsResponse is the response for /profile/collections
type ListProfileGamesResponse ¶
type ListProfileGamesResponse struct {
Games []*Game `json:"games"`
}
ListProfileGamesResponse is what the API server answers when we ask for what games an account develops.
type ListProfileOwnedKeysResponse ¶
type ListProfileOwnedKeysResponse struct {
OwnedKeys []*DownloadKey `json:"ownedKeys"`
}
ListProfileOwnedKeysResponse is the response for /profile/owned-keys
type ListUploadBuildsParams ¶
type ListUploadBuildsParams struct {
UploadID int64
// Optional
Credentials GameCredentials
}
type ListUploadBuildsResponse ¶
type ListUploadBuildsResponse struct {
Builds []*Build `json:"builds"`
}
type LoginWithPasswordParams ¶
type MakeBuildDownloadParams ¶
type MakeBuildDownloadParams struct {
BuildID int64
Type BuildFileType
// Optional: Defaults to BuildFileSubTypeDefault
SubType BuildFileSubType
// Optional
UUID string
// Optional
Credentials GameCredentials
}
type MakeUploadDownloadParams ¶
type MakeUploadDownloadParams struct {
UploadID int64
// Optional
UUID string
// Optional
Credentials GameCredentials
}
type NewDownloadSessionParams ¶
type NewDownloadSessionParams struct {
GameID int64
Credentials GameCredentials
}
type NewDownloadSessionResponse ¶
type NewDownloadSessionResponse struct {
UUID string `json:"uuid"`
}
type Query ¶
func (*Query) AddAPICredentials ¶
func (q *Query) AddAPICredentials()
func (*Query) AddBoolIfTrue ¶
func (*Query) AddGameCredentials ¶
func (q *Query) AddGameCredentials(gc GameCredentials)
func (*Query) AddInt64IfNonZero ¶
func (*Query) AddStringIfNonEmpty ¶
type Sale ¶
type Sale struct {
// Site-wide unique identifier generated by itch.io
ID int64 `json:"id"`
// Game this sale is for
GameID int64 `json:"gameId"`
// Discount rate in percent.
// Can be negative, see https://itch.io/updates/introducing-reverse-sales
Rate float64 `json:"rate"`
// Timestamp the sale started at
StartDate string `json:"startDate"`
// Timestamp the sale ends at
EndDate string `json:"endDate"`
}
Describes a discount for a game.
type SearchGamesParams ¶
type SearchGamesResponse ¶
type SearchUsersParams ¶
type SearchUsersResponse ¶
type Spec ¶
A Spec points to a given itch.io game, optionally to a specific channel
func ParseSpec ¶
ParseSpec parses something of the form `user/page:channel` and returns `user/page` and `channel` separately
func (*Spec) EnsureChannel ¶
EnsureChannel returns an error if this spec is missing a channel
type SubkeyParams ¶
type SubkeyResponse ¶
type TOTPVerifyParams ¶
type TOTPVerifyResponse ¶
type UpgradePath ¶
type UpgradePath struct {
Builds []*Build `json:"builds"`
}
type Upload ¶
type Upload struct {
// Site-wide unique identifier generated by itch.io
ID int64 `json:"id"`
// Original file name (example: `Overland_x64.zip`)
Filename string `json:"filename"`
// Human-friendly name set by developer (example: `Overland for Windows 64-bit`)
DisplayName string `json:"displayName"`
// Size of upload in bytes. For wharf-enabled uploads, it's the archive size.
Size int64 `json:"size"`
// Name of the wharf channel for this upload, if it's a wharf-enabled upload
ChannelName string `json:"channelName"`
// Latest build for this upload, if it's a wharf-enabled upload
Build *Build `json:"build"`
// Upload type: default, soundtrack, etc.
Type UploadType `json:"type"`
// Traits describes platform availability, whether it's a demo upload etc.
Traits UploadTraits `json:"traits"`
// Date this upload was created at
CreatedAt *time.Time `json:"createdAt"`
// Date this upload was last updated at (order changed, display name set, etc.)
UpdatedAt *time.Time `json:"updatedAt"`
}
An Upload is a downloadable file. Some are wharf-enabled, which means they're actually a "channel" that may contain multiple builds, pushed with <https://github.com/itchio/butler>
type UploadDownloadResponse ¶
type UploadDownloadResponse struct {
URL string `json:"url"`
}
UploadDownloadResponse is what the API replies to when we ask to download an upload
type UploadTraits ¶
type UploadTraits struct {
PlatformWindows bool `trait:"p_windows"`
PlatformLinux bool `trait:"p_linux"`
PlatformOSX bool `trait:"p_osx"`
PlatformAndroid bool `trait:"p_android"`
Preorder bool `trait:"preorder"`
Demo bool `trait:"demo"`
}
func (UploadTraits) MarshalJSON ¶
func (tt UploadTraits) MarshalJSON() ([]byte, error)
func (*UploadTraits) UnmarshalJSON ¶
func (tt *UploadTraits) UnmarshalJSON(data []byte) error
type UploadType ¶
type UploadType string
const ( UploadTypeDefault UploadType = "default" //---------------- // embed types //---------------- UploadTypeFlash UploadType = "flash" UploadTypeUnity UploadType = "unity" UploadTypeJava UploadType = "java" UploadTypeHTML UploadType = "html" //---------------- // asorted types //---------------- UploadTypeSoundtrack UploadType = "soundtrack" UploadTypeBook UploadType = "book" UploadTypeVideo UploadType = "video" UploadTypeDocumentation UploadType = "documentation" UploadTypeMod UploadType = "mod" UploadTypeAudioAssets UploadType = "audio_assets" UploadTypeGraphicalAssets UploadType = "graphical_assets" UploadTypeSourcecode UploadType = "sourcecode" UploadTypeOther UploadType = "other" )
type User ¶
type User struct {
// Site-wide unique identifier generated by itch.io
ID int64 `json:"id"`
// The user's username (used for login)
Username string `json:"username"`
// The user's display name: human-friendly, may contain spaces, unicode etc.
DisplayName string `json:"displayName"`
// Has the user opted into creating games?
Developer bool `json:"developer" gorm:"-"`
// Is the user part of itch.io's press program?
PressUser bool `json:"pressUser" gorm:"-"`
// The address of the user's page on itch.io
URL string `json:"url"`
// User's avatar, may be a GIF
CoverURL string `json:"coverUrl"`
// Static version of user's avatar, only set if the main cover URL is a GIF
StillCoverURL string `json:"stillCoverUrl"`
}
User represents an itch.io account, with basic profile info
type WharfStatusResponse ¶
type WharfStatusResponse struct {
Success bool `json:"success"`
}
WharfStatusResponse is what the API responds with when we ask for the status of the wharf infrastructure