public void Should_Return_Successfully_With_An_Impersonation_Key() { var postTokenPageSessionRequestModel = new PostIvrSessionRequestModel { AttributeValues = new System.Collections.Generic.Dictionary <string, string> { { "param1", "parameter value 1" }, { "param2", "parameter value 2" } }, PhoneNumber = "512-555-5555", Expiration = 10 }; bool success = _ivrSessionsApi.IvrSessionsPost(postTokenPageSessionRequestModel, TestApiSettings.ImpersonationAccountKey); // Should post successfully. Assert.IsTrue(success); }
/// <summary> /// Creates a temporary "session" with parameters so that the caller can be forwarded to the IVR service with this context. /// </summary> /// <exception cref="epay3.Web.Api.Sdk.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="postIvrSessionRequestModel">Contains the parameters for the "session".</param> /// <param name="impersonationAccountKey">The key that allows impersonation of another account for which the token is being created. Only specify a value if the account being impersonated is different from the account that is submitting this request. (optional, default to )</param> public bool IvrSessionsPost(PostIvrSessionRequestModel postIvrSessionRequestModel, string impersonationAccountKey = null) { // verify the required parameter 'postIvrSessionRequestModel' is set if (postIvrSessionRequestModel == null) { throw new ApiException(400, "Missing required parameter 'postIvrSessionRequestModel' when calling IvrSessionsApi->IvrSessionsPost"); } var localVarPath = "/api/v1/ivrSessions"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new Dictionary <String, String>(); var localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new Dictionary <String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { "application/json", "text/json", "application/xml", "text/xml", "application/x-www-form-urlencoded" }; String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json", "text/json", "application/xml", "text/xml" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); if (impersonationAccountKey != null) { localVarHeaderParams.Add("impersonationAccountKey", Configuration.ApiClient.ParameterToString(impersonationAccountKey)); // header parameter } if (postIvrSessionRequestModel.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(postIvrSessionRequestModel); // http body (model) parameter } else { localVarPostBody = postIvrSessionRequestModel; // byte array } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)Configuration.ApiClient.CallApi(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (localVarStatusCode >= 400) { throw new ApiException(localVarStatusCode, "Error calling IvrSessionsPost: " + localVarResponse.Content, localVarResponse.Content); } else if (localVarStatusCode == 0) { throw new ApiException(localVarStatusCode, "Error calling IvrSessionsPost: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); } return(true); }