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 project. By using the OpenAPI-spec 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:
import openapi "github.com/GIT_USER_ID/GIT_REPO_ID"
To use a proxy, set the environment variable HTTP_PROXY:
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.
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.
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.
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 | Post /aa/ | Add Accessauth |
| AccessAuthAPI | AssignAccessauthAaAssignGroupIdAaIdPut | Put /aa/assign/{group_id}/{aa_id} | Assign Accessauth |
| AccessAuthAPI | ChangeAccessauthAaAaIdPatch | Patch /aa/{aa_id} | Change Accessauth |
| AccessAuthAPI | DeleteAccessauthAaAaIdDelete | Delete /aa/{aa_id} | Delete Accessauth |
| AccessAuthAPI | GetAllAccessauthsAaGet | Get /aa/ | Get All Accessauths |
| AccessAuthAPI | GetOneAccessauthAaAaIdGet | Get /aa/{aa_id} | Get One Accessauth |
| AccessAuthAPI | UnassignAccessauthAaUnassignGroupIdAaIdPut | Put /aa/unassign/{group_id}/{aa_id} | Unassign Accessauth |
| CardAPI | AddCardCardsGroupIdPost | Post /cards/{group_id} | Add Card |
| CardAPI | DelCardCardsDeleteGet | Get /cards/delete | Del Card |
| CardAPI | GetCardsCardsGroupIdGet | Get /cards/{group_id} | Get Cards |
| DebugItemsMaybeDontShowThisInUIAPI | AddCardManuallyDebugAddcardGroupidCardKeyGet | Get /debug/addcard/{groupid}/{card_key} | Add Card Manually |
| DebugItemsMaybeDontShowThisInUIAPI | ListAllCardsDebugGetcardsPut | Put /debug/getcards | List All Cards |
| DebugItemsMaybeDontShowThisInUIAPI | RemoveCardManuallyDebugRmcardCardKeyGet | Get /debug/rmcard/{card_key} | Remove Card Manually |
| DoorAPI | OpenDoorDoorClosePut | Put /door/close | Open Door |
| DoorAPI | OpenDoorDoorOpenPut | Put /door/open | Open Door |
| DoorAPI | TestAccessDoorTestPost | Post /door/test | Test Access |
| GroupAPI | CreateGroupGroupsPost | Post /groups/ | Create Group |
| GroupAPI | DeleteGroupGroupsGroupIdDelete | Delete /groups/{group_id} | Delete Group |
| GroupAPI | GetGroupsGroupsGet | Get /groups/ | Get Groups |
| TokenAPI | LoginForAccessTokenTokenPost | Post /token | Login For Access Token |
| TokenAPI | TestLoginTestLoginGet | Get /test/login | Test Login |
| UsersAPI | CreateUserUsersPost | Post /users/ | Create User |
| UsersAPI | DeleteUserUsersUserIdDelete | Delete /users/{user_id} | Delete User |
| UsersAPI | ReadUserUsersUserIdGet | Get /users/{user_id} | Read User |
| UsersAPI | ReadUsersUsersGet | Get /users/ | Read Users |
| UsersAPI | UpdateUserUsersUserIdPatch | Patch /users/{user_id} | Update User |
Documentation For Models
- AccessAuthorizationCreate
- AccessAuthorizationDB
- AccessAuthorizationResponse
- AccessAuthorizationUpdate
- Card
- GroupCreate
- GroupDB
- GroupResponse
- HTTPValidationError
- LocationInner
- Timetable
- TimetableCreate
- Token
- UserCreate
- UserDB
- UserResponse
- UserUpdate
- ValidationError
Documentation For Authorization
Authentication schemes defined for the API:
OAuth2PasswordBearer
- Type: OAuth
- Flow: password
- Authorization URL:
- Scopes: N/A
Example
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.
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:
PtrBoolPtrIntPtrInt32PtrInt64PtrFloatPtrFloat32PtrFloat64PtrStringPtrTime