This commit is contained in:
Illya Marchenko 2024-04-10 22:21:45 +03:00
parent 88dd10c967
commit a523824e66
Signed by: stuzer05
GPG Key ID: A6ABAAA9268F9F4F
3 changed files with 28 additions and 28 deletions

View File

@ -1,4 +1,4 @@
# Go API client for openapi
# Go API client for monobank
API для отримання інформації про виписки та стан особистого рахунку та рахунків ФОП. Для надання доступу потрібно пройти авторизацію у особистому кабінеті https://api.monobank.ua/ та отримати токен для персонального використання.
@ -11,12 +11,12 @@ API недоступне для клієнтів до 16 років, дані з
У разі виявлення експлуатації цього API в якості корпоративного, банк залишає за собою право накласти санкції на компанію.
## 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 API client was generated by the [OpenAPI Generator](https://monobank-generator.tech) project. By using the [OpenAPI-spec](https://www.monobanks.org/) from a remote server, you can easily generate an API client.
- API version: v2303
- Package version: 1.0.0
- Generator version: 7.4.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
- Build package: org.monobanktools.codegen.languages.GoClientCodegen
## Installation
@ -45,18 +45,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 `monobank.ContextServerIndex` of type `int`.
```go
ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1)
ctx := context.WithValue(context.Background(), monobank.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 `monobank.ContextServerVariables` of type `map[string]string`.
```go
ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{
ctx := context.WithValue(context.Background(), monobank.ContextServerVariables, map[string]string{
"basePath": "v2",
})
```
@ -67,13 +67,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 `monobank.ContextOperationServerIndices` and `monobank.ContextOperationServerVariables` context maps.
```go
ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{
ctx := context.WithValue(context.Background(), monobank.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(), monobank.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},

View File

@ -28,13 +28,13 @@ import (
"context"
"fmt"
"os"
openapiclient "gitea.stuzer.link/stuzer05/go-monobank"
monobankclient "gitea.stuzer.link/stuzer05/go-monobank"
)
func main() {
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
configuration := monobankclient.NewConfiguration()
apiClient := monobankclient.NewAPIClient(configuration)
resp, r, err := apiClient.DefaultApi.BankCurrencyGet(context.Background()).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.BankCurrencyGet``: %v\n", err)
@ -89,14 +89,14 @@ import (
"context"
"fmt"
"os"
openapiclient "gitea.stuzer.link/stuzer05/go-monobank"
monobankclient "gitea.stuzer.link/stuzer05/go-monobank"
)
func main() {
xToken := "u3AulkpZFI1lIuGsik6vuPsVWqN7GoWs6o_MO2sdf301" // string | Token для особистого доступу до API
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
configuration := monobankclient.NewConfiguration()
apiClient := monobankclient.NewAPIClient(configuration)
resp, r, err := apiClient.DefaultApi.PersonalClientInfoGet(context.Background()).XToken(xToken).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.PersonalClientInfoGet``: %v\n", err)
@ -155,7 +155,7 @@ import (
"context"
"fmt"
"os"
openapiclient "gitea.stuzer.link/stuzer05/go-monobank"
monobankclient "gitea.stuzer.link/stuzer05/go-monobank"
)
func main() {
@ -164,8 +164,8 @@ func main() {
from := "1546304461" // string | Початок часу виписки.
to := "1546306461" // string | Останній час виписки (якщо відсутній, буде використовуватись поточний час). (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
configuration := monobankclient.NewConfiguration()
apiClient := monobankclient.NewAPIClient(configuration)
resp, r, err := apiClient.DefaultApi.PersonalStatementAccountFromToGet(context.Background(), account, from, to).XToken(xToken).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.PersonalStatementAccountFromToGet``: %v\n", err)
@ -233,15 +233,15 @@ import (
"context"
"fmt"
"os"
openapiclient "gitea.stuzer.link/stuzer05/go-monobank"
monobankclient "gitea.stuzer.link/stuzer05/go-monobank"
)
func main() {
xToken := "xToken_example" // string | Token для особистого доступу до API
setWebHook := *openapiclient.NewSetWebHook() // SetWebHook |
setWebHook := *monobankclient.NewSetWebHook() // SetWebHook |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
configuration := monobankclient.NewConfiguration()
apiClient := monobankclient.NewAPIClient(configuration)
r, err := apiClient.DefaultApi.PersonalWebhookPost(context.Background()).XToken(xToken).SetWebHook(setWebHook).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.PersonalWebhookPost``: %v\n", err)

View File

@ -5,22 +5,22 @@ Testing DefaultApiService
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech);
// Code generated by OpenAPI Generator (https://monobank-generator.tech);
package monobank
import (
"context"
openapiclient "gitea.stuzer.link/stuzer05/go-monobank"
monobankclient "gitea.stuzer.link/stuzer05/go-monobank"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"testing"
)
func Test_openapi_DefaultApiService(t *testing.T) {
func Test_monobank_DefaultApiService(t *testing.T) {
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
configuration := monobankclient.NewConfiguration()
apiClient := monobankclient.NewAPIClient(configuration)
t.Run("Test DefaultApiService BankCurrencyGet", func(t *testing.T) {