@@ -8,6 +8,7 @@ import { MultipleQueriesResponse } from '../model/multipleQueriesResponse';
8
8
import { SaveObjectResponse } from '../model/saveObjectResponse' ;
9
9
10
10
import { ObjectSerializer , Authentication , VoidAuth , Interceptor } from '../model/models' ;
11
+ import { HttpBasicAuth , HttpBearerAuth , ApiKeyAuth , OAuth } from '../model/models' ;
11
12
12
13
import { HttpError , RequestFile } from './apis' ;
13
14
@@ -17,7 +18,10 @@ let defaultBasePath = 'https://test-1.algolianet.com';
17
18
// This file is autogenerated - Please do not edit
18
19
// ===============================================
19
20
20
- export enum SearchApiApiKeys { }
21
+ export enum SearchApiApiKeys {
22
+ apiKey ,
23
+ appId ,
24
+ }
21
25
22
26
export class SearchApi {
23
27
protected _basePath = defaultBasePath ;
@@ -26,20 +30,19 @@ export class SearchApi {
26
30
27
31
protected authentications = {
28
32
default : < Authentication > new VoidAuth ( ) ,
33
+ apiKey : new ApiKeyAuth ( 'header' , 'X-Algolia-API-Key' ) ,
34
+ appId : new ApiKeyAuth ( 'header' , 'X-Algolia-Application-Id' ) ,
29
35
} ;
30
36
31
37
protected interceptors : Interceptor [ ] = [ ] ;
32
38
33
- constructor ( basePath ?: string ) ;
34
- constructor ( basePathOrUsername : string , password ?: string , basePath ?: string ) {
35
- if ( password ) {
36
- if ( basePath ) {
37
- this . basePath = basePath ;
38
- }
39
- } else {
40
- if ( basePathOrUsername ) {
41
- this . basePath = basePathOrUsername ;
42
- }
39
+ constructor ( appId : string , apiKey : string , basePath ?: string ) {
40
+ this . setApiKey ( SearchApiApiKeys . appId , appId ) ;
41
+ this . setApiKey ( SearchApiApiKeys . apiKey , apiKey ) ;
42
+ this . basePath = 'https://' + appId + '-1.algolianet.com' ;
43
+
44
+ if ( basePath ) {
45
+ this . basePath = basePath ;
43
46
}
44
47
}
45
48
@@ -78,14 +81,10 @@ export class SearchApi {
78
81
/**
79
82
*
80
83
* @summary Performs multiple write operations in a single API call
81
- * @param xAlgoliaApplicationId Algolia appID
82
- * @param xAlgoliaAPIKey Algolia API key
83
84
* @param indexName The index in which to perform the request
84
85
* @param batchObject
85
86
*/
86
87
public async batch (
87
- xAlgoliaApplicationId : string ,
88
- xAlgoliaAPIKey : string ,
89
88
indexName : string ,
90
89
batchObject : BatchObject ,
91
90
options : { headers : { [ name : string ] : string } } = { headers : { } }
@@ -107,20 +106,6 @@ export class SearchApi {
107
106
}
108
107
let localVarFormParams : any = { } ;
109
108
110
- // verify required parameter 'xAlgoliaApplicationId' is not null or undefined
111
- if ( xAlgoliaApplicationId === null || xAlgoliaApplicationId === undefined ) {
112
- throw new Error (
113
- 'Required parameter xAlgoliaApplicationId was null or undefined when calling batch.'
114
- ) ;
115
- }
116
-
117
- // verify required parameter 'xAlgoliaAPIKey' is not null or undefined
118
- if ( xAlgoliaAPIKey === null || xAlgoliaAPIKey === undefined ) {
119
- throw new Error (
120
- 'Required parameter xAlgoliaAPIKey was null or undefined when calling batch.'
121
- ) ;
122
- }
123
-
124
109
// verify required parameter 'indexName' is not null or undefined
125
110
if ( indexName === null || indexName === undefined ) {
126
111
throw new Error ( 'Required parameter indexName was null or undefined when calling batch.' ) ;
@@ -131,14 +116,6 @@ export class SearchApi {
131
116
throw new Error ( 'Required parameter batchObject was null or undefined when calling batch.' ) ;
132
117
}
133
118
134
- localVarHeaderParams [ 'X-Algolia-Application-Id' ] = ObjectSerializer . serialize (
135
- xAlgoliaApplicationId ,
136
- 'string'
137
- ) ;
138
- localVarHeaderParams [ 'X-Algolia-API-Key' ] = ObjectSerializer . serialize (
139
- xAlgoliaAPIKey ,
140
- 'string'
141
- ) ;
142
119
( < any > Object ) . assign ( localVarHeaderParams , options . headers ) ;
143
120
144
121
let localVarUseFormData = false ;
@@ -154,6 +131,16 @@ export class SearchApi {
154
131
} ;
155
132
156
133
let authenticationPromise = Promise . resolve ( ) ;
134
+ if ( this . authentications . apiKey . apiKey ) {
135
+ authenticationPromise = authenticationPromise . then ( ( ) =>
136
+ this . authentications . apiKey . applyToRequest ( localVarRequestOptions )
137
+ ) ;
138
+ }
139
+ if ( this . authentications . appId . apiKey ) {
140
+ authenticationPromise = authenticationPromise . then ( ( ) =>
141
+ this . authentications . appId . applyToRequest ( localVarRequestOptions )
142
+ ) ;
143
+ }
157
144
authenticationPromise = authenticationPromise . then ( ( ) =>
158
145
this . authentications . default . applyToRequest ( localVarRequestOptions )
159
146
) ;
@@ -192,13 +179,9 @@ export class SearchApi {
192
179
/**
193
180
*
194
181
* @summary Get search results for the given requests.
195
- * @param xAlgoliaApplicationId Algolia appID
196
- * @param xAlgoliaAPIKey Algolia API key
197
182
* @param multipleQueriesObject
198
183
*/
199
184
public async multipleQueries (
200
- xAlgoliaApplicationId : string ,
201
- xAlgoliaAPIKey : string ,
202
185
multipleQueriesObject : MultipleQueriesObject ,
203
186
options : { headers : { [ name : string ] : string } } = { headers : { } }
204
187
) : Promise < { response : http . IncomingMessage ; body : MultipleQueriesResponse } > {
@@ -214,35 +197,13 @@ export class SearchApi {
214
197
}
215
198
let localVarFormParams : any = { } ;
216
199
217
- // verify required parameter 'xAlgoliaApplicationId' is not null or undefined
218
- if ( xAlgoliaApplicationId === null || xAlgoliaApplicationId === undefined ) {
219
- throw new Error (
220
- 'Required parameter xAlgoliaApplicationId was null or undefined when calling multipleQueries.'
221
- ) ;
222
- }
223
-
224
- // verify required parameter 'xAlgoliaAPIKey' is not null or undefined
225
- if ( xAlgoliaAPIKey === null || xAlgoliaAPIKey === undefined ) {
226
- throw new Error (
227
- 'Required parameter xAlgoliaAPIKey was null or undefined when calling multipleQueries.'
228
- ) ;
229
- }
230
-
231
200
// verify required parameter 'multipleQueriesObject' is not null or undefined
232
201
if ( multipleQueriesObject === null || multipleQueriesObject === undefined ) {
233
202
throw new Error (
234
203
'Required parameter multipleQueriesObject was null or undefined when calling multipleQueries.'
235
204
) ;
236
205
}
237
206
238
- localVarHeaderParams [ 'X-Algolia-Application-Id' ] = ObjectSerializer . serialize (
239
- xAlgoliaApplicationId ,
240
- 'string'
241
- ) ;
242
- localVarHeaderParams [ 'X-Algolia-API-Key' ] = ObjectSerializer . serialize (
243
- xAlgoliaAPIKey ,
244
- 'string'
245
- ) ;
246
207
( < any > Object ) . assign ( localVarHeaderParams , options . headers ) ;
247
208
248
209
let localVarUseFormData = false ;
@@ -258,6 +219,16 @@ export class SearchApi {
258
219
} ;
259
220
260
221
let authenticationPromise = Promise . resolve ( ) ;
222
+ if ( this . authentications . apiKey . apiKey ) {
223
+ authenticationPromise = authenticationPromise . then ( ( ) =>
224
+ this . authentications . apiKey . applyToRequest ( localVarRequestOptions )
225
+ ) ;
226
+ }
227
+ if ( this . authentications . appId . apiKey ) {
228
+ authenticationPromise = authenticationPromise . then ( ( ) =>
229
+ this . authentications . appId . applyToRequest ( localVarRequestOptions )
230
+ ) ;
231
+ }
261
232
authenticationPromise = authenticationPromise . then ( ( ) =>
262
233
this . authentications . default . applyToRequest ( localVarRequestOptions )
263
234
) ;
@@ -296,14 +267,10 @@ export class SearchApi {
296
267
/**
297
268
* Add an object to the index, automatically assigning it an object ID
298
269
* @summary Save object
299
- * @param xAlgoliaApplicationId Algolia appID
300
- * @param xAlgoliaAPIKey Algolia API key
301
270
* @param indexName The index in which to perform the request
302
271
* @param requestBody
303
272
*/
304
273
public async saveObject (
305
- xAlgoliaApplicationId : string ,
306
- xAlgoliaAPIKey : string ,
307
274
indexName : string ,
308
275
requestBody : { [ key : string ] : object } ,
309
276
options : { headers : { [ name : string ] : string } } = { headers : { } }
@@ -325,20 +292,6 @@ export class SearchApi {
325
292
}
326
293
let localVarFormParams : any = { } ;
327
294
328
- // verify required parameter 'xAlgoliaApplicationId' is not null or undefined
329
- if ( xAlgoliaApplicationId === null || xAlgoliaApplicationId === undefined ) {
330
- throw new Error (
331
- 'Required parameter xAlgoliaApplicationId was null or undefined when calling saveObject.'
332
- ) ;
333
- }
334
-
335
- // verify required parameter 'xAlgoliaAPIKey' is not null or undefined
336
- if ( xAlgoliaAPIKey === null || xAlgoliaAPIKey === undefined ) {
337
- throw new Error (
338
- 'Required parameter xAlgoliaAPIKey was null or undefined when calling saveObject.'
339
- ) ;
340
- }
341
-
342
295
// verify required parameter 'indexName' is not null or undefined
343
296
if ( indexName === null || indexName === undefined ) {
344
297
throw new Error (
@@ -353,14 +306,6 @@ export class SearchApi {
353
306
) ;
354
307
}
355
308
356
- localVarHeaderParams [ 'X-Algolia-Application-Id' ] = ObjectSerializer . serialize (
357
- xAlgoliaApplicationId ,
358
- 'string'
359
- ) ;
360
- localVarHeaderParams [ 'X-Algolia-API-Key' ] = ObjectSerializer . serialize (
361
- xAlgoliaAPIKey ,
362
- 'string'
363
- ) ;
364
309
( < any > Object ) . assign ( localVarHeaderParams , options . headers ) ;
365
310
366
311
let localVarUseFormData = false ;
@@ -376,6 +321,16 @@ export class SearchApi {
376
321
} ;
377
322
378
323
let authenticationPromise = Promise . resolve ( ) ;
324
+ if ( this . authentications . apiKey . apiKey ) {
325
+ authenticationPromise = authenticationPromise . then ( ( ) =>
326
+ this . authentications . apiKey . applyToRequest ( localVarRequestOptions )
327
+ ) ;
328
+ }
329
+ if ( this . authentications . appId . apiKey ) {
330
+ authenticationPromise = authenticationPromise . then ( ( ) =>
331
+ this . authentications . appId . applyToRequest ( localVarRequestOptions )
332
+ ) ;
333
+ }
379
334
authenticationPromise = authenticationPromise . then ( ( ) =>
380
335
this . authentications . default . applyToRequest ( localVarRequestOptions )
381
336
) ;
0 commit comments