Skip to content

Commit

Permalink
feat: update spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Eliot Whalan committed Apr 17, 2024
1 parent 896538c commit c3ba577
Show file tree
Hide file tree
Showing 125 changed files with 2,485 additions and 1,092 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Go API client for openapi
# Go API client for moonsdk

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

Expand All @@ -23,7 +23,7 @@ go get golang.org/x/net/context
Put the package under your project folder and add the following in import:

```go
import openapi "github.com/GIT_USER_ID/GIT_REPO_ID"
import moonsdk "github.com/GIT_USER_ID/GIT_REPO_ID"
```

To use a proxy, set the environment variable `HTTP_PROXY`:
Expand All @@ -38,18 +38,18 @@ 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 `openapi.ContextServerIndex` of type `int`.
For using other server than the one defined on index 0 set context value `moonsdk.ContextServerIndex` of type `int`.

```go
ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1)
ctx := context.WithValue(context.Background(), moonsdk.ContextServerIndex, 1)
```

### Templated Server URL

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

```go
ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{
ctx := context.WithValue(context.Background(), moonsdk.ContextServerVariables, map[string]string{
"basePath": "v2",
})
```
Expand All @@ -60,13 +60,13 @@ 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 `openapi.ContextOperationServerIndices` and `openapi.ContextOperationServerVariables` context maps.
Similar rules for overriding default operation server index and variables applies by using `moonsdk.ContextOperationServerIndices` and `moonsdk.ContextOperationServerVariables` context maps.

```go
ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{
ctx := context.WithValue(context.Background(), moonsdk.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVariables, map[string]map[string]string{
ctx = context.WithValue(context.Background(), moonsdk.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
Expand Down Expand Up @@ -306,8 +306,8 @@ Example
```go
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
moonsdk.ContextAPIKeys,
map[string]moonsdk.APIKey{
"Authorization": {Key: "API_KEY_STRING"},
},
)
Expand All @@ -326,7 +326,7 @@ r, err := client.Service.Operation(auth, args)
Example

```go
auth := context.WithValue(context.Background(), openapi.ContextAccessToken, "ACCESSTOKENSTRING")
auth := context.WithValue(context.Background(), moonsdk.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)
```

Expand All @@ -338,7 +338,7 @@ import "golang.org/x/oauth2"
/* Perform OAuth2 round trip request and obtain a token */

tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, openapi.ContextOAuth2, tokenSource)
auth := context.WithValue(oauth2.NoContext, moonsdk.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)
```

Expand All @@ -355,8 +355,8 @@ Example
```go
auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
moonsdk.ContextAPIKeys,
map[string]moonsdk.APIKey{
"x-api-key": {Key: "API_KEY_STRING"},
},
)
Expand Down
129 changes: 92 additions & 37 deletions api_aave.go

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

Loading

0 comments on commit c3ba577

Please sign in to comment.