示例#1
0
        /// <summary>
        /// create
        /// </summary>
        ///
        /// <param name="options"> Create Service parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Service </returns>
        public static ServiceResource Create(CreateServiceOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
示例#2
0
        /// <summary>
        /// create
        /// </summary>
        ///
        /// <param name="friendlyName"> The friendly_name </param>
        /// <param name="apnCredentialSid"> The apn_credential_sid </param>
        /// <param name="gcmCredentialSid"> The gcm_credential_sid </param>
        /// <param name="messagingServiceSid"> The messaging_service_sid </param>
        /// <param name="facebookMessengerPageId"> The facebook_messenger_page_id </param>
        /// <param name="defaultApnNotificationProtocolVersion"> The default_apn_notification_protocol_version </param>
        /// <param name="defaultGcmNotificationProtocolVersion"> The default_gcm_notification_protocol_version </param>
        /// <param name="fcmCredentialSid"> The fcm_credential_sid </param>
        /// <param name="defaultFcmNotificationProtocolVersion"> The default_fcm_notification_protocol_version </param>
        /// <param name="logEnabled"> The log_enabled </param>
        /// <param name="alexaSkillId"> The alexa_skill_id </param>
        /// <param name="defaultAlexaNotificationProtocolVersion"> The default_alexa_notification_protocol_version </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Service </returns>
        public static ServiceResource Create(string friendlyName = null, string apnCredentialSid = null, string gcmCredentialSid = null, string messagingServiceSid = null, string facebookMessengerPageId = null, string defaultApnNotificationProtocolVersion = null, string defaultGcmNotificationProtocolVersion = null, string fcmCredentialSid = null, string defaultFcmNotificationProtocolVersion = null, bool?logEnabled = null, string alexaSkillId = null, string defaultAlexaNotificationProtocolVersion = null, ITwilioRestClient client = null)
        {
            var options = new CreateServiceOptions {
                FriendlyName = friendlyName, ApnCredentialSid = apnCredentialSid, GcmCredentialSid = gcmCredentialSid, MessagingServiceSid = messagingServiceSid, FacebookMessengerPageId = facebookMessengerPageId, DefaultApnNotificationProtocolVersion = defaultApnNotificationProtocolVersion, DefaultGcmNotificationProtocolVersion = defaultGcmNotificationProtocolVersion, FcmCredentialSid = fcmCredentialSid, DefaultFcmNotificationProtocolVersion = defaultFcmNotificationProtocolVersion, LogEnabled = logEnabled, AlexaSkillId = alexaSkillId, DefaultAlexaNotificationProtocolVersion = defaultAlexaNotificationProtocolVersion
            };

            return(Create(options, client));
        }
 private static Request BuildCreateRequest(CreateServiceOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Notify,
                "/v1/Services",
                postParams: options.GetParams()
                ));
 }
示例#4
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="friendlyName"> A string to describe the resource </param>
        /// <param name="apnCredentialSid"> The SID of the Credential to use for APN Bindings </param>
        /// <param name="gcmCredentialSid"> The SID of the Credential to use for GCM Bindings </param>
        /// <param name="messagingServiceSid"> The SID of the Messaging Service to use for SMS Bindings </param>
        /// <param name="facebookMessengerPageId"> Deprecated </param>
        /// <param name="defaultApnNotificationProtocolVersion"> The protocol version to use for sending APNS notifications
        ///                                             </param>
        /// <param name="defaultGcmNotificationProtocolVersion"> The protocol version to use for sending GCM notifications
        ///                                             </param>
        /// <param name="fcmCredentialSid"> The SID of the Credential to use for FCM Bindings </param>
        /// <param name="defaultFcmNotificationProtocolVersion"> The protocol version to use for sending FCM notifications
        ///                                             </param>
        /// <param name="logEnabled"> Whether to log notifications </param>
        /// <param name="alexaSkillId"> Deprecated </param>
        /// <param name="defaultAlexaNotificationProtocolVersion"> Deprecated </param>
        /// <param name="deliveryCallbackUrl"> Webhook URL </param>
        /// <param name="deliveryCallbackEnabled"> Enable delivery callbacks </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Service </returns>
        public static async System.Threading.Tasks.Task <ServiceResource> CreateAsync(string friendlyName            = null,
                                                                                      string apnCredentialSid        = null,
                                                                                      string gcmCredentialSid        = null,
                                                                                      string messagingServiceSid     = null,
                                                                                      string facebookMessengerPageId = null,
                                                                                      string defaultApnNotificationProtocolVersion = null,
                                                                                      string defaultGcmNotificationProtocolVersion = null,
                                                                                      string fcmCredentialSid = null,
                                                                                      string defaultFcmNotificationProtocolVersion = null,
                                                                                      bool?logEnabled     = null,
                                                                                      string alexaSkillId = null,
                                                                                      string defaultAlexaNotificationProtocolVersion = null,
                                                                                      string deliveryCallbackUrl   = null,
                                                                                      bool?deliveryCallbackEnabled = null,
                                                                                      ITwilioRestClient client     = null)
        {
            var options = new CreateServiceOptions()
            {
                FriendlyName = friendlyName, ApnCredentialSid = apnCredentialSid, GcmCredentialSid = gcmCredentialSid, MessagingServiceSid = messagingServiceSid, FacebookMessengerPageId = facebookMessengerPageId, DefaultApnNotificationProtocolVersion = defaultApnNotificationProtocolVersion, DefaultGcmNotificationProtocolVersion = defaultGcmNotificationProtocolVersion, FcmCredentialSid = fcmCredentialSid, DefaultFcmNotificationProtocolVersion = defaultFcmNotificationProtocolVersion, LogEnabled = logEnabled, AlexaSkillId = alexaSkillId, DefaultAlexaNotificationProtocolVersion = defaultAlexaNotificationProtocolVersion, DeliveryCallbackUrl = deliveryCallbackUrl, DeliveryCallbackEnabled = deliveryCallbackEnabled
            };

            return(await CreateAsync(options, client));
        }
示例#5
0
        /// <summary>
        /// create
        /// </summary>
        ///
        /// <param name="options"> Create Service parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Service </returns>
        public static async System.Threading.Tasks.Task <ServiceResource> CreateAsync(CreateServiceOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }