/// <summary> /// create /// </summary> /// <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> CreateAsync(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(await CreateAsync(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)); }