/// <summary> /// Create Subscription Invoke the provisioning API to get a dedicated mobile number for an account or application. Note that Free Trial apps will have a 30-Day Limit for their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. After the `expiryDate`, you may make another Provisioning call to extend the activeDays by another 30-Days. For paid apps, a provisioned number can be allotted for a maximum of 5 years. If a Provisioning call is made which will result to activeDays > 1825, a 409 `Active Days Max` response will be returned to indicate that the provisioned number is already valid for more than 5 years and that no update to activeDays has been made. /// </summary> /// <exception cref="Telstra.Messaging.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">A JSON payload containing the required attributes</param> /// <returns>ApiResponse of ProvisionNumberResponse</returns> public Telstra.Messaging.Client.ApiResponse <ProvisionNumberResponse> CreateSubscriptionWithHttpInfo(ProvisionNumberRequest body) { // verify the required parameter 'body' is set if (body == null) { throw new Telstra.Messaging.Client.ApiException(400, "Missing required parameter 'body' when calling ProvisioningApi->CreateSubscription"); } Telstra.Messaging.Client.RequestOptions localVarRequestOptions = new Telstra.Messaging.Client.RequestOptions(); String[] _contentTypes = new String[] { "application/json" }; // to determine the Accept header String[] _accepts = new String[] { "application/json" }; var localVarContentType = Telstra.Messaging.Client.ClientUtils.SelectHeaderContentType(_contentTypes); if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); } var localVarAccept = Telstra.Messaging.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) { localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); } localVarRequestOptions.Data = body; // authentication (auth) required // oauth required if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) { localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); } // make the HTTP request var localVarResponse = this.Client.Post <ProvisionNumberResponse>("/messages/provisioning/subscriptions", localVarRequestOptions, this.Configuration); if (this.ExceptionFactory != null) { Exception _exception = this.ExceptionFactory("CreateSubscription", localVarResponse); if (_exception != null) { throw _exception; } } return(localVarResponse); }
/// <summary> /// Create Subscription Invoke the provisioning API to get a dedicated mobile number for an account or application. Note that Free Trial apps will have a 30-Day Limit for their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. After the `expiryDate`, you may make another Provisioning call to extend the activeDays by another 30-Days. For paid apps, a provisioned number can be allotted for a maximum of 5 years. If a Provisioning call is made which will result to activeDays > 1825, a 409 `Active Days Max` response will be returned to indicate that the provisioned number is already valid for more than 5 years and that no update to activeDays has been made. /// </summary> /// <exception cref="Telstra.Messaging.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">A JSON payload containing the required attributes</param> /// <returns>Task of ApiResponse (ProvisionNumberResponse)</returns> public async System.Threading.Tasks.Task <Telstra.Messaging.Client.ApiResponse <ProvisionNumberResponse> > CreateSubscriptionAsyncWithHttpInfo(ProvisionNumberRequest body) { // verify the required parameter 'body' is set if (body == null) { throw new Telstra.Messaging.Client.ApiException(400, "Missing required parameter 'body' when calling ProvisioningApi->CreateSubscription"); } Telstra.Messaging.Client.RequestOptions localVarRequestOptions = new Telstra.Messaging.Client.RequestOptions(); String[] _contentTypes = new String[] { "application/json" }; // to determine the Accept header String[] _accepts = new String[] { "application/json" }; foreach (var _contentType in _contentTypes) { localVarRequestOptions.HeaderParameters.Add("Content-Type", _contentType); } foreach (var _accept in _accepts) { localVarRequestOptions.HeaderParameters.Add("Accept", _accept); } localVarRequestOptions.Data = body; // authentication (auth) required // oauth required if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) { localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); } // make the HTTP request var localVarResponse = await this.AsynchronousClient.PostAsync <ProvisionNumberResponse>("/messages/provisioning/subscriptions", localVarRequestOptions, this.Configuration); if (this.ExceptionFactory != null) { Exception _exception = this.ExceptionFactory("CreateSubscription", localVarResponse); if (_exception != null) { throw _exception; } } return(localVarResponse); }
/// <summary> /// Get Subscription Get mobile number subscription for an account /// </summary> /// <exception cref="Telstra.Messaging.Client.ApiException">Thrown when fails to make API call</exception> /// <returns>ApiResponse of GetSubscriptionResponse</returns> public Telstra.Messaging.Client.ApiResponse <GetSubscriptionResponse> GetSubscriptionWithHttpInfo() { Telstra.Messaging.Client.RequestOptions localVarRequestOptions = new Telstra.Messaging.Client.RequestOptions(); String[] _contentTypes = new String[] { }; // to determine the Accept header String[] _accepts = new String[] { "application/json" }; var localVarContentType = Telstra.Messaging.Client.ClientUtils.SelectHeaderContentType(_contentTypes); if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); } var localVarAccept = Telstra.Messaging.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) { localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); } // authentication (auth) required // oauth required if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) { localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); } // make the HTTP request var localVarResponse = this.Client.Get <GetSubscriptionResponse>("/messages/provisioning/subscriptions", localVarRequestOptions, this.Configuration); if (this.ExceptionFactory != null) { Exception _exception = this.ExceptionFactory("GetSubscription", localVarResponse); if (_exception != null) { throw _exception; } } return(localVarResponse); }
/// <summary> /// Get Subscription Get mobile number subscription for an account /// </summary> /// <exception cref="Telstra.Messaging.Client.ApiException">Thrown when fails to make API call</exception> /// <returns>Task of ApiResponse (GetSubscriptionResponse)</returns> public async System.Threading.Tasks.Task <Telstra.Messaging.Client.ApiResponse <GetSubscriptionResponse> > GetSubscriptionAsyncWithHttpInfo() { Telstra.Messaging.Client.RequestOptions localVarRequestOptions = new Telstra.Messaging.Client.RequestOptions(); String[] _contentTypes = new String[] { }; // to determine the Accept header String[] _accepts = new String[] { "application/json" }; foreach (var _contentType in _contentTypes) { localVarRequestOptions.HeaderParameters.Add("Content-Type", _contentType); } foreach (var _accept in _accepts) { localVarRequestOptions.HeaderParameters.Add("Accept", _accept); } // authentication (auth) required // oauth required if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) { localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); } // make the HTTP request var localVarResponse = await this.AsynchronousClient.GetAsync <GetSubscriptionResponse>("/messages/provisioning/subscriptions", localVarRequestOptions, this.Configuration); if (this.ExceptionFactory != null) { Exception _exception = this.ExceptionFactory("GetSubscription", localVarResponse); if (_exception != null) { throw _exception; } } return(localVarResponse); }
/// <summary> /// Generate OAuth2 token To generate an OAuth2 Authentication token, pass through your `Client key` and `Client secret` that you received when you registered for the **API Free Trial** Product. The grant_type should be left as `client_credentials` and the scope as `NSMS`. The token will expire in one hour. /// </summary> /// <exception cref="Telstra.Messaging.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="clientId"></param> /// <param name="clientSecret"></param> /// <param name="grantType"></param> /// <param name="scope">NSMS (optional)</param> /// <returns>Task of ApiResponse (OAuthResponse)</returns> public async System.Threading.Tasks.Task <Telstra.Messaging.Client.ApiResponse <OAuthResponse> > AuthTokenAsyncWithHttpInfo(string clientId, string clientSecret, string grantType, string scope = default(string)) { // verify the required parameter 'clientId' is set if (clientId == null) { throw new Telstra.Messaging.Client.ApiException(400, "Missing required parameter 'clientId' when calling AuthenticationApi->AuthToken"); } // verify the required parameter 'clientSecret' is set if (clientSecret == null) { throw new Telstra.Messaging.Client.ApiException(400, "Missing required parameter 'clientSecret' when calling AuthenticationApi->AuthToken"); } // verify the required parameter 'grantType' is set if (grantType == null) { throw new Telstra.Messaging.Client.ApiException(400, "Missing required parameter 'grantType' when calling AuthenticationApi->AuthToken"); } Telstra.Messaging.Client.RequestOptions localVarRequestOptions = new Telstra.Messaging.Client.RequestOptions(); String[] _contentTypes = new String[] { "application/x-www-form-urlencoded" }; // to determine the Accept header String[] _accepts = new String[] { "application/json" }; foreach (var _contentType in _contentTypes) { localVarRequestOptions.HeaderParameters.Add("Content-Type", _contentType); } foreach (var _accept in _accepts) { localVarRequestOptions.HeaderParameters.Add("Accept", _accept); } if (clientId != null) { localVarRequestOptions.FormParameters.Add("client_id", Telstra.Messaging.Client.ClientUtils.ParameterToString(clientId)); // form parameter } if (clientSecret != null) { localVarRequestOptions.FormParameters.Add("client_secret", Telstra.Messaging.Client.ClientUtils.ParameterToString(clientSecret)); // form parameter } if (grantType != null) { localVarRequestOptions.FormParameters.Add("grant_type", Telstra.Messaging.Client.ClientUtils.ParameterToString(grantType)); // form parameter } if (scope != null) { localVarRequestOptions.FormParameters.Add("scope", Telstra.Messaging.Client.ClientUtils.ParameterToString(scope)); // form parameter } // make the HTTP request var localVarResponse = await this.AsynchronousClient.PostAsync <OAuthResponse>("/oauth/token", localVarRequestOptions, this.Configuration); if (this.ExceptionFactory != null) { Exception _exception = this.ExceptionFactory("AuthToken", localVarResponse); if (_exception != null) { throw _exception; } } return(localVarResponse); }