feat(version): update to orchestrator version v1.1.0

This commit is contained in:
SoXX 2024-09-04 20:49:07 +02:00
parent 6a34afab9b
commit 4bc123c9e6
10 changed files with 646 additions and 8 deletions

View File

@ -2,24 +2,18 @@
<configuration default="false" name="Generate Code" type="SwaggerCodegen" editBeforeRun="true" show_console_on_std_err="false" show_console_on_std_out="false">
<option name="allowRunningInParallel" value="false" />
<option name="customTemplatesPath" value="" />
<option name="envs">
<map />
</option>
<option name="generateToPath" value="C:\Users\SoXX\GolandProjects\anthrove\orchestrator-swagger-go-client" />
<option name="generateToPath" value="E:\Anthrove\orchestrator-swagger-go-client" />
<option name="generationParameters">
<list />
</option>
<option name="generatorType" value="OPENAPI_GENERATOR_V6" />
<option name="jdkPath" value="C:\Users\SoXX\AppData\Local\Programs\GoLand\jbr\bin\java.exe" />
<option name="language" value="go" />
<option name="passParentEnvs" value="true" />
<option name="programParameters" />
<option name="projectPathOnTarget" />
<option name="selectedOptions">
<list />
</option>
<option name="specificationPath" value="C:\Users\SoXX\GolandProjects\anthrove\orchestrator\docs\swagger.yaml" />
<option name="workingDirectory" value="C:\Users\SoXX\GolandProjects\anthrove\orchestrator\docs" />
<option name="specificationPath" value="E:\Anthrove\orchestrator\docs\swagger.json" />
<method v="2" />
</configuration>
</component>

View File

@ -1,5 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CommitMessageInspectionProfile">
<profile version="1.0">
<inspection_tool class="CommitFormat" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="CommitNamingConvention" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>

View File

@ -4,16 +4,20 @@
README.md
api/openapi.yaml
api_user.go
api_user_message.go
api_user_source.go
client.go
configuration.go
docs/TaskMessage.md
docs/TaskResponse.md
docs/TaskStartTask.md
docs/UserApi.md
docs/UserMessageApi.md
docs/UserSourceApi.md
git_push.sh
go.mod
go.sum
model_task_message.go
model_task_response.go
model_task_start_task.go
response.go

View File

@ -81,6 +81,7 @@ Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*UserApi* | [**UserTaskPost**](docs/UserApi.md#usertaskpost) | **Post** /user/task | Start scraping all user sources
*UserApi* | [**UserTaskUserIdGet**](docs/UserApi.md#usertaskuseridget) | **Get** /user/task/{user_id} | Gets all tasks of a user
*UserMessageApi* | [**PlugMessagesPlugIdentifierUserSourceIdGet**](docs/UserMessageApi.md#plugmessagesplugidentifierusersourceidget) | **Get** /plug/messages/{plug_identifier}/{user_source_id} | Get all Messages from a user
*UserSourceApi* | [**PlugTaskPlugIdentifierPost**](docs/UserSourceApi.md#plugtaskplugidentifierpost) | **Post** /plug/task/{plug_identifier} | Start a plug task
*UserSourceApi* | [**PlugTaskPlugIdentifierTaskIdDelete**](docs/UserSourceApi.md#plugtaskplugidentifiertaskiddelete) | **Delete** /plug/task/{plug_identifier}/{task_id} | Stop a plug task
*UserSourceApi* | [**PlugTaskPlugIdentifierTaskIdGet**](docs/UserSourceApi.md#plugtaskplugidentifiertaskidget) | **Get** /plug/task/{plug_identifier}/{task_id} | Gets the status of a plug task
@ -88,6 +89,7 @@ Class | Method | HTTP request | Description
## Documentation For Models
- [TaskMessage](docs/TaskMessage.md)
- [TaskResponse](docs/TaskResponse.md)
- [TaskStartTask](docs/TaskStartTask.md)

View File

@ -11,6 +11,40 @@ info:
servers:
- url: /api/v1
paths:
/plug/messages/{plug_identifier}/{user_source_id}:
get:
description: Retrieves all user messages from a specific plug
parameters:
- description: User Source ID
in: path
name: user_source_id
required: true
schema:
type: string
- description: Plug Identifier
in: path
name: plug_identifier
required: true
schema:
type: string
responses:
"200":
content:
'*/*':
schema:
items:
$ref: '#/components/schemas/task.Message'
type: array
description: OK
"400":
content:
'*/*':
schema:
$ref: '#/components/schemas/gin.H'
description: Bad Request
summary: Get all Messages from a user
tags:
- User Message
/plug/task/{plug_identifier}:
post:
description: Starts a task for the specified plug
@ -165,6 +199,22 @@ components:
additionalProperties:
type: object
type: object
task.Message:
example:
user_source_id: user_source_id
created_at: created_at
body: body
title: title
properties:
body:
type: string
created_at:
type: string
title:
type: string
user_source_id:
type: string
type: object
task.Response:
example:
plug_task_id: plug_task_id

141
api_user_message.go Normal file
View File

@ -0,0 +1,141 @@
/*
Anthrove Orchestrator API
This service handles the communication between the manager and the plugs
API version: 1.0
Contact: support@anthrove.art
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package openapi
import (
"bytes"
"context"
"io/ioutil"
"net/http"
"net/url"
"strings"
)
// UserMessageApiService UserMessageApi service
type UserMessageApiService service
type ApiPlugMessagesPlugIdentifierUserSourceIdGetRequest struct {
ctx context.Context
ApiService *UserMessageApiService
userSourceId string
plugIdentifier string
}
func (r ApiPlugMessagesPlugIdentifierUserSourceIdGetRequest) Execute() ([]TaskMessage, *http.Response, error) {
return r.ApiService.PlugMessagesPlugIdentifierUserSourceIdGetExecute(r)
}
/*
PlugMessagesPlugIdentifierUserSourceIdGet Get all Messages from a user
Retrieves all user messages from a specific plug
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param userSourceId User Source ID
@param plugIdentifier Plug Identifier
@return ApiPlugMessagesPlugIdentifierUserSourceIdGetRequest
*/
func (a *UserMessageApiService) PlugMessagesPlugIdentifierUserSourceIdGet(ctx context.Context, userSourceId string, plugIdentifier string) ApiPlugMessagesPlugIdentifierUserSourceIdGetRequest {
return ApiPlugMessagesPlugIdentifierUserSourceIdGetRequest{
ApiService: a,
ctx: ctx,
userSourceId: userSourceId,
plugIdentifier: plugIdentifier,
}
}
// Execute executes the request
//
// @return []TaskMessage
func (a *UserMessageApiService) PlugMessagesPlugIdentifierUserSourceIdGetExecute(r ApiPlugMessagesPlugIdentifierUserSourceIdGetRequest) ([]TaskMessage, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue []TaskMessage
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserMessageApiService.PlugMessagesPlugIdentifierUserSourceIdGet")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/plug/messages/{plug_identifier}/{user_source_id}"
localVarPath = strings.Replace(localVarPath, "{"+"user_source_id"+"}", url.PathEscape(parameterToString(r.userSourceId, "")), -1)
localVarPath = strings.Replace(localVarPath, "{"+"plug_identifier"+"}", url.PathEscape(parameterToString(r.plugIdentifier, "")), -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 localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 400 {
var v map[string]map[string]interface{}
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.model = v
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}

View File

@ -52,6 +52,8 @@ type APIClient struct {
UserApi *UserApiService
UserMessageApi *UserMessageApiService
UserSourceApi *UserSourceApiService
}
@ -72,6 +74,7 @@ func NewAPIClient(cfg *Configuration) *APIClient {
// API Services
c.UserApi = (*UserApiService)(&c.common)
c.UserMessageApi = (*UserMessageApiService)(&c.common)
c.UserSourceApi = (*UserSourceApiService)(&c.common)
return c

134
docs/TaskMessage.md Normal file
View File

@ -0,0 +1,134 @@
# TaskMessage
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Body** | Pointer to **string** | | [optional]
**CreatedAt** | Pointer to **string** | | [optional]
**Title** | Pointer to **string** | | [optional]
**UserSourceId** | Pointer to **string** | | [optional]
## Methods
### NewTaskMessage
`func NewTaskMessage() *TaskMessage`
NewTaskMessage instantiates a new TaskMessage object
This constructor will assign default values to properties that have it defined,
and makes sure properties required by API are set, but the set of arguments
will change when the set of required properties is changed
### NewTaskMessageWithDefaults
`func NewTaskMessageWithDefaults() *TaskMessage`
NewTaskMessageWithDefaults instantiates a new TaskMessage object
This constructor will only assign default values to properties that have it defined,
but it doesn't guarantee that properties required by API are set
### GetBody
`func (o *TaskMessage) GetBody() string`
GetBody returns the Body field if non-nil, zero value otherwise.
### GetBodyOk
`func (o *TaskMessage) GetBodyOk() (*string, bool)`
GetBodyOk returns a tuple with the Body field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetBody
`func (o *TaskMessage) SetBody(v string)`
SetBody sets Body field to given value.
### HasBody
`func (o *TaskMessage) HasBody() bool`
HasBody returns a boolean if a field has been set.
### GetCreatedAt
`func (o *TaskMessage) GetCreatedAt() string`
GetCreatedAt returns the CreatedAt field if non-nil, zero value otherwise.
### GetCreatedAtOk
`func (o *TaskMessage) GetCreatedAtOk() (*string, bool)`
GetCreatedAtOk returns a tuple with the CreatedAt field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetCreatedAt
`func (o *TaskMessage) SetCreatedAt(v string)`
SetCreatedAt sets CreatedAt field to given value.
### HasCreatedAt
`func (o *TaskMessage) HasCreatedAt() bool`
HasCreatedAt returns a boolean if a field has been set.
### GetTitle
`func (o *TaskMessage) GetTitle() string`
GetTitle returns the Title field if non-nil, zero value otherwise.
### GetTitleOk
`func (o *TaskMessage) GetTitleOk() (*string, bool)`
GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetTitle
`func (o *TaskMessage) SetTitle(v string)`
SetTitle sets Title field to given value.
### HasTitle
`func (o *TaskMessage) HasTitle() bool`
HasTitle returns a boolean if a field has been set.
### GetUserSourceId
`func (o *TaskMessage) GetUserSourceId() string`
GetUserSourceId returns the UserSourceId field if non-nil, zero value otherwise.
### GetUserSourceIdOk
`func (o *TaskMessage) GetUserSourceIdOk() (*string, bool)`
GetUserSourceIdOk returns a tuple with the UserSourceId field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetUserSourceId
`func (o *TaskMessage) SetUserSourceId(v string)`
SetUserSourceId sets UserSourceId field to given value.
### HasUserSourceId
`func (o *TaskMessage) HasUserSourceId() bool`
HasUserSourceId returns a boolean if a field has been set.
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

82
docs/UserMessageApi.md Normal file
View File

@ -0,0 +1,82 @@
# \UserMessageApi
All URIs are relative to */api/v1*
Method | HTTP request | Description
------------- | ------------- | -------------
[**PlugMessagesPlugIdentifierUserSourceIdGet**](UserMessageApi.md#PlugMessagesPlugIdentifierUserSourceIdGet) | **Get** /plug/messages/{plug_identifier}/{user_source_id} | Get all Messages from a user
## PlugMessagesPlugIdentifierUserSourceIdGet
> []TaskMessage PlugMessagesPlugIdentifierUserSourceIdGet(ctx, userSourceId, plugIdentifier).Execute()
Get all Messages from a user
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
userSourceId := "userSourceId_example" // string | User Source ID
plugIdentifier := "plugIdentifier_example" // string | Plug Identifier
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.UserMessageApi.PlugMessagesPlugIdentifierUserSourceIdGet(context.Background(), userSourceId, plugIdentifier).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserMessageApi.PlugMessagesPlugIdentifierUserSourceIdGet``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `PlugMessagesPlugIdentifierUserSourceIdGet`: []TaskMessage
fmt.Fprintf(os.Stdout, "Response from `UserMessageApi.PlugMessagesPlugIdentifierUserSourceIdGet`: %v\n", resp)
}
```
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**userSourceId** | **string** | User Source ID |
**plugIdentifier** | **string** | Plug Identifier |
### Other Parameters
Other parameters are passed through a pointer to a apiPlugMessagesPlugIdentifierUserSourceIdGetRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
### Return type
[**[]TaskMessage**](TaskMessage.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: */*
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)

222
model_task_message.go Normal file
View File

@ -0,0 +1,222 @@
/*
Anthrove Orchestrator API
This service handles the communication between the manager and the plugs
API version: 1.0
Contact: support@anthrove.art
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package openapi
import (
"encoding/json"
)
// TaskMessage struct for TaskMessage
type TaskMessage struct {
Body *string `json:"body,omitempty"`
CreatedAt *string `json:"created_at,omitempty"`
Title *string `json:"title,omitempty"`
UserSourceId *string `json:"user_source_id,omitempty"`
}
// NewTaskMessage instantiates a new TaskMessage object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewTaskMessage() *TaskMessage {
this := TaskMessage{}
return &this
}
// NewTaskMessageWithDefaults instantiates a new TaskMessage object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewTaskMessageWithDefaults() *TaskMessage {
this := TaskMessage{}
return &this
}
// GetBody returns the Body field value if set, zero value otherwise.
func (o *TaskMessage) GetBody() string {
if o == nil || o.Body == nil {
var ret string
return ret
}
return *o.Body
}
// GetBodyOk returns a tuple with the Body field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TaskMessage) GetBodyOk() (*string, bool) {
if o == nil || o.Body == nil {
return nil, false
}
return o.Body, true
}
// HasBody returns a boolean if a field has been set.
func (o *TaskMessage) HasBody() bool {
if o != nil && o.Body != nil {
return true
}
return false
}
// SetBody gets a reference to the given string and assigns it to the Body field.
func (o *TaskMessage) SetBody(v string) {
o.Body = &v
}
// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise.
func (o *TaskMessage) GetCreatedAt() string {
if o == nil || o.CreatedAt == nil {
var ret string
return ret
}
return *o.CreatedAt
}
// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TaskMessage) GetCreatedAtOk() (*string, bool) {
if o == nil || o.CreatedAt == nil {
return nil, false
}
return o.CreatedAt, true
}
// HasCreatedAt returns a boolean if a field has been set.
func (o *TaskMessage) HasCreatedAt() bool {
if o != nil && o.CreatedAt != nil {
return true
}
return false
}
// SetCreatedAt gets a reference to the given string and assigns it to the CreatedAt field.
func (o *TaskMessage) SetCreatedAt(v string) {
o.CreatedAt = &v
}
// GetTitle returns the Title field value if set, zero value otherwise.
func (o *TaskMessage) GetTitle() string {
if o == nil || o.Title == nil {
var ret string
return ret
}
return *o.Title
}
// GetTitleOk returns a tuple with the Title field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TaskMessage) GetTitleOk() (*string, bool) {
if o == nil || o.Title == nil {
return nil, false
}
return o.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (o *TaskMessage) HasTitle() bool {
if o != nil && o.Title != nil {
return true
}
return false
}
// SetTitle gets a reference to the given string and assigns it to the Title field.
func (o *TaskMessage) SetTitle(v string) {
o.Title = &v
}
// GetUserSourceId returns the UserSourceId field value if set, zero value otherwise.
func (o *TaskMessage) GetUserSourceId() string {
if o == nil || o.UserSourceId == nil {
var ret string
return ret
}
return *o.UserSourceId
}
// GetUserSourceIdOk returns a tuple with the UserSourceId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TaskMessage) GetUserSourceIdOk() (*string, bool) {
if o == nil || o.UserSourceId == nil {
return nil, false
}
return o.UserSourceId, true
}
// HasUserSourceId returns a boolean if a field has been set.
func (o *TaskMessage) HasUserSourceId() bool {
if o != nil && o.UserSourceId != nil {
return true
}
return false
}
// SetUserSourceId gets a reference to the given string and assigns it to the UserSourceId field.
func (o *TaskMessage) SetUserSourceId(v string) {
o.UserSourceId = &v
}
func (o TaskMessage) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.Body != nil {
toSerialize["body"] = o.Body
}
if o.CreatedAt != nil {
toSerialize["created_at"] = o.CreatedAt
}
if o.Title != nil {
toSerialize["title"] = o.Title
}
if o.UserSourceId != nil {
toSerialize["user_source_id"] = o.UserSourceId
}
return json.Marshal(toSerialize)
}
type NullableTaskMessage struct {
value *TaskMessage
isSet bool
}
func (v NullableTaskMessage) Get() *TaskMessage {
return v.value
}
func (v *NullableTaskMessage) Set(val *TaskMessage) {
v.value = val
v.isSet = true
}
func (v NullableTaskMessage) IsSet() bool {
return v.isSet
}
func (v *NullableTaskMessage) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTaskMessage(val *TaskMessage) *NullableTaskMessage {
return &NullableTaskMessage{value: val, isSet: true}
}
func (v NullableTaskMessage) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTaskMessage) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}