Skip to content

Commit 4473066

Browse files
committed
refactor: go-fmt'd repository
1 parent 6bad496 commit 4473066

19 files changed

+206
-258
lines changed

api_index.go

+74-75
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
/*
22
* Manticore Search Client
33
*
4-
* Low-level client for Manticore Search.
4+
* Low-level client for Manticore Search.
55
*
66
* API version: 1.0.0
77
* Contact: [email protected]
88
*/
99

10-
1110
package manticoresearch
1211

1312
import (
@@ -27,9 +26,9 @@ var (
2726
type IndexApiService service
2827

2928
type ApiBulkRequest struct {
30-
ctx _context.Context
29+
ctx _context.Context
3130
ApiService *IndexApiService
32-
body *string
31+
body *string
3332
}
3433

3534
func (r ApiBulkRequest) Body(body string) ApiBulkRequest {
@@ -43,34 +42,34 @@ func (r ApiBulkRequest) Execute() (BulkResponse, *_nethttp.Response, GenericOpen
4342

4443
/*
4544
* Bulk Bulk index operations
46-
* Sends multiple operatons like inserts, updates, replaces or deletes.
47-
For each operation it's object must have same format as in their dedicated method.
45+
* Sends multiple operatons like inserts, updates, replaces or deletes.
46+
For each operation it's object must have same format as in their dedicated method.
4847
The method expects a raw string as the batch in NDJSON.
49-
Each operation object needs to be serialized to
50-
JSON and separated by endline (\n).
51-
48+
Each operation object needs to be serialized to
49+
JSON and separated by endline (\n).
50+
5251
An example of raw input:
53-
52+
5453
```
5554
{"insert": {"index": "movies", "doc": {"plot": "A secret team goes to North Pole", "rating": 9.5, "language": [2, 3], "title": "This is an older movie", "lon": 51.99, "meta": {"keywords":["travel","ice"],"genre":["adventure"]}, "year": 1950, "lat": 60.4, "advise": "PG-13"}}}
5655
\n
5756
{"delete": {"index": "movies","id":700}}
5857
```
59-
58+
6059
Responds with an object telling whenever any errors occured and an array with status for each operation:
61-
60+
6261
```
6362
{'items':[{'update':{'_index':'products','_id':1,'result':'updated'}},{'update':{'_index':'products','_id':2,'result':'updated'}}],'errors':false}
6463
```
65-
64+
6665
6766
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
6867
* @return ApiBulkRequest
69-
*/
68+
*/
7069
func (a *IndexApiService) Bulk(ctx _context.Context) ApiBulkRequest {
7170
return ApiBulkRequest{
7271
ApiService: a,
73-
ctx: ctx,
72+
ctx: ctx,
7473
}
7574
}
7675

@@ -149,13 +148,13 @@ func (a *IndexApiService) BulkExecute(r ApiBulkRequest) (BulkResponse, *_nethttp
149148
body: localVarBody,
150149
error: localVarHTTPResponse.Status,
151150
}
152-
var v ErrorResponse
153-
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
154-
if err != nil {
155-
newErr.error = err.Error()
156-
return localVarReturnValue, localVarHTTPResponse, newErr
157-
}
158-
newErr.model = v
151+
var v ErrorResponse
152+
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
153+
if err != nil {
154+
newErr.error = err.Error()
155+
return localVarReturnValue, localVarHTTPResponse, newErr
156+
}
157+
newErr.model = v
159158
return localVarReturnValue, localVarHTTPResponse, newErr
160159
}
161160

@@ -172,8 +171,8 @@ func (a *IndexApiService) BulkExecute(r ApiBulkRequest) (BulkResponse, *_nethttp
172171
}
173172

174173
type ApiDeleteRequest struct {
175-
ctx _context.Context
176-
ApiService *IndexApiService
174+
ctx _context.Context
175+
ApiService *IndexApiService
177176
deleteDocumentRequest *DeleteDocumentRequest
178177
}
179178

@@ -203,19 +202,19 @@ Example of input to delete using a query:
203202
```
204203
205204
The match query has same syntax as in for searching.
206-
Responds with an object telling how many documents got deleted:
205+
Responds with an object telling how many documents got deleted:
207206
208207
```
209208
{'_index':'products','updated':1}
210209
```
211210
212211
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
213212
* @return ApiDeleteRequest
214-
*/
213+
*/
215214
func (a *IndexApiService) Delete(ctx _context.Context) ApiDeleteRequest {
216215
return ApiDeleteRequest{
217216
ApiService: a,
218-
ctx: ctx,
217+
ctx: ctx,
219218
}
220219
}
221220

@@ -294,13 +293,13 @@ func (a *IndexApiService) DeleteExecute(r ApiDeleteRequest) (DeleteResponse, *_n
294293
body: localVarBody,
295294
error: localVarHTTPResponse.Status,
296295
}
297-
var v ErrorResponse
298-
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
299-
if err != nil {
300-
newErr.error = err.Error()
301-
return localVarReturnValue, localVarHTTPResponse, newErr
302-
}
303-
newErr.model = v
296+
var v ErrorResponse
297+
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
298+
if err != nil {
299+
newErr.error = err.Error()
300+
return localVarReturnValue, localVarHTTPResponse, newErr
301+
}
302+
newErr.model = v
304303
return localVarReturnValue, localVarHTTPResponse, newErr
305304
}
306305

@@ -317,8 +316,8 @@ func (a *IndexApiService) DeleteExecute(r ApiDeleteRequest) (DeleteResponse, *_n
317316
}
318317

319318
type ApiInsertRequest struct {
320-
ctx _context.Context
321-
ApiService *IndexApiService
319+
ctx _context.Context
320+
ApiService *IndexApiService
322321
insertDocumentRequest *InsertDocumentRequest
323322
}
324323

@@ -333,32 +332,32 @@ func (r ApiInsertRequest) Execute() (SuccessResponse, *_nethttp.Response, Generi
333332

334333
/*
335334
* Insert Create a new document in an index
336-
* Insert a document.
335+
* Insert a document.
337336
Expects an object like:
338-
337+
339338
```
340339
{'index':'movies','id':701,'doc':{'title':'This is an old movie','plot':'A secret team goes to North Pole','year':1950,'rating':9.5,'lat':60.4,'lon':51.99,'advise':'PG-13','meta':'{"keywords":{"travel","ice"},"genre":{"adventure"}}','language':[2,3]}}
341340
```
342-
341+
343342
The document id can also be missing, in which case an autogenerated one will be used:
344-
343+
345344
```
346345
{'index':'movies','doc':{'title':'This is a new movie','plot':'A secret team goes to North Pole','year':2020,'rating':9.5,'lat':60.4,'lon':51.99,'advise':'PG-13','meta':'{"keywords":{"travel","ice"},"genre":{"adventure"}}','language':[2,3]}}
347346
```
348-
347+
349348
It responds with an object in format:
350-
349+
351350
```
352351
{'_index':'products','_id':701,'created':true,'result':'created','status':201}
353352
```
354353
355354
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
356355
* @return ApiInsertRequest
357-
*/
356+
*/
358357
func (a *IndexApiService) Insert(ctx _context.Context) ApiInsertRequest {
359358
return ApiInsertRequest{
360359
ApiService: a,
361-
ctx: ctx,
360+
ctx: ctx,
362361
}
363362
}
364363

@@ -437,13 +436,13 @@ func (a *IndexApiService) InsertExecute(r ApiInsertRequest) (SuccessResponse, *_
437436
body: localVarBody,
438437
error: localVarHTTPResponse.Status,
439438
}
440-
var v ErrorResponse
441-
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
442-
if err != nil {
443-
newErr.error = err.Error()
444-
return localVarReturnValue, localVarHTTPResponse, newErr
445-
}
446-
newErr.model = v
439+
var v ErrorResponse
440+
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
441+
if err != nil {
442+
newErr.error = err.Error()
443+
return localVarReturnValue, localVarHTTPResponse, newErr
444+
}
445+
newErr.model = v
447446
return localVarReturnValue, localVarHTTPResponse, newErr
448447
}
449448

@@ -460,8 +459,8 @@ func (a *IndexApiService) InsertExecute(r ApiInsertRequest) (SuccessResponse, *_
460459
}
461460

462461
type ApiReplaceRequest struct {
463-
ctx _context.Context
464-
ApiService *IndexApiService
462+
ctx _context.Context
463+
ApiService *IndexApiService
465464
insertDocumentRequest *InsertDocumentRequest
466465
}
467466

@@ -485,11 +484,11 @@ Responds with an object in format: <br/>
485484
486485
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
487486
* @return ApiReplaceRequest
488-
*/
487+
*/
489488
func (a *IndexApiService) Replace(ctx _context.Context) ApiReplaceRequest {
490489
return ApiReplaceRequest{
491490
ApiService: a,
492-
ctx: ctx,
491+
ctx: ctx,
493492
}
494493
}
495494

@@ -568,13 +567,13 @@ func (a *IndexApiService) ReplaceExecute(r ApiReplaceRequest) (SuccessResponse,
568567
body: localVarBody,
569568
error: localVarHTTPResponse.Status,
570569
}
571-
var v ErrorResponse
572-
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
573-
if err != nil {
574-
newErr.error = err.Error()
575-
return localVarReturnValue, localVarHTTPResponse, newErr
576-
}
577-
newErr.model = v
570+
var v ErrorResponse
571+
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
572+
if err != nil {
573+
newErr.error = err.Error()
574+
return localVarReturnValue, localVarHTTPResponse, newErr
575+
}
576+
newErr.model = v
578577
return localVarReturnValue, localVarHTTPResponse, newErr
579578
}
580579

@@ -591,8 +590,8 @@ func (a *IndexApiService) ReplaceExecute(r ApiReplaceRequest) (SuccessResponse,
591590
}
592591

593592
type ApiUpdateRequest struct {
594-
ctx _context.Context
595-
ApiService *IndexApiService
593+
ctx _context.Context
594+
ApiService *IndexApiService
596595
updateDocumentRequest *UpdateDocumentRequest
597596
}
598597

@@ -618,22 +617,22 @@ And update by using a match query:
618617
619618
```
620619
{'index':'movies','doc':{'rating':9.49},'query':{'bool':{'must':[{'query_string':'new movie'}]}}}
621-
```
620+
```
622621
623622
The match query has same syntax as for searching.
624-
Responds with an object that tells how many documents where updated in format:
623+
Responds with an object that tells how many documents where updated in format:
625624
626625
```
627626
{'_index':'products','updated':1}
628627
```
629628
630629
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
631630
* @return ApiUpdateRequest
632-
*/
631+
*/
633632
func (a *IndexApiService) Update(ctx _context.Context) ApiUpdateRequest {
634633
return ApiUpdateRequest{
635634
ApiService: a,
636-
ctx: ctx,
635+
ctx: ctx,
637636
}
638637
}
639638

@@ -712,13 +711,13 @@ func (a *IndexApiService) UpdateExecute(r ApiUpdateRequest) (UpdateResponse, *_n
712711
body: localVarBody,
713712
error: localVarHTTPResponse.Status,
714713
}
715-
var v ErrorResponse
716-
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
717-
if err != nil {
718-
newErr.error = err.Error()
719-
return localVarReturnValue, localVarHTTPResponse, newErr
720-
}
721-
newErr.model = v
714+
var v ErrorResponse
715+
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
716+
if err != nil {
717+
newErr.error = err.Error()
718+
return localVarReturnValue, localVarHTTPResponse, newErr
719+
}
720+
newErr.model = v
722721
return localVarReturnValue, localVarHTTPResponse, newErr
723722
}
724723

0 commit comments

Comments
 (0)