コード例 #1
0
        /// <summary>
        ///  Request JWT for User
        /// </summary>
        /// <param name="data"></param>
        /// <returns>Task of JSONWebTokenResponse</returns>
        public async System.Threading.Tasks.Task<JSONWebTokenResponse> GetUserTokenAsync (LoginDetails data)
        {
             ApiResponse<JSONWebTokenResponse> response = await GetUserTokenAsyncWithHttpInfo(data);
             return response.Data;

        }
コード例 #2
0
        /// <summary>
        ///  Request JWT for User
        /// </summary>
        /// <param name="data"></param>
        /// <returns>Task of ApiResponse (JSONWebTokenResponse)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<JSONWebTokenResponse>> GetUserTokenAsyncWithHttpInfo (LoginDetails data)
        {
            // verify the required parameter 'data' is set
            if (data == null) throw new ApiException(400, "Missing required parameter 'data' when calling GetUserToken");
            
    
            var path_ = "/token/user";
    
            var pathParams = new Dictionary<String, String>();
            var queryParams = new Dictionary<String, String>();
            var headerParams = new Dictionary<String, String>();
            var formParams = new Dictionary<String, String>();
            var fileParams = new Dictionary<String, FileParameter>();
            Object postBody = null;

            // to determine the Content-Type header
            String[] httpContentTypes = new String[] {
                "application/json"
            };
            String httpContentType = Configuration.ApiClient.SelectHeaderContentType(httpContentTypes);

            // to determine the Accept header
            String[] httpHeaderAccepts = new String[] {
                "application/json"
            };
            String httpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(httpHeaderAccepts);
            if (httpHeaderAccept != null)
                headerParams.Add("Accept", httpHeaderAccept);

            // set "format" to json by default
            // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
            pathParams.Add("format", "json");
            
            
            
            
            postBody = Configuration.ApiClient.Serialize(data); // http body (model) parameter
            

            

            // make the HTTP request
            IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, 
                Method.POST, queryParams, postBody, headerParams, formParams, fileParams, 
                pathParams, httpContentType);

            int statusCode = (int) response.StatusCode;
 
            if (statusCode >= 400)
                throw new ApiException (statusCode, "Error calling GetUserToken: " + response.Content, response.Content);
            else if (statusCode == 0)
                throw new ApiException (statusCode, "Error calling GetUserToken: " + response.ErrorMessage, response.ErrorMessage);

            return new ApiResponse<JSONWebTokenResponse>(statusCode,
                response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (JSONWebTokenResponse) Configuration.ApiClient.Deserialize(response, typeof(JSONWebTokenResponse)));
            
        }
コード例 #3
0
 /// <summary>
 ///  Request JWT for User
 /// </summary>
 /// <param name="data"></param> 
 /// <returns>JSONWebTokenResponse</returns>
 public JSONWebTokenResponse GetUserToken (LoginDetails data)
 {
      ApiResponse<JSONWebTokenResponse> response = GetUserTokenWithHttpInfo(data);
      return response.Data;
 }
コード例 #4
0
        /// <summary>
        ///  Request JWT for User
        /// </summary>
        /// <exception cref="Squiggle.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="data"></param>
        /// <returns>ApiResponse of JSONWebToken</returns>
        public ApiResponse<JSONWebToken> GetUserTokenWithHttpInfo(LoginDetails data)
        {
            // verify the required parameter 'data' is set
            if (data == null)
                throw new ApiException(400, "Missing required parameter 'data' when calling DefaultApi->GetUserToken");

            var localVarPath = "/token/user";
            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"
            };
            String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            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 (data != null && data.GetType() != typeof(byte[]))
            {
                localVarPostBody = Configuration.ApiClient.Serialize(data); // http body (model) parameter
            }
            else
            {
                localVarPostBody = data; // 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 (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("GetUserToken", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<JSONWebToken>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (JSONWebToken) Configuration.ApiClient.Deserialize(localVarResponse, typeof(JSONWebToken)));
        }
コード例 #5
0
 /// <summary>
 ///  Request JWT for User
 /// </summary>
 /// <exception cref="Squiggle.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="data"></param>
 /// <returns>JSONWebToken</returns>
 public JSONWebToken GetUserToken(LoginDetails data)
 {
     ApiResponse<JSONWebToken> localVarResponse = GetUserTokenWithHttpInfo(data);
      return localVarResponse.Data;
 }
コード例 #6
0
 public void Init()
 {
     instance = new LoginDetails();
 }
コード例 #7
0
     /// <summary>
     ///  Request JWT for Address
     /// </summary>
     /// <param name="data"></param> 
     /// <returns>JSONWebTokenResponse</returns>            
     public JSONWebTokenResponse RequestAddressToken (LoginDetails data)
     {
         
         // verify the required parameter 'data' is set
         if (data == null) throw new ApiException(400, "Missing required parameter 'data' when calling RequestAddressToken");
         
 
         var path = "/authentication/address";
         path = path.Replace("{format}", "json");
         
 
         var queryParams = new Dictionary<String, String>();
         var headerParams = new Dictionary<String, String>();
         var formParams = new Dictionary<String, String>();
         var fileParams = new Dictionary<String, FileParameter>();
         String postBody = null;
 
         
         
         
         postBody = ApiClient.Serialize(data); // http body (model) parameter
         
 
         // authentication setting, if any
         String[] authSettings = new String[] {  };
 
         // make the HTTP request
         IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
 
         if (((int)response.StatusCode) >= 400)
             throw new ApiException ((int)response.StatusCode, "Error calling RequestAddressToken: " + response.Content, response.Content);
         else if (((int)response.StatusCode) == 0)
             throw new ApiException ((int)response.StatusCode, "Error calling RequestAddressToken: " + response.ErrorMessage, response.ErrorMessage);
 
         return (JSONWebTokenResponse) ApiClient.Deserialize(response.Content, typeof(JSONWebTokenResponse), response.Headers);
     }