Esempio n. 1
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="type"> Credential type, one of "gcm", "fcm", or "apn" </param>
        /// <param name="friendlyName"> Friendly name for stored credential </param>
        /// <param name="certificate"> [APN only] URL encoded representation of the certificate, e. </param>
        /// <param name="privateKey"> [APN only] URL encoded representation of the private key, e. </param>
        /// <param name="sandbox"> [APN only] use this credential for sending to production or sandbox APNs </param>
        /// <param name="apiKey"> [GCM only] This is the "API key" for project from Google Developer console for your GCM
        ///              Service application credential </param>
        /// <param name="secret"> [FCM only] This is the "Server key" of your project from Firebase console under Settings /
        ///              Cloud messaging. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Credential </returns>
        public static CredentialResource Create(CredentialResource.PushServiceEnum type,
                                                string friendlyName      = null,
                                                string certificate       = null,
                                                string privateKey        = null,
                                                bool?sandbox             = null,
                                                string apiKey            = null,
                                                string secret            = null,
                                                ITwilioRestClient client = null)
        {
            var options = new CreateCredentialOptions(type)
            {
                FriendlyName = friendlyName, Certificate = certificate, PrivateKey = privateKey, Sandbox = sandbox, ApiKey = apiKey, Secret = secret
            };

            return(Create(options, client));
        }
 /// <summary>
 /// create
 /// </summary>
 /// <param name="options"> Create 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> CreateAsync(CreateCredentialOptions options, 
                                                                                 ITwilioRestClient client = null)
 {
     client = client ?? TwilioClient.GetRestClient();
     var response = await client.RequestAsync(BuildCreateRequest(options, client));
     return FromJson(response.Content);
 }
 /// <summary>
 /// create
 /// </summary>
 /// <param name="options"> Create Credential parameters </param>
 /// <param name="client"> Client to make requests to Twilio </param>
 /// <returns> A single instance of Credential </returns> 
 public static CredentialResource Create(CreateCredentialOptions options, ITwilioRestClient client = null)
 {
     client = client ?? TwilioClient.GetRestClient();
     var response = client.Request(BuildCreateRequest(options, client));
     return FromJson(response.Content);
 }