diff --git a/README.md b/README.md index 66fd074..b4a87f1 100644 --- a/README.md +++ b/README.md @@ -31,13 +31,13 @@ Install-Package JsonSubTypes ## Installation ``` # Package Manager -Install-Package PostFinanceCheckout -Version 7.0.0 +Install-Package PostFinanceCheckout -Version 7.0.1 # .NET CLI -dotnet add package PostFinanceCheckout --version 7.0.0 +dotnet add package PostFinanceCheckout --version 7.0.1 # Paket CLI -paket add PostFinanceCheckout --version 7.0.0 +paket add PostFinanceCheckout --version 7.0.1 # PackageReference - + ``` Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces: diff --git a/src/PostFinanceCheckout/Client/ApiClient.cs b/src/PostFinanceCheckout/Client/ApiClient.cs index 12f59cc..707b8c4 100644 --- a/src/PostFinanceCheckout/Client/ApiClient.cs +++ b/src/PostFinanceCheckout/Client/ApiClient.cs @@ -124,6 +124,11 @@ private RestRequest PrepareRequest( request.AddBody(postBody, contentType); } + if (contentType != null) + { + request.AddHeader("Content-Type", contentType); + } + return request; } @@ -148,7 +153,7 @@ public Object CallApi( { Dictionary defaultHeaderParams = new Dictionary() { - {"x-meta-sdk-version", "7.0.0"}, + {"x-meta-sdk-version", "7.0.1"}, {"x-meta-sdk-language", "csharp"}, {"x-meta-sdk-provider", "PostFinance Checkout"}, {"x-meta-sdk-language-version", Environment.Version.ToString()} @@ -540,7 +545,7 @@ private String ToQueryString(List> queryParams) List query = new List(); foreach (var param in queryParams) { - query.Add(param.Key + "=" + param.Value); + query.Add(param.Key + "=" + HttpUtility.UrlEncode(param.Value)); } return "?" + string.Join("&", query.ToArray()); } diff --git a/src/PostFinanceCheckout/Client/Configuration.cs b/src/PostFinanceCheckout/Client/Configuration.cs index 0141447..5803b8d 100644 --- a/src/PostFinanceCheckout/Client/Configuration.cs +++ b/src/PostFinanceCheckout/Client/Configuration.cs @@ -21,7 +21,7 @@ public class Configuration : IReadableConfiguration /// Version of the package. /// /// Version of the package. - public const string Version = "7.0.0"; + public const string Version = "7.0.1"; /// /// Identifier for ISO 8601 DateTime Format @@ -94,7 +94,7 @@ public Configuration(string applicationUserID, string authenticationKey, RestCli _authenticationKey = authenticationKey; _applicationUserID = applicationUserID; _restClientOptions = restClientOptions; - UserAgent = "PostFinanceCheckout/7.0.0/csharp"; + UserAgent = "PostFinanceCheckout/7.0.1/csharp"; BasePath = "https://checkout.postfinance.ch:443/api"; DefaultHeader = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); @@ -355,8 +355,8 @@ public static String ToDebugReport() String report = "C# SDK (PostFinanceCheckout) Debug Report:\n"; report += " OS: " + System.Environment.OSVersion + "\n"; report += " .NET Framework Version: " + System.Environment.Version + "\n"; - report += " Version of the API: 7.0.0\n"; - report += " SDK Package Version: 7.0.0\n"; + report += " Version of the API: 7.0.1\n"; + report += " SDK Package Version: 7.0.1\n"; return report; } diff --git a/src/PostFinanceCheckout/Model/AbstractPaymentLinkUpdate.cs b/src/PostFinanceCheckout/Model/AbstractPaymentLinkUpdate.cs index fa8af0d..27410c0 100644 --- a/src/PostFinanceCheckout/Model/AbstractPaymentLinkUpdate.cs +++ b/src/PostFinanceCheckout/Model/AbstractPaymentLinkUpdate.cs @@ -83,9 +83,9 @@ public AbstractPaymentLinkUpdate() public string Language { get; set; } /// - /// The line items allows to define the line items for this payment link. When the line items are defined they cannot be overridden through the request parameters. + /// The line items allows to define the line items for this payment link. When the line items are defined they cannot be overridden through the request parameters. If no amount for the payment link is defined, the additional checkout page to enter the amount is shown to the consumer. /// - /// The line items allows to define the line items for this payment link. When the line items are defined they cannot be overridden through the request parameters. + /// The line items allows to define the line items for this payment link. When the line items are defined they cannot be overridden through the request parameters. If no amount for the payment link is defined, the additional checkout page to enter the amount is shown to the consumer. [DataMember(Name="lineItems", EmitDefaultValue=false)] public List LineItems { get; set; } diff --git a/src/PostFinanceCheckout/Model/CardAuthenticationResponse.cs b/src/PostFinanceCheckout/Model/CardAuthenticationResponse.cs index 8d78330..87c1e24 100644 --- a/src/PostFinanceCheckout/Model/CardAuthenticationResponse.cs +++ b/src/PostFinanceCheckout/Model/CardAuthenticationResponse.cs @@ -24,34 +24,34 @@ public enum CardAuthenticationResponse { /// - /// Enum ENROLLMENT_VERIFICATION_ERROR for value: ENROLLMENT_VERIFICATION_ERROR + /// Enum FULLY_AUTHENTICATED for value: FULLY_AUTHENTICATED /// - [EnumMember(Value = "ENROLLMENT_VERIFICATION_ERROR")] - ENROLLMENT_VERIFICATION_ERROR, + [EnumMember(Value = "FULLY_AUTHENTICATED")] + FULLY_AUTHENTICATED, /// - /// Enum NOT_ENROLLED for value: NOT_ENROLLED + /// Enum AUTHENTICATION_NOT_REQUIRED for value: AUTHENTICATION_NOT_REQUIRED /// - [EnumMember(Value = "NOT_ENROLLED")] - NOT_ENROLLED, + [EnumMember(Value = "AUTHENTICATION_NOT_REQUIRED")] + AUTHENTICATION_NOT_REQUIRED, /// - /// Enum AUTHENTICATION_ERROR for value: AUTHENTICATION_ERROR + /// Enum NOT_ENROLLED for value: NOT_ENROLLED /// - [EnumMember(Value = "AUTHENTICATION_ERROR")] - AUTHENTICATION_ERROR, + [EnumMember(Value = "NOT_ENROLLED")] + NOT_ENROLLED, /// - /// Enum AUTHENTICATION_NOT_REQUIRED for value: AUTHENTICATION_NOT_REQUIRED + /// Enum ENROLLMENT_ERROR for value: ENROLLMENT_ERROR /// - [EnumMember(Value = "AUTHENTICATION_NOT_REQUIRED")] - AUTHENTICATION_NOT_REQUIRED, + [EnumMember(Value = "ENROLLMENT_ERROR")] + ENROLLMENT_ERROR, /// - /// Enum FULLY_AUTHENTICATED for value: FULLY_AUTHENTICATED + /// Enum AUTHENTICATION_ERROR for value: AUTHENTICATION_ERROR /// - [EnumMember(Value = "FULLY_AUTHENTICATED")] - FULLY_AUTHENTICATED + [EnumMember(Value = "AUTHENTICATION_ERROR")] + AUTHENTICATION_ERROR } } diff --git a/src/PostFinanceCheckout/Model/PaymentContract.cs b/src/PostFinanceCheckout/Model/PaymentContract.cs index 05ba2c6..1d30c35 100644 --- a/src/PostFinanceCheckout/Model/PaymentContract.cs +++ b/src/PostFinanceCheckout/Model/PaymentContract.cs @@ -85,6 +85,13 @@ public PaymentContract() [DataMember(Name="id", EmitDefaultValue=false)] public long? Id { get; private set; } + /// + /// The date and time when the object was last modified. + /// + /// The date and time when the object was last modified. + [DataMember(Name="lastModifiedDate", EmitDefaultValue=false)] + public DateTime? LastModifiedDate { get; private set; } + /// /// Gets or Sets RejectedOn /// @@ -139,6 +146,7 @@ public override string ToString() sb.Append(" CreatedOn: ").Append(CreatedOn).Append("\n"); sb.Append(" ExternalId: ").Append(ExternalId).Append("\n"); sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" LastModifiedDate: ").Append(LastModifiedDate).Append("\n"); sb.Append(" RejectedOn: ").Append(RejectedOn).Append("\n"); sb.Append(" RejectionReason: ").Append(RejectionReason).Append("\n"); sb.Append(" StartTerminatingOn: ").Append(StartTerminatingOn).Append("\n"); @@ -220,6 +228,11 @@ public bool Equals(PaymentContract input) (this.Id != null && this.Id.Equals(input.Id)) ) && + ( + this.LastModifiedDate == input.LastModifiedDate || + (this.LastModifiedDate != null && + this.LastModifiedDate.Equals(input.LastModifiedDate)) + ) && ( this.RejectedOn == input.RejectedOn || (this.RejectedOn != null && @@ -282,6 +295,8 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ExternalId.GetHashCode(); if (this.Id != null) hashCode = hashCode * 59 + this.Id.GetHashCode(); + if (this.LastModifiedDate != null) + hashCode = hashCode * 59 + this.LastModifiedDate.GetHashCode(); if (this.RejectedOn != null) hashCode = hashCode * 59 + this.RejectedOn.GetHashCode(); if (this.RejectionReason != null) diff --git a/src/PostFinanceCheckout/Model/PaymentLink.cs b/src/PostFinanceCheckout/Model/PaymentLink.cs index 3ba0ff1..b52afb0 100644 --- a/src/PostFinanceCheckout/Model/PaymentLink.cs +++ b/src/PostFinanceCheckout/Model/PaymentLink.cs @@ -110,9 +110,9 @@ public PaymentLink() public string Language { get; private set; } /// - /// The line items allows to define the line items for this payment link. When the line items are defined they cannot be overridden through the request parameters. + /// The line items allows to define the line items for this payment link. When the line items are defined they cannot be overridden through the request parameters. If no amount for the payment link is defined, the additional checkout page to enter the amount is shown to the consumer. /// - /// The line items allows to define the line items for this payment link. When the line items are defined they cannot be overridden through the request parameters. + /// The line items allows to define the line items for this payment link. When the line items are defined they cannot be overridden through the request parameters. If no amount for the payment link is defined, the additional checkout page to enter the amount is shown to the consumer. [DataMember(Name="lineItems", EmitDefaultValue=false)] public List LineItems { get; private set; } diff --git a/src/PostFinanceCheckout/Model/PaymentLinkUpdate.cs b/src/PostFinanceCheckout/Model/PaymentLinkUpdate.cs index 04a20d8..dd07260 100644 --- a/src/PostFinanceCheckout/Model/PaymentLinkUpdate.cs +++ b/src/PostFinanceCheckout/Model/PaymentLinkUpdate.cs @@ -116,9 +116,9 @@ public PaymentLinkUpdate(long? id, long? version) public string Language { get; set; } /// - /// The line items allows to define the line items for this payment link. When the line items are defined they cannot be overridden through the request parameters. + /// The line items allows to define the line items for this payment link. When the line items are defined they cannot be overridden through the request parameters. If no amount for the payment link is defined, the additional checkout page to enter the amount is shown to the consumer. /// - /// The line items allows to define the line items for this payment link. When the line items are defined they cannot be overridden through the request parameters. + /// The line items allows to define the line items for this payment link. When the line items are defined they cannot be overridden through the request parameters. If no amount for the payment link is defined, the additional checkout page to enter the amount is shown to the consumer. [DataMember(Name="lineItems", EmitDefaultValue=false)] public List LineItems { get; set; } diff --git a/src/PostFinanceCheckout/Model/WebAppConfirmationRequest.cs b/src/PostFinanceCheckout/Model/WebAppConfirmationRequest.cs new file mode 100644 index 0000000..f4ea505 --- /dev/null +++ b/src/PostFinanceCheckout/Model/WebAppConfirmationRequest.cs @@ -0,0 +1,104 @@ +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using SwaggerDateConverter = PostFinanceCheckout.Client.SwaggerDateConverter; + +namespace PostFinanceCheckout.Model +{ + /// + /// WebAppConfirmationRequest + /// + [DataContract] + public partial class WebAppConfirmationRequest : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + public WebAppConfirmationRequest() + { + } + + /// + /// The user returns to the web app after granting the permission. The HTTP request contains the code. Provide it here to confirm the web app installation. + /// + /// The user returns to the web app after granting the permission. The HTTP request contains the code. Provide it here to confirm the web app installation. + [DataMember(Name="code", EmitDefaultValue=false)] + public string Code { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class WebAppConfirmationRequest {\n"); + sb.Append(" Code: ").Append(Code).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as WebAppConfirmationRequest); + } + + /// + /// Returns true if WebAppConfirmationRequest instances are equal + /// + /// Instance of WebAppConfirmationRequest to be compared + /// Boolean + public bool Equals(WebAppConfirmationRequest input) + { + if (input == null) + return false; + + return + ( + this.Code == input.Code || + (this.Code != null && + this.Code.Equals(input.Code)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Code != null) + hashCode = hashCode * 59 + this.Code.GetHashCode(); + return hashCode; + } + } + + } + +} diff --git a/src/PostFinanceCheckout/Model/WebAppConfirmationResponse.cs b/src/PostFinanceCheckout/Model/WebAppConfirmationResponse.cs new file mode 100644 index 0000000..f15fc71 --- /dev/null +++ b/src/PostFinanceCheckout/Model/WebAppConfirmationResponse.cs @@ -0,0 +1,165 @@ +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using SwaggerDateConverter = PostFinanceCheckout.Client.SwaggerDateConverter; + +namespace PostFinanceCheckout.Model +{ + /// + /// The confirmation response provides the details about the installation of the web app. + /// + [DataContract] + public partial class WebAppConfirmationResponse : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + public WebAppConfirmationResponse() + { + } + + /// + /// The access code grants permissions to the web service API according to the OAuth standard. + /// + /// The access code grants permissions to the web service API according to the OAuth standard. + [DataMember(Name="access_token", EmitDefaultValue=false)] + public string AccessToken { get; private set; } + + /// + /// The scope contains the permissions granted to the web app within the space. + /// + /// The scope contains the permissions granted to the web app within the space. + [DataMember(Name="scope", EmitDefaultValue=false)] + public string Scope { get; private set; } + + /// + /// This is the space into which the web app is installed into. + /// + /// This is the space into which the web app is installed into. + [DataMember(Name="space", EmitDefaultValue=false)] + public Space Space { get; private set; } + + /// + /// The state contains the state parameter content provided when initiating the app installation. + /// + /// The state contains the state parameter content provided when initiating the app installation. + [DataMember(Name="state", EmitDefaultValue=false)] + public string State { get; private set; } + + /// + /// The token type indicates the type of the access token. The type determines the authentication mechanism to use for accessing the web service API. + /// + /// The token type indicates the type of the access token. The type determines the authentication mechanism to use for accessing the web service API. + [DataMember(Name="token_type", EmitDefaultValue=false)] + public string TokenType { get; private set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class WebAppConfirmationResponse {\n"); + sb.Append(" AccessToken: ").Append(AccessToken).Append("\n"); + sb.Append(" Scope: ").Append(Scope).Append("\n"); + sb.Append(" Space: ").Append(Space).Append("\n"); + sb.Append(" State: ").Append(State).Append("\n"); + sb.Append(" TokenType: ").Append(TokenType).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as WebAppConfirmationResponse); + } + + /// + /// Returns true if WebAppConfirmationResponse instances are equal + /// + /// Instance of WebAppConfirmationResponse to be compared + /// Boolean + public bool Equals(WebAppConfirmationResponse input) + { + if (input == null) + return false; + + return + ( + this.AccessToken == input.AccessToken || + (this.AccessToken != null && + this.AccessToken.Equals(input.AccessToken)) + ) && + ( + this.Scope == input.Scope || + (this.Scope != null && + this.Scope.Equals(input.Scope)) + ) && + ( + this.Space == input.Space || + (this.Space != null && + this.Space.Equals(input.Space)) + ) && + ( + this.State == input.State || + (this.State != null && + this.State.Equals(input.State)) + ) && + ( + this.TokenType == input.TokenType || + (this.TokenType != null && + this.TokenType.Equals(input.TokenType)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.AccessToken != null) + hashCode = hashCode * 59 + this.AccessToken.GetHashCode(); + if (this.Scope != null) + hashCode = hashCode * 59 + this.Scope.GetHashCode(); + if (this.Space != null) + hashCode = hashCode * 59 + this.Space.GetHashCode(); + if (this.State != null) + hashCode = hashCode * 59 + this.State.GetHashCode(); + if (this.TokenType != null) + hashCode = hashCode * 59 + this.TokenType.GetHashCode(); + return hashCode; + } + } + + } + +} diff --git a/src/PostFinanceCheckout/PostFinanceCheckout.csproj b/src/PostFinanceCheckout/PostFinanceCheckout.csproj index d328124..320bac7 100644 --- a/src/PostFinanceCheckout/PostFinanceCheckout.csproj +++ b/src/PostFinanceCheckout/PostFinanceCheckout.csproj @@ -20,12 +20,12 @@ PostFinanceCheckout https://www.apache.org/licenses/LICENSE-2.0.txt https://github.com/pfpayments/csharp-sdk - 7.0.0 - 7.0.0 + 7.0.1 + 7.0.1 PostFinanceCheckout;payment;sdk;Payment Integration Library customweb - 7.0.0 + 7.0.1 git https://github.com/pfpayments/csharp-sdk.git PostFinanceCheckout diff --git a/src/PostFinanceCheckout/Service/WebAppService.cs b/src/PostFinanceCheckout/Service/WebAppService.cs new file mode 100644 index 0000000..2e9e1be --- /dev/null +++ b/src/PostFinanceCheckout/Service/WebAppService.cs @@ -0,0 +1,331 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using RestSharp; +using PostFinanceCheckout.Client; +using PostFinanceCheckout.Model; + +namespace PostFinanceCheckout.Service +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IWebAppService : IApiAccessor + { + #region Synchronous Operations + /// + /// Check Installation + /// + /// + /// This operation returns true when the app is installed in given space. The web app is implied by the client ID resp. user ID that is been used to invoke this operation. + /// + /// Thrown when fails to make API call + /// This parameter identifies the space which should be checked if the web app is installed. + /// bool? + bool? CheckInstallation (long? spaceId); + + /// + /// Check Installation + /// + /// + /// This operation returns true when the app is installed in given space. The web app is implied by the client ID resp. user ID that is been used to invoke this operation. + /// + /// Thrown when fails to make API call + /// This parameter identifies the space which should be checked if the web app is installed. + /// ApiResponse of bool? + ApiResponse CheckInstallationWithHttpInfo (long? spaceId); + /// + /// Confirm + /// + /// + /// This operation confirms the app installation. This method has to be invoked after the user returns to the web app. The request of the user will contain the code as a request parameter. The web app is implied by the client ID resp. user ID that is been used to invoke this operation. + /// + /// Thrown when fails to make API call + /// + /// WebAppConfirmationResponse + WebAppConfirmationResponse Confirm (WebAppConfirmationRequest request); + + /// + /// Confirm + /// + /// + /// This operation confirms the app installation. This method has to be invoked after the user returns to the web app. The request of the user will contain the code as a request parameter. The web app is implied by the client ID resp. user ID that is been used to invoke this operation. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of WebAppConfirmationResponse + ApiResponse ConfirmWithHttpInfo (WebAppConfirmationRequest request); + /// + /// Uninstall + /// + /// + /// This operation uninstalls the web app from the provided space. The web app is implied by the client ID resp. user ID that is been used to invoke this operation. + /// + /// Thrown when fails to make API call + /// This parameter identifies the space within which the web app should be uninstalled. + /// + void Uninstall (long? spaceId); + + /// + /// Uninstall + /// + /// + /// This operation uninstalls the web app from the provided space. The web app is implied by the client ID resp. user ID that is been used to invoke this operation. + /// + /// Thrown when fails to make API call + /// This parameter identifies the space within which the web app should be uninstalled. + /// ApiResponse of Object(void) + ApiResponse UninstallWithHttpInfo (long? spaceId); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class WebAppService : IWebAppService + { + private PostFinanceCheckout.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public WebAppService(PostFinanceCheckout.Client.Configuration configuration = null) + { + if(configuration == null){ + throw new ArgumentException("Parameter cannot be null", "configuration"); + } + this.Configuration = configuration; + + ExceptionFactory = PostFinanceCheckout.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public String GetBasePath() + { + return this.Configuration.ApiClient.RestClient.Options.BaseUrl.ToString(); + } + + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public PostFinanceCheckout.Client.Configuration Configuration {get; set;} + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public PostFinanceCheckout.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Check Installation This operation returns true when the app is installed in given space. The web app is implied by the client ID resp. user ID that is been used to invoke this operation. + /// + /// Thrown when fails to make API call + /// This parameter identifies the space which should be checked if the web app is installed. + /// bool? + public bool? CheckInstallation (long? spaceId) + { + ApiResponse localVarResponse = CheckInstallationWithHttpInfo(spaceId); + return localVarResponse.Data; + } + + /// + /// Check Installation This operation returns true when the app is installed in given space. The web app is implied by the client ID resp. user ID that is been used to invoke this operation. + + /// + /// Thrown when fails to make API call + /// This parameter identifies the space which should be checked if the web app is installed. + /// ApiResponse of bool? + public ApiResponse< bool? > CheckInstallationWithHttpInfo (long? spaceId) + { + // verify the required parameter 'spaceId' is set + if (spaceId == null) + throw new ApiException(400, "Missing required parameter 'spaceId' when calling WebAppService->CheckInstallation"); + + var localVarPath = "/web-app/check-installation"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content type + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + if (spaceId != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "spaceId", spaceId)); // query parameter + + + int requestTimeout = this.Configuration.Timeout * 1000; + + // make the HTTP request + RestResponse localVarResponse = (RestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType, requestTimeout); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("CheckInstallation", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers + .GroupBy(x => x.Name, x => x.Value.ToString()) + .ToDictionary(x => x.Key, x => String.Join(", ", x)), + (bool?) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(bool?))); + } + /// + /// Confirm This operation confirms the app installation. This method has to be invoked after the user returns to the web app. The request of the user will contain the code as a request parameter. The web app is implied by the client ID resp. user ID that is been used to invoke this operation. + /// + /// Thrown when fails to make API call + /// + /// WebAppConfirmationResponse + public WebAppConfirmationResponse Confirm (WebAppConfirmationRequest request) + { + ApiResponse localVarResponse = ConfirmWithHttpInfo(request); + return localVarResponse.Data; + } + + /// + /// Confirm This operation confirms the app installation. This method has to be invoked after the user returns to the web app. The request of the user will contain the code as a request parameter. The web app is implied by the client ID resp. user ID that is been used to invoke this operation. + + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of WebAppConfirmationResponse + public ApiResponse< WebAppConfirmationResponse > ConfirmWithHttpInfo (WebAppConfirmationRequest request) + { + // verify the required parameter 'request' is set + if (request == null) + throw new ApiException(400, "Missing required parameter 'request' when calling WebAppService->Confirm"); + + var localVarPath = "/web-app/confirm"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content type + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + if (request != null && request.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(request); // http body (model) parameter + } + else + { + localVarPostBody = request; // byte array + } + + + int requestTimeout = this.Configuration.Timeout * 1000; + + // make the HTTP request + RestResponse localVarResponse = (RestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType, requestTimeout); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("Confirm", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers + .GroupBy(x => x.Name, x => x.Value.ToString()) + .ToDictionary(x => x.Key, x => String.Join(", ", x)), + (WebAppConfirmationResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(WebAppConfirmationResponse))); + } + /// + /// Uninstall This operation uninstalls the web app from the provided space. The web app is implied by the client ID resp. user ID that is been used to invoke this operation. + /// + /// Thrown when fails to make API call + /// This parameter identifies the space within which the web app should be uninstalled. + /// + public void Uninstall (long? spaceId) + { + UninstallWithHttpInfo(spaceId); + } + + /// + /// Uninstall This operation uninstalls the web app from the provided space. The web app is implied by the client ID resp. user ID that is been used to invoke this operation. + + /// + /// Thrown when fails to make API call + /// This parameter identifies the space within which the web app should be uninstalled. + /// ApiResponse of Object(void) + public ApiResponse UninstallWithHttpInfo (long? spaceId) + { + // verify the required parameter 'spaceId' is set + if (spaceId == null) + throw new ApiException(400, "Missing required parameter 'spaceId' when calling WebAppService->Uninstall"); + + var localVarPath = "/web-app/uninstall"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content type + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + if (spaceId != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "spaceId", spaceId)); // query parameter + + + int requestTimeout = this.Configuration.Timeout * 1000; + + // make the HTTP request + RestResponse localVarResponse = (RestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType, requestTimeout); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("Uninstall", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers + .GroupBy(x => x.Name, x => x.Value.ToString()) + .ToDictionary(x => x.Key, x => String.Join(", ", x)), + null); + } + } +}