Beispiel #1
0
        /// <summary>
        /// Update an existing push notification credential on your account
        /// </summary>
        /// <param name="options"> Update Credential parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Credential </returns>
        public static CredentialResource Update(UpdateCredentialOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildUpdateRequest(options, client));

            return(FromJson(response.Content));
        }
Beispiel #2
0
 private static Request BuildUpdateRequest(UpdateCredentialOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Conversations,
                "/v1/Credentials/" + options.PathSid + "",
                postParams: options.GetParams(),
                headerParams: null
                ));
 }
Beispiel #3
0
        /// <summary>
        /// Update an existing push notification credential on your account
        /// </summary>
        /// <param name="pathSid"> A 34 character string that uniquely identifies this resource. </param>
        /// <param name="type"> The type of push-notification service the credential is for. </param>
        /// <param name="friendlyName"> A string to describe the resource </param>
        /// <param name="certificate"> [APN only] The URL encoded representation of the certificate. </param>
        /// <param name="privateKey"> [APN only] The URL encoded representation of the private key. </param>
        /// <param name="sandbox"> [APN only] Whether to send the credential to sandbox APNs. </param>
        /// <param name="apiKey"> [GCM only] The API key for the project that was obtained from the Google Developer console
        ///              for your GCM Service application credential. </param>
        /// <param name="secret"> [FCM only] The Server key of your project from Firebase console. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Credential </returns>
        public static async System.Threading.Tasks.Task <CredentialResource> UpdateAsync(string pathSid,
                                                                                         CredentialResource.PushTypeEnum type = null,
                                                                                         string friendlyName      = null,
                                                                                         string certificate       = null,
                                                                                         string privateKey        = null,
                                                                                         bool?sandbox             = null,
                                                                                         string apiKey            = null,
                                                                                         string secret            = null,
                                                                                         ITwilioRestClient client = null)
        {
            var options = new UpdateCredentialOptions(pathSid)
            {
                Type = type, FriendlyName = friendlyName, Certificate = certificate, PrivateKey = privateKey, Sandbox = sandbox, ApiKey = apiKey, Secret = secret
            };

            return(await UpdateAsync(options, client));
        }
Beispiel #4
0
        /// <summary>
        /// Update an existing push notification credential on your account
        /// </summary>
        /// <param name="options"> Update Credential parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Credential </returns>
        public static async System.Threading.Tasks.Task <CredentialResource> UpdateAsync(UpdateCredentialOptions options,
                                                                                         ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildUpdateRequest(options, client));

            return(FromJson(response.Content));
        }