Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9780111

Browse files
add option to pass custom headers to requrest
1 parent d6786e0 commit 9780111

File tree

4 files changed

+32
-21
lines changed

4 files changed

+32
-21
lines changed

‎generator-templates/api.mustache

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace {{packageName}}.{{apiPackage}}
3333
/// <exception cref="{{packageName}}.Client.ApiException">Thrown when fails to make API call</exception>
3434
{{#allParams}}/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}</param>
3535
{{/allParams}}/// <returns>{{#returnType}}{{returnType}}{{/returnType}}</returns>
36-
{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} {{operationId}} ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
36+
{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} {{operationId}} ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}, {{/allParams}}Dictionary<String,String> headers);
3737

3838
/// <summary>
3939
/// {{summary}}
@@ -44,7 +44,7 @@ namespace {{packageName}}.{{apiPackage}}
4444
/// <exception cref="{{packageName}}.Client.ApiException">Thrown when fails to make API call</exception>
4545
{{#allParams}}/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}</param>
4646
{{/allParams}}/// <returns>ApiResponse of {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Object(void){{/returnType}}</returns>
47-
ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}> {{operationId}}WithHttpInfo ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
47+
ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}> {{operationId}}WithHttpInfo ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}, {{/allParams}}Dictionary<String,String> headers);
4848
{{/operation}}
4949
#endregion Synchronous Operations
5050
{{#supportsAsync}}
@@ -193,9 +193,9 @@ namespace {{packageName}}.{{apiPackage}}
193193
/// <exception cref="{{packageName}}.Client.ApiException">Thrown when fails to make API call</exception>
194194
{{#allParams}}/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}</param>
195195
{{/allParams}}/// <returns>{{#returnType}}{{returnType}}{{/returnType}}</returns>
196-
public {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} {{operationId}} ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
196+
public {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} {{operationId}} ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}, {{/allParams}}Dictionary<String,String> headers)
197197
{
198-
{{#returnType}}ApiResponse<{{{returnType}}}> localVarResponse = {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
198+
{{#returnType}}ApiResponse<{{{returnType}}}> localVarResponse = {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}, {{/allParams}}headers);
199199
return localVarResponse.Data;{{/returnType}}{{^returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{/returnType}}
200200
}
201201

@@ -205,7 +205,7 @@ namespace {{packageName}}.{{apiPackage}}
205205
/// <exception cref="{{packageName}}.Client.ApiException">Thrown when fails to make API call</exception>
206206
{{#allParams}}/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}</param>
207207
{{/allParams}}/// <returns>ApiResponse of {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Object(void){{/returnType}}</returns>
208-
public ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}> {{operationId}}WithHttpInfo ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
208+
public ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}> {{operationId}}WithHttpInfo ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default({{{dataType}}}){{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}, {{/allParams}}Dictionary<String,String> headers)
209209
{
210210
{{#allParams}}
211211
{{#required}}
@@ -218,7 +218,7 @@ namespace {{packageName}}.{{apiPackage}}
218218
var localVarPath = "{{#netStandard}}.{{/netStandard}}{{{path}}}";
219219
var localVarPathParams = new Dictionary<String, String>();
220220
var localVarQueryParams = new List<KeyValuePair<String, String>>();
221-
var localVarHeaderParams = new Dictionary<String,String>(this.Configuration.DefaultHeader);
221+
var localVarHeaderParams = this.Configuration.DefaultHeader.Union(headers).ToDictionary (k => k.Key, v => v.Value);
222222
var localVarFormParams = new Dictionary<String, String>();
223223
var localVarFileParams = new Dictionary<String, FileParameter>();
224224
Object localVarPostBody = null;

‎src/Regula.DocumentReader.WebClient/Api/DefaultApi.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public interface IDefaultApi : IApiAccessor
3333
/// </remarks>
3434
/// <exception cref="Regula.DocumentReader.WebClient.Client.ApiException">Thrown when fails to make API call</exception>
3535
/// <returns>DeviceInfo</returns>
36-
DeviceInfo Ping ();
36+
DeviceInfo Ping (Dictionary<String,String>headers);
3737

3838
/// <summary>
3939
/// Server health check
@@ -43,7 +43,7 @@ public interface IDefaultApi : IApiAccessor
4343
/// </remarks>
4444
/// <exception cref="Regula.DocumentReader.WebClient.Client.ApiException">Thrown when fails to make API call</exception>
4545
/// <returns>ApiResponse of DeviceInfo</returns>
46-
ApiResponse<DeviceInfo> PingWithHttpInfo ();
46+
ApiResponse<DeviceInfo> PingWithHttpInfo (Dictionary<String,String>headers);
4747
#endregion Synchronous Operations
4848
#region Asynchronous Operations
4949
/// <summary>
@@ -183,9 +183,9 @@ public void AddDefaultHeader(string key, string value)
183183
/// </summary>
184184
/// <exception cref="Regula.DocumentReader.WebClient.Client.ApiException">Thrown when fails to make API call</exception>
185185
/// <returns>DeviceInfo</returns>
186-
public DeviceInfo Ping ()
186+
public DeviceInfo Ping (Dictionary<String,String>headers)
187187
{
188-
ApiResponse<DeviceInfo> localVarResponse = PingWithHttpInfo();
188+
ApiResponse<DeviceInfo> localVarResponse = PingWithHttpInfo(headers);
189189
return localVarResponse.Data;
190190
}
191191

@@ -194,13 +194,13 @@ public DeviceInfo Ping ()
194194
/// </summary>
195195
/// <exception cref="Regula.DocumentReader.WebClient.Client.ApiException">Thrown when fails to make API call</exception>
196196
/// <returns>ApiResponse of DeviceInfo</returns>
197-
public ApiResponse<DeviceInfo> PingWithHttpInfo ()
197+
public ApiResponse<DeviceInfo> PingWithHttpInfo (Dictionary<String,String>headers)
198198
{
199199

200200
var localVarPath = "/api/ping";
201201
var localVarPathParams = new Dictionary<String, String>();
202202
var localVarQueryParams = new List<KeyValuePair<String, String>>();
203-
var localVarHeaderParams = newDictionary<String,String>(this.Configuration.DefaultHeader);
203+
var localVarHeaderParams = this.Configuration.DefaultHeader.Union(headers).ToDictionary(k =>k.Key, v =>v.Value);
204204
var localVarFormParams = new Dictionary<String, String>();
205205
var localVarFileParams = new Dictionary<String, FileParameter>();
206206
Object localVarPostBody = null;

‎src/Regula.DocumentReader.WebClient/Api/DocumentReaderApi.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections.Generic;
23
using Regula.DocumentReader.WebClient.Model;
34
using Regula.DocumentReader.WebClient.Model.Ext;
45

@@ -17,18 +18,28 @@ public DocumentReaderApi(string basePath)
1718

1819
private string License { get; set; }
1920

20-
public RecognitionResponse Process(ProcessRequest processRequest)
21+
public RecognitionResponse Process(ProcessRequest processRequest)
22+
{
23+
return Process(processRequest, new Dictionary<String, String>());
24+
}
25+
26+
public RecognitionResponse Process(ProcessRequest processRequest, Dictionary<String, String> headers)
2127
{
2228
if (processRequest.SystemInfo == null)
2329
processRequest.SystemInfo = new ProcessSystemInfo(License);
2430
else
2531
processRequest.SystemInfo.License = License;
2632

27-
return new RecognitionResponse(this._processApi.ApiProcess(processRequest));
33+
return new RecognitionResponse(this._processApi.ApiProcess(processRequest,headers));
2834
}
2935
public DeviceInfo Ping ()
3036
{
31-
return this._defaultApi.Ping();
37+
return this._defaultApi.Ping(new Dictionary<String, String>());
38+
}
39+
40+
public DeviceInfo Ping (Dictionary<String, String> headers)
41+
{
42+
return this._defaultApi.Ping(headers);
3243
}
3344

3445
public DocumentReaderApi WithLicense(string license)

‎src/Regula.DocumentReader.WebClient/Api/ProcessApi.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public interface IProcessApi : IApiAccessor
3434
/// <exception cref="Regula.DocumentReader.WebClient.Client.ApiException">Thrown when fails to make API call</exception>
3535
/// <param name="processRequest"></param>
3636
/// <returns>ProcessResponse</returns>
37-
ProcessResponse ApiProcess (ProcessRequest processRequest);
37+
ProcessResponse ApiProcess (ProcessRequest processRequest,Dictionary<String,String>headers);
3838

3939
/// <summary>
4040
/// Process list of documents images and return extracted data
@@ -45,7 +45,7 @@ public interface IProcessApi : IApiAccessor
4545
/// <exception cref="Regula.DocumentReader.WebClient.Client.ApiException">Thrown when fails to make API call</exception>
4646
/// <param name="processRequest"></param>
4747
/// <returns>ApiResponse of ProcessResponse</returns>
48-
ApiResponse<ProcessResponse> ApiProcessWithHttpInfo (ProcessRequest processRequest);
48+
ApiResponse<ProcessResponse> ApiProcessWithHttpInfo (ProcessRequest processRequest,Dictionary<String,String>headers);
4949
#endregion Synchronous Operations
5050
#region Asynchronous Operations
5151
/// <summary>
@@ -188,9 +188,9 @@ public void AddDefaultHeader(string key, string value)
188188
/// <exception cref="Regula.DocumentReader.WebClient.Client.ApiException">Thrown when fails to make API call</exception>
189189
/// <param name="processRequest"></param>
190190
/// <returns>ProcessResponse</returns>
191-
public ProcessResponse ApiProcess (ProcessRequest processRequest)
191+
public ProcessResponse ApiProcess (ProcessRequest processRequest,Dictionary<String,String>headers)
192192
{
193-
ApiResponse<ProcessResponse> localVarResponse = ApiProcessWithHttpInfo(processRequest);
193+
ApiResponse<ProcessResponse> localVarResponse = ApiProcessWithHttpInfo(processRequest,headers);
194194
return localVarResponse.Data;
195195
}
196196

@@ -200,7 +200,7 @@ public ProcessResponse ApiProcess (ProcessRequest processRequest)
200200
/// <exception cref="Regula.DocumentReader.WebClient.Client.ApiException">Thrown when fails to make API call</exception>
201201
/// <param name="processRequest"></param>
202202
/// <returns>ApiResponse of ProcessResponse</returns>
203-
public ApiResponse<ProcessResponse> ApiProcessWithHttpInfo (ProcessRequest processRequest)
203+
public ApiResponse<ProcessResponse> ApiProcessWithHttpInfo (ProcessRequest processRequest,Dictionary<String,String>headers)
204204
{
205205
// verify the required parameter 'processRequest' is set
206206
if (processRequest == null)
@@ -209,7 +209,7 @@ public ApiResponse<ProcessResponse> ApiProcessWithHttpInfo (ProcessRequest proce
209209
var localVarPath = "/api/process";
210210
var localVarPathParams = new Dictionary<String, String>();
211211
var localVarQueryParams = new List<KeyValuePair<String, String>>();
212-
var localVarHeaderParams = newDictionary<String,String>(this.Configuration.DefaultHeader);
212+
var localVarHeaderParams = this.Configuration.DefaultHeader.Union(headers).ToDictionary(k =>k.Key, v =>v.Value);
213213
var localVarFormParams = new Dictionary<String, String>();
214214
var localVarFileParams = new Dictionary<String, FileParameter>();
215215
Object localVarPostBody = null;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /