api: google.golang.org/api/appstate/v1 Index | Files

package appstate

import "google.golang.org/api/appstate/v1"

Package appstate provides access to the Google App State API.

For product documentation, see: https://developers.google.com/games/services/web/api/states

Creating a client

Usage example:

import "google.golang.org/api/appstate/v1"
...
ctx := context.Background()
appstateService, err := appstate.NewService(ctx)

In this example, Google Application Default Credentials are used for authentication.

For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.

Other authentication options

To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:

appstateService, err := appstate.NewService(ctx, option.WithAPIKey("AIza..."))

To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:

config := &oauth2.Config{...}
// ...
token, err := config.Exchange(ctx, ...)
appstateService, err := appstate.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))

See https://godoc.org/google.golang.org/api/option/ for details on options.

Index

Package Files

appstate-gen.go

Constants

const (
    // View and manage your data for this application
    AppstateScope = "https://www.googleapis.com/auth/appstate"
)

OAuth2 scopes used by this API.

type GetResponse Uses

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:"-"`

    // NullFields is a list of field names (e.g. "CurrentStateVersion") to
    // include in API requests with the JSON null value. By default, fields
    // with empty values are omitted from API requests. However, any field
    // with an empty value appearing in NullFields will be sent to the
    // server as null. It is an error if a field in this list has a
    // non-empty value. This may be used to include null fields in Patch
    // requests.
    NullFields []string `json:"-"`
}

GetResponse: This is a JSON template for an app state resource.

func (*GetResponse) MarshalJSON Uses

func (s *GetResponse) MarshalJSON() ([]byte, error)

type ListResponse Uses

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:"-"`

    // NullFields is a list of field names (e.g. "Items") to include in API
    // requests with the JSON null value. By default, fields with empty
    // values are omitted from API requests. However, any field with an
    // empty value appearing in NullFields will be sent to the server as
    // null. It is an error if a field in this list has a non-empty value.
    // This may be used to include null fields in Patch requests.
    NullFields []string `json:"-"`
}

ListResponse: This is a JSON template to convert a list-response for app state.

func (*ListResponse) MarshalJSON Uses

func (s *ListResponse) MarshalJSON() ([]byte, error)

type Service Uses

type Service struct {
    BasePath  string // API endpoint base URL
    UserAgent string // optional additional User-Agent fragment

    States *StatesService
    // contains filtered or unexported fields
}

func New Uses

func New(client *http.Client) (*Service, error)

New creates a new Service. It uses the provided http.Client for requests.

Deprecated: please use NewService instead. To provide a custom HTTP client, use option.WithHTTPClient. If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.

func NewService Uses

func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error)

NewService creates a new Service.

type StatesClearCall Uses

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

func (*StatesClearCall) Context Uses

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 Uses

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 Uses

func (c *StatesClearCall) Do(opts ...googleapi.CallOption) (*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 Uses

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.

func (*StatesClearCall) Header Uses

func (c *StatesClearCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

type StatesDeleteCall Uses

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

func (*StatesDeleteCall) Context Uses

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 Uses

func (c *StatesDeleteCall) Do(opts ...googleapi.CallOption) error

Do executes the "appstate.states.delete" call.

func (*StatesDeleteCall) Fields Uses

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.

func (*StatesDeleteCall) Header Uses

func (c *StatesDeleteCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

type StatesGetCall Uses

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

func (*StatesGetCall) Context Uses

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 Uses

func (c *StatesGetCall) Do(opts ...googleapi.CallOption) (*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 Uses

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) Header Uses

func (c *StatesGetCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

func (*StatesGetCall) IfNoneMatch Uses

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 Uses

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

func (*StatesListCall) Context Uses

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 Uses

func (c *StatesListCall) Do(opts ...googleapi.CallOption) (*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 Uses

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) Header Uses

func (c *StatesListCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

func (*StatesListCall) IfNoneMatch Uses

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 Uses

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 Uses

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

func NewStatesService Uses

func NewStatesService(s *Service) *StatesService

func (*StatesService) Clear Uses

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 Uses

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 Uses

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 Uses

func (r *StatesService) List() *StatesListCall

List: Lists all the states keys, and optionally the state data.

func (*StatesService) Update Uses

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 Uses

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

func (*StatesUpdateCall) Context Uses

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 Uses

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 Uses

func (c *StatesUpdateCall) Do(opts ...googleapi.CallOption) (*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 Uses

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.

func (*StatesUpdateCall) Header Uses

func (c *StatesUpdateCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

type UpdateRequest Uses

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:"-"`

    // NullFields is a list of field names (e.g. "Data") to include in API
    // requests with the JSON null value. By default, fields with empty
    // values are omitted from API requests. However, any field with an
    // empty value appearing in NullFields will be sent to the server as
    // null. It is an error if a field in this list has a non-empty value.
    // This may be used to include null fields in Patch requests.
    NullFields []string `json:"-"`
}

UpdateRequest: This is a JSON template for a requests which update app state

func (*UpdateRequest) MarshalJSON Uses

func (s *UpdateRequest) MarshalJSON() ([]byte, error)

type WriteResult Uses

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:"-"`

    // NullFields is a list of field names (e.g. "CurrentStateVersion") to
    // include in API requests with the JSON null value. By default, fields
    // with empty values are omitted from API requests. However, any field
    // with an empty value appearing in NullFields will be sent to the
    // server as null. It is an error if a field in this list has a
    // non-empty value. This may be used to include null fields in Patch
    // requests.
    NullFields []string `json:"-"`
}

WriteResult: This is a JSON template for an app state write result.

func (*WriteResult) MarshalJSON Uses

func (s *WriteResult) MarshalJSON() ([]byte, error)

Package appstate imports 14 packages (graph). Updated 2019-07-18. Refresh now. Tools for package owners.