screeps

package
v0.0.0-...-f9ee86f Latest Latest
Warning

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

Go to latest
Published: May 9, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package screeps - Screeps API Library

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Example

func Example()

Example usage

Types

type AuthMeResponse

type AuthMeResponse struct {
	BaseResponse    `json:",inline"`
	ID              string `json:"_id"`
	Email           string
	Username        string
	CPU             int
	Badge           Badge
	Password        bool
	LastRespawnDate int64
	NotifyPrefs     struct {
		ErrorsInterval int
	}
	GCL                  int64
	Credits              int64
	Subscription         bool
	LifetimeSubscription bool
	Power                int64
	Money                float64
	SubscriptionTokens   int
	CPUShard             map[string]int
	CPUShardUpdatedTime  int64
	Runtime              struct {
		IVM bool
	}
	PowerExperimentations    int
	PowerExperimentationTime int64
	Github                   struct {
		ID       string
		Username string
	}
	Steam struct {
		ID          string
		DisplayName string
		Ownership   []int
	}
}

AuthMeResponse AuthMeResponse

type AuthSigninRequest

type AuthSigninRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

AuthSigninRequest AuthSigninRequest

type AuthSigninResponse

type AuthSigninResponse struct {
	BaseResponse
	Token string
}

AuthSigninResponse AuthSigninResponse

type AuthmodResponse

type AuthmodResponse struct {
	BaseResponse
	Name              string
	Version           string
	AllowRegistration bool
	Steam             bool
	Github            string
}

AuthmodResponse AuthmodResponse

type Badge

type Badge struct {
	Type   int8
	Color1 string
	Color2 string
	Color3 string
	Param  int
	Flip   bool
}

Badge Screeps Badge format BUG(): Doesn't handle custom badges

type BaseResponse

type BaseResponse struct {
	Ok    int8
	Error string
}

BaseResponse BaseResponse

type Client

type Client struct {
	DefaultShard string
	// contains filtered or unexported fields
}

Client Screeps API client

func NewClient

func NewClient(config config.ServerConfig) *Client

NewClient creates a new client

func (*Client) AuthMe

func (c *Client) AuthMe() (*AuthMeResponse, error)

AuthMe GET /api/auth/me

func (*Client) AuthSignin

func (c *Client) AuthSignin() (*AuthSigninResponse, error)

AuthSignin POST /api/auth/signin

func (*Client) Authmod

func (c *Client) Authmod() (*AuthmodResponse, error)

Authmod GET /api/authmod

func (*Client) GetMemory

func (c *Client) GetMemory(path string, shard string) (*GetMemoryResponse, error)

GetMemory GET /api/user/memory

func (*Client) GetMemorySegment

func (c *Client) GetMemorySegment(segment int, shard string) (*GetMemoryResponse, error)

GetMemorySegment GET /api/user/memory-segment

func (*Client) GetMemorySegments

func (c *Client) GetMemorySegments(segments []int, shard string) ([]GetMemoryResponse, error)

GetMemorySegments GET /api/user/memory-segment

func (*Client) GetVersion

func (c *Client) GetVersion() (*VersionResponse, error)

GetVersion - Returns the current server version and info (Cached)

func (*Client) IsOfficial

func (c *Client) IsOfficial() bool

IsOfficial Returns true if server is screeps.com

func (*Client) QueryToken

func (c *Client) QueryToken(token string) (*QueryTokenResponse, error)

QueryToken GET /api/auth/query-token

func (*Client) RoomHistory

func (c *Client) RoomHistory(room string, tick int64, shard string) (*RoomHistoryResponse, error)

RoomHistory GET /api/room-history Returns empty RoomHistoryResponse if history doesn't exist

func (*Client) ServersList

func (c *Client) ServersList() (*ServersListResponse, error)

ServersList POST /api/servers/list

func (*Client) SetDebug

func (c *Client) SetDebug(val bool)

SetDebug - Enables resty debug output

func (*Client) Version

func (c *Client) Version() (*VersionResponse, error)

Version GET /api/version

type GetMemoryResponse

type GetMemoryResponse struct {
	BaseResponse
	Data string
}

GetMemoryResponse Response for #GetMemory

func (*GetMemoryResponse) Decompress

func (mr *GetMemoryResponse) Decompress() error

Decompress - Decompresses gzip compressed data

func (*GetMemoryResponse) Parse

func (mr *GetMemoryResponse) Parse(tgt *interface{}) error

Parse - Parses JSON data into struct

type GetMemorySegmentsResponse

type GetMemorySegmentsResponse struct {
	BaseResponse
	Data []string
}

GetMemorySegmentsResponse GetMemorySegmentsResponse

type QueryTokenResponse

type QueryTokenResponse struct {
	BaseResponse
	Token Token
}

QueryTokenResponse QueryTokenResponse

type RoomHistoryResponse

type RoomHistoryResponse struct {
	Timestamp int64
	Room      string
	Base      int64
	Ticks     map[string]map[string]RoomObject
}

RoomHistoryResponse RoomHistoryResponse

type RoomObject

type RoomObject struct {
	ID    string `json:"_id"`
	Room  string
	Type  string
	X     int8
	Y     int8
	Props map[string]interface{} `json:",inline"`
}

RoomObject - Screeps RoomObject

type ServersListResponse

type ServersListResponse struct {
	BaseResponse
	Likes   []interface{}
	Servers []struct {
		ID        string `json:"_id"`
		LikeCount int
		Name      string
		Settings  struct {
			Host string
			Pass string
			Port string
		}
		Status string
	}
}

ServersListResponse Response for #ServersList

type Token

type Token struct {
	ID               string `json:"_id"`
	Full             bool
	Token            string
	NoRateLimitUntil int64
}

Token Screeps Token Info TODO: Add limited token fields

type VersionResponse

type VersionResponse struct {
	BaseResponse
	Package       int
	Protocol      int
	UseNativeAuth bool
	Users         int
	ServerData    struct {
		WelcomeText          string
		HistoryChunkSize     int
		Shards               []string
		SocketUpdateThrottle int
		Renderer             interface{}
		CustomObjectTypes    interface{}
	}
}

VersionResponse VersionResponse

Jump to

Keyboard shortcuts

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