Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Flowpipe SDK to incorporate latest API changes and the new Trigger API endpoints. #13

Merged
merged 4 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added new trigger SDK API.
  • Loading branch information
vhadianto committed Jul 22, 2024
commit d788fb9ae924edeed2be9c6537b7d1201852e470
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ Class | Method | HTTP request | Description
*ProcessApi* | [**GetExecution**](docs/ProcessApi.md#getexecution) | **Get** /process/{process_id}/execution | Get process execution
*ProcessApi* | [**GetLog**](docs/ProcessApi.md#getlog) | **Get** /process/{process_id}/log/process.json | Get process log
*ProcessApi* | [**List**](docs/ProcessApi.md#list) | **Get** /process | List processs
*TriggerApi* | [**Command**](docs/TriggerApi.md#command) | **Post** /trigger/{trigger_name}/command | Execute a trigger command
*TriggerApi* | [**Get**](docs/TriggerApi.md#get) | **Get** /trigger/{trigger_name} | Get trigger
*TriggerApi* | [**List**](docs/TriggerApi.md#list) | **Get** /trigger | List triggers
*VariableApi* | [**Get**](docs/VariableApi.md#get) | **Get** /variable/{variable_name} | Get variable
Expand Down
69 changes: 69 additions & 0 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ paths:
- Pipeline
/pipeline/{pipeline_name}/command:
post:
description: Execute a pipeline command
operationId: pipeline_command
parameters:
- description: The name of the pipeline
Expand Down Expand Up @@ -899,6 +900,74 @@ paths:
summary: Get trigger
tags:
- Trigger
/trigger/{trigger_name}/command:
post:
description: Execute a trigger command
operationId: trigger_command
parameters:
- description: The name of the trigger
explode: false
in: path
name: trigger_name
required: true
schema:
format: "^[a-z_]{0,32}$"
type: string
style: simple
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CmdPipeline'
description: Trigger command.
required: true
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/PipelineExecutionResponse'
description: OK
"400":
content:
application/json:
schema:
$ref: '#/components/schemas/perr.ErrorModel'
description: Bad Request
"401":
content:
application/json:
schema:
$ref: '#/components/schemas/perr.ErrorModel'
description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/perr.ErrorModel'
description: Forbidden
"404":
content:
application/json:
schema:
$ref: '#/components/schemas/perr.ErrorModel'
description: Not Found
"429":
content:
application/json:
schema:
$ref: '#/components/schemas/perr.ErrorModel'
description: Too Many Requests
"500":
content:
application/json:
schema:
$ref: '#/components/schemas/perr.ErrorModel'
description: Internal Server Error
summary: Execute a trigger command
tags:
- Trigger
x-codegen-request-body-name: request
/variable:
get:
description: Lists variables
Expand Down
2 changes: 2 additions & 0 deletions api_pipeline.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

180 changes: 180 additions & 0 deletions api_trigger.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions docs/PipelineApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Method | HTTP request | Description

Execute a pipeline command



### Example

```go
Expand Down
73 changes: 73 additions & 0 deletions docs/TriggerApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,84 @@ All URIs are relative to *https://localhost/api/v0*

Method | HTTP request | Description
------------- | ------------- | -------------
[**Command**](TriggerApi.md#Command) | **Post** /trigger/{trigger_name}/command | Execute a trigger command
[**Get**](TriggerApi.md#Get) | **Get** /trigger/{trigger_name} | Get trigger
[**List**](TriggerApi.md#List) | **Get** /trigger | List triggers



## Command

> map[string]interface{} Command(ctx, triggerName).Request(request).Execute()

Execute a trigger command



### Example

```go
package main

import (
"context"
"fmt"
"os"
openapiclient "github.com/turbot/flowpipe-sdk-go"
)

func main() {
triggerName := "triggerName_example" // string | The name of the trigger
request := *openapiclient.NewCmdPipeline("Command_example") // CmdPipeline | Trigger command.

configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.TriggerApi.Command(context.Background(), triggerName).Request(request).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `TriggerApi.Command``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `Command`: map[string]interface{}
fmt.Fprintf(os.Stdout, "Response from `TriggerApi.Command`: %v\n", resp)
}
```

### Path Parameters


Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**triggerName** | **string** | The name of the trigger |

### Other Parameters

Other parameters are passed through a pointer to a apiCommandRequest struct via the builder pattern


Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------

**request** | [**CmdPipeline**](CmdPipeline.md) | Trigger command. |

### Return type

**map[string]interface{}**

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

[[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)


## Get

> FpTrigger Get(ctx, triggerName).Execute()
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/turbot/flowpipe-sdk-go

go 1.20
go 1.22.4

require github.com/stretchr/testify v1.9.0

Expand Down