Exemple #1
0
        /// <summary>
        /// Update a RemoteConfig. We treat this as an always-existingresource (when it is not found in our data store, we treat it as version0, a template with zero conditions and zero parameters). Hence there areno Create or Delete operations. Returns the updated template whensuccessful (and the updated eTag as a response header), or an error ifthings go wrong.Possible error messages:* VALIDATION_ERROR (HTTP status 400) with additional details if thetemplate being passed in can not be validated.* AUTHENTICATION_ERROR (HTTP status 401) if the request can not beauthenticate (e.g. no access token, or invalid access token).* AUTHORIZATION_ERROR (HTTP status 403) if the request can not beauthorized (e.g. the user has no access to the specified project id).* VERSION_MISMATCH (HTTP status 412) when trying to update when theexpected eTag (passed in via the "If-match" header) is not specified, oris specified but does does not match the current eTag.* Internal error (HTTP status 500) for Database problems or other internalerrors.
        /// Documentation https://developers.google.com/firebaseremoteconfig/v1/reference/projects/updateRemoteConfig
        /// 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 Firebaseremoteconfig service.</param>
        /// <param name="project">The GMP project identifier. Required.See note at the beginning of this file regarding project ids.</param>
        /// <param name="body">A valid Firebaseremoteconfig v1 body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>RemoteConfigResponse</returns>
        public static RemoteConfig UpdateRemoteConfig(FirebaseremoteconfigService service, string project, RemoteConfig body, ProjectsUpdateRemoteConfigOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }

                // Building the initial request.
                var request = service.Projects.UpdateRemoteConfig(body, project);

                // Applying optional parameters to the request.
                request = (ProjectsResource.UpdateRemoteConfigRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Projects.UpdateRemoteConfig failed.", ex);
            }
        }
Exemple #2
0
        /// <summary>
        /// Get the latest version Remote Configuration for a project.Returns the RemoteConfig as the payload, and also the eTag as aresponse header.
        /// Documentation https://developers.google.com/firebaseremoteconfig/v1/reference/projects/getRemoteConfig
        /// 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 Firebaseremoteconfig service.</param>
        /// <param name="project">The GMP project identifier. Required.See note at the beginning of this file regarding project ids.</param>
        /// <returns>RemoteConfigResponse</returns>
        public static RemoteConfig GetRemoteConfig(FirebaseremoteconfigService service, string project)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }

                // Make the request.
                return(service.Projects.GetRemoteConfig(project).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Projects.GetRemoteConfig failed.", ex);
            }
        }