Skip to content

Commit

Permalink
Merge pull request #165 from aziontech/generated-sdk
Browse files Browse the repository at this point in the history
Auto-generated SDK
  • Loading branch information
pablodiehl authored Feb 28, 2025
2 parents c5ff679 + d544bbd commit 1172dd2
Show file tree
Hide file tree
Showing 17 changed files with 434 additions and 230 deletions.
2 changes: 2 additions & 0 deletions edgefunctions/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ client.go
configuration.go
docs/BadRequestResponse.md
docs/CreateEdgeFunctionRequest.md
docs/CreateEdgeFunctionRequestJsonArgs.md
docs/EdgeFunctionResponse.md
docs/EdgeFunctionsAPI.md
docs/ErrorResponse.md
Expand All @@ -20,6 +21,7 @@ go.mod
go.sum
model_bad_request_response.go
model_create_edge_function_request.go
model_create_edge_function_request_json_args.go
model_edge_function_response.go
model_error_response.go
model_links.go
Expand Down
2 changes: 1 addition & 1 deletion edgefunctions/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.0.1
7.12.0
30 changes: 16 additions & 14 deletions edgefunctions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,27 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat

- API version: 2.0.0
- Package version: 1.0.0
- Generator version: 7.12.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen

## Installation

Install the following dependencies:

```shell
```sh
go get github.com/stretchr/testify/assert
go get golang.org/x/net/context
```

Put the package under your project folder and add the following in import:

```golang
```go
import edgefunctions "github.com/GIT_USER_ID/GIT_REPO_ID"
```

To use a proxy, set the environment variable `HTTP_PROXY`:

```golang
```go
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
```

Expand All @@ -36,17 +37,17 @@ Default configuration comes with `Servers` field that contains server objects as

### Select Server Configuration

For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`.
For using other server than the one defined on index 0 set context value `edgefunctions.ContextServerIndex` of type `int`.

```golang
```go
ctx := context.WithValue(context.Background(), edgefunctions.ContextServerIndex, 1)
```

### Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`.
Templated server URL is formatted using default variables from configuration or from context value `edgefunctions.ContextServerVariables` of type `map[string]string`.

```golang
```go
ctx := context.WithValue(context.Background(), edgefunctions.ContextServerVariables, map[string]string{
"basePath": "v2",
})
Expand All @@ -58,9 +59,9 @@ Note, enum values are always validated and all unused variables are silently ign

Each operation can use different server URL defined using `OperationServers` map in the `Configuration`.
An operation is uniquely identified by `"{classname}Service.{nickname}"` string.
Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps.
Similar rules for overriding default operation server index and variables applies by using `edgefunctions.ContextOperationServerIndices` and `edgefunctions.ContextOperationServerVariables` context maps.

```golang
```go
ctx := context.WithValue(context.Background(), edgefunctions.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
Expand Down Expand Up @@ -89,6 +90,7 @@ Class | Method | HTTP request | Description

- [BadRequestResponse](docs/BadRequestResponse.md)
- [CreateEdgeFunctionRequest](docs/CreateEdgeFunctionRequest.md)
- [CreateEdgeFunctionRequestJsonArgs](docs/CreateEdgeFunctionRequestJsonArgs.md)
- [EdgeFunctionResponse](docs/EdgeFunctionResponse.md)
- [ErrorResponse](docs/ErrorResponse.md)
- [Links](docs/Links.md)
Expand All @@ -108,16 +110,16 @@ Authentication schemes defined for the API:
- **API key parameter name**: Authorization
- **Location**: HTTP header

Note, each API key must be added to a map of `map[string]APIKey` where the key is: Authorization and passed in as the auth context for each request.
Note, each API key must be added to a map of `map[string]APIKey` where the key is: tokenAuth and passed in as the auth context for each request.

Example

```golang
```go
auth := context.WithValue(
context.Background(),
sw.ContextAPIKeys,
map[string]sw.APIKey{
"Authorization": {Key: "API_KEY_STRING"},
edgefunctions.ContextAPIKeys,
map[string]edgefunctions.APIKey{
"tokenAuth": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
Expand Down
36 changes: 30 additions & 6 deletions edgefunctions/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,8 @@ components:
required: true
schemas:
ErrorResponse:
example:
detail: detail
properties:
detail:
type: string
Expand Down Expand Up @@ -467,7 +469,7 @@ components:
name: name
active: true
language: language
json_args: ""
json_args: {}
initiator_type: edge_application
properties:
name:
Expand All @@ -476,7 +478,8 @@ components:
type: string
code:
type: string
json_args: {}
json_args:
$ref: '#/components/schemas/CreateEdgeFunctionRequest_json_args'
initiator_type:
enum:
- edge_application
Expand All @@ -488,6 +491,19 @@ components:
type: boolean
type: object
BadRequestResponse:
example:
code:
- code
- code
name:
- name
- name
active:
- active
- active
language:
- language
- language
properties:
name:
items:
Expand Down Expand Up @@ -532,15 +548,16 @@ components:
code: code
name: name
active: true
json_args: ""
json_args: {}
language: language
initiator_type: edge_application
properties:
name:
type: string
code:
type: string
json_args: {}
json_args:
$ref: '#/components/schemas/CreateEdgeFunctionRequest_json_args'
active:
type: boolean
initiator_type:
Expand All @@ -558,18 +575,25 @@ components:
code: code
name: name
active: true
json_args: ""
json_args: {}
properties:
name:
type: string
code:
type: string
json_args: {}
json_args:
$ref: '#/components/schemas/CreateEdgeFunctionRequest_json_args'
active:
type: boolean
is_proprietary_code:
type: boolean
type: object
CreateEdgeFunctionRequest_json_args:
oneOf:
- type: object
- items:
type: object
type: array
securitySchemes:
tokenAuth:
description: |
Expand Down
8 changes: 4 additions & 4 deletions edgefunctions/api_edge_functions.go

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

46 changes: 20 additions & 26 deletions edgefunctions/client.go

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

Loading

0 comments on commit 1172dd2

Please sign in to comment.