176 lines
8.0 KiB
Markdown
176 lines
8.0 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* | [**AddAccessauthAaPost**](docs/AccessAuthAPI.md#addaccessauthaapost) | **Post** /aa/ | Add Accessauth
|
|
*AccessAuthAPI* | [**AssignAccessauthAaAssignGroupIdAaIdPut**](docs/AccessAuthAPI.md#assignaccessauthaaassigngroupidaaidput) | **Put** /aa/assign/{group_id}/{aa_id} | Assign Accessauth
|
|
*AccessAuthAPI* | [**ChangeAccessauthAaAaIdPatch**](docs/AccessAuthAPI.md#changeaccessauthaaaaidpatch) | **Patch** /aa/{aa_id} | Change Accessauth
|
|
*AccessAuthAPI* | [**DeleteAccessauthAaAaIdDelete**](docs/AccessAuthAPI.md#deleteaccessauthaaaaiddelete) | **Delete** /aa/{aa_id} | Delete Accessauth
|
|
*AccessAuthAPI* | [**GetAllAccessauthsAaGet**](docs/AccessAuthAPI.md#getallaccessauthsaaget) | **Get** /aa/ | Get All Accessauths
|
|
*AccessAuthAPI* | [**GetOneAccessauthAaAaIdGet**](docs/AccessAuthAPI.md#getoneaccessauthaaaaidget) | **Get** /aa/{aa_id} | Get One Accessauth
|
|
*AccessAuthAPI* | [**UnassignAccessauthAaUnassignGroupIdAaIdPut**](docs/AccessAuthAPI.md#unassignaccessauthaaunassigngroupidaaidput) | **Put** /aa/unassign/{group_id}/{aa_id} | Unassign Accessauth
|
|
*CardAPI* | [**AddCardCardsGroupIdPost**](docs/CardAPI.md#addcardcardsgroupidpost) | **Post** /cards/{group_id} | Add Card
|
|
*CardAPI* | [**DelCardCardsDeleteGet**](docs/CardAPI.md#delcardcardsdeleteget) | **Get** /cards/delete | Del Card
|
|
*CardAPI* | [**GetCardsCardsGroupIdGet**](docs/CardAPI.md#getcardscardsgroupidget) | **Get** /cards/{group_id} | Get Cards
|
|
*DebugItemsMaybeDontShowThisInUIAPI* | [**AddCardManuallyDebugAddcardGroupidCardKeyGet**](docs/DebugItemsMaybeDontShowThisInUIAPI.md#addcardmanuallydebugaddcardgroupidcardkeyget) | **Get** /debug/addcard/{groupid}/{card_key} | Add Card Manually
|
|
*DebugItemsMaybeDontShowThisInUIAPI* | [**ListAllCardsDebugGetcardsPut**](docs/DebugItemsMaybeDontShowThisInUIAPI.md#listallcardsdebuggetcardsput) | **Put** /debug/getcards | List All Cards
|
|
*DebugItemsMaybeDontShowThisInUIAPI* | [**RemoveCardManuallyDebugRmcardCardKeyGet**](docs/DebugItemsMaybeDontShowThisInUIAPI.md#removecardmanuallydebugrmcardcardkeyget) | **Get** /debug/rmcard/{card_key} | Remove Card Manually
|
|
*DoorAPI* | [**OpenDoorDoorClosePut**](docs/DoorAPI.md#opendoordoorcloseput) | **Put** /door/close | Open Door
|
|
*DoorAPI* | [**OpenDoorDoorOpenPut**](docs/DoorAPI.md#opendoordooropenput) | **Put** /door/open | Open Door
|
|
*DoorAPI* | [**TestAccessDoorTestPost**](docs/DoorAPI.md#testaccessdoortestpost) | **Post** /door/test | Test Access
|
|
*GroupAPI* | [**CreateGroupGroupsPost**](docs/GroupAPI.md#creategroupgroupspost) | **Post** /groups/ | Create Group
|
|
*GroupAPI* | [**DeleteGroupGroupsGroupIdDelete**](docs/GroupAPI.md#deletegroupgroupsgroupiddelete) | **Delete** /groups/{group_id} | Delete Group
|
|
*GroupAPI* | [**GetGroupsGroupsGet**](docs/GroupAPI.md#getgroupsgroupsget) | **Get** /groups/ | Get Groups
|
|
*TokenAPI* | [**LoginForAccessTokenTokenPost**](docs/TokenAPI.md#loginforaccesstokentokenpost) | **Post** /token | Login For Access Token
|
|
*TokenAPI* | [**TestLoginTestLoginGet**](docs/TokenAPI.md#testlogintestloginget) | **Get** /test/login | Test Login
|
|
*UsersAPI* | [**CreateUserUsersPost**](docs/UsersAPI.md#createuseruserspost) | **Post** /users/ | Create User
|
|
*UsersAPI* | [**DeleteUserUsersUserIdDelete**](docs/UsersAPI.md#deleteuserusersuseriddelete) | **Delete** /users/{user_id} | Delete User
|
|
*UsersAPI* | [**ReadUserUsersUserIdGet**](docs/UsersAPI.md#readuserusersuseridget) | **Get** /users/{user_id} | Read User
|
|
*UsersAPI* | [**ReadUsersUsersGet**](docs/UsersAPI.md#readusersusersget) | **Get** /users/ | Read Users
|
|
*UsersAPI* | [**UpdateUserUsersUserIdPatch**](docs/UsersAPI.md#updateuserusersuseridpatch) | **Patch** /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
|
|
|
|
|
|
|