Documentation ¶
Index ¶
- Variables
- type APIClient
- type APIResponse
- type AddObjectIntentRequest
- type BranchesResponse
- type CheckUniqueObjectNameRequest
- type Client
- func (c *Client) AddObjectIntent(addObjectIntentReq AddObjectIntentRequest) (UpsertResponse, error)
- func (c *Client) Branches() (BranchesResponse, error)
- func (c *Client) CheckUniqueObjectName(shard, name string, uniqueObjectNameType screepstype.UniqueObjectName) (Response, error)
- func (c *Client) Console(shard, expression string) (InsertResponse, error)
- func (c *Client) CreateConstruction(createConstructionReq CreateConstructionRequest) (UpsertResponse, error)
- func (c *Client) CreateFlag(createFlagReq CreateFlagRequest) (UpsertResponse, error)
- func (c *Client) DeleteMemory(shard, path string) (InsertResponse, error)
- func (c *Client) DestroyStructure(shard, room, user string, ids []string) (UpsertResponse, error)
- func (c *Client) GenUniqueObjectName(shard string, uniqueObjectNameType screepstype.UniqueObjectName) (GenUniqueObjectNameResponse, error)
- func (c *Client) LeaderboardFind(mode, username, season string) (LeaderboardFindResponse, error)
- func (c *Client) LeaderboardList(mode, season string, limit, offset int) (LeaderboardListResponse, error)
- func (c *Client) LeaderboardSeasons() (LeaderboardSeasonsResponse, error)
- func (c *Client) MapStats(shard string, rooms []string, statName screepstype.StatName, ...) (MapStatsResponse, error)
- func (c *Client) Me(shard string) (MeResponse, error)
- func (c *Client) Memory(shard, path string) (MemoryResponse, error)
- func (c *Client) MemorySegment(shard string, segment int) (MemorySegmentResponse, error)
- func (c *Client) MessagesIndex() (MessagesIndexResponse, error)
- func (c *Client) MessagesList(respondent string) (MessagesListResponse, error)
- func (c *Client) MessagesSend(respondent, text string) (Response, error)
- func (c *Client) MessagesUnreadCount() (MessagesUnreadCountResponse, error)
- func (c *Client) MoneyHistory() (MoneyHistoryResponse, error)
- func (c *Client) MyOrders() (OrdersResponse, error)
- func (c *Client) Orders(shard, resourceType string) (OrdersResponse, error)
- func (c *Client) OrdersIndex(shard string) (OrdersIndexResponse, error)
- func (c *Client) PlaceSpawn(placeSpawnReq PlaceSpawnRequest) (PlaceSpawnResponse, error)
- func (c *Client) PullCode(branch string) (PullCodeResponse, error)
- func (c *Client) PushCode(branch string, modules map[string]string) (PushCodeResponse, error)
- func (c *Client) RemoveFlag(shard, room, name string) (UpsertResponse, error)
- func (c *Client) RemoveObject(shard, room, id string) (UpsertResponse, error)
- func (c *Client) Respawn() (RespawnResponse, error)
- func (c *Client) RespawnProhibitedRooms() (RespawnProhibitedRoomsResponse, error)
- func (c *Client) RoomOverview(shard, room string, statsPeriod screepstype.StatsPeriod) (RoomOverviewResponse, error)
- func (c *Client) RoomStatus(shard, room string) (RoomStatusResponse, error)
- func (c *Client) RoomTerrain(shard, room string, encoded bool) (RoomTerrainResponse, error)
- func (c *Client) SetActiveBranch(branch string, activeName screepstype.ActiveName) (Response, error)
- func (c *Client) SignIn(email, password string) error
- func (c *Client) SuicideCreep(shard, room, id string) (UpsertResponse, error)
- func (c *Client) Time(shard string) (TimeResponse, error)
- func (c *Client) Token() string
- func (c *Client) UnclaimController(shard, room, id string) (UpsertResponse, error)
- func (c *Client) UpdateMemory(shard, path, value string) (InsertResponse, error)
- func (c *Client) UpdateMemorySegment(shard, data string, segment int) (Response, error)
- func (c *Client) UserFind(id, username string) (UserFindResponse, error)
- func (c *Client) UserOverview(statName screepstype.StatName, statsPeriod screepstype.StatsPeriod) (UserOverviewResponse, error)
- func (c *Client) UserRooms(id string) (UserRoomsResponse, error)
- func (c *Client) UserStats(id string, statsPeriod screepstype.StatsPeriod) (UserStatsResponse, error)
- func (c *Client) Version() (VersionResponse, error)
- func (c *Client) WorldStartRoom() (WorldStartRoomResponse, error)
- func (c *Client) WorldStatus() (WorldStatusResponse, error)
- func (c *Client) XsollaUser(shard string) (XsollaUserResponse, error)
- type ConsoleRequest
- type CreateConstructionRequest
- type CreateFlagRequest
- type Credentials
- type DestroyStructureIntentRequest
- type GenUniqueObjectNameRequest
- type GenUniqueObjectNameResponse
- type InsertResponse
- type LeaderboardFindResponse
- type LeaderboardListResponse
- type LeaderboardSeasonsResponse
- type MapStatsRequest
- type MapStatsResponse
- type MeResponse
- type MemoryRequest
- type MemoryResponse
- type MemorySegmentResponse
- type MessagesIndexResponse
- type MessagesListResponse
- type MessagesSendRequest
- type MessagesUnreadCountResponse
- type MoneyHistoryResponse
- type MyOrdersResponse
- type OrdersIndexResponse
- type OrdersResponse
- type PlaceSpawnRequest
- type PlaceSpawnResponse
- type PullCodeResponse
- type PushCodeRequest
- type PushCodeResponse
- type RawMemoryResponse
- type RemoveFlagRequest
- type RespawnProhibitedRoomsResponse
- type RespawnResponse
- type Response
- type RoomOverviewResponse
- type RoomStatusResponse
- type RoomTerrainResponse
- type SetActiveBranchRequest
- type SignInRequest
- type SignInResponse
- type TimeResponse
- type UpdateMemoryRequest
- type UpsertResponse
- type UserFindResponse
- type UserOverviewResponse
- type UserRoomsResponse
- type UserStatsResponse
- type VersionResponse
- type WorldStartRoomResponse
- type WorldStatusResponse
- type XsollaUserResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var (
DefaultHTTPTimeout = 10 * time.Second
)
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient interface { // Auth Me(shard string) (MeResponse, error) SignIn(email, password string) error // Code Branches() (BranchesResponse, error) Console(shard, expression string) (InsertResponse, error) PullCode(branch string) (PullCodeResponse, error) PushCode(branch string, modules map[string]string) (PushCodeResponse, error) SetActiveBranch(branch string, activeName screepstype.ActiveName) (Response, error) // Game AddObjectIntent(addObjectIntentReq AddObjectIntentRequest) (UpsertResponse, error) CheckUniqueObjectName(shard, name string, uniqueObjectNameType screepstype.UniqueObjectName) (Response, error) CreateConstruction(createConstructionReq CreateConstructionRequest) (UpsertResponse, error) CreateFlag(createFlagReq CreateFlagRequest) (UpsertResponse, error) DestroyStructure(shard, room, user string, ids []string) (UpsertResponse, error) GenUniqueObjectName(shard string, uniqueObjectNameType screepstype.UniqueObjectName) (GenUniqueObjectNameResponse, error) PlaceSpawn(placeSpawnReq PlaceSpawnRequest) (PlaceSpawnResponse, error) RemoveFlag(shard, room, name string) (UpsertResponse, error) RemoveObject(shard, room, id string) (UpsertResponse, error) Respawn() (RespawnResponse, error) RespawnProhibitedRooms() (RespawnProhibitedRoomsResponse, error) SuicideCreep(shard, room, id string) (UpsertResponse, error) Time(shard string) (TimeResponse, error) UnclaimController(shard, room, id string) (UpsertResponse, error) // Leaderboard LeaderboardFind(mode, username, season string) (LeaderboardFindResponse, error) LeaderboardList(mode, season string, limit, offset int) (LeaderboardListResponse, error) LeaderboardSeasons() (LeaderboardSeasonsResponse, error) // Map MapStats(shard string, rooms []string, statName screepstype.StatName, statsPeriod screepstype.StatsPeriod) (MapStatsResponse, error) // Market MoneyHistory() (MoneyHistoryResponse, error) Orders(shard, resourceType string) (OrdersResponse, error) OrdersIndex(shard string) (OrdersIndexResponse, error) MyOrders() (OrdersResponse, error) // Memory Memory(shard, path string) (MemoryResponse, error) UpdateMemory(shard, path, value string) (InsertResponse, error) DeleteMemory(shard, path string) (InsertResponse, error) // Messages MessagesIndex() (MessagesIndexResponse, error) MessagesList(respondent string) (MessagesListResponse, error) MessagesSend(respondent, text string) (Response, error) MessagesUnreadCount() (MessagesUnreadCountResponse, error) // Room RoomOverview(shard, room string, statsPeriod screepstype.StatsPeriod) (RoomOverviewResponse, error) RoomStatus(shard, room string) (RoomStatusResponse, error) RoomTerrain(shard, room string, encoded bool) (RoomTerrainResponse, error) // User UserFind(id, username string) (UserFindResponse, error) UserOverview(statName screepstype.StatName, statsPeriod screepstype.StatsPeriod) (UserOverviewResponse, error) UserRooms(id string) (UserRoomsResponse, error) UserStats(id string, statsPeriod screepstype.StatsPeriod) (UserStatsResponse, error) // Version Version() (VersionResponse, error) // World WorldStartRoom() (WorldStartRoomResponse, error) WorldStatus() (WorldStatusResponse, error) // Xsolla XsollaUser(shard string) (XsollaUserResponse, error) }
type APIResponse ¶
type APIResponse interface {
IsOk() bool
}
type AddObjectIntentRequest ¶
type AddObjectIntentRequest struct { Shard string `json:"shard"` Room string `json:"room"` ID string `json:"_id"` Name screepstype.ObjectIntent `json:"name"` Intent interface{} `json:"intent"` }
type BranchesResponse ¶
type BranchesResponse struct { Response Branches []screepstype.Branch `json:"list"` }
type CheckUniqueObjectNameRequest ¶
type CheckUniqueObjectNameRequest struct { Shard string `json:"shard"` Type screepstype.UniqueObjectName `json:"type"` Name string `json:"name"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(credentials Credentials) (*Client, error)
func (*Client) AddObjectIntent ¶
func (c *Client) AddObjectIntent(addObjectIntentReq AddObjectIntentRequest) (UpsertResponse, error)
func (*Client) Branches ¶
func (c *Client) Branches() (BranchesResponse, error)
func (*Client) CheckUniqueObjectName ¶
func (c *Client) CheckUniqueObjectName(shard, name string, uniqueObjectNameType screepstype.UniqueObjectName) (Response, error)
func (*Client) CreateConstruction ¶
func (c *Client) CreateConstruction(createConstructionReq CreateConstructionRequest) (UpsertResponse, error)
func (*Client) CreateFlag ¶
func (c *Client) CreateFlag(createFlagReq CreateFlagRequest) (UpsertResponse, error)
func (*Client) DeleteMemory ¶
func (c *Client) DeleteMemory(shard, path string) (InsertResponse, error)
func (*Client) DestroyStructure ¶
func (c *Client) DestroyStructure(shard, room, user string, ids []string) (UpsertResponse, error)
func (*Client) GenUniqueObjectName ¶
func (c *Client) GenUniqueObjectName(shard string, uniqueObjectNameType screepstype.UniqueObjectName) (GenUniqueObjectNameResponse, error)
func (*Client) LeaderboardFind ¶
func (c *Client) LeaderboardFind(mode, username, season string) (LeaderboardFindResponse, error)
func (*Client) LeaderboardList ¶
func (c *Client) LeaderboardList(mode, season string, limit, offset int) (LeaderboardListResponse, error)
func (*Client) LeaderboardSeasons ¶
func (c *Client) LeaderboardSeasons() (LeaderboardSeasonsResponse, error)
func (*Client) MapStats ¶
func (c *Client) MapStats(shard string, rooms []string, statName screepstype.StatName, statsPeriod screepstype.StatsPeriod) (MapStatsResponse, error)
func (*Client) MemorySegment ¶
func (c *Client) MemorySegment(shard string, segment int) (MemorySegmentResponse, error)
func (*Client) MessagesIndex ¶
func (c *Client) MessagesIndex() (MessagesIndexResponse, error)
func (*Client) MessagesList ¶
func (c *Client) MessagesList(respondent string) (MessagesListResponse, error)
func (*Client) MessagesSend ¶
func (*Client) MessagesUnreadCount ¶
func (c *Client) MessagesUnreadCount() (MessagesUnreadCountResponse, error)
func (*Client) MoneyHistory ¶
func (c *Client) MoneyHistory() (MoneyHistoryResponse, error)
func (*Client) MyOrders ¶
func (c *Client) MyOrders() (OrdersResponse, error)
func (*Client) OrdersIndex ¶
func (c *Client) OrdersIndex(shard string) (OrdersIndexResponse, error)
func (*Client) PlaceSpawn ¶
func (c *Client) PlaceSpawn(placeSpawnReq PlaceSpawnRequest) (PlaceSpawnResponse, error)
func (*Client) RemoveFlag ¶
func (c *Client) RemoveFlag(shard, room, name string) (UpsertResponse, error)
func (*Client) RemoveObject ¶
func (c *Client) RemoveObject(shard, room, id string) (UpsertResponse, error)
func (*Client) Respawn ¶
func (c *Client) Respawn() (RespawnResponse, error)
func (*Client) RespawnProhibitedRooms ¶
func (c *Client) RespawnProhibitedRooms() (RespawnProhibitedRoomsResponse, error)
func (*Client) RoomOverview ¶
func (c *Client) RoomOverview(shard, room string, statsPeriod screepstype.StatsPeriod) (RoomOverviewResponse, error)
func (*Client) RoomStatus ¶
func (c *Client) RoomStatus(shard, room string) (RoomStatusResponse, error)
func (*Client) RoomTerrain ¶
func (c *Client) RoomTerrain(shard, room string, encoded bool) (RoomTerrainResponse, error)
func (*Client) SetActiveBranch ¶
func (c *Client) SetActiveBranch(branch string, activeName screepstype.ActiveName) (Response, error)
func (*Client) SuicideCreep ¶
func (c *Client) SuicideCreep(shard, room, id string) (UpsertResponse, error)
func (*Client) UnclaimController ¶
func (c *Client) UnclaimController(shard, room, id string) (UpsertResponse, error)
func (*Client) UpdateMemory ¶
func (c *Client) UpdateMemory(shard, path, value string) (InsertResponse, error)
func (*Client) UpdateMemorySegment ¶
func (*Client) UserOverview ¶
func (c *Client) UserOverview(statName screepstype.StatName, statsPeriod screepstype.StatsPeriod) (UserOverviewResponse, error)
func (*Client) UserStats ¶
func (c *Client) UserStats(id string, statsPeriod screepstype.StatsPeriod) (UserStatsResponse, error)
func (*Client) Version ¶
func (c *Client) Version() (VersionResponse, error)
func (*Client) WorldStartRoom ¶
func (c *Client) WorldStartRoom() (WorldStartRoomResponse, error)
func (*Client) WorldStatus ¶
func (c *Client) WorldStatus() (WorldStatusResponse, error)
func (*Client) XsollaUser ¶
func (c *Client) XsollaUser(shard string) (XsollaUserResponse, error)
type ConsoleRequest ¶
type ConsoleRequest struct {
Expression string `json:"expression"`
}
type CreateFlagRequest ¶
type CreateFlagRequest struct { Shard string `json:"shard"` Room string `json:"room"` X int `json:"x"` Y int `json:"y"` Name string `json:"name"` Color screepstype.Color `json:"color"` SecondaryColor screepstype.Color `json:"secondaryColor"` }
type Credentials ¶
type GenUniqueObjectNameRequest ¶
type GenUniqueObjectNameRequest struct { Shard string `json:"shard"` Type screepstype.UniqueObjectName `json:"type"` }
type InsertResponse ¶
type InsertResponse struct { Response Result screepstype.InsertResult `json:"result"` Ops []screepstype.InsertOps `json:"ops"` InsertedCount int `json:"insertedCount"` InsertedIDs []string `json:"insertedIDs"` }
type LeaderboardFindResponse ¶
type LeaderboardFindResponse struct { Response screepstype.LeaderboardPosition Positions []screepstype.LeaderboardPosition `json:"list"` }
type LeaderboardListResponse ¶
type LeaderboardListResponse struct { Response Positions []screepstype.LeaderboardPosition `json:"list"` Count int `json:"count"` Users map[string]screepstype.User `json:"users"` }
type LeaderboardSeasonsResponse ¶
type LeaderboardSeasonsResponse struct { Response Seasons []screepstype.Season `json:"seasons"` }
type MapStatsRequest ¶
type MapStatsRequest struct { Shard string `json:"shard"` Rooms []string `json:"rooms"` StatName screepstype.StatName `json:"statName"` }
type MapStatsResponse ¶
type MapStatsResponse struct { Response GameTime int `json:"gameTime"` Stats map[string]screepstype.MapRoomStats `json:"stats"` Users map[string]screepstype.User `json:"users"` }
type MeResponse ¶
type MeResponse struct { Response ID string `json:"_id"` Email string `json:"email"` Username string `json:"username"` CPU int `json:"cpu"` Badge screepstype.Badge `json:"badge"` Password bool `json:"password"` Credits int `json:"credits"` LastRespawnDate int `json:"lastRespawnDate"` PromoPeriodUntil int `json:"promoPeriodUntil"` Money int `json:"money"` SubscriptionTokens int `json:"subscriptionTokens"` GitHub screepstype.GitHub `json:"github"` Steam screepstype.Steam `json:"steam"` }
type MemoryRequest ¶
type MemoryResponse ¶
type MemoryResponse struct { Response Data interface{} `json:"data"` }
func (*MemoryResponse) UnmarshalJSON ¶
func (m *MemoryResponse) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the data string, which is of the form `gz:` followed by base64-encoded gzipped JSON encoding of the requested memory path, into a more functional map[string]interface{}.
type MemorySegmentResponse ¶
type MessagesIndexResponse ¶
type MessagesIndexResponse struct { Response Messages []screepstype.MessageWithRecipients `json:"messages"` Users map[string]screepstype.User `json:"users"` }
type MessagesListResponse ¶
type MessagesListResponse struct { Response Messages []screepstype.Message `json:"messages"` }
type MessagesSendRequest ¶
type MoneyHistoryResponse ¶
type MoneyHistoryResponse struct { Response Page int `json:"page"` HasMore bool `json:"hasMore"` Messages []screepstype.MoneyMessage `json:"messages"` }
type MyOrdersResponse ¶
type MyOrdersResponse struct { Response Orders []screepstype.MarketOrder `json:"list"` }
type OrdersIndexResponse ¶
type OrdersIndexResponse struct { Response ResourceCounts []screepstype.ResourceCount `json:"list"` }
type OrdersResponse ¶
type OrdersResponse struct { Response Orders []screepstype.MarketOrder `json:"list"` }
type PlaceSpawnRequest ¶
type PlaceSpawnResponse ¶
type PullCodeResponse ¶
type PushCodeRequest ¶
type PushCodeResponse ¶
type RawMemoryResponse ¶
type RemoveFlagRequest ¶
type RespawnResponse ¶
type RespawnResponse struct { Response First screepstype.Document `json:"0"` Second screepstype.Document `json:"1"` }
type Response ¶
type Response struct { Ok int `json:"ok"` Error screepstype.Error `json:"error"` }
type RoomOverviewResponse ¶
type RoomOverviewResponse struct { Response Owner screepstype.RoomOwner `json:"owner"` Stats screepstype.RoomStats `json:"stats"` }
type RoomStatusResponse ¶
type RoomStatusResponse struct { Response Room screepstype.Room `json:"room"` }
type RoomTerrainResponse ¶
type RoomTerrainResponse struct { Response Terrain []screepstype.RoomTerrain `json:"terrain"` }
type SetActiveBranchRequest ¶
type SetActiveBranchRequest struct { ActiveName screepstype.ActiveName `json:"activeName"` Branch string `json:"branch"` }
type SignInRequest ¶
type SignInResponse ¶
type TimeResponse ¶
type UpdateMemoryRequest ¶
type UpsertResponse ¶
type UpsertResponse struct { Response Result screepstype.Document `json:"result"` Connection screepstype.Connection `json:"connection"` Message screepstype.UpsertMessage `json:"message"` }
type UserFindResponse ¶
type UserFindResponse struct { Response User screepstype.User `json:"user"` }
type UserOverviewResponse ¶
type UserOverviewResponse struct { Response Shards map[string]screepstype.Shard `json:"shards"` Totals screepstype.StatsWithIntervals `json:"totals"` }
type UserRoomsResponse ¶
type UserStatsResponse ¶
type UserStatsResponse struct { Response Stats screepstype.StatsWithIntervals `json:"stats"` }
type VersionResponse ¶
type VersionResponse struct { Response Package int `json:"package"` Protocol int `json:"protocol"` ServerData screepstype.ServerData `json:"serverData"` }
type WorldStartRoomResponse ¶
type WorldStatusResponse ¶
type WorldStatusResponse struct { Response Status screepstype.WorldStatus `json:"status"` }
type XsollaUserResponse ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.