Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to latest MaaS API #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .swagger-codegen/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.1
3.0.10
42 changes: 26 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ This Python package is automatically generated by the [Swagger Codegen](https://

- API version: 0.5.2
- Package version: 1.0.0
- Build package: io.swagger.codegen.languages.PythonClientCodegen
- Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen

## Requirements.

Expand Down Expand Up @@ -71,52 +71,62 @@ import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.AuthApi()
username = 'username_example' # str |
password = 'password_example' # str |
validityseconds = 56 # int | (optional)
api_instance = swagger_client.AuthApi(swagger_client.ApiClient(configuration))
username = 'username_example' # str |
password = 'password_example' # str |
validityseconds = 56 # int |

try:
# Logs a user in and returns an JWT token for authentication
api_response = api_instance.auth_login_post(username, password, validityseconds=validityseconds)
api_response = api_instance.auth_login_post(username, password, validityseconds)
pprint(api_response)
except ApiException as e:
print("Exception when calling AuthApi->auth_login_post: %s\n" % e)

```

## Documentation for API Endpoints

All URIs are relative to *https://localhost:8443/v0*
All URIs are relative to *https://maas.intern.k4cg.org/v0*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AuthApi* | [**auth_login_post**](docs/AuthApi.md#auth_login_post) | **POST** /auth/login | Logs a user in and returns an JWT token for authentication
*ItemsApi* | [**items_get**](docs/ItemsApi.md#items_get) | **GET** /items | List all available items
*ItemsApi* | [**items_item_id_consume_patch**](docs/ItemsApi.md#items_item_id_consume_patch) | **PATCH** /items/{itemId}/consume | Consumes a Item
*ItemsApi* | [**items_item_id_consume_put**](docs/ItemsApi.md#items_item_id_consume_put) | **PUT** /items/{itemId}/consume | Consumes a Item
*ItemsApi* | [**items_item_id_delete**](docs/ItemsApi.md#items_item_id_delete) | **DELETE** /items/{itemId} | Delete Item
*ItemsApi* | [**items_item_id_get**](docs/ItemsApi.md#items_item_id_get) | **GET** /items/{itemId} | Get a certain Item
*ItemsApi* | [**items_item_id_patch**](docs/ItemsApi.md#items_item_id_patch) | **PATCH** /items/{itemId} | Update Item
*ItemsApi* | [**items_item_id_put**](docs/ItemsApi.md#items_item_id_put) | **PUT** /items/{itemId} | Update Item
*ItemsApi* | [**items_item_id_stats_get**](docs/ItemsApi.md#items_item_id_stats_get) | **GET** /items/{itemId}/stats | Get consumption stats
*ItemsApi* | [**items_post**](docs/ItemsApi.md#items_post) | **POST** /items | Add a new item
*ItemsApi* | [**items_stats_get**](docs/ItemsApi.md#items_stats_get) | **GET** /items/stats | Get consumption stats of all items
*ServiceApi* | [**service_stats_get**](docs/ServiceApi.md#service_stats_get) | **GET** /service/stats | Total service stats
*UsersApi* | [**users_get**](docs/UsersApi.md#users_get) | **GET** /users | List all users
*UsersApi* | [**users_post**](docs/UsersApi.md#users_post) | **POST** /users | Add a new user
*UsersApi* | [**users_user_id_credits_add_patch**](docs/UsersApi.md#users_user_id_credits_add_patch) | **PATCH** /users/{userId}/credits/add | Add users credits
*UsersApi* | [**users_user_id_credits_transfer_patch**](docs/UsersApi.md#users_user_id_credits_transfer_patch) | **PATCH** /users/{userId}/credits/transfer | Transfer credits
*UsersApi* | [**users_user_id_credits_withdraw_patch**](docs/UsersApi.md#users_user_id_credits_withdraw_patch) | **PATCH** /users/{userId}/credits/withdraw | Widthdraw users credits
*UsersApi* | [**users_user_id_admin_set_put**](docs/UsersApi.md#users_user_id_admin_set_put) | **PUT** /users/{userId}/admin/set | Promote a user to admin
*UsersApi* | [**users_user_id_admin_unset_put**](docs/UsersApi.md#users_user_id_admin_unset_put) | **PUT** /users/{userId}/admin/unset | Remove admin capabilities from an user
*UsersApi* | [**users_user_id_credits_add_put**](docs/UsersApi.md#users_user_id_credits_add_put) | **PUT** /users/{userId}/credits/add | Add users credits
*UsersApi* | [**users_user_id_credits_transfer_put**](docs/UsersApi.md#users_user_id_credits_transfer_put) | **PUT** /users/{userId}/credits/transfer | Transfer credits
*UsersApi* | [**users_user_id_credits_withdraw_put**](docs/UsersApi.md#users_user_id_credits_withdraw_put) | **PUT** /users/{userId}/credits/withdraw | Widthdraw users credits
*UsersApi* | [**users_user_id_delete**](docs/UsersApi.md#users_user_id_delete) | **DELETE** /users/{userId} | Delete user
*UsersApi* | [**users_user_id_get**](docs/UsersApi.md#users_user_id_get) | **GET** /users/{userId} | Get user by user ID
*UsersApi* | [**users_user_id_password_patch**](docs/UsersApi.md#users_user_id_password_patch) | **PATCH** /users/{userId}/password | Change password for currently logged in user.
*UsersApi* | [**users_user_id_resetpassword_patch**](docs/UsersApi.md#users_user_id_resetpassword_patch) | **PATCH** /users/{userId}/resetpassword | Set password for user ID
*UsersApi* | [**users_user_id_password_put**](docs/UsersApi.md#users_user_id_password_put) | **PUT** /users/{userId}/password | Change password for currently logged in user.
*UsersApi* | [**users_user_id_resetpassword_put**](docs/UsersApi.md#users_user_id_resetpassword_put) | **PUT** /users/{userId}/resetpassword | Set password for user ID
*UsersApi* | [**users_user_id_stats_get**](docs/UsersApi.md#users_user_id_stats_get) | **GET** /users/{userId}/stats | Get matomat stats for user


## Documentation For Models

- [AuthSuccess](docs/AuthSuccess.md)
- [Body](docs/Body.md)
- [Body1](docs/Body1.md)
- [Body2](docs/Body2.md)
- [Body3](docs/Body3.md)
- [Body4](docs/Body4.md)
- [Body5](docs/Body5.md)
- [Body6](docs/Body6.md)
- [Body7](docs/Body7.md)
- [Body8](docs/Body8.md)
- [Error](docs/Error.md)
- [Item](docs/Item.md)
- [ItemStats](docs/ItemStats.md)
Expand Down
15 changes: 7 additions & 8 deletions docs/AuthApi.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# swagger_client.AuthApi

All URIs are relative to *https://localhost:8443/v0*
All URIs are relative to *https://maas.intern.k4cg.org/v0*

Method | HTTP request | Description
------------- | ------------- | -------------
[**auth_login_post**](AuthApi.md#auth_login_post) | **POST** /auth/login | Logs a user in and returns an JWT token for authentication


# **auth_login_post**
> AuthSuccess auth_login_post(username, password, validityseconds=validityseconds)
> list[AuthSuccess] auth_login_post(username, password, validityseconds)

Logs a user in and returns an JWT token for authentication

Expand All @@ -26,11 +25,11 @@ from pprint import pprint
api_instance = swagger_client.AuthApi()
username = 'username_example' # str |
password = 'password_example' # str |
validityseconds = 56 # int | (optional)
validityseconds = 56 # int |

try:
# Logs a user in and returns an JWT token for authentication
api_response = api_instance.auth_login_post(username, password, validityseconds=validityseconds)
api_response = api_instance.auth_login_post(username, password, validityseconds)
pprint(api_response)
except ApiException as e:
print("Exception when calling AuthApi->auth_login_post: %s\n" % e)
Expand All @@ -42,11 +41,11 @@ Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **str**| |
**password** | **str**| |
**validityseconds** | **int**| | [optional]
**validityseconds** | **int**| |

### Return type

[**AuthSuccess**](AuthSuccess.md)
[**list[AuthSuccess]**](AuthSuccess.md)

### Authorization

Expand All @@ -55,7 +54,7 @@ No authorization required
### HTTP request headers

- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: Not defined
- **Accept**: application/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)

1 change: 0 additions & 1 deletion docs/AuthSuccess.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ Name | Type | Description | Notes

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


11 changes: 11 additions & 0 deletions docs/Body.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Body

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**username** | **str** | |
**password** | **str** | |
**validityseconds** | **int** | | [optional]

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

10 changes: 10 additions & 0 deletions docs/Body1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Body1

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **str** | The name of the item |
**cost** | **int** | The number of credits a single consumption of this Item requires (unit for credits is smallest unit in currency used) |

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

10 changes: 10 additions & 0 deletions docs/Body2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Body2

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **str** | The name of the item |
**cost** | **int** | The number of credits a single consumption of this Item requires (unit for credits is smallest unit in currency used) |

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

12 changes: 12 additions & 0 deletions docs/Body3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Body3

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **str** | The name of the user |
**password** | **str** | |
**passwordrepeat** | **str** | |
**admin** | **int** | |

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

9 changes: 9 additions & 0 deletions docs/Body4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Body4

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**credits** | **int** | |

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

9 changes: 9 additions & 0 deletions docs/Body5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Body5

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**credits** | **int** | |

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

9 changes: 9 additions & 0 deletions docs/Body6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Body6

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**credits** | **int** | |

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

11 changes: 11 additions & 0 deletions docs/Body7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Body7

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**password** | **str** | |
**passwordnew** | **str** | |
**passwordrepeat** | **str** | |

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

10 changes: 10 additions & 0 deletions docs/Body8.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Body8

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**passwordnew** | **str** | |
**passwordrepeat** | **str** | |

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

1 change: 0 additions & 1 deletion docs/Error.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ Name | Type | Description | Notes

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


1 change: 0 additions & 1 deletion docs/Item.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ Name | Type | Description | Notes

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


1 change: 0 additions & 1 deletion docs/ItemStats.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ Name | Type | Description | Notes

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


37 changes: 18 additions & 19 deletions docs/ItemsApi.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# swagger_client.ItemsApi

All URIs are relative to *https://localhost:8443/v0*
All URIs are relative to *https://maas.intern.k4cg.org/v0*

Method | HTTP request | Description
------------- | ------------- | -------------
[**items_get**](ItemsApi.md#items_get) | **GET** /items | List all available items
[**items_item_id_consume_patch**](ItemsApi.md#items_item_id_consume_patch) | **PATCH** /items/{itemId}/consume | Consumes a Item
[**items_item_id_consume_put**](ItemsApi.md#items_item_id_consume_put) | **PUT** /items/{itemId}/consume | Consumes a Item
[**items_item_id_delete**](ItemsApi.md#items_item_id_delete) | **DELETE** /items/{itemId} | Delete Item
[**items_item_id_get**](ItemsApi.md#items_item_id_get) | **GET** /items/{itemId} | Get a certain Item
[**items_item_id_patch**](ItemsApi.md#items_item_id_patch) | **PATCH** /items/{itemId} | Update Item
[**items_item_id_put**](ItemsApi.md#items_item_id_put) | **PUT** /items/{itemId} | Update Item
[**items_item_id_stats_get**](ItemsApi.md#items_item_id_stats_get) | **GET** /items/{itemId}/stats | Get consumption stats
[**items_post**](ItemsApi.md#items_post) | **POST** /items | Add a new item
[**items_stats_get**](ItemsApi.md#items_stats_get) | **GET** /items/stats | Get consumption stats of all items


# **items_get**
> list[Item] items_get()

Expand Down Expand Up @@ -64,12 +63,12 @@ This endpoint does not need any parameter.

[[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)

# **items_item_id_consume_patch**
> ItemStats items_item_id_consume_patch(item_id)
# **items_item_id_consume_put**
> ItemStats items_item_id_consume_put(item_id)

Consumes a Item

Consumes a Item and subtracts the cost of the Item from the credit of the user. If not enough credit exists the operation will be rejected
Consumes a Item and subtracts the cost of the Item from the credit of the user.

### Example
```python
Expand All @@ -91,10 +90,10 @@ item_id = 56 # int | The ID of the Item that needs to be consumed

try:
# Consumes a Item
api_response = api_instance.items_item_id_consume_patch(item_id)
api_response = api_instance.items_item_id_consume_put(item_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling ItemsApi->items_item_id_consume_patch: %s\n" % e)
print("Exception when calling ItemsApi->items_item_id_consume_put: %s\n" % e)
```

### Parameters
Expand Down Expand Up @@ -141,7 +140,7 @@ configuration.api_key['Authorization'] = 'YOUR_API_KEY'

# create an instance of the API class
api_instance = swagger_client.ItemsApi(swagger_client.ApiClient(configuration))
item_id = 56 # int | The ID of the Item to perform an operation on
item_id = 56 # int | The ID of the Item that needs to be deleted

try:
# Delete Item
Expand All @@ -155,7 +154,7 @@ except ApiException as e:

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**item_id** | **int**| The ID of the Item to perform an operation on |
**item_id** | **int**| The ID of the Item that needs to be deleted |

### Return type

Expand Down Expand Up @@ -195,7 +194,7 @@ configuration.api_key['Authorization'] = 'YOUR_API_KEY'

# create an instance of the API class
api_instance = swagger_client.ItemsApi(swagger_client.ApiClient(configuration))
item_id = 56 # int | The ID of the Item to perform an operation on
item_id = 56 # int | The ID of the Item that needs to be fetched

try:
# Get a certain Item
Expand All @@ -209,7 +208,7 @@ except ApiException as e:

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**item_id** | **int**| The ID of the Item to perform an operation on |
**item_id** | **int**| The ID of the Item that needs to be fetched |

### Return type

Expand All @@ -226,8 +225,8 @@ Name | Type | Description | Notes

[[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)

# **items_item_id_patch**
> Item items_item_id_patch(item_id, name, cost)
# **items_item_id_put**
> Item items_item_id_put(name, cost, item_id)

Update Item

Expand All @@ -249,25 +248,25 @@ configuration.api_key['Authorization'] = 'YOUR_API_KEY'

# create an instance of the API class
api_instance = swagger_client.ItemsApi(swagger_client.ApiClient(configuration))
item_id = 56 # int | The ID of the Item to perform an operation on
name = 'name_example' # str |
cost = 56 # int |
item_id = 56 # int | The ID of the Item that needs to be updated

try:
# Update Item
api_response = api_instance.items_item_id_patch(item_id, name, cost)
api_response = api_instance.items_item_id_put(name, cost, item_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling ItemsApi->items_item_id_patch: %s\n" % e)
print("Exception when calling ItemsApi->items_item_id_put: %s\n" % e)
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**item_id** | **int**| The ID of the Item to perform an operation on |
**name** | **str**| |
**cost** | **int**| |
**item_id** | **int**| The ID of the Item that needs to be updated |

### Return type

Expand Down
Loading