butlerd

package
v15.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2018 License: MIT Imports: 39 Imported by: 29

README

butlerd

butlerd (butler daemon) is a JSON-RPC 2.0 service over TCP that allows using butler for long-running tasks (called operations) or one-off requests.

Documentation

Comprehensive documentation is available at http://docs.itch.ovh/butlerd/master/

Documentation

Index

Constants

This section is empty.

Variables

Functions

func FromDateTime

func FromDateTime(s string) (time.Time, error)

func H

func HTTPError

func HTTPError(code int, msg string, args ...interface{}) error

func NewStateConsumer

func NewStateConsumer(params *NewStateConsumerParams) (*state.Consumer, error)

func ToDateTime

func ToDateTime(t time.Time) string

Types

type AcceptLicenseParams

type AcceptLicenseParams struct {
	// The full text of the license agreement, in its default
	// language, which is usually English.
	Text string `json:"text"`
}

Sent during @@LaunchParams if the game/application comes with a service license agreement (at the time of this writing, this only happens if it was installed from a DMG file).

@tags Dialogs @category Launch @caller server

func (AcceptLicenseParams) Validate

func (p AcceptLicenseParams) Validate() error

type AcceptLicenseResult

type AcceptLicenseResult struct {
	// true if the user accepts the terms of the license, false otherwise.
	// Note that false will cancel the launch.
	Accept bool `json:"accept"`
}

type Action

type Action struct {
	// human-readable or standard name
	Name string `json:"name"`

	// file path (relative to manifest or absolute), URL, etc.
	Path string `json:"path"`

	// icon name (see static/fonts/icomoon/demo.html, don't include `icon-` prefix)
	Icon string `json:"icon,omitempty"`

	// command-line arguments
	Args []string `json:"args,omitempty"`

	// sandbox opt-in
	Sandbox bool `json:"sandbox,omitempty"`

	// requested API scope
	Scope string `json:"scope,omitempty"`

	// don't redirect stdout/stderr, open in new console window
	Console bool `json:"console,omitempty"`

	// platform to restrict this action too
	Platform ox.Platform `json:"platform,omitempty"`

	// localized action name
	Locales map[string]*ActionLocale `json:"locales,omitempty"`
}

An Action is a choice for the user to pick when launching a game.

see https://itch.io/docs/itch/integrating/manifest.html

type ActionLocale

type ActionLocale struct {
	// A localized action name
	Name string `json:"name"`
}

type AllowSandboxSetupParams

type AllowSandboxSetupParams struct{}

Ask the user to allow sandbox setup. Will be followed by a UAC prompt (on Windows) or a pkexec dialog (on Linux) if the user allows.

Sent during @@LaunchParams.

@category Launch @tags Dialogs @caller server

func (AllowSandboxSetupParams) Validate

func (p AllowSandboxSetupParams) Validate() error

type AllowSandboxSetupResult

type AllowSandboxSetupResult struct {
	// Set to true if user allowed the sandbox setup, false otherwise
	Allow bool `json:"allow"`
}

type BackgroundTask

type BackgroundTask struct {
	Desc string
	Do   func(rc *RequestContext) error
}

type BackgroundTaskFunc

type BackgroundTaskFunc func(rc *RequestContext) error

type BackgroundTaskID

type BackgroundTaskID int64

type CancelFuncs

type CancelFuncs struct {
	Funcs map[string]context.CancelFunc
}

func (*CancelFuncs) Add

func (cf *CancelFuncs) Add(id string, f context.CancelFunc)

func (*CancelFuncs) Call

func (cf *CancelFuncs) Call(id string) bool

func (*CancelFuncs) Remove

func (cf *CancelFuncs) Remove(id string)

type Cave

type Cave struct {
	ID string `json:"id"`

	Game   *itchio.Game   `json:"game"`
	Upload *itchio.Upload `json:"upload"`
	Build  *itchio.Build  `json:"build"`

	Stats       *CaveStats       `json:"stats"`
	InstallInfo *CaveInstallInfo `json:"installInfo"`
}

type CaveInstallInfo

type CaveInstallInfo struct {
	InstalledSize   int64  `json:"installedSize"`
	InstallLocation string `json:"installLocation"`
	InstallFolder   string `json:"installFolder"`
	Pinned          bool   `json:"pinned,omitempty"`
}

type CaveStats

type CaveStats struct {
	InstalledAt   *time.Time `json:"installedAt"`
	LastTouchedAt *time.Time `json:"lastTouchedAt"`
	SecondsRun    int64      `json:"secondsRun"`
}

type CaveSummary

type CaveSummary struct {
	ID string `json:"id"`

	GameID int64 `json:"gameId"`

	LastTouchedAt *time.Time `json:"lastTouchedAt"`
	SecondsRun    int64      `json:"secondsRun"`
	InstalledSize int64      `json:"installedSize"`
}

type CavesFilters

type CavesFilters struct {
	// @optional
	Classification itchio.GameClassification `json:"classification"`

	// @optional
	GameID int64 `json:"gameId"`

	// @optional
	InstallLocationID string `json:"installLocationId"`
}

func (CavesFilters) Validate

func (p CavesFilters) Validate() error

type CavesSetPinnedParams

type CavesSetPinnedParams struct {
	// ID of the cave to pin/unpin
	CaveID string `json:"caveId"`

	// Pinned state the cave should have after this call
	Pinned bool `json:"pinned"`
}

@name Caves.SetPinned @category Install @caller client

func (CavesSetPinnedParams) Validate

func (p CavesSetPinnedParams) Validate() error

type CavesSetPinnedResult

type CavesSetPinnedResult struct{}

type CheckUpdateParams

type CheckUpdateParams struct {
	// If specified, will only look for updates to these caves
	// @optional
	CaveIDs []string `json:"caveIds"`

	// If specified, will log information even when we have no warnings/errors
	// @optional
	Verbose bool `json:"verbose"`
}

Looks for game updates.

If a list of cave identifiers is passed, will only look for updates for these caves *and will ignore snooze*.

Otherwise, will look for updates for all games, respecting snooze.

Updates found are regularly sent via @@GameUpdateAvailableNotification, and then all at once in the result.

@category Update @caller client

func (CheckUpdateParams) Validate

func (p CheckUpdateParams) Validate() error

type CheckUpdateResult

type CheckUpdateResult struct {
	// Any updates found (might be empty)
	Updates []*GameUpdate `json:"updates"`
	// Warnings messages logged while looking for updates
	Warnings []string `json:"warnings"`
}

type CleanDownloadsApplyParams

type CleanDownloadsApplyParams struct {
	Entries []*CleanDownloadsEntry `json:"entries"`
}

Remove the specified entries from disk, freeing up disk space.

@name CleanDownloads.Apply @category Clean Downloads @caller client

func (CleanDownloadsApplyParams) Validate

func (p CleanDownloadsApplyParams) Validate() error

type CleanDownloadsApplyResult

type CleanDownloadsApplyResult struct{}

@category Clean Downloads

type CleanDownloadsEntry

type CleanDownloadsEntry struct {
	// The complete path of the file or folder we intend to remove
	Path string `json:"path"`
	// The size of the folder or file, in bytes
	Size int64 `json:"size"`
}

@category Clean Downloads

type CleanDownloadsSearchParams

type CleanDownloadsSearchParams struct {
	// A list of folders to scan for potential subfolders to clean up
	Roots []string `json:"roots"`
	// A list of subfolders to not consider when cleaning
	// (staging folders for in-progress downloads)
	Whitelist []string `json:"whitelist"`
}

Look for folders we can clean up in various download folders. This finds anything that doesn't correspond to any current downloads we know about.

@name CleanDownloads.Search @category Clean Downloads @caller client

func (CleanDownloadsSearchParams) Validate

func (p CleanDownloadsSearchParams) Validate() error

type CleanDownloadsSearchResult

type CleanDownloadsSearchResult struct {
	// Entries we found that could use some cleaning (with path and size information)
	Entries []*CleanDownloadsEntry `json:"entries"`
}

@category Clean Downloads

type Code

type Code int64

butlerd JSON-RPC 2.0 error codes

const (
	// An operation was cancelled gracefully
	CodeOperationCancelled Code = 499
	// An operation was aborted by the user
	CodeOperationAborted Code = 410

	// We tried to launch something, but the install folder just wasn't there
	CodeInstallFolderDisappeared Code = 404

	// We tried to install something, but could not find compatible uploads
	CodeNoCompatibleUploads Code = 2001

	// This title is packaged in a way that is not supported.
	CodeUnsupportedPackaging Code = 3000

	// This title is hosted on an incompatible third-party website
	CodeUnsupportedHost Code = 3001

	// Nothing that can be launched was found
	CodeNoLaunchCandidates Code = 5000

	// Java Runtime Environment is required to launch this title.
	CodeJavaRuntimeNeeded Code = 6000

	// There is no Internet connection
	CodeNetworkDisconnected Code = 9000

	// API error
	CodeAPIError Code = 12000

	// The database is busy
	CodeDatabaseBusy Code = 16000

	// An install location could not be removed because it has active downloads
	CodeCantRemoveLocationBecauseOfActiveDownloads Code = 18000
)

func (Code) Error

func (code Code) Error() string

func (Code) RpcErrorCode

func (code Code) RpcErrorCode() int64

func (Code) RpcErrorData

func (code Code) RpcErrorData() map[string]interface{}

func (Code) RpcErrorMessage

func (code Code) RpcErrorMessage() string

func (Code) String

func (code Code) String() string

type CollectionGamesFilters

type CollectionGamesFilters struct {
	Installed      bool                      `json:"installed"`
	Classification itchio.GameClassification `json:"classification"`
}

func (CollectionGamesFilters) Validate

func (p CollectionGamesFilters) Validate() error

type Conn

type Conn interface {
	Notify(ctx context.Context, method string, params interface{}) error
	Call(ctx context.Context, method string, params interface{}, result interface{}) error
}

type CoolHandler

type CoolHandler func(w http.ResponseWriter, r *http.Request) error

type Cursor

type Cursor string

type DiskUsageInfo

type DiskUsageInfo struct {
	FinalDiskUsage  int64  `json:"finalDiskUsage"`
	NeededFreeSpace int64  `json:"neededFreeSpace"`
	Accuracy        string `json:"accuracy"`
}

type Download

type Download struct {
	ID            string         `json:"id"`
	Error         *string        `json:"error"`
	ErrorMessage  *string        `json:"errorMessage"`
	ErrorCode     *int64         `json:"errorCode"`
	Reason        DownloadReason `json:"reason"`
	Position      int64          `json:"position"`
	CaveID        string         `json:"caveId"`
	Game          *itchio.Game   `json:"game"`
	Upload        *itchio.Upload `json:"upload"`
	Build         *itchio.Build  `json:"build"`
	StartedAt     *time.Time     `json:"startedAt"`
	FinishedAt    *time.Time     `json:"finishedAt"`
	StagingFolder string         `json:"stagingFolder"`
}

Represents a download queued, which will be performed whenever @@DownloadsDriveParams is called.

type DownloadKeySummary

type DownloadKeySummary 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"`

	// Date this key was created at (often coincides with purchase time)
	CreatedAt *time.Time `json:"createdAt"`
}

type DownloadProgress

type DownloadProgress struct {
	Stage    string  `json:"stage"`
	Progress float64 `json:"progress"`
	ETA      float64 `json:"eta"`
	BPS      float64 `json:"bps"`
}

type DownloadReason

type DownloadReason string
const (
	DownloadReasonInstall       DownloadReason = "install"
	DownloadReasonReinstall     DownloadReason = "reinstall"
	DownloadReasonUpdate        DownloadReason = "update"
	DownloadReasonVersionSwitch DownloadReason = "version-switch"
)

type DownloadsClearFinishedParams

type DownloadsClearFinishedParams struct {
}

Removes all finished downloads from the queue.

@name Downloads.ClearFinished @category Downloads @caller client

func (DownloadsClearFinishedParams) Validate

func (p DownloadsClearFinishedParams) Validate() error

type DownloadsClearFinishedResult

type DownloadsClearFinishedResult struct {
}

type DownloadsDiscardParams

type DownloadsDiscardParams struct {
	DownloadID string `json:"downloadId"`
}

Attempts to discard a download

@name Downloads.Discard @category Downloads @caller client

func (DownloadsDiscardParams) Validate

func (p DownloadsDiscardParams) Validate() error

type DownloadsDiscardResult

type DownloadsDiscardResult struct{}

type DownloadsDriveCancelParams

type DownloadsDriveCancelParams struct{}

Stop driving downloads gracefully.

@name Downloads.Drive.Cancel @category Downloads @caller client

func (DownloadsDriveCancelParams) Validate

func (p DownloadsDriveCancelParams) Validate() error

type DownloadsDriveCancelResult

type DownloadsDriveCancelResult struct {
	DidCancel bool `json:"didCancel"`
}

type DownloadsDriveDiscardedNotification

type DownloadsDriveDiscardedNotification struct {
	Download *Download `json:"download"`
}

@name Downloads.Drive.Discarded

type DownloadsDriveErroredNotification

type DownloadsDriveErroredNotification struct {
	// The download that errored. It contains all the error
	// information: a short message, a full stack trace,
	// and a butlerd error code.
	Download *Download `json:"download"`
}

@name Downloads.Drive.Errored

type DownloadsDriveFinishedNotification

type DownloadsDriveFinishedNotification struct {
	Download *Download `json:"download"`
}

@name Downloads.Drive.Finished

type DownloadsDriveNetworkStatusNotification

type DownloadsDriveNetworkStatusNotification struct {
	// The current network status
	Status NetworkStatus `json:"status"`
}

Sent during @@DownloadsDriveParams to inform on network status changes.

@name Downloads.Drive.NetworkStatus

type DownloadsDriveParams

type DownloadsDriveParams struct{}

Drive downloads, which is: perform them one at a time, until they're all finished.

@name Downloads.Drive @category Downloads @caller client

func (DownloadsDriveParams) Validate

func (p DownloadsDriveParams) Validate() error

type DownloadsDriveProgressNotification

type DownloadsDriveProgressNotification struct {
	Download *Download         `json:"download"`
	Progress *DownloadProgress `json:"progress"`
	// BPS values for the last minute
	SpeedHistory []float64 `json:"speedHistory"`
}

@name Downloads.Drive.Progress

type DownloadsDriveResult

type DownloadsDriveResult struct{}

type DownloadsDriveStartedNotification

type DownloadsDriveStartedNotification struct {
	Download *Download `json:"download"`
}

@name Downloads.Drive.Started

type DownloadsListParams

type DownloadsListParams struct {
}

List all known downloads.

@name Downloads.List @category Downloads @caller client

func (DownloadsListParams) Validate

func (p DownloadsListParams) Validate() error

type DownloadsListResult

type DownloadsListResult struct {
	Downloads []*Download `json:"downloads"`
}

type DownloadsPrioritizeParams

type DownloadsPrioritizeParams struct {
	DownloadID string `json:"downloadId"`
}

Put a download on top of the queue.

@name Downloads.Prioritize @category Downloads @caller client

func (DownloadsPrioritizeParams) Validate

func (p DownloadsPrioritizeParams) Validate() error

type DownloadsPrioritizeResult

type DownloadsPrioritizeResult struct {
}

type DownloadsQueueParams

type DownloadsQueueParams struct {
	Item *InstallQueueResult `json:"item"`
}

Queue a download that will be performed later by @@DownloadsDriveParams.

@name Downloads.Queue @category Downloads @caller client

func (DownloadsQueueParams) Validate

func (p DownloadsQueueParams) Validate() error

type DownloadsQueueResult

type DownloadsQueueResult struct {
}

type DownloadsRetryParams

type DownloadsRetryParams struct {
	DownloadID string `json:"downloadId"`
}

Retries a download that has errored

@name Downloads.Retry @category Downloads @caller client

func (DownloadsRetryParams) Validate

func (p DownloadsRetryParams) Validate() error

type DownloadsRetryResult

type DownloadsRetryResult struct{}

type Error

type Error interface {
	error
	RpcErrorCode() int64
	RpcErrorMessage() string
	RpcErrorData() map[string]interface{}
}

func AsButlerdError

func AsButlerdError(err error) (Error, bool)

func StandardRpcError

func StandardRpcError(Code int64) Error

type FetchCaveParams

type FetchCaveParams struct {
	CaveID string `json:"caveId"`
}

Retrieve info on a cave by ID.

@name Fetch.Cave @category Fetch @caller client

func (FetchCaveParams) Validate

func (p FetchCaveParams) Validate() error

type FetchCaveResult

type FetchCaveResult struct {
	Cave *Cave `json:"cave"`
}

type FetchCavesParams

type FetchCavesParams struct {
	// Maximum number of caves to return at a time.
	// @optional
	Limit int64 `json:"limit"`

	// When specified only shows game titles that contain this string
	// @optional
	Search string `json:"search"`

	// @optional
	SortBy string `json:"sortBy"`

	// Filters
	// @optional
	Filters CavesFilters `json:"filters"`

	// @optional
	Reverse bool `json:"reverse"`

	// Used for pagination, if specified
	// @optional
	Cursor Cursor `json:"cursor"`
}

Retrieve info for all caves.

@name Fetch.Caves @category Fetch @caller client

func (FetchCavesParams) GetCursor

func (p FetchCavesParams) GetCursor() Cursor

func (FetchCavesParams) GetLimit

func (p FetchCavesParams) GetLimit() int64

func (FetchCavesParams) Validate

func (p FetchCavesParams) Validate() error

type FetchCavesResult

type FetchCavesResult struct {
	Items []*Cave `json:"items"`

	// Use to fetch the next 'page' of results
	// @optional
	NextCursor Cursor `json:"nextCursor,omitempty"`
}

type FetchCollectionGamesParams

type FetchCollectionGamesParams struct {
	// Profile to use to fetch collection
	ProfileID int64 `json:"profileId"`

	// Identifier of the collection to look for
	CollectionID int64 `json:"collectionId"`

	// Maximum number of games to return at a time.
	// @optional
	Limit int64 `json:"limit"`

	// When specified only shows game titles that contain this string
	// @optional
	Search string `json:"search"`

	// Criterion to sort by
	// @optional
	SortBy string `json:"sortBy"`

	// Filters
	// @optional
	Filters CollectionGamesFilters `json:"filters"`

	// @optional
	Reverse bool `json:"reverse"`

	// Used for pagination, if specified
	// @optional
	Cursor Cursor `json:"cursor"`

	// If set, will force fresh data
	// @optional
	Fresh bool `json:"fresh"`
}

Fetches information about a collection and the games it contains.

@name Fetch.Collection.Games @category Fetch @caller client

func (FetchCollectionGamesParams) GetCursor

func (p FetchCollectionGamesParams) GetCursor() Cursor

func (FetchCollectionGamesParams) GetLimit

func (p FetchCollectionGamesParams) GetLimit() int64

func (FetchCollectionGamesParams) IsFresh

func (p FetchCollectionGamesParams) IsFresh() bool

func (FetchCollectionGamesParams) Validate

func (p FetchCollectionGamesParams) Validate() error

type FetchCollectionGamesResult

type FetchCollectionGamesResult struct {
	// Requested games for this collection
	Items []*itchio.CollectionGame `json:"items"`

	// Use to fetch the next 'page' of results
	// @optional
	NextCursor Cursor `json:"nextCursor,omitempty"`

	// If true, re-issue request with 'Fresh'
	// @optional
	Stale bool `json:"stale,omitempty"`
}

func (*FetchCollectionGamesResult) SetStale

func (r *FetchCollectionGamesResult) SetStale(stale bool)

type FetchCollectionParams

type FetchCollectionParams struct {
	// Profile to use to fetch collection
	ProfileID int64 `json:"profileId"`

	// Collection to fetch
	CollectionID int64 `json:"collectionId"`

	// Force an API request before replying.
	// Usually set after getting 'stale' in the response.
	// @optional
	Fresh bool `json:"fresh"`
}

Fetch a collection's title, gamesCount, etc. but not its games.

@name Fetch.Collection @category Fetch @caller client

func (FetchCollectionParams) IsFresh

func (p FetchCollectionParams) IsFresh() bool

func (FetchCollectionParams) Validate

func (p FetchCollectionParams) Validate() error

type FetchCollectionResult

type FetchCollectionResult struct {
	// Collection info
	Collection *itchio.Collection `json:"collection"`

	// True if the info was from local DB and
	// it should be re-queried using "Fresh"
	// @optional
	Stale bool `json:"stale,omitempty"`
}

func (*FetchCollectionResult) SetStale

func (r *FetchCollectionResult) SetStale(stale bool)

type FetchCommonsParams

type FetchCommonsParams struct{}

@name Fetch.Commons @category Fetch @caller client

func (FetchCommonsParams) Validate

func (p FetchCommonsParams) Validate() error

type FetchCommonsResult

type FetchCommonsResult struct {
	DownloadKeys     []*DownloadKeySummary     `json:"downloadKeys"`
	Caves            []*CaveSummary            `json:"caves"`
	InstallLocations []*InstallLocationSummary `json:"installLocations"`
}

type FetchDownloadKeyParams

type FetchDownloadKeyParams struct {
	DownloadKeyID int64 `json:"downloadKeyId"`

	ProfileID int64 `json:"profileId"`

	// Force an API request
	// @optional
	Fresh bool `json:"fresh"`
}

Fetches a download key

@name Fetch.DownloadKey @category Fetch @caller client

func (FetchDownloadKeyParams) IsFresh

func (p FetchDownloadKeyParams) IsFresh() bool

func (FetchDownloadKeyParams) Validate

func (p FetchDownloadKeyParams) Validate() error

type FetchDownloadKeyResult

type FetchDownloadKeyResult struct {
	DownloadKey *itchio.DownloadKey `json:"downloadKey"`

	// Marks that a request should be issued afterwards with 'Fresh' set
	// @optional
	Stale bool `json:"stale,omitempty"`
}

type FetchExpireAllParams

type FetchExpireAllParams struct{}

Mark all local data as stale.

@name Fetch.ExpireAll @category Fetch @caller client

func (FetchExpireAllParams) Validate

func (p FetchExpireAllParams) Validate() error

type FetchExpireAllResult

type FetchExpireAllResult struct{}

type FetchGameParams

type FetchGameParams struct {
	// Identifier of game to look for
	GameID int64 `json:"gameId"`

	// Force an API request
	// @optional
	Fresh bool `json:"fresh"`
}

Fetches information for an itch.io game.

@name Fetch.Game @category Fetch @caller client

func (FetchGameParams) IsFresh

func (p FetchGameParams) IsFresh() bool

func (FetchGameParams) Validate

func (p FetchGameParams) Validate() error

type FetchGameResult

type FetchGameResult struct {
	// Game info
	Game *itchio.Game `json:"game"`

	// Marks that a request should be issued afterwards with 'Fresh' set
	// @optional
	Stale bool `json:"stale,omitempty"`
}

func (*FetchGameResult) SetStale

func (r *FetchGameResult) SetStale(stale bool)

type FetchGameUploadsParams

type FetchGameUploadsParams struct {
	// Identifier of the game whose uploads we should look for
	GameID int64 `json:"gameId"`

	// Only returns compatible uploads
	OnlyCompatible bool `json:"compatible"`

	// Force an API request
	// @optional
	Fresh bool `json:"fresh"`
}

Fetches uploads for an itch.io game

@name Fetch.GameUploads @category Fetch @caller client

func (FetchGameUploadsParams) IsFresh

func (p FetchGameUploadsParams) IsFresh() bool

func (FetchGameUploadsParams) Validate

func (p FetchGameUploadsParams) Validate() error

type FetchGameUploadsResult

type FetchGameUploadsResult struct {
	// List of uploads
	Uploads []*itchio.Upload `json:"uploads"`

	// Marks that a request should be issued
	// afterwards with 'Fresh' set
	// @optional
	Stale bool `json:"stale,omitempty"`
}

func (*FetchGameUploadsResult) SetStale

func (r *FetchGameUploadsResult) SetStale(stale bool)

type FetchProfileCollectionsParams

type FetchProfileCollectionsParams struct {
	// Profile for which to fetch collections
	ProfileID int64 `json:"profileId"`

	// Maximum number of collections to return at a time.
	// @optional
	Limit int64 `json:"limit"`

	// When specified only shows collection titles that contain this string
	// @optional
	Search string `json:"search"`

	// Criterion to sort by
	// @optional
	SortBy string `json:"sortBy"`

	// @optional
	Reverse bool `json:"reverse"`

	// Used for pagination, if specified
	// @optional
	Cursor Cursor `json:"cursor"`

	// If set, will force fresh data
	// @optional
	Fresh bool `json:"fresh"`
}

Lists collections for a profile. Does not contain games.

@name Fetch.ProfileCollections @category Fetch @caller client

func (FetchProfileCollectionsParams) GetCursor

func (p FetchProfileCollectionsParams) GetCursor() Cursor

func (FetchProfileCollectionsParams) GetLimit

func (p FetchProfileCollectionsParams) GetLimit() int64

func (FetchProfileCollectionsParams) IsFresh

func (p FetchProfileCollectionsParams) IsFresh() bool

func (FetchProfileCollectionsParams) Validate

func (p FetchProfileCollectionsParams) Validate() error

type FetchProfileCollectionsResult

type FetchProfileCollectionsResult struct {
	// Collections belonging to the profile
	Items []*itchio.Collection `json:"items"`

	// Used to fetch the next page
	// @optional
	NextCursor Cursor `json:"nextCursor,omitempty"`

	// If true, re-issue request with "Fresh"
	// @optional
	Stale bool `json:"stale,omitempty"`
}

func (*FetchProfileCollectionsResult) SetStale

func (r *FetchProfileCollectionsResult) SetStale(stale bool)

type FetchProfileGamesParams

type FetchProfileGamesParams struct {
	// Profile for which to fetch games
	ProfileID int64 `json:"profileId"`

	// Maximum number of items to return at a time.
	// @optional
	Limit int64 `json:"limit"`

	// When specified only shows game titles that contain this string
	// @optional
	Search string `json:"search"`

	// Criterion to sort by
	// @optional
	SortBy string `json:"sortBy"`

	// Filters
	// @optional
	Filters ProfileGameFilters `json:"filters"`

	// @optional
	Reverse bool `json:"reverse"`

	// Used for pagination, if specified
	// @optional
	Cursor Cursor `json:"cursor"`

	// If set, will force fresh data
	// @optional
	Fresh bool `json:"fresh"`
}

@name Fetch.ProfileGames @category Fetch @caller client

func (FetchProfileGamesParams) GetCursor

func (p FetchProfileGamesParams) GetCursor() Cursor

func (FetchProfileGamesParams) GetLimit

func (p FetchProfileGamesParams) GetLimit() int64

func (FetchProfileGamesParams) IsFresh

func (p FetchProfileGamesParams) IsFresh() bool

func (FetchProfileGamesParams) Validate

func (p FetchProfileGamesParams) Validate() error

type FetchProfileGamesResult

type FetchProfileGamesResult struct {
	// Profile games
	Items []*ProfileGame `json:"items"`

	// Used to fetch the next page
	// @optional
	NextCursor Cursor `json:"nextCursor,omitempty"`

	// If true, re-issue request with "Fresh"
	// @optional
	Stale bool `json:"stale,omitempty"`
}

func (*FetchProfileGamesResult) SetStale

func (r *FetchProfileGamesResult) SetStale(stale bool)

type FetchProfileOwnedKeysParams

type FetchProfileOwnedKeysParams struct {
	// Profile to use to fetch game
	ProfileID int64 `json:"profileId"`

	// Maximum number of collections to return at a time.
	// @optional
	Limit int64 `json:"limit"`

	// When specified only shows game titles that contain this string
	// @optional
	Search string `json:"search"`

	// Criterion to sort by
	// @optional
	SortBy string `json:"sortBy"`

	// Filters
	// @optional
	Filters ProfileOwnedKeysFilters `json:"filters"`

	// @optional
	Reverse bool `json:"reverse"`

	// Used for pagination, if specified
	// @optional
	Cursor Cursor `json:"cursor"`

	// If set, will force fresh data
	// @optional
	Fresh bool `json:"fresh"`
}

@name Fetch.ProfileOwnedKeys @category Fetch @caller client

func (FetchProfileOwnedKeysParams) GetCursor

func (p FetchProfileOwnedKeysParams) GetCursor() Cursor

func (FetchProfileOwnedKeysParams) GetLimit

func (p FetchProfileOwnedKeysParams) GetLimit() int64

func (FetchProfileOwnedKeysParams) IsFresh

func (p FetchProfileOwnedKeysParams) IsFresh() bool

func (FetchProfileOwnedKeysParams) Validate

func (p FetchProfileOwnedKeysParams) Validate() error

type FetchProfileOwnedKeysResult

type FetchProfileOwnedKeysResult struct {
	// Download keys fetched for profile
	Items []*itchio.DownloadKey `json:"items"`

	// Used to fetch the next page
	// @optional
	NextCursor Cursor `json:"nextCursor,omitempty"`

	// If true, re-issue request with "Fresh"
	// @optional
	Stale bool `json:"stale,omitempty"`
}

func (*FetchProfileOwnedKeysResult) SetStale

func (r *FetchProfileOwnedKeysResult) SetStale(stale bool)

type FetchSaleParams

type FetchSaleParams struct {
	// Identifier of the game for which to look for a sale
	GameID int64 `json:"gameId"`
}

Fetches the best current *locally cached* sale for a given game.

@name Fetch.Sale @category Fetch @caller client

func (FetchSaleParams) Validate

func (p FetchSaleParams) Validate() error

type FetchSaleResult

type FetchSaleResult struct {
	// @optional
	Sale *itchio.Sale `json:"sale"`
}

type FetchUserParams

type FetchUserParams struct {
	// Identifier of the user to look for
	UserID int64 `json:"userId"`

	// Profile to use to look upser
	ProfileID int64 `json:"profileId"`

	// Force an API request
	// @optional
	Fresh bool `json:"fresh"`
}

Fetches information for an itch.io user.

@name Fetch.User @category Fetch @caller client

func (FetchUserParams) IsFresh

func (p FetchUserParams) IsFresh() bool

func (FetchUserParams) Validate

func (p FetchUserParams) Validate() error

type FetchUserResult

type FetchUserResult struct {
	// User info
	User *itchio.User `json:"user"`

	// Marks that a request should be issued
	// afterwards with 'Fresh' set
	// @optional
	Stale bool `json:"stale,omitempty"`
}

func (*FetchUserResult) SetStale

func (r *FetchUserResult) SetStale(stale bool)

type GameCredentials

type GameCredentials struct {
	// A valid itch.io API key
	APIKey string `json:"apiKey"`
	// A download key identifier, or 0 if no download key is available
	// @optional
	DownloadKey int64 `json:"downloadKey"`
}

GameCredentials contains all the credentials required to make API requests including the download key if any.

func (*GameCredentials) JustAPIKey

func (gc *GameCredentials) JustAPIKey() *GameCredentials

type GameFindUploadsParams

type GameFindUploadsParams struct {
	// Which game to find uploads for
	Game *itchio.Game `json:"game"`
}

Finds uploads compatible with the current runtime, for a given game.

@name Game.FindUploads @category Install @caller client

func (GameFindUploadsParams) Validate

func (p GameFindUploadsParams) Validate() error

type GameFindUploadsResult

type GameFindUploadsResult struct {
	// A list of uploads that were found to be compatible.
	Uploads []*itchio.Upload `json:"uploads"`
}

type GameUpdate

type GameUpdate struct {
	// Cave we found an update for
	CaveID string `json:"caveId"`

	// Game we found an update for
	Game *itchio.Game `json:"game"`

	// True if this is a direct update, ie. we're on
	// a channel that still exists, and there's a new build
	// False if it's an indirect update, for example a new
	// upload that appeared after we installed, but we're
	// not sure if it's an upgrade or other additional content
	Direct bool `json:"direct"`

	// Available choice of updates
	Choices []*GameUpdateChoice `json:"choices"`
}

Describes an available update for a particular game install.

@category Update

type GameUpdateAvailableNotification

type GameUpdateAvailableNotification struct {
	Update *GameUpdate `json:"update"`
}

Sent during @@CheckUpdateParams, every time butler finds an update for a game. Can be safely ignored if displaying updates as they are found is not a requirement for the client.

@category Update @tags Optional

type GameUpdateChoice

type GameUpdateChoice struct {
	// Upload to be installed
	Upload *itchio.Upload `json:"upload"`
	// Build to be installed (may be nil)
	Build *itchio.Build `json:"build"`
	// How confident we are that this is the right upgrade
	Confidence float64 `json:"confidence"`
}

One possible upload/build choice to upgrade a cave

@category update

type GetClientFunc

type GetClientFunc func(key string) *itchio.Client

type HTMLLaunchParams

type HTMLLaunchParams struct {
	// Absolute path on disk to serve
	RootFolder string `json:"rootFolder"`
	// Path of index file, relative to root folder
	IndexPath string `json:"indexPath"`

	// Command-line arguments, to pass as `global.Itch.args`
	Args []string `json:"args"`
	// Environment variables, to pass as `global.Itch.env`
	Env map[string]string `json:"env"`
}

Ask the client to perform an HTML launch, ie. open an HTML5 game, ideally in an embedded browser.

Sent during @@LaunchParams.

@category Launch @caller server

func (HTMLLaunchParams) Validate

func (p HTMLLaunchParams) Validate() error

type HTMLLaunchResult

type HTMLLaunchResult struct {
}

type InFlightBackgroundTask

type InFlightBackgroundTask struct {
	QueuedAt time.Time
	Desc     string
}

type InFlightRequest

type InFlightRequest struct {
	DispatchedAt time.Time
	Desc         string
}

type InstallCancelParams

type InstallCancelParams struct {
	// The UUID of the task to cancel, as passed to @@OperationStartParams
	ID string `json:"id"`
}

Attempt to gracefully cancel an ongoing operation.

@name Install.Cancel @category Install @caller client

func (InstallCancelParams) Validate

func (p InstallCancelParams) Validate() error

type InstallCancelResult

type InstallCancelResult struct {
	DidCancel bool `json:"didCancel"`
}

type InstallLocationSizeInfo

type InstallLocationSizeInfo struct {
	// Number of bytes used by caves installed in this location
	InstalledSize int64 `json:"installedSize"`
	// Free space at this location (depends on the partition/disk on which
	// it is), or a negative value if we can't find it
	FreeSize int64 `json:"freeSize"`
	// Total space of this location (depends on the partition/disk on which
	// it is), or a negative value if we can't find it
	TotalSize int64 `json:"totalSize"`
}

type InstallLocationSummary

type InstallLocationSummary struct {
	ID       string                   `json:"id"`
	Path     string                   `json:"path"`
	SizeInfo *InstallLocationSizeInfo `json:"sizeInfo,omitempty"`
}

type InstallLocationsAddParams

type InstallLocationsAddParams struct {
	// identifier of the new install location.
	// if not specified, will be generated.
	// @optional
	ID string `json:"id"`

	// path of the new install location
	Path string `json:"path"`
}

@name Install.Locations.Add @category Install @caller client

func (InstallLocationsAddParams) Validate

func (p InstallLocationsAddParams) Validate() error

type InstallLocationsAddResult

type InstallLocationsAddResult struct {
	InstallLocation *InstallLocationSummary `json:"installLocation"`
}

type InstallLocationsGetByIDParams

type InstallLocationsGetByIDParams struct {
	// identifier of the install location to remove
	ID string `json:"id"`
}

@name Install.Locations.GetByID @category Install @caller client

func (InstallLocationsGetByIDParams) Validate

func (p InstallLocationsGetByIDParams) Validate() error

type InstallLocationsGetByIDResult

type InstallLocationsGetByIDResult struct {
	InstallLocation *InstallLocationSummary `json:"installLocation"`
}

type InstallLocationsListParams

type InstallLocationsListParams struct {
}

@name Install.Locations.List @category Install @caller client

func (InstallLocationsListParams) Validate

func (p InstallLocationsListParams) Validate() error

type InstallLocationsListResult

type InstallLocationsListResult struct {
	InstallLocations []*InstallLocationSummary `json:"installLocations"`
}

type InstallLocationsRemoveParams

type InstallLocationsRemoveParams struct {
	// identifier of the install location to remove
	ID string `json:"id"`
}

@name Install.Locations.Remove @category Install @caller client

func (InstallLocationsRemoveParams) Validate

func (p InstallLocationsRemoveParams) Validate() error

type InstallLocationsRemoveResult

type InstallLocationsRemoveResult struct {
}

type InstallLocationsScanConfirmImportParams

type InstallLocationsScanConfirmImportParams struct {
	// number of items that will be imported
	NumItems int64 `json:"numItems"`
}

Sent at the end of @@InstallLocationsScanParams

@name Install.Locations.Scan.ConfirmImport @category Install @caller server

func (InstallLocationsScanConfirmImportParams) Validate

type InstallLocationsScanConfirmImportResult

type InstallLocationsScanConfirmImportResult struct {
	Confirm bool `json:"confirm"`
}

type InstallLocationsScanParams

type InstallLocationsScanParams struct {
	// path to a legacy marketDB
	// @optional
	LegacyMarketPath string `json:"legacyMarketPath"`
}

@name Install.Locations.Scan @category Install @caller client

func (InstallLocationsScanParams) Validate

func (p InstallLocationsScanParams) Validate() error

type InstallLocationsScanResult

type InstallLocationsScanResult struct {
	NumFoundItems    int64 `json:"numFoundItems"`
	NumImportedItems int64 `json:"numImportedItems"`
}

type InstallLocationsScanYieldNotification

type InstallLocationsScanYieldNotification struct {
	Game *itchio.Game `json:"game"`
}

Sent during @@InstallLocationsScanParams whenever a game is found.

@name Install.Locations.Scan.Yield @category Install

type InstallPerformParams

type InstallPerformParams struct {
	// ID that can be later used in @@InstallCancelParams
	ID string `json:"id"`

	// The folder turned by @@InstallQueueParams
	StagingFolder string `json:"stagingFolder"`
}

Perform an install that was previously queued via @@InstallQueueParams.

Can be cancelled by passing the same `ID` to @@InstallCancelParams.

@name Install.Perform @category Install @tags Cancellable @caller client

func (InstallPerformParams) Validate

func (p InstallPerformParams) Validate() error

type InstallPerformResult

type InstallPerformResult struct{}

type InstallPlanInfo

type InstallPlanInfo struct {
	Upload    *itchio.Upload `json:"upload"`
	Build     *itchio.Build  `json:"build"`
	Type      string         `json:"type"`
	DiskUsage *DiskUsageInfo `json:"diskUsage"`

	Error        string `json:"error,omitempty"`
	ErrorMessage string `json:"errorMessage,omitempty"`
	ErrorCode    int64  `json:"errorCode,omitempty"`
}

type InstallPlanParams

type InstallPlanParams struct {
	// The ID of the game we're planning to install
	GameID int64 `json:"gameId"`

	// The download session ID to use for this install plan
	// @optional
	DownloadSessionID string `json:"downloadSessionId"`

	// @optional
	UploadID int64 `json:"uploadId"`
}

For modal-first install

@name Install.Plan @category Install @caller client

func (InstallPlanParams) Validate

func (p InstallPlanParams) Validate() error

type InstallPlanResult

type InstallPlanResult struct {
	Game    *itchio.Game     `json:"game"`
	Uploads []*itchio.Upload `json:"uploads"`

	Info *InstallPlanInfo `json:"info"`
}

type InstallQueueParams

type InstallQueueParams struct {
	// ID of the cave to perform the install for.
	// If not specified, will create a new cave.
	// @optional
	CaveID string `json:"caveId"`

	// If unspecified, will default to 'install'
	// @optional
	Reason DownloadReason `json:"reason"`

	// If CaveID is not specified, ID of an install location
	// to install to.
	// @optional
	InstallLocationID string `json:"installLocationId"`

	// If set, InstallFolder can be set and no cave
	// record will be read or modified
	// @optional
	NoCave bool `json:"noCave"`

	// When NoCave is set, exactly where to install
	// @optional
	InstallFolder string `json:"installFolder"`

	// Which game to install.
	//
	// If unspecified and caveId is specified, the same game will be used.
	// @optional
	Game *itchio.Game `json:"game"`

	// Which upload to install.
	//
	// If unspecified and caveId is specified, the same upload will be used.
	// @optional
	Upload *itchio.Upload `json:"upload"`

	// Which build to install
	//
	// If unspecified and caveId is specified, the same build will be used.
	// @optional
	Build *itchio.Build `json:"build"`

	// If true, do not run windows installers, just extract
	// whatever to the install folder.
	// @optional
	IgnoreInstallers bool `json:"ignoreInstallers,omitempty"`

	// A folder that butler can use to store temporary files, like
	// partial downloads, checkpoint files, etc.
	// @optional
	StagingFolder string `json:"stagingFolder"`

	// If set, and the install operation is successfully disambiguated,
	// will queue it as a download for butler to drive.
	// See @@DownloadsDriveParams.
	// @optional
	QueueDownload bool `json:"queueDownload"`
}

Queues an install operation to be later performed via @@InstallPerformParams.

@name Install.Queue @category Install @caller client

func (InstallQueueParams) Validate

func (p InstallQueueParams) Validate() error

type InstallQueueResult

type InstallQueueResult struct {
	ID                string         `json:"id"`
	Reason            DownloadReason `json:"reason"`
	CaveID            string         `json:"caveId"`
	Game              *itchio.Game   `json:"game"`
	Upload            *itchio.Upload `json:"upload"`
	Build             *itchio.Build  `json:"build"`
	InstallFolder     string         `json:"installFolder"`
	StagingFolder     string         `json:"stagingFolder"`
	InstallLocationID string         `json:"installLocationId"`
}

type InstallResult

type InstallResult struct {
	// The game we installed
	Game *itchio.Game `json:"game"`
	// The upload we installed
	Upload *itchio.Upload `json:"upload"`
	// The build we installed
	// @optional
	Build *itchio.Build `json:"build"`
}

What was installed by a subtask of @@OperationStartParams.

See @@TaskSucceededNotification.

@category Install @kind type

type InstallVersionSwitchPickParams

type InstallVersionSwitchPickParams struct {
	Cave   *Cave           `json:"cave"`
	Upload *itchio.Upload  `json:"upload"`
	Builds []*itchio.Build `json:"builds"`
}

Let the user pick which version to switch to.

@category Install @caller server

func (InstallVersionSwitchPickParams) Validate

type InstallVersionSwitchPickResult

type InstallVersionSwitchPickResult struct {
	// A negative index aborts the version switch
	Index int64 `json:"index"`
}

type InstallVersionSwitchQueueParams

type InstallVersionSwitchQueueParams struct {
	// The cave to switch to a different version
	CaveID string `json:"caveId"`
}

Prepare to queue a version switch. The client will receive an @@InstallVersionSwitchPickParams.

@name Install.VersionSwitch.Queue @category Install @caller client

func (InstallVersionSwitchQueueParams) Validate

type InstallVersionSwitchQueueResult

type InstallVersionSwitchQueueResult struct {
}

type JsonRPC2Conn

type JsonRPC2Conn struct {
	Conn *jsonrpc2.Conn
}

func (*JsonRPC2Conn) Call

func (jc *JsonRPC2Conn) Call(ctx context.Context, method string, params interface{}, result interface{}) error

func (*JsonRPC2Conn) Close

func (jc *JsonRPC2Conn) Close() error

func (*JsonRPC2Conn) Notify

func (jc *JsonRPC2Conn) Notify(ctx context.Context, method string, params interface{}) error

type LFObjectCodec

type LFObjectCodec struct{}

func (LFObjectCodec) ReadObject

func (LFObjectCodec) ReadObject(stream *bufio.Reader, v interface{}) error

func (LFObjectCodec) WriteObject

func (LFObjectCodec) WriteObject(stream io.Writer, obj interface{}) error

type LaunchExitedNotification

type LaunchExitedNotification struct{}

Sent during @@LaunchParams, when the game has actually exited.

@category Launch

type LaunchParams

type LaunchParams struct {
	// The ID of the cave to launch
	CaveID string `json:"caveId"`

	// The directory to use to store installer files for prerequisites
	PrereqsDir string `json:"prereqsDir"`

	// Force installing all prerequisites, even if they're already marked as installed
	// @optional
	ForcePrereqs bool `json:"forcePrereqs,omitempty"`

	// Enable sandbox (regardless of manifest opt-in)
	// @optional
	Sandbox bool `json:"sandbox,omitempty"`
}

Attempt to launch an installed game.

@name Launch @category Launch @caller client

func (LaunchParams) Validate

func (p LaunchParams) Validate() error

type LaunchResult

type LaunchResult struct {
}

type LaunchRunningNotification

type LaunchRunningNotification struct{}

Sent during @@LaunchParams, when the game is configured, prerequisites are installed sandbox is set up (if enabled), and the game is actually running.

@category Launch

type LogLevel

type LogLevel string
const (
	// Hidden from logs by default, noisy
	LogLevelDebug LogLevel = "debug"
	// Just thinking out loud
	LogLevelInfo LogLevel = "info"
	// We're continuing, but we're not thrilled about it
	LogLevelWarning LogLevel = "warning"
	// We're eventually going to fail loudly
	LogLevelError LogLevel = "error"
)

type LogNotification

type LogNotification struct {
	// Level of the message (`info`, `warn`, etc.)
	Level LogLevel `json:"level"`
	// Contents of the message.
	//
	// Note: logs may contain non-ASCII characters, or even emojis.
	Message string `json:"message"`
}

Sent any time butler needs to send a log message. The client should relay them in their own stdout / stderr, and collect them so they can be part of an issue report if something goes wrong.

type Manifest

type Manifest struct {
	// Actions are a list of options to give the user when launching a game.
	Actions []*Action `json:"actions"`

	// Prereqs describe libraries or frameworks that must be installed
	// prior to launching a game
	Prereqs []*Prereq `json:"prereqs,omitempty"`
}

A Manifest describes prerequisites (dependencies) and actions that can be taken while launching a game.

type MetaAuthenticateParams

type MetaAuthenticateParams struct {
	Secret string `json:"secret"`
}

When using TCP transport, must be the first message sent

@name Meta.Authenticate @category Utilities @caller client

func (MetaAuthenticateParams) Validate

func (p MetaAuthenticateParams) Validate() error

type MetaAuthenticateResult

type MetaAuthenticateResult struct {
	OK bool `json:"ok"`
}

type MetaFlowEstablishedNotification

type MetaFlowEstablishedNotification struct {
	// The identifier of the daemon process for which the flow was established
	PID int64 `json:"pid"`
}

The first notification sent when @@MetaFlowParams is called.

@category Utilities

type MetaFlowParams

type MetaFlowParams struct {
}

When called, defines the entire duration of the daemon's life.

Cancelling that conversation (or closing the TCP connection) will shut down the daemon after all other requests have finished. This allows gracefully switching to another daemon.

This conversation is also used to send all global notifications, regarding data that's fetched, network state, etc.

Note that this call never returns - you have to cancel it when you're done with the daemon.

@name Meta.Flow @category Utilities @caller client

func (MetaFlowParams) Validate

func (p MetaFlowParams) Validate() error

type MetaFlowResult

type MetaFlowResult struct {
}

type MetaShutdownParams

type MetaShutdownParams struct {
}

When called, gracefully shutdown the butler daemon. @name Meta.Shutdown @category Utilities @caller client

func (MetaShutdownParams) Validate

func (p MetaShutdownParams) Validate() error

type MetaShutdownResult

type MetaShutdownResult struct {
}

type NetworkSetBandwidthThrottleParams

type NetworkSetBandwidthThrottleParams struct {
	// If true, will limit. If false, will clear any bandwidth throttles in place
	Enabled bool `json:"enabled"`
	// The target bandwidth, in kbps
	Rate int64 `json:"rate"`
}

@name Network.SetBandwidthThrottle @category Utilities @caller client

func (NetworkSetBandwidthThrottleParams) Validate

type NetworkSetBandwidthThrottleResult

type NetworkSetBandwidthThrottleResult struct{}

type NetworkSetSimulateOfflineParams

type NetworkSetSimulateOfflineParams struct {
	// If true, all operations after this point will behave
	// as if there were no network connections
	Enabled bool `json:"enabled"`
}

@name Network.SetSimulateOffline @category Utilities @caller client

func (NetworkSetSimulateOfflineParams) Validate

type NetworkSetSimulateOfflineResult

type NetworkSetSimulateOfflineResult struct{}

type NetworkStatus

type NetworkStatus string
const (
	NetworkStatusOnline  NetworkStatus = "online"
	NetworkStatusOffline NetworkStatus = "offline"
)

type NewStateConsumerParams

type NewStateConsumerParams struct {
	// Mandatory
	Conn Conn
	Ctx  context.Context

	// Optional
	LogFile *os.File
}

type NotificationHandler

type NotificationHandler func(rc *RequestContext)

type NotificationInterceptor

type NotificationInterceptor func(method string, params interface{}) error

type PickManifestActionParams

type PickManifestActionParams struct {
	// A list of actions to pick from. Must be shown to the user in the order they're passed.
	Actions []*Action `json:"actions"`
}

Sent during @@LaunchParams, ask the user to pick a manifest action to launch.

See [itch app manifests](https://itch.io/docs/itch/integrating/manifest.html).

@tags Dialogs @category Launch @caller server

func (PickManifestActionParams) Validate

func (p PickManifestActionParams) Validate() error

type PickManifestActionResult

type PickManifestActionResult struct {
	// Index of action picked by user, or negative if aborting
	Index int `json:"index"`
}

type PickUploadParams

type PickUploadParams struct {
	// An array of upload objects to choose from
	Uploads []*itchio.Upload `json:"uploads"`
}

Asks the user to pick between multiple available uploads

@category Install @tags Dialog @caller server

func (PickUploadParams) Validate

func (p PickUploadParams) Validate() error

type PickUploadResult

type PickUploadResult struct {
	// The index (in the original array) of the upload that was picked,
	// or a negative value to cancel.
	Index int64 `json:"index"`
}

type Prereq

type Prereq struct {
	// A prerequisite to be installed, see <https://itch.io/docs/itch/integrating/prereqs/> for the full list.
	Name string `json:"name"`
}

type PrereqStatus

type PrereqStatus string

@category Launch

const (
	// Prerequisite has not started downloading yet
	PrereqStatusPending PrereqStatus = "pending"
	// Prerequisite is currently being downloaded
	PrereqStatusDownloading PrereqStatus = "downloading"
	// Prerequisite has been downloaded and is pending installation
	PrereqStatusReady PrereqStatus = "ready"
	// Prerequisite is currently installing
	PrereqStatusInstalling PrereqStatus = "installing"
	// Prerequisite was installed (successfully or not)
	PrereqStatusDone PrereqStatus = "done"
)

type PrereqTask

type PrereqTask struct {
	// Full name of the prerequisite, for example: `Microsoft .NET Framework 4.6.2`
	FullName string `json:"fullName"`
	// Order of task in the list. Respect this order in the UI if you want consistent progress indicators.
	Order int `json:"order"`
}

Information about a prerequisite task.

@category Launch

type PrereqsEndedNotification

type PrereqsEndedNotification struct {
}

Sent during @@LaunchParams, when all prereqs have finished installing (successfully or not)

After this is received, it's safe to close any UI element showing prereq task state.

@category Launch

type PrereqsFailedParams

type PrereqsFailedParams struct {
	// Short error
	Error string `json:"error"`
	// Longer error (to include in logs)
	ErrorStack string `json:"errorStack"`
}

Sent during @@LaunchParams, when one or more prerequisites have failed to install. The user may choose to proceed with the launch anyway.

@category Launch @caller server

func (PrereqsFailedParams) Validate

func (p PrereqsFailedParams) Validate() error

type PrereqsFailedResult

type PrereqsFailedResult struct {
	// Set to true if the user wants to proceed with the launch in spite of the prerequisites failure
	Continue bool `json:"continue"`
}

type PrereqsStartedNotification

type PrereqsStartedNotification struct {
	// A list of prereqs that need to be tended to
	Tasks map[string]*PrereqTask `json:"tasks"`
}

Sent during @@LaunchParams, when some prerequisites are about to be installed.

This is a good time to start showing a UI element with the state of prereq tasks.

Updates are regularly provided via @@PrereqsTaskStateNotification.

@category Launch

type PrereqsTaskStateNotification

type PrereqsTaskStateNotification struct {
	// Short name of the prerequisite task (e.g. `xna-4.0`)
	Name string `json:"name"`
	// Current status of the prereq
	Status PrereqStatus `json:"status"`
	// Value between 0 and 1 (floating)
	Progress float64 `json:"progress"`
	// ETA in seconds (floating)
	ETA float64 `json:"eta"`
	// Network bandwidth used in bytes per second (floating)
	BPS float64 `json:"bps"`
}

Current status of a prerequisite task

Sent during @@LaunchParams, after @@PrereqsStartedNotification, repeatedly until all prereq tasks are done.

@category Launch

type Profile

type Profile struct {
	// itch.io user ID, doubling as profile ID
	ID int64 `json:"id"`

	// Timestamp the user last connected at (to the client)
	LastConnected time.Time `json:"lastConnected"`

	// User information
	User *itchio.User `json:"user"`
}

Represents a user for which we have profile information, ie. that we can connect as, etc.

type ProfileDataGetParams

type ProfileDataGetParams struct {
	ProfileID int64  `json:"profileId"`
	Key       string `json:"key"`
}

Retrieves some data associated to a profile, by key.

@name Profile.Data.Get @category Profile @caller client

func (ProfileDataGetParams) Validate

func (p ProfileDataGetParams) Validate() error

type ProfileDataGetResult

type ProfileDataGetResult struct {
	// True if the value existed
	OK    bool   `json:"ok"`
	Value string `json:"value"`
}

type ProfileDataPutParams

type ProfileDataPutParams struct {
	ProfileID int64  `json:"profileId"`
	Key       string `json:"key"`
	Value     string `json:"value"`
}

Stores some data associated to a profile, by key.

@name Profile.Data.Put @category Profile @caller client

func (ProfileDataPutParams) Validate

func (p ProfileDataPutParams) Validate() error

type ProfileDataPutResult

type ProfileDataPutResult struct {
}

type ProfileForgetParams

type ProfileForgetParams struct {
	ProfileID int64 `json:"profileId"`
}

Forgets a remembered profile - it won't appear in the @@ProfileListParams results anymore.

@name Profile.Forget @category Profile @caller client

func (ProfileForgetParams) Validate

func (p ProfileForgetParams) Validate() error

type ProfileForgetResult

type ProfileForgetResult struct {
	// True if the profile did exist (and was successfully forgotten)
	Success bool `json:"success"`
}

type ProfileGame

type ProfileGame struct {
	Game *itchio.Game `json:"game"`

	ViewsCount     int64 `json:"viewsCount"`
	DownloadsCount int64 `json:"downloadsCount"`
	PurchasesCount int64 `json:"purchasesCount"`

	Published bool `json:"published"`
}

type ProfileGameFilters

type ProfileGameFilters struct {
	Visibility string `json:"visibility"`
	PaidStatus string `json:"paidStatus"`
}

func (ProfileGameFilters) Validate

func (p ProfileGameFilters) Validate() error

type ProfileListParams

type ProfileListParams struct {
}

Lists remembered profiles

@name Profile.List @category Profile @caller client

func (ProfileListParams) Validate

func (p ProfileListParams) Validate() error

type ProfileListResult

type ProfileListResult struct {
	// A list of remembered profiles
	Profiles []*Profile `json:"profiles"`
}

type ProfileLoginWithAPIKeyParams

type ProfileLoginWithAPIKeyParams struct {
	// The API token to use
	APIKey string `json:"apiKey"`
}

Add a new profile by API key login. This can be used for integration tests, for example. Note that no cookies are returned for this kind of login.

@name Profile.LoginWithAPIKey @category Profile @caller client

func (ProfileLoginWithAPIKeyParams) Validate

func (p ProfileLoginWithAPIKeyParams) Validate() error

type ProfileLoginWithAPIKeyResult

type ProfileLoginWithAPIKeyResult struct {
	// Information for the new profile, now remembered
	Profile *Profile `json:"profile"`
}

type ProfileLoginWithPasswordParams

type ProfileLoginWithPasswordParams struct {
	// The username (or e-mail) to use for login
	Username string `json:"username"`

	// The password to use
	Password string `json:"password"`
}

Add a new profile by password login

@name Profile.LoginWithPassword @category Profile @caller client

func (ProfileLoginWithPasswordParams) Validate

type ProfileLoginWithPasswordResult

type ProfileLoginWithPasswordResult struct {
	// Information for the new profile, now remembered
	Profile *Profile `json:"profile"`

	// Profile cookie for website
	Cookie map[string]string `json:"cookie"`
}

type ProfileOwnedKeysFilters

type ProfileOwnedKeysFilters struct {
	Installed      bool                      `json:"installed"`
	Classification itchio.GameClassification `json:"classification"`
}

func (ProfileOwnedKeysFilters) Validate

func (p ProfileOwnedKeysFilters) Validate() error

type ProfileRequestCaptchaParams

type ProfileRequestCaptchaParams struct {
	// Address of page containing a recaptcha widget
	RecaptchaURL string `json:"recaptchaUrl"`
}

Ask the user to solve a captcha challenge Sent during @@ProfileLoginWithPasswordParams if certain conditions are met.

@name Profile.RequestCaptcha @category Profile @caller server

func (ProfileRequestCaptchaParams) Validate

func (p ProfileRequestCaptchaParams) Validate() error

type ProfileRequestCaptchaResult

type ProfileRequestCaptchaResult struct {
	// The response given by recaptcha after it's been filled
	RecaptchaResponse string `json:"recaptchaResponse"`
}

type ProfileRequestTOTPParams

type ProfileRequestTOTPParams struct {
}

Ask the user to provide a TOTP token. Sent during @@ProfileLoginWithPasswordParams if the user has two-factor authentication enabled.

@name Profile.RequestTOTP @category Profile @caller server

func (ProfileRequestTOTPParams) Validate

func (p ProfileRequestTOTPParams) Validate() error

type ProfileRequestTOTPResult

type ProfileRequestTOTPResult struct {
	// The TOTP code entered by the user
	Code string `json:"code"`
}

type ProfileUseSavedLoginParams

type ProfileUseSavedLoginParams struct {
	ProfileID int64 `json:"profileId"`
}

Use saved login credentials to validate a profile.

@name Profile.UseSavedLogin @category Profile @caller client

func (ProfileUseSavedLoginParams) Validate

func (p ProfileUseSavedLoginParams) Validate() error

type ProfileUseSavedLoginResult

type ProfileUseSavedLoginResult struct {
	// Information for the now validated profile
	Profile *Profile `json:"profile"`
}

type ProgressNotification

type ProgressNotification struct {
	// An overall progress value between 0 and 1
	Progress float64 `json:"progress"`
	// Estimated completion time for the operation, in seconds (floating)
	ETA float64 `json:"eta"`
	// Network bandwidth used, in bytes per second (floating)
	BPS float64 `json:"bps"`
}

Sent periodically during @@InstallPerformParams to inform on the current state of an install

@name Progress @category Install

type RequestContext

type RequestContext struct {
	Ctx                 context.Context
	Consumer            *state.Consumer
	Client              GetClientFunc
	QueueBackgroundTask func(bt BackgroundTask)

	HTTPClient    *http.Client
	HTTPTransport *http.Transport

	Params      *json.RawMessage
	Conn        Conn
	CancelFuncs *CancelFuncs

	ButlerVersion       string
	ButlerVersionString string

	Group    *singleflight.Group
	Shutdown func()
	// contains filtered or unexported fields
}

func (*RequestContext) Call

func (rc *RequestContext) Call(method string, params interface{}, res interface{}) error

func (*RequestContext) EndProgress

func (rc *RequestContext) EndProgress()

func (*RequestContext) GetConn

func (rc *RequestContext) GetConn() *sqlite.Conn

func (*RequestContext) InterceptNotification

func (rc *RequestContext) InterceptNotification(method string, interceptor NotificationInterceptor)

func (*RequestContext) Notify

func (rc *RequestContext) Notify(method string, params interface{}) error

func (*RequestContext) ProfileClient

func (rc *RequestContext) ProfileClient(profileID int64) (*models.Profile, *itchio.Client)

func (*RequestContext) PutConn

func (rc *RequestContext) PutConn(conn *sqlite.Conn)

func (*RequestContext) RootClient

func (rc *RequestContext) RootClient() *itchio.Client

func (*RequestContext) StartProgress

func (rc *RequestContext) StartProgress()

func (*RequestContext) StartProgressWithInitialAndTotal

func (rc *RequestContext) StartProgressWithInitialAndTotal(initialProgress float64, totalBytes int64)

func (*RequestContext) StartProgressWithTotalBytes

func (rc *RequestContext) StartProgressWithTotalBytes(totalBytes int64)

func (*RequestContext) StopInterceptingNotification

func (rc *RequestContext) StopInterceptingNotification(method string)

func (*RequestContext) WithConn

func (rc *RequestContext) WithConn(f func(conn *sqlite.Conn))

func (*RequestContext) WithConnBool

func (rc *RequestContext) WithConnBool(f func(conn *sqlite.Conn) bool) bool

func (*RequestContext) WithConnString

func (rc *RequestContext) WithConnString(f func(conn *sqlite.Conn) string) string

type RequestHandler

type RequestHandler func(rc *RequestContext) (interface{}, error)

type Router

type Router struct {
	Handlers             map[string]RequestHandler
	NotificationHandlers map[string]NotificationHandler
	CancelFuncs          *CancelFuncs

	Group        *singleflight.Group
	ShutdownChan chan struct{}

	ButlerVersion       string
	ButlerVersionString string
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter(dbPool *sqlite.Pool, getClient GetClientFunc, httpClient *http.Client, httpTransport *http.Transport) *Router

func (*Router) Dispatch

func (r *Router) Dispatch(ctx context.Context, origConn *jsonrpc2.Conn, req *jsonrpc2.Request)

func (*Router) Logf

func (r *Router) Logf(format string, args ...interface{})

func (*Router) QueueBackgroundTask

func (r *Router) QueueBackgroundTask(bt BackgroundTask)

func (*Router) Register

func (r *Router) Register(method string, rh RequestHandler)

func (*Router) RegisterNotification

func (r *Router) RegisterNotification(method string, nh NotificationHandler)

type RpcError

type RpcError struct {
	Code    int64
	Message string
}

func (*RpcError) Error

func (re *RpcError) Error() string

func (*RpcError) RpcErrorCode

func (re *RpcError) RpcErrorCode() int64

func (*RpcError) RpcErrorData

func (re *RpcError) RpcErrorData() map[string]interface{}

func (*RpcError) RpcErrorMessage

func (re *RpcError) RpcErrorMessage() string

type SearchGamesParams

type SearchGamesParams struct {
	ProfileID int64 `json:"profileId"`

	Query string `json:"query"`
}

Searches for games.

@name Search.Games @category Search @caller client

func (SearchGamesParams) Validate

func (p SearchGamesParams) Validate() error

type SearchGamesResult

type SearchGamesResult struct {
	Games []*itchio.Game `json:"games"`
}

type SearchUsersParams

type SearchUsersParams struct {
	ProfileID int64 `json:"profileId"`

	Query string `json:"query"`
}

Searches for users.

@name Search.Users @category Search @caller client

func (SearchUsersParams) Validate

func (p SearchUsersParams) Validate() error

type SearchUsersResult

type SearchUsersResult struct {
	Users []*itchio.User `json:"users"`
}

type ServeHTTPParams

type ServeHTTPParams struct {
	HTTPListener net.Listener

	HTTPSListener net.Listener
	TLSState      *TLSState

	Handler  jsonrpc2.Handler
	Consumer *state.Consumer

	ShutdownChan chan struct{}

	Log bool
}

type ServeTCPParams

type ServeTCPParams struct {
	Handler   jsonrpc2.Handler
	Consumer  *state.Consumer
	Listener  net.Listener
	Secret    string
	Log       bool
	KeepAlive bool

	ShutdownChan chan struct{}
}

type Server

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

func NewServer

func NewServer(secret string) *Server

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(ctx context.Context, params ServeHTTPParams) error

func (*Server) ServeTCP

func (s *Server) ServeTCP(ctx context.Context, params ServeTCPParams) error

type ShellLaunchParams

type ShellLaunchParams struct {
	// Absolute path of item to open, e.g. `D:\\Games\\Itch\\garden\\README.txt`
	ItemPath string `json:"itemPath"`
}

Ask the client to perform a shell launch, ie. open an item with the operating system's default handler (File explorer).

Sent during @@LaunchParams.

@category Launch @caller server

func (ShellLaunchParams) Validate

func (p ShellLaunchParams) Validate() error

type ShellLaunchResult

type ShellLaunchResult struct {
}

type SnoozeCaveParams

type SnoozeCaveParams struct {
	CaveID string `json:"caveId"`
}

Snoozing a cave means we ignore all new uploads (that would be potential updates) between the cave's last install operation and now.

This can be undone by calling @@CheckUpdateParams with this specific cave identifier.

@category Update @caller client

func (SnoozeCaveParams) Validate

func (p SnoozeCaveParams) Validate() error

type SnoozeCaveResult

type SnoozeCaveResult struct {
}

type SystemStatFSParams

type SystemStatFSParams struct {
	Path string `json:"path"`
}

Get information on a filesystem.

@name System.StatFS @category System @caller client

func (SystemStatFSParams) Validate

func (p SystemStatFSParams) Validate() error

type SystemStatFSResult

type SystemStatFSResult struct {
	FreeSize  int64 `json:"freeSize"`
	TotalSize int64 `json:"totalSize"`
}

type TLSState

type TLSState struct {
	Config       *tls.Config
	CertPEMBlock []byte
}

func MakeTLSState

func MakeTLSState() (*TLSState, error)

type TaskReason

type TaskReason string

@category Install

const (
	// Task was started for an install operation
	TaskReasonInstall TaskReason = "install"
	// Task was started for an uninstall operation
	TaskReasonUninstall TaskReason = "uninstall"
)

type TaskStartedNotification

type TaskStartedNotification struct {
	// Why this task was started
	Reason TaskReason `json:"reason"`
	// Is this task a download? An install?
	Type TaskType `json:"type"`
	// The game this task is dealing with
	Game *itchio.Game `json:"game"`
	// The upload this task is dealing with
	Upload *itchio.Upload `json:"upload"`
	// The build this task is dealing with (if any)
	Build *itchio.Build `json:"build,omitempty"`
	// Total size in bytes
	TotalSize int64 `json:"totalSize,omitempty"`
}

Each operation is made up of one or more tasks. This notification is sent during @@OperationStartParams whenever a specific task starts.

@category Install

type TaskSucceededNotification

type TaskSucceededNotification struct {
	Type TaskType `json:"type"`
	// If the task installed something, then this contains
	// info about the game, upload, build that were installed
	InstallResult *InstallResult `json:"installResult,omitempty"`
}

Sent during @@OperationStartParams whenever a task succeeds for an operation.

@category Install

type TaskType

type TaskType string

@category Install

const (
	// We're fetching files from a remote server
	TaskTypeDownload TaskType = "download"
	// We're running an installer
	TaskTypeInstall TaskType = "install"
	// We're running an uninstaller
	TaskTypeUninstall TaskType = "uninstall"
	// We're applying some patches
	TaskTypeUpdate TaskType = "update"
	// We're healing from a signature and heal source
	TaskTypeHeal TaskType = "heal"
)

type TestDoubleParams

type TestDoubleParams struct {
	// The number to double
	Number int64 `json:"number"`
}

Test request: return a number, doubled. Implement that to use @@TestDoubleTwiceParams in your testing.

@name Test.Double @category Test @caller server

func (TestDoubleParams) Validate

func (p TestDoubleParams) Validate() error

type TestDoubleResult

type TestDoubleResult struct {
	// The number, doubled
	Number int64 `json:"number"`
}

Result for Test.Double

type TestDoubleTwiceParams

type TestDoubleTwiceParams struct {
	// The number to quadruple
	Number int64 `json:"number"`
}

Test request: asks butler to double a number twice. First by calling @@TestDoubleParams, then by returning the result of that call doubled.

Use that to try out your JSON-RPC 2.0 over TCP implementation.

@name Test.DoubleTwice @category Test @caller client

func (TestDoubleTwiceParams) Validate

func (p TestDoubleTwiceParams) Validate() error

type TestDoubleTwiceResult

type TestDoubleTwiceResult struct {
	// The input, quadrupled
	Number int64 `json:"number"`
}

@category Test

type URLLaunchParams

type URLLaunchParams struct {
	// URL to open, e.g. `https://itch.io/community`
	URL string `json:"url"`
}

Ask the client to perform an URL launch, ie. open an address with the system browser or appropriate.

Sent during @@LaunchParams.

@category Launch @caller server

func (URLLaunchParams) Validate

func (p URLLaunchParams) Validate() error

type URLLaunchResult

type URLLaunchResult struct{}

type UninstallPerformParams

type UninstallPerformParams struct {
	// The cave to uninstall
	CaveID string `json:"caveId"`

	// If true, don't attempt to run any uninstallers, just
	// remove the DB record and burn the install folder to the ground.
	// @optional
	Hard bool `json:"hard"`
}

UninstallParams contains all the parameters needed to perform an uninstallation for a game via @@OperationStartParams.

@name Uninstall.Perform @category Install @caller client

func (UninstallPerformParams) Validate

func (p UninstallPerformParams) Validate() error

type UninstallPerformResult

type UninstallPerformResult struct{}

type VersionGetParams

type VersionGetParams struct{}

Retrieves the version of the butler instance the client is connected to.

This endpoint is meant to gather information when reporting issues, rather than feature sniffing. Conforming clients should automatically download new versions of butler, see the **Updating** section.

@name Version.Get @category Utilities @tags Offline @caller client

func (VersionGetParams) Validate

func (p VersionGetParams) Validate() error

type VersionGetResult

type VersionGetResult struct {
	// Something short, like `v8.0.0`
	Version string `json:"version"`

	// Something long, like `v8.0.0, built on Aug 27 2017 @ 01:13:55, ref d833cc0aeea81c236c81dffb27bc18b2b8d8b290`
	VersionString string `json:"versionString"`
}

type WithParamsFunc

type WithParamsFunc func() (interface{}, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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