117 lines
3.2 KiB
Go
117 lines
3.2 KiB
Go
|
/*
|
||
|
Anthrove Orchestrator API
|
||
|
|
||
|
This service handles the communication between the manager and the plugs
|
||
|
|
||
|
API version: 0.1-PREVIEW
|
||
|
Contact: support@anthrove.art
|
||
|
*/
|
||
|
|
||
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||
|
|
||
|
package openapi
|
||
|
|
||
|
import (
|
||
|
"bytes"
|
||
|
"context"
|
||
|
"io"
|
||
|
"net/http"
|
||
|
"net/url"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
// UserAPIService UserAPI service
|
||
|
type UserAPIService service
|
||
|
|
||
|
type ApiUserUserIdPutRequest struct {
|
||
|
ctx context.Context
|
||
|
ApiService *UserAPIService
|
||
|
userId string
|
||
|
}
|
||
|
|
||
|
func (r ApiUserUserIdPutRequest) Execute() (*http.Response, error) {
|
||
|
return r.ApiService.UserUserIdPutExecute(r)
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
UserUserIdPut Initiates a scraping operation for the entire user
|
||
|
|
||
|
Initiates a scraping operation for the entire user and returns the created task IDs.
|
||
|
|
||
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
@param userId Anthrove UserID
|
||
|
@return ApiUserUserIdPutRequest
|
||
|
*/
|
||
|
func (a *UserAPIService) UserUserIdPut(ctx context.Context, userId string) ApiUserUserIdPutRequest {
|
||
|
return ApiUserUserIdPutRequest{
|
||
|
ApiService: a,
|
||
|
ctx: ctx,
|
||
|
userId: userId,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Execute executes the request
|
||
|
func (a *UserAPIService) UserUserIdPutExecute(r ApiUserUserIdPutRequest) (*http.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = http.MethodPut
|
||
|
localVarPostBody interface{}
|
||
|
formFiles []formFile
|
||
|
)
|
||
|
|
||
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserAPIService.UserUserIdPut")
|
||
|
if err != nil {
|
||
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
||
|
}
|
||
|
|
||
|
localVarPath := localBasePath + "/user/{user_id}"
|
||
|
localVarPath = strings.Replace(localVarPath, "{"+"user_id"+"}", url.PathEscape(parameterValueToString(r.userId, "userId")), -1)
|
||
|
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := url.Values{}
|
||
|
localVarFormParams := url.Values{}
|
||
|
|
||
|
// to determine the Content-Type header
|
||
|
localVarHTTPContentTypes := []string{}
|
||
|
|
||
|
// set Content-Type header
|
||
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||
|
if localVarHTTPContentType != "" {
|
||
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||
|
}
|
||
|
|
||
|
// to determine the Accept header
|
||
|
localVarHTTPHeaderAccepts := []string{}
|
||
|
|
||
|
// set Accept header
|
||
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||
|
if localVarHTTPHeaderAccept != "" {
|
||
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||
|
}
|
||
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
||
|
if err != nil {
|
||
|
return localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
return localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarHTTPResponse, nil
|
||
|
}
|