Documentation ¶
Overview ¶
Package appstate provides access to the Google App State API.
See https://developers.google.com/games/services/web/api/states
Usage example:
import "google.golang.org/api/appstate/v1" ... appstateService, err := appstate.New(oauthHttpClient)
Index ¶
- Constants
- type GetResponse
- type ListResponse
- type Service
- type StatesClearCall
- type StatesDeleteCall
- type StatesGetCall
- type StatesListCall
- func (c *StatesListCall) Context(ctx context.Context) *StatesListCall
- func (c *StatesListCall) Do() (*ListResponse, error)
- func (c *StatesListCall) Fields(s ...googleapi.Field) *StatesListCall
- func (c *StatesListCall) IfNoneMatch(entityTag string) *StatesListCall
- func (c *StatesListCall) IncludeData(includeData bool) *StatesListCall
- type StatesService
- func (r *StatesService) Clear(stateKey int64) *StatesClearCall
- func (r *StatesService) Delete(stateKey int64) *StatesDeleteCall
- func (r *StatesService) Get(stateKey int64) *StatesGetCall
- func (r *StatesService) List() *StatesListCall
- func (r *StatesService) Update(stateKey int64, updaterequest *UpdateRequest) *StatesUpdateCall
- type StatesUpdateCall
- type UpdateRequest
- type WriteResult
Constants ¶
const (
// View and manage your data for this application
AppstateScope = "https://www.googleapis.com/auth/appstate"
)
OAuth2 scopes used by this API.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GetResponse ¶
type GetResponse struct { // CurrentStateVersion: The current app state version. CurrentStateVersion string `json:"currentStateVersion,omitempty"` // Data: The requested data. Data string `json:"data,omitempty"` // Kind: Uniquely identifies the type of this resource. Value is always // the fixed string appstate#getResponse. Kind string `json:"kind,omitempty"` // StateKey: The key for the data. StateKey int64 `json:"stateKey,omitempty"` // ServerResponse contains the HTTP response code and headers from the // server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "CurrentStateVersion") // to unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` }
GetResponse: This is a JSON template for an app state resource.
func (*GetResponse) MarshalJSON ¶
func (s *GetResponse) MarshalJSON() ([]byte, error)
type ListResponse ¶
type ListResponse struct { // Items: The app state data. Items []*GetResponse `json:"items,omitempty"` // Kind: Uniquely identifies the type of this resource. Value is always // the fixed string appstate#listResponse. Kind string `json:"kind,omitempty"` // MaximumKeyCount: The maximum number of keys allowed for this user. MaximumKeyCount int64 `json:"maximumKeyCount,omitempty"` // ServerResponse contains the HTTP response code and headers from the // server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "Items") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` }
ListResponse: This is a JSON template to convert a list-response for app state.
func (*ListResponse) MarshalJSON ¶
func (s *ListResponse) MarshalJSON() ([]byte, error)
type Service ¶
type Service struct { BasePath string // API endpoint base URL UserAgent string // optional additional User-Agent fragment States *StatesService // contains filtered or unexported fields }
type StatesClearCall ¶
type StatesClearCall struct {
// contains filtered or unexported fields
}
func (*StatesClearCall) Context ¶
func (c *StatesClearCall) Context(ctx context.Context) *StatesClearCall
Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.
func (*StatesClearCall) CurrentDataVersion ¶
func (c *StatesClearCall) CurrentDataVersion(currentDataVersion string) *StatesClearCall
CurrentDataVersion sets the optional parameter "currentDataVersion": The version of the data to be cleared. Version strings are returned by the server.
func (*StatesClearCall) Do ¶
func (c *StatesClearCall) Do() (*WriteResult, error)
Do executes the "appstate.states.clear" call. Exactly one of *WriteResult or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *WriteResult.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*StatesClearCall) Fields ¶
func (c *StatesClearCall) Fields(s ...googleapi.Field) *StatesClearCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.
type StatesDeleteCall ¶
type StatesDeleteCall struct {
// contains filtered or unexported fields
}
func (*StatesDeleteCall) Context ¶
func (c *StatesDeleteCall) Context(ctx context.Context) *StatesDeleteCall
Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.
func (*StatesDeleteCall) Do ¶
func (c *StatesDeleteCall) Do() error
Do executes the "appstate.states.delete" call.
func (*StatesDeleteCall) Fields ¶
func (c *StatesDeleteCall) Fields(s ...googleapi.Field) *StatesDeleteCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.
type StatesGetCall ¶
type StatesGetCall struct {
// contains filtered or unexported fields
}
func (*StatesGetCall) Context ¶
func (c *StatesGetCall) Context(ctx context.Context) *StatesGetCall
Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.
func (*StatesGetCall) Do ¶
func (c *StatesGetCall) Do() (*GetResponse, error)
Do executes the "appstate.states.get" call. Exactly one of *GetResponse or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *GetResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*StatesGetCall) Fields ¶
func (c *StatesGetCall) Fields(s ...googleapi.Field) *StatesGetCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.
func (*StatesGetCall) IfNoneMatch ¶
func (c *StatesGetCall) IfNoneMatch(entityTag string) *StatesGetCall
IfNoneMatch sets the optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request. Use googleapi.IsNotModified to check whether the response error from Do is the result of In-None-Match.
type StatesListCall ¶
type StatesListCall struct {
// contains filtered or unexported fields
}
func (*StatesListCall) Context ¶
func (c *StatesListCall) Context(ctx context.Context) *StatesListCall
Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.
func (*StatesListCall) Do ¶
func (c *StatesListCall) Do() (*ListResponse, error)
Do executes the "appstate.states.list" call. Exactly one of *ListResponse or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *ListResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*StatesListCall) Fields ¶
func (c *StatesListCall) Fields(s ...googleapi.Field) *StatesListCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.
func (*StatesListCall) IfNoneMatch ¶
func (c *StatesListCall) IfNoneMatch(entityTag string) *StatesListCall
IfNoneMatch sets the optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request. Use googleapi.IsNotModified to check whether the response error from Do is the result of In-None-Match.
func (*StatesListCall) IncludeData ¶
func (c *StatesListCall) IncludeData(includeData bool) *StatesListCall
IncludeData sets the optional parameter "includeData": Whether to include the full data in addition to the version number
type StatesService ¶
type StatesService struct {
// contains filtered or unexported fields
}
func NewStatesService ¶
func NewStatesService(s *Service) *StatesService
func (*StatesService) Clear ¶
func (r *StatesService) Clear(stateKey int64) *StatesClearCall
Clear: Clears (sets to empty) the data for the passed key if and only if the passed version matches the currently stored version. This method results in a conflict error on version mismatch.
func (*StatesService) Delete ¶
func (r *StatesService) Delete(stateKey int64) *StatesDeleteCall
Delete: Deletes a key and the data associated with it. The key is removed and no longer counts against the key quota. Note that since this method is not safe in the face of concurrent modifications, it should only be used for development and testing purposes. Invoking this method in shipping code can result in data loss and data corruption.
func (*StatesService) Get ¶
func (r *StatesService) Get(stateKey int64) *StatesGetCall
Get: Retrieves the data corresponding to the passed key. If the key does not exist on the server, an HTTP 404 will be returned.
func (*StatesService) List ¶
func (r *StatesService) List() *StatesListCall
List: Lists all the states keys, and optionally the state data.
func (*StatesService) Update ¶
func (r *StatesService) Update(stateKey int64, updaterequest *UpdateRequest) *StatesUpdateCall
Update: Update the data associated with the input key if and only if the passed version matches the currently stored version. This method is safe in the face of concurrent writes. Maximum per-key size is 128KB.
type StatesUpdateCall ¶
type StatesUpdateCall struct {
// contains filtered or unexported fields
}
func (*StatesUpdateCall) Context ¶
func (c *StatesUpdateCall) Context(ctx context.Context) *StatesUpdateCall
Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.
func (*StatesUpdateCall) CurrentStateVersion ¶
func (c *StatesUpdateCall) CurrentStateVersion(currentStateVersion string) *StatesUpdateCall
CurrentStateVersion sets the optional parameter "currentStateVersion": The version of the app state your application is attempting to update. If this does not match the current version, this method will return a conflict error. If there is no data stored on the server for this key, the update will succeed irrespective of the value of this parameter.
func (*StatesUpdateCall) Do ¶
func (c *StatesUpdateCall) Do() (*WriteResult, error)
Do executes the "appstate.states.update" call. Exactly one of *WriteResult or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *WriteResult.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*StatesUpdateCall) Fields ¶
func (c *StatesUpdateCall) Fields(s ...googleapi.Field) *StatesUpdateCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.
type UpdateRequest ¶
type UpdateRequest struct { // Data: The new app state data that your application is trying to // update with. Data string `json:"data,omitempty"` // Kind: Uniquely identifies the type of this resource. Value is always // the fixed string appstate#updateRequest. Kind string `json:"kind,omitempty"` // ForceSendFields is a list of field names (e.g. "Data") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` }
UpdateRequest: This is a JSON template for a requests which update app state
func (*UpdateRequest) MarshalJSON ¶
func (s *UpdateRequest) MarshalJSON() ([]byte, error)
type WriteResult ¶
type WriteResult struct { // CurrentStateVersion: The version of the data for this key on the // server. CurrentStateVersion string `json:"currentStateVersion,omitempty"` // Kind: Uniquely identifies the type of this resource. Value is always // the fixed string appstate#writeResult. Kind string `json:"kind,omitempty"` // StateKey: The written key. StateKey int64 `json:"stateKey,omitempty"` // ServerResponse contains the HTTP response code and headers from the // server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "CurrentStateVersion") // to unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` }
WriteResult: This is a JSON template for an app state write result.
func (*WriteResult) MarshalJSON ¶
func (s *WriteResult) MarshalJSON() ([]byte, error)