177 lines
8.6 KiB
Markdown
177 lines
8.6 KiB
Markdown
# Go API client for openapi
|
|
|
|
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
|
|
## 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: 0.1.0
|
|
- Package version: 1.0.0
|
|
- Generator version: 7.24.0-SNAPSHOT
|
|
- Build package: org.openapitools.codegen.languages.GoClientCodegen
|
|
|
|
## Installation
|
|
|
|
Import the package in a go file in your project and run `go mod tidy`:
|
|
|
|
```go
|
|
import openapi "github.com/GIT_USER_ID/GIT_REPO_ID"
|
|
```
|
|
|
|
To use a proxy, set the environment variable `HTTP_PROXY`:
|
|
|
|
```go
|
|
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
|
|
```
|
|
|
|
## 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 `openapi.ContextServerIndex` of type `int`.
|
|
|
|
```go
|
|
ctx := context.WithValue(context.Background(), openapi.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`.
|
|
|
|
```go
|
|
ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{
|
|
"basePath": "v2",
|
|
})
|
|
```
|
|
|
|
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 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.
|
|
|
|
```go
|
|
ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{
|
|
"{classname}Service.{nickname}": 2,
|
|
})
|
|
ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVariables, map[string]map[string]string{
|
|
"{classname}Service.{nickname}": {
|
|
"port": "8443",
|
|
},
|
|
})
|
|
```
|
|
|
|
## Documentation for API Endpoints
|
|
|
|
All URIs are relative to *http://localhost*
|
|
|
|
Class | Method | HTTP request | Description
|
|
------------ | ------------- | ------------- | -------------
|
|
*AccessAuthAPI* | [**AddAccessauthApiV1AaPost**](docs/AccessAuthAPI.md#addaccessauthapiv1aapost) | **Post** /api/v1/aa/ | Add Accessauth
|
|
*AccessAuthAPI* | [**AssignAccessauthApiV1AaAssignGroupIdAaIdPut**](docs/AccessAuthAPI.md#assignaccessauthapiv1aaassigngroupidaaidput) | **Put** /api/v1/aa/assign/{group_id}/{aa_id} | Assign Accessauth
|
|
*AccessAuthAPI* | [**ChangeAccessauthApiV1AaAaIdPatch**](docs/AccessAuthAPI.md#changeaccessauthapiv1aaaaidpatch) | **Patch** /api/v1/aa/{aa_id} | Change Accessauth
|
|
*AccessAuthAPI* | [**DeleteAccessauthApiV1AaAaIdDelete**](docs/AccessAuthAPI.md#deleteaccessauthapiv1aaaaiddelete) | **Delete** /api/v1/aa/{aa_id} | Delete Accessauth
|
|
*AccessAuthAPI* | [**GetAllAccessauthsApiV1AaGet**](docs/AccessAuthAPI.md#getallaccessauthsapiv1aaget) | **Get** /api/v1/aa/ | Get All Accessauths
|
|
*AccessAuthAPI* | [**GetOneAccessauthApiV1AaAaIdGet**](docs/AccessAuthAPI.md#getoneaccessauthapiv1aaaaidget) | **Get** /api/v1/aa/{aa_id} | Get One Accessauth
|
|
*AccessAuthAPI* | [**UnassignAccessauthApiV1AaUnassignGroupIdAaIdPut**](docs/AccessAuthAPI.md#unassignaccessauthapiv1aaunassigngroupidaaidput) | **Put** /api/v1/aa/unassign/{group_id}/{aa_id} | Unassign Accessauth
|
|
*CardAPI* | [**AddCardApiV1CardsGroupIdPost**](docs/CardAPI.md#addcardapiv1cardsgroupidpost) | **Post** /api/v1/cards/{group_id} | Add Card
|
|
*CardAPI* | [**DelCardApiV1CardsDeleteGet**](docs/CardAPI.md#delcardapiv1cardsdeleteget) | **Get** /api/v1/cards/delete | Del Card
|
|
*CardAPI* | [**GetCardsApiV1CardsGroupIdGet**](docs/CardAPI.md#getcardsapiv1cardsgroupidget) | **Get** /api/v1/cards/{group_id} | Get Cards
|
|
*DebugItemsMaybeDontShowThisInUIAPI* | [**AddCardManuallyApiV1DebugAddcardGroupidCardKeyGet**](docs/DebugItemsMaybeDontShowThisInUIAPI.md#addcardmanuallyapiv1debugaddcardgroupidcardkeyget) | **Get** /api/v1/debug/addcard/{groupid}/{card_key} | Add Card Manually
|
|
*DebugItemsMaybeDontShowThisInUIAPI* | [**ListAllCardsApiV1DebugGetcardsPut**](docs/DebugItemsMaybeDontShowThisInUIAPI.md#listallcardsapiv1debuggetcardsput) | **Put** /api/v1/debug/getcards | List All Cards
|
|
*DebugItemsMaybeDontShowThisInUIAPI* | [**RemoveCardManuallyApiV1DebugRmcardCardKeyGet**](docs/DebugItemsMaybeDontShowThisInUIAPI.md#removecardmanuallyapiv1debugrmcardcardkeyget) | **Get** /api/v1/debug/rmcard/{card_key} | Remove Card Manually
|
|
*DoorAPI* | [**OpenDoorApiV1DoorClosePut**](docs/DoorAPI.md#opendoorapiv1doorcloseput) | **Put** /api/v1/door/close | Open Door
|
|
*DoorAPI* | [**OpenDoorApiV1DoorOpenPut**](docs/DoorAPI.md#opendoorapiv1dooropenput) | **Put** /api/v1/door/open | Open Door
|
|
*DoorAPI* | [**TestAccessApiV1DoorTestPost**](docs/DoorAPI.md#testaccessapiv1doortestpost) | **Post** /api/v1/door/test | Test Access
|
|
*GroupAPI* | [**CreateGroupApiV1GroupsPost**](docs/GroupAPI.md#creategroupapiv1groupspost) | **Post** /api/v1/groups/ | Create Group
|
|
*GroupAPI* | [**DeleteGroupApiV1GroupsGroupIdDelete**](docs/GroupAPI.md#deletegroupapiv1groupsgroupiddelete) | **Delete** /api/v1/groups/{group_id} | Delete Group
|
|
*GroupAPI* | [**GetGroupsApiV1GroupsGet**](docs/GroupAPI.md#getgroupsapiv1groupsget) | **Get** /api/v1/groups/ | Get Groups
|
|
*TokenAPI* | [**LoginForAccessTokenApiV1TokenPost**](docs/TokenAPI.md#loginforaccesstokenapiv1tokenpost) | **Post** /api/v1/token | Login For Access Token
|
|
*TokenAPI* | [**TestLoginApiV1TestLoginGet**](docs/TokenAPI.md#testloginapiv1testloginget) | **Get** /api/v1/test/login | Test Login
|
|
*UsersAPI* | [**CreateUserApiV1UsersPost**](docs/UsersAPI.md#createuserapiv1userspost) | **Post** /api/v1/users/ | Create User
|
|
*UsersAPI* | [**DeleteUserApiV1UsersUserIdDelete**](docs/UsersAPI.md#deleteuserapiv1usersuseriddelete) | **Delete** /api/v1/users/{user_id} | Delete User
|
|
*UsersAPI* | [**GetCurrentUserApiV1UsersCurrentGet**](docs/UsersAPI.md#getcurrentuserapiv1userscurrentget) | **Get** /api/v1/users/current | Get Current User
|
|
*UsersAPI* | [**ReadUserApiV1UsersUserIdGet**](docs/UsersAPI.md#readuserapiv1usersuseridget) | **Get** /api/v1/users/{user_id} | Read User
|
|
*UsersAPI* | [**ReadUsersApiV1UsersGet**](docs/UsersAPI.md#readusersapiv1usersget) | **Get** /api/v1/users/ | Read Users
|
|
*UsersAPI* | [**UpdateUserApiV1UsersUserIdPatch**](docs/UsersAPI.md#updateuserapiv1usersuseridpatch) | **Patch** /api/v1/users/{user_id} | Update User
|
|
|
|
|
|
## Documentation For Models
|
|
|
|
- [AccessAuthorizationCreate](docs/AccessAuthorizationCreate.md)
|
|
- [AccessAuthorizationDB](docs/AccessAuthorizationDB.md)
|
|
- [AccessAuthorizationResponse](docs/AccessAuthorizationResponse.md)
|
|
- [AccessAuthorizationUpdate](docs/AccessAuthorizationUpdate.md)
|
|
- [Card](docs/Card.md)
|
|
- [GroupCreate](docs/GroupCreate.md)
|
|
- [GroupDB](docs/GroupDB.md)
|
|
- [GroupResponse](docs/GroupResponse.md)
|
|
- [HTTPValidationError](docs/HTTPValidationError.md)
|
|
- [LocationInner](docs/LocationInner.md)
|
|
- [Timetable](docs/Timetable.md)
|
|
- [TimetableCreate](docs/TimetableCreate.md)
|
|
- [Token](docs/Token.md)
|
|
- [UserCreate](docs/UserCreate.md)
|
|
- [UserDB](docs/UserDB.md)
|
|
- [UserResponse](docs/UserResponse.md)
|
|
- [UserUpdate](docs/UserUpdate.md)
|
|
- [ValidationError](docs/ValidationError.md)
|
|
|
|
|
|
## Documentation For Authorization
|
|
|
|
|
|
Authentication schemes defined for the API:
|
|
### OAuth2PasswordBearer
|
|
|
|
|
|
- **Type**: OAuth
|
|
- **Flow**: password
|
|
- **Authorization URL**:
|
|
- **Scopes**: N/A
|
|
|
|
Example
|
|
|
|
```go
|
|
auth := context.WithValue(context.Background(), openapi.ContextAccessToken, "ACCESSTOKENSTRING")
|
|
r, err := client.Service.Operation(auth, args)
|
|
```
|
|
|
|
Or via OAuth2 module to automatically refresh tokens and perform user authentication.
|
|
|
|
```go
|
|
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)
|
|
r, err := client.Service.Operation(auth, args)
|
|
```
|
|
|
|
|
|
## 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`
|
|
|
|
## Author
|
|
|
|
|
|
|