Skip to content

Commit

Permalink
Re-generate Go API client
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Oct 3, 2020
1 parent e220138 commit 942d4cb
Show file tree
Hide file tree
Showing 14 changed files with 229 additions and 14 deletions.
3 changes: 2 additions & 1 deletion client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ API for managing and authenticating Netsoc users.
## 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.7
- API version: 1.0.8
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen

Expand Down Expand Up @@ -36,6 +36,7 @@ Class | Method | HTTP request | Description
*UsersApi* | [**CreateUser**](docs/UsersApi.md#createuser) | **Post** /users | Create a new user
*UsersApi* | [**DeleteUser**](docs/UsersApi.md#deleteuser) | **Delete** /users/{username} | Delete a user by their username
*UsersApi* | [**GetUser**](docs/UsersApi.md#getuser) | **Get** /users/{username} | Get a user by their username
*UsersApi* | [**GetUserByID**](docs/UsersApi.md#getuserbyid) | **Get** /users/id:{uid} | Get a user by their ID
*UsersApi* | [**GetUsers**](docs/UsersApi.md#getusers) | **Get** /users | List users
*UsersApi* | [**IssueToken**](docs/UsersApi.md#issuetoken) | **Post** /users/{username}/token | Issue a token
*UsersApi* | [**Login**](docs/UsersApi.md#login) | **Post** /users/{username}/login | Log into a user account (obtain JWT)
Expand Down
64 changes: 63 additions & 1 deletion client/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ info:
description: |
API for managing and authenticating Netsoc users.
title: Netsoc IAM
version: 1.0.7
version: 1.0.8
servers:
- url: https://iam.netsoc.ie/v1
- url: https://iam.staging.netsoc.ie/v1
Expand Down Expand Up @@ -120,6 +120,58 @@ paths:
summary: Create a new user
tags:
- users
/users/id:{uid}:
get:
description: |
Requires a valid admin JWT.
operationId: getUserByID
parameters:
- description: User ID
explode: false
in: path
name: uid
required: true
schema:
format: int32
type: integer
style: simple
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/User'
description: Requested user
"401":
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Error'
description: Authorization error (e.g. incorret password, invalid token,
token expired etc.)
"403":
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Error'
description: Admin token is required
"404":
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Error'
description: User with username does not exist
"500":
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Error'
description: General server error
security:
- jwt_admin: []
summary: Get a user by their ID
tags:
- users
/users/{username}:
delete:
description: |
Expand Down Expand Up @@ -623,6 +675,16 @@ paths:
- users
components:
parameters:
UserID:
description: User ID
explode: false
in: path
name: uid
required: true
schema:
format: int32
type: integer
style: simple
Username:
description: User's username.
example: root
Expand Down
119 changes: 118 additions & 1 deletion client/api_users.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* API for managing and authenticating Netsoc users.
*
* API version: 1.0.7
* API version: 1.0.8
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/

Expand Down Expand Up @@ -387,6 +387,123 @@ func (a *UsersApiService) GetUser(ctx _context.Context, username string) (User,
return localVarReturnValue, localVarHTTPResponse, nil
}

/*
GetUserByID Get a user by their ID
Requires a valid admin JWT.
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param uid User ID
@return User
*/
func (a *UsersApiService) GetUserByID(ctx _context.Context, uid int32) (User, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue User
)

// create path and map variables
localVarPath := a.client.cfg.BasePath + "/users/id:{uid}"
localVarPath = strings.Replace(localVarPath, "{"+"uid"+"}", _neturl.QueryEscape(parameterToString(uid, "")) , -1)

localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}

// to determine the Content-Type header
localVarHTTPContentTypes := []string{}

// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}

// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}

// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}

localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}

localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}

if localVarHTTPResponse.StatusCode >= 300 {
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 401 {
var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
if localVarHTTPResponse.StatusCode == 403 {
var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
if localVarHTTPResponse.StatusCode == 404 {
var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
if localVarHTTPResponse.StatusCode == 500 {
var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.model = v
}
return localVarReturnValue, localVarHTTPResponse, newErr
}

err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}

return localVarReturnValue, localVarHTTPResponse, nil
}

/*
GetUsers List users
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
Expand Down
4 changes: 2 additions & 2 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* API for managing and authenticating Netsoc users.
*
* API version: 1.0.7
* API version: 1.0.8
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/

Expand Down Expand Up @@ -40,7 +40,7 @@ var (
xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`)
)

// APIClient manages communication with the Netsoc IAM API v1.0.7
// APIClient manages communication with the Netsoc IAM API v1.0.8
// In most cases there should be only one, shared, APIClient.
type APIClient struct {
cfg *Configuration
Expand Down
2 changes: 1 addition & 1 deletion client/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* API for managing and authenticating Netsoc users.
*
* API version: 1.0.7
* API version: 1.0.8
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/

Expand Down
35 changes: 35 additions & 0 deletions client/docs/UsersApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Method | HTTP request | Description
[**CreateUser**](UsersApi.md#CreateUser) | **Post** /users | Create a new user
[**DeleteUser**](UsersApi.md#DeleteUser) | **Delete** /users/{username} | Delete a user by their username
[**GetUser**](UsersApi.md#GetUser) | **Get** /users/{username} | Get a user by their username
[**GetUserByID**](UsersApi.md#GetUserByID) | **Get** /users/id:{uid} | Get a user by their ID
[**GetUsers**](UsersApi.md#GetUsers) | **Get** /users | List users
[**IssueToken**](UsersApi.md#IssueToken) | **Post** /users/{username}/token | Issue a token
[**Login**](UsersApi.md#Login) | **Post** /users/{username}/login | Log into a user account (obtain JWT)
Expand Down Expand Up @@ -120,6 +121,40 @@ Name | Type | Description | Notes
[[Back to README]](../README.md)


## GetUserByID

> User GetUserByID(ctx, uid)
Get a user by their ID

Requires a valid admin JWT.

### Required Parameters


Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**uid** | **int32**| User ID |

### Return type

[**User**](User.md)

### Authorization

[jwt_admin](../README.md#jwt_admin)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json, application/problem+json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)


## GetUsers

> []User GetUsers(ctx, )
Expand Down
2 changes: 1 addition & 1 deletion client/model_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* API for managing and authenticating Netsoc users.
*
* API version: 1.0.7
* API version: 1.0.8
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/

Expand Down
2 changes: 1 addition & 1 deletion client/model_issue_token_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* API for managing and authenticating Netsoc users.
*
* API version: 1.0.7
* API version: 1.0.8
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/

Expand Down
2 changes: 1 addition & 1 deletion client/model_login_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* API for managing and authenticating Netsoc users.
*
* API version: 1.0.7
* API version: 1.0.8
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/

Expand Down
2 changes: 1 addition & 1 deletion client/model_reset_password_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* API for managing and authenticating Netsoc users.
*
* API version: 1.0.7
* API version: 1.0.8
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/

Expand Down
2 changes: 1 addition & 1 deletion client/model_token_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* API for managing and authenticating Netsoc users.
*
* API version: 1.0.7
* API version: 1.0.8
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/

Expand Down
2 changes: 1 addition & 1 deletion client/model_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* API for managing and authenticating Netsoc users.
*
* API version: 1.0.7
* API version: 1.0.8
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/

Expand Down
2 changes: 1 addition & 1 deletion client/model_user_meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* API for managing and authenticating Netsoc users.
*
* API version: 1.0.7
* API version: 1.0.8
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/

Expand Down
2 changes: 1 addition & 1 deletion client/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* API for managing and authenticating Netsoc users.
*
* API version: 1.0.7
* API version: 1.0.8
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/

Expand Down

0 comments on commit 942d4cb

Please sign in to comment.