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

fix: example cursor #335

Merged
merged 3 commits into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions .github/workflows/template_sdk-generate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v3
with:
token: ${{ secrets.NUMARY_GITHUB_TOKEN }}
repository: numary/numary-sdk-${{ matrix.sdk }}
repository: formancehq/numary-sdk-${{ matrix.sdk }}
path: sdks/${{ matrix.sdk }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
Expand All @@ -30,4 +30,4 @@ jobs:
- name: Install Task
uses: arduino/setup-task@v1
- name: Launch Generate
run: task sdk:generate VERSION=main -- ${{ matrix.sdk }}
run: task sdk:generate VERSION=main -- ${{ matrix.sdk }}
4 changes: 2 additions & 2 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ tasks:
- sh: '[ "{{.CLI_ARGS}}" != "" ]'
msg: Please specify generator as first cli arg (ie "task generate -- go")
cmds:
- wget https://raw.githubusercontent.com/numary/ledger/{{.VERSION}}/pkg/api/controllers/swagger.yaml -O swagger.yaml
- wget https://raw.githubusercontent.com/formancehq/ledger/{{.VERSION}}/pkg/api/controllers/swagger.yaml -O swagger.yaml
- sed -i -e "s/LEDGER_VERSION/{{.VERSION}}/g" swagger.yaml
- >
docker run --rm -w /local -v ${PWD}:/local openapitools/openapi-generator-cli:latest generate
-i ./swagger.yaml
-g {{ (split "-" .CLI_ARGS)._0 }}
-c ./configs/{{.CLI_ARGS}}.yaml
-o ./sdks/{{.CLI_ARGS}}
--git-user-id=numary
--git-user-id=formancehq
--git-repo-id=numary-sdk-{{.CLI_ARGS}}
-p packageVersion={{.VERSION}}

Expand Down
156 changes: 78 additions & 78 deletions pkg/api/controllers/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ info:
version: "LEDGER_VERSION"

servers:
antoinegelloz marked this conversation as resolved.
Show resolved Hide resolved
- url: https://{organization}.o.numary.cloud/ledger
description: Production server
variables:
organization:
description: The organization on which the ledger is located
default: ""
- url: https://{organization}.o.numary.cloud/ledger
description: Production server
variables:
organization:
description: The organization on which the ledger is located
default: ""

paths:
/_info:
Expand All @@ -32,30 +32,30 @@ paths:
summary: Count the accounts from a ledger.
operationId: countAccounts
tags:
- accounts
- accounts
parameters:
- name: ledger
in: path
description: Name of the ledger.
required: true
schema:
type: string
example: ledger001
- name: address
in: query
description: Filter accounts by address pattern (regular expression placed between ^ and $).
schema:
type: string
example: users:.+
- name: metadata
in: query
description: Filter accounts by metadata key value pairs. Nested objects can be used as seen in the example below.
style: deepObject
explode: true
schema:
type: object
properties: {}
example: metadata[key]=value1&metadata[a.nested.key]=value2
- name: ledger
in: path
description: Name of the ledger.
required: true
schema:
type: string
example: ledger001
- name: address
in: query
description: Filter accounts by address pattern (regular expression placed between ^ and $).
schema:
type: string
example: users:.+
- name: metadata
in: query
description: Filter accounts by metadata key value pairs. Nested objects can be used as seen in the example below.
style: deepObject
explode: true
schema:
type: object
properties: {}
example: metadata[key]=value1&metadata[a.nested.key]=value2
responses:
"200":
description: OK
Expand Down Expand Up @@ -320,7 +320,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/MappingResponse'

/{ledger}/script:
post:
tags:
Expand Down Expand Up @@ -354,7 +354,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ScriptResult'

/{ledger}/stats:
get:
tags:
Expand Down Expand Up @@ -383,51 +383,51 @@ paths:
/{ledger}/transactions:
head:
tags:
- transactions
- transactions
summary: Count the transactions from a ledger.
operationId: countTransactions
parameters:
- name: ledger
in: path
description: Name of the ledger.
required: true
schema:
type: string
example: ledger001
- name: reference
in: query
description: Filter transactions by reference field.
schema:
type: string
example: ref:001
- name: account
in: query
description: Filter transactions with postings involving given account, either
as source or destination (regular expression placed between ^ and $).
schema:
type: string
example: users:001
- name: source
in: query
description: Filter transactions with postings involving given account at source (regular expression placed between ^ and $).
schema:
type: string
example: users:001
- name: destination
in: query
description: Filter transactions with postings involving given account at destination (regular expression placed between ^ and $).
schema:
type: string
example: users:001
- name: metadata
in: query
description: Filter transactions by metadata key value pairs. Nested objects can be used as seen in the example below.
style: deepObject
explode: true
schema:
type: object
properties: { }
example: metadata[key]=value1&metadata[a.nested.key]=value2
- name: ledger
in: path
description: Name of the ledger.
required: true
schema:
type: string
example: ledger001
- name: reference
in: query
description: Filter transactions by reference field.
schema:
type: string
example: ref:001
- name: account
in: query
description: Filter transactions with postings involving given account, either
as source or destination (regular expression placed between ^ and $).
schema:
type: string
example: users:001
- name: source
in: query
description: Filter transactions with postings involving given account at source (regular expression placed between ^ and $).
schema:
type: string
example: users:001
- name: destination
in: query
description: Filter transactions with postings involving given account at destination (regular expression placed between ^ and $).
schema:
type: string
example: users:001
- name: metadata
in: query
description: Filter transactions by metadata key value pairs. Nested objects can be used as seen in the example below.
style: deepObject
explode: true
schema:
type: object
properties: { }
example: metadata[key]=value1&metadata[a.nested.key]=value2
responses:
"200":
description: OK
Expand Down Expand Up @@ -1247,16 +1247,16 @@ components:
properties:
page_size:
type: integer
example: 1
example: 15
has_more:
type: boolean
example: false
previous:
type: string
example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=
example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol="
antoinegelloz marked this conversation as resolved.
Show resolved Hide resolved
next:
type: string
example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==
example: ""

TransactionsResponse:
type: object
Expand Down Expand Up @@ -1303,8 +1303,8 @@ components:
balance:
type: number
required:
- input
- output
- input
- output
example:
input: 100
output: 20
Expand Down
8 changes: 3 additions & 5 deletions sdk/templates/go/README.mustache
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Go API client for Numary
# Formance Go SDK

{{#appDescriptionWithNewLines}}
{{{.}}}
{{/appDescriptionWithNewLines}}

## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.
This SDK was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate SDK.

- API version: {{appVersion}}
- Package version: {{packageVersion}}
Expand All @@ -19,10 +19,8 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})

## Installation

Install the following dependencies:

```shell
go get github.com/numary/go-ledgerclient
go get github.com/formancehq/numary-sdk-go
```

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