api

package
v0.0.0-...-50f1b1e Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	LoginClient
	DownloadClient

	Status(ctx context.Context) (StatusSpec, error)
}

func NewClient

func NewClient() Client

type DownloadClient

type DownloadClient interface {
	DownloadPatchManifest(ctx context.Context) (PatchManifest, error)
	DownloadFile(ctx context.Context, name string) (io.ReadCloser, error)
}

type LoginClient

type LoginClient interface {
	Login(ctx context.Context, username, password string) (*LoginResponse, error)
	RetryDelayedLogin(ctx context.Context, queueToken string) (*LoginResponse, error)
	CompleteTwoFactorAuth(ctx context.Context, responseToken, code string) (*LoginResponse, error)
}

type LoginDelayedSuccessPayload

type LoginDelayedSuccessPayload struct {
	QueueToken string `json:"queueToken,omitempty"`
	ETA        int    `json:"eta,string,omitempty"`
	Position   int    `json:"position,string,omitempty"`
}

type LoginPartialSuccessPayload

type LoginPartialSuccessPayload struct {
	ResponseToken string `json:"responseToken,omitempty"`
}

type LoginResponse

type LoginResponse struct {
	Success SuccessKind `json:"success"`
	Message string      `json:"banner"`

	// Will be set if success == "true"
	*LoginSuccessPayload `json:",inline,omitempty"`

	// Will be set if success == "partial"
	*LoginPartialSuccessPayload `json:",inline,omitempty"`

	// Will be set if success == "delayed"
	*LoginDelayedSuccessPayload `json:",inline,omitempty"`
}

type LoginSuccessPayload

type LoginSuccessPayload struct {
	Gameserver string `json:"gameserver,omitempty"`
	Cookie     string `json:"cookie,omitempty"`
}

type ManifestEntry

type ManifestEntry struct {
	Download       string                `json:"dl"`
	Only           []string              `json:"only"`
	Hash           string                `json:"hash"`
	CompressedHash string                `json:"compHash"`
	Patches        map[string]*PatchSpec `json:"patches"`
}

type PatchManifest

type PatchManifest map[string]*ManifestEntry

type PatchSpec

type PatchSpec struct {
	Filename            string `json:"filename"`
	PatchHash           string `json:"patchHash"`
	CompressedPatchHash string `json:"compPatchHash"`
}

type StatusSpec

type StatusSpec struct {
	Open               bool   `json:"open"`
	Banner             string `json:"banner"`
	LastCookieIssuedAt int64  `json:"lastCookieIssuedAt"`
	LastGameAuthAt     int64  `json:"lastGameAuthAt"`
}

type SuccessKind

type SuccessKind string
const (
	SuccessTrue    SuccessKind = "true"
	SuccessFalse   SuccessKind = "false"
	SuccessPartial SuccessKind = "partial"
	SuccessDelayed SuccessKind = "delayed"
)

Jump to

Keyboard shortcuts

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