/// <summary> /// 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. /// Documentation https://developers.google.com/appstate/v1/reference/states/clear /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated Appstate service.</param> /// <param name="stateKey">The key for the data to be retrieved.</param> /// <param name="optional">Optional paramaters.</param> /// <returns>WriteResultResponse</returns> public static WriteResult Clear(AppstateService service, int?stateKey, StatesClearOptionalParms optional = null) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (stateKey == null) { throw new ArgumentNullException(stateKey); } // Building the initial request. var request = service.States.Clear(stateKey); // Applying optional parameters to the request. request = (StatesResource.ClearRequest)SampleHelpers.ApplyOptionalParms(request, optional); // Requesting data. return(request.Execute()); } catch (Exception ex) { throw new Exception("Request States.Clear failed.", ex); } }
/// <summary> /// Retrieves the data corresponding to the passed key. If the key does not exist on the server, an HTTP 404 will be returned. /// Documentation https://developers.google.com/appstate/v1/reference/states/get /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated Appstate service.</param> /// <param name="stateKey">The key for the data to be retrieved.</param> /// <returns>GetResponseResponse</returns> public static GetResponse Get(AppstateService service, int?stateKey) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (stateKey == null) { throw new ArgumentNullException(stateKey); } // Make the request. return(service.States.Get(stateKey).Execute()); } catch (Exception ex) { throw new Exception("Request States.Get failed.", ex); } }
/// <summary> /// 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. /// Documentation https://developers.google.com/appstate/v1/reference/states/delete /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated Appstate service.</param> /// <param name="stateKey">The key for the data to be retrieved.</param> public static void Delete(AppstateService service, int?stateKey) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (stateKey == null) { throw new ArgumentNullException(stateKey); } // Make the request. service.States.Delete(stateKey).Execute(); } catch (Exception ex) { throw new Exception("Request States.Delete failed.", ex); } }
/// <summary> /// Lists all the states keys, and optionally the state data. /// Documentation https://developers.google.com/appstate/v1/reference/states/list /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated Appstate service.</param> /// <param name="optional">Optional paramaters.</param> /// <returns>ListResponseResponse</returns> public static ListResponse List(AppstateService service, StatesListOptionalParms optional = null) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } // Building the initial request. var request = service.States.List(); // Applying optional parameters to the request. request = (StatesResource.ListRequest)SampleHelpers.ApplyOptionalParms(request, optional); // Requesting data. return(request.Execute()); } catch (Exception ex) { throw new Exception("Request States.List failed.", ex); } }