Skip to content

Commit

Permalink
Merge pull request #1 from satraul/development
Browse files Browse the repository at this point in the history
Release v1.0.0
  • Loading branch information
satraul committed Aug 22, 2020
2 parents 33aedbf + 45ee1ca commit c19736b
Show file tree
Hide file tree
Showing 21 changed files with 487 additions and 3,250 deletions.
23 changes: 0 additions & 23 deletions .openapi-generator-ignore

This file was deleted.

17 changes: 0 additions & 17 deletions .openapi-generator/FILES

This file was deleted.

1 change: 0 additions & 1 deletion .openapi-generator/VERSION

This file was deleted.

8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Ahmad Satryaji Aulia

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
114 changes: 32 additions & 82 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,42 @@
# Go API client for bca
# bca-go

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
go-bca is the (unofficial) BCA SDK for the Go programming language.

## 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.

- API version: 1.0
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.GoClientExperimentalCodegen
This SDK was kickstarted by the [OpenAPI Generator](https://openapi-generator.tech) project.

## Installation

Install the following dependencies:

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

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

```golang
import sw "./bca"
```

## Configuration of Server URL

Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification.

### Select Server Configuration

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

```golang
ctx := context.WithValue(context.Background(), sw.ContextServerIndex, 1)
go get github.com/satraul/bca-go
```

### Templated Server URL

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

```golang
ctx := context.WithValue(context.Background(), sw.ContextServerVariables, map[string]string{
"basePath": "v2",
})
import (
bca "github.com/satraul/bca-go"
)

func main() {
api := bca.NewAPIClient(bca.NewConfiguration())
auth, err := api.Login(ctx, "username", "password", "1.2.3.4")
if err != nil {
panic(err)
}

balance, err := api.BalanceInquiry(ctx, auth)
if err != nil {
panic(err)
}
log.Printf("%+v\n", balance)

if err := api.Logout(ctx, auth); err != nil {
panic(err)
}
}
```

Note, enum values are always validated and all unused variables are silently ignored.

### URLs Configuration per Operation

Each operation can use different server URL defined using `OperationServers` map in the `Configuration`.
An operation is uniquely identifield 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.

```
ctx := context.WithValue(context.Background(), sw.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), sw.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})
```
See the a full example at [example/example.go](example/example.go).

## Documentation for API Endpoints

Expand All @@ -76,37 +48,15 @@ Class | Method | HTTP request | Description
*BCAApi* | [**BalanceInquiry**](docs/BCAApi.md#balanceinquiry) | **Post** /balanceinquiry.do | BalanceInquiry
*BCAApi* | [**Login**](docs/BCAApi.md#login) | **Post** /authentication.do | Login
*BCAApi* | [**Logout**](docs/BCAApi.md#logout) | **Get** /authentication.do?value(actions)=logout | Logout
*BCAApi* | [**Menu**](docs/BCAApi.md#menu) | **Post** /accountstmt.do?value(actions)=menu | Menu


## Documentation For Models

- [InlineObject](docs/InlineObject.md)
- [InlineObject1](docs/InlineObject1.md)


## Documentation For Authorization

Endpoints do not require authorization.


## Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains
a number of utility functions to easily obtain pointers to values of basic types.
Each of these functions takes a value of the given basic type and returns a pointer to it:

* `PtrBool`
* `PtrInt`
* `PtrInt32`
* `PtrInt64`
* `PtrFloat`
* `PtrFloat32`
* `PtrFloat64`
* `PtrString`
* `PtrTime`
[**Login**](docs/BCAApi.md#login) will return session cookies (`[]*Cookie`) that are used for auth in all other endpoints.

## Author
## Contributing

Pull requests are welcome.

## License

[MIT](LICENSE)
Loading

0 comments on commit c19736b

Please sign in to comment.