From 88fa5499b5ceaf2e6a0d6eec7014f82ac8f901f9 Mon Sep 17 00:00:00 2001 From: WoodenMaiden Date: Tue, 21 Jan 2025 00:11:37 +0100 Subject: [PATCH 1/8] feat: docker compose --- docker-compose.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9bd2550 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +services: + api: + image: ghcr.io/timecopsync/project-api:1.0.1 + environment: + SECRET_KEY_BASE: somesecretvaluethatshoudlntbepublic + DATABASE_URL: postgres://postgres:postgres@db:5432/sync + db: + image: bitnami/postgresql + environment: + - POSTGRESQL_USERNAME=postgres + - POSTGRESQL_PASSWORD=postgres + - POSTGRESQL_DATABASE=sync + ports: + - '5432:5432' + volumes: + - db_data:/bitnami/postgresql + +volumes: + db_data: \ No newline at end of file From 803171a8f4b38c08a59be1738678ca49abbf66dd Mon Sep 17 00:00:00 2001 From: WoodenMaiden Date: Tue, 21 Jan 2025 00:16:40 +0100 Subject: [PATCH 2/8] feat: dependabot --- .github/dependabot.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..d9def6e --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,18 @@ +version: 2 +updates: + - package-ecosystem: "pub" + directory: "/" + schedule: + interval: "monthly" + labels: + - "dependencies" + reviewers: + - "WoodenMaiden" + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: "monthly" + labels: + - "ci" + reviewers: + - "WoodenMaiden" \ No newline at end of file From 229ff8abb2f1fbec19477c69e02caf66563da78b Mon Sep 17 00:00:00 2001 From: WoodenMaiden Date: Wed, 22 Jan 2025 16:29:29 +0100 Subject: [PATCH 3/8] feat: generate api client --- Makefile | 38 +++ pubspec.yaml | 2 + rest_client/.gitignore | 19 ++ rest_client/.openapi-generator-ignore | 23 ++ rest_client/.openapi-generator/FILES | 41 +++ rest_client/.openapi-generator/VERSION | 1 + rest_client/README.md | 97 ++++++ rest_client/analysis_options.yaml | 0 rest_client/doc/Project.md | 18 ++ rest_client/doc/ProjectApi.md | 236 ++++++++++++++ rest_client/doc/ProjectInput.md | 15 + rest_client/doc/ProjectInputProject.md | 17 + rest_client/doc/ProjectResponse.md | 15 + rest_client/doc/Projects.md | 16 + rest_client/doc/ProjectsMetadata.md | 15 + rest_client/doc/Timer.md | 20 ++ rest_client/doc/TimerApi.md | 230 +++++++++++++ rest_client/doc/TimerInput.md | 15 + rest_client/doc/TimerInputTimer.md | 19 ++ rest_client/doc/TimerResponse.md | 15 + rest_client/doc/Timers.md | 16 + rest_client/lib/api.dart | 59 ++++ rest_client/lib/api/project_api.dart | 302 ++++++++++++++++++ rest_client/lib/api/timer_api.dart | 279 ++++++++++++++++ rest_client/lib/api_client.dart | 278 ++++++++++++++++ rest_client/lib/api_exception.dart | 33 ++ rest_client/lib/api_helper.dart | 104 ++++++ rest_client/lib/auth/api_key_auth.dart | 40 +++ rest_client/lib/auth/authentication.dart | 17 + rest_client/lib/auth/http_basic_auth.dart | 26 ++ rest_client/lib/auth/http_bearer_auth.dart | 49 +++ rest_client/lib/auth/oauth.dart | 24 ++ rest_client/lib/model/project.dart | 164 ++++++++++ rest_client/lib/model/project_input.dart | 109 +++++++ .../lib/model/project_input_project.dart | 146 +++++++++ rest_client/lib/model/project_response.dart | 118 +++++++ rest_client/lib/model/projects.dart | 125 ++++++++ rest_client/lib/model/projects_metadata.dart | 119 +++++++ rest_client/lib/model/timer.dart | 200 ++++++++++++ rest_client/lib/model/timer_input.dart | 109 +++++++ rest_client/lib/model/timer_input_timer.dart | 182 +++++++++++ rest_client/lib/model/timer_response.dart | 118 +++++++ rest_client/lib/model/timers.dart | 125 ++++++++ rest_client/pubspec.yaml | 17 + rest_client/test/project_api_test.dart | 56 ++++ .../test/project_input_project_test.dart | 40 +++ rest_client/test/project_input_test.dart | 27 ++ rest_client/test/project_response_test.dart | 27 ++ rest_client/test/project_test.dart | 46 +++ rest_client/test/projects_metadata_test.dart | 28 ++ rest_client/test/projects_test.dart | 32 ++ rest_client/test/timer_api_test.dart | 56 ++++ rest_client/test/timer_input_test.dart | 27 ++ rest_client/test/timer_input_timer_test.dart | 52 +++ rest_client/test/timer_response_test.dart | 27 ++ rest_client/test/timer_test.dart | 58 ++++ rest_client/test/timers_test.dart | 32 ++ 57 files changed, 4119 insertions(+) create mode 100644 Makefile create mode 100644 rest_client/.gitignore create mode 100644 rest_client/.openapi-generator-ignore create mode 100644 rest_client/.openapi-generator/FILES create mode 100644 rest_client/.openapi-generator/VERSION create mode 100644 rest_client/README.md create mode 100644 rest_client/analysis_options.yaml create mode 100644 rest_client/doc/Project.md create mode 100644 rest_client/doc/ProjectApi.md create mode 100644 rest_client/doc/ProjectInput.md create mode 100644 rest_client/doc/ProjectInputProject.md create mode 100644 rest_client/doc/ProjectResponse.md create mode 100644 rest_client/doc/Projects.md create mode 100644 rest_client/doc/ProjectsMetadata.md create mode 100644 rest_client/doc/Timer.md create mode 100644 rest_client/doc/TimerApi.md create mode 100644 rest_client/doc/TimerInput.md create mode 100644 rest_client/doc/TimerInputTimer.md create mode 100644 rest_client/doc/TimerResponse.md create mode 100644 rest_client/doc/Timers.md create mode 100644 rest_client/lib/api.dart create mode 100644 rest_client/lib/api/project_api.dart create mode 100644 rest_client/lib/api/timer_api.dart create mode 100644 rest_client/lib/api_client.dart create mode 100644 rest_client/lib/api_exception.dart create mode 100644 rest_client/lib/api_helper.dart create mode 100644 rest_client/lib/auth/api_key_auth.dart create mode 100644 rest_client/lib/auth/authentication.dart create mode 100644 rest_client/lib/auth/http_basic_auth.dart create mode 100644 rest_client/lib/auth/http_bearer_auth.dart create mode 100644 rest_client/lib/auth/oauth.dart create mode 100644 rest_client/lib/model/project.dart create mode 100644 rest_client/lib/model/project_input.dart create mode 100644 rest_client/lib/model/project_input_project.dart create mode 100644 rest_client/lib/model/project_response.dart create mode 100644 rest_client/lib/model/projects.dart create mode 100644 rest_client/lib/model/projects_metadata.dart create mode 100644 rest_client/lib/model/timer.dart create mode 100644 rest_client/lib/model/timer_input.dart create mode 100644 rest_client/lib/model/timer_input_timer.dart create mode 100644 rest_client/lib/model/timer_response.dart create mode 100644 rest_client/lib/model/timers.dart create mode 100644 rest_client/pubspec.yaml create mode 100644 rest_client/test/project_api_test.dart create mode 100644 rest_client/test/project_input_project_test.dart create mode 100644 rest_client/test/project_input_test.dart create mode 100644 rest_client/test/project_response_test.dart create mode 100644 rest_client/test/project_test.dart create mode 100644 rest_client/test/projects_metadata_test.dart create mode 100644 rest_client/test/projects_test.dart create mode 100644 rest_client/test/timer_api_test.dart create mode 100644 rest_client/test/timer_input_test.dart create mode 100644 rest_client/test/timer_input_timer_test.dart create mode 100644 rest_client/test/timer_response_test.dart create mode 100644 rest_client/test/timer_test.dart create mode 100644 rest_client/test/timers_test.dart diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..76208b3 --- /dev/null +++ b/Makefile @@ -0,0 +1,38 @@ +ROOT := $(shell git rev-parse --show-toplevel) +FLUTTER := $(shell which flutter) +FLUTTER_BIN_DIR := $(shell dirname $(FLUTTER)) +FLUTTER_DIR := $(FLUTTER_BIN_DIR:/bin=) +DART := $(FLUTTER_BIN_DIR)/cache/dart-sdk/bin/dart +CLIENT_DIR := rest_client + +# Flutter +.PHONY: analyze +analyze: + $(FLUTTER) analyze + +.PHONY: format +format: + $(FLUTTER) format . + +.PHONY: test +test: + $(FLUTTER) test + +.PHONY: codegen +codegen: + openapi-generator generate \ + -i https://raw.githubusercontent.com/TimeCopSync/timecopsync_projects_api/refs/heads/main/priv/static/swagger.json \ + -g dart \ + -o $(CLIENT_DIR) \ + -pubAuthor=timecopsync-project \ + -pubAuthorEmail=yann.pomie@laposte.net \ + -pubDescription="Api client to interact with a timecopsync endpoint (generated with openapi-generator)" \ + -pubName=timecopsync_api \ + --minimal-update + rm -v $(CLIENT_DIR)/.travis.yml + rm -v $(CLIENT_DIR)/git_push.sh + +.PHONY: run +run: + $(FLUTTER) run + diff --git a/pubspec.yaml b/pubspec.yaml index d07005a..9ebdde3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -46,6 +46,8 @@ dependencies: permission_handler: ^11.0.0 dynamic_color: ^1.6.8 pdf: ^3.10.6 + rest_client: + path: ./rest_client dependency_overrides: intl: 0.18.1 diff --git a/rest_client/.gitignore b/rest_client/.gitignore new file mode 100644 index 0000000..0f74d29 --- /dev/null +++ b/rest_client/.gitignore @@ -0,0 +1,19 @@ +# See https://dart.dev/guides/libraries/private-files + +.dart_tool/ +.packages +build/ + +# Except for application packages +pubspec.lock + +doc/api/ + +# IntelliJ +*.iml +*.ipr +*.iws +.idea/ + +# Mac +.DS_Store diff --git a/rest_client/.openapi-generator-ignore b/rest_client/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/rest_client/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/rest_client/.openapi-generator/FILES b/rest_client/.openapi-generator/FILES new file mode 100644 index 0000000..045471c --- /dev/null +++ b/rest_client/.openapi-generator/FILES @@ -0,0 +1,41 @@ +.gitignore +.travis.yml +README.md +analysis_options.yaml +doc/Project.md +doc/ProjectApi.md +doc/ProjectInput.md +doc/ProjectInputProject.md +doc/ProjectResponse.md +doc/Projects.md +doc/ProjectsMetadata.md +doc/Timer.md +doc/TimerApi.md +doc/TimerInput.md +doc/TimerInputTimer.md +doc/TimerResponse.md +doc/Timers.md +git_push.sh +lib/api.dart +lib/api/project_api.dart +lib/api/timer_api.dart +lib/api_client.dart +lib/api_exception.dart +lib/api_helper.dart +lib/auth/api_key_auth.dart +lib/auth/authentication.dart +lib/auth/http_basic_auth.dart +lib/auth/http_bearer_auth.dart +lib/auth/oauth.dart +lib/model/project.dart +lib/model/project_input.dart +lib/model/project_input_project.dart +lib/model/project_response.dart +lib/model/projects.dart +lib/model/projects_metadata.dart +lib/model/timer.dart +lib/model/timer_input.dart +lib/model/timer_input_timer.dart +lib/model/timer_response.dart +lib/model/timers.dart +pubspec.yaml diff --git a/rest_client/.openapi-generator/VERSION b/rest_client/.openapi-generator/VERSION new file mode 100644 index 0000000..758bb9c --- /dev/null +++ b/rest_client/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.10.0 diff --git a/rest_client/README.md b/rest_client/README.md new file mode 100644 index 0000000..47239db --- /dev/null +++ b/rest_client/README.md @@ -0,0 +1,97 @@ +# openapi +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 1.0 +- Generator version: 7.10.0 +- Build package: org.openapitools.codegen.languages.DartClientCodegen + +## Requirements + +Dart 2.12 or later + +## Installation & Usage + +### Github +If this Dart package is published to Github, add the following dependency to your pubspec.yaml +``` +dependencies: + openapi: + git: https://github.com/GIT_USER_ID/GIT_REPO_ID.git +``` + +### Local +To use the package in your local drive, add the following dependency to your pubspec.yaml +``` +dependencies: + openapi: + path: /path/to/openapi +``` + +## Tests + +TODO + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```dart +import 'package:openapi/api.dart'; + + +final api_instance = ProjectApi(); +final body = ProjectInput(); // ProjectInput | Project to create + +try { + final result = api_instance.timecopsyncProjectsApiWebProjectControllerCreate(body); + print(result); +} catch (e) { + print('Exception when calling ProjectApi->timecopsyncProjectsApiWebProjectControllerCreate: $e\n'); +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to */api/v1* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*ProjectApi* | [**timecopsyncProjectsApiWebProjectControllerCreate**](doc//ProjectApi.md#timecopsyncprojectsapiwebprojectcontrollercreate) | **POST** /projects | +*ProjectApi* | [**timecopsyncProjectsApiWebProjectControllerDelete**](doc//ProjectApi.md#timecopsyncprojectsapiwebprojectcontrollerdelete) | **DELETE** /projects/{id} | +*ProjectApi* | [**timecopsyncProjectsApiWebProjectControllerIndex**](doc//ProjectApi.md#timecopsyncprojectsapiwebprojectcontrollerindex) | **GET** /projects | +*ProjectApi* | [**timecopsyncProjectsApiWebProjectControllerShow**](doc//ProjectApi.md#timecopsyncprojectsapiwebprojectcontrollershow) | **GET** /projects/{id} | +*ProjectApi* | [**timecopsyncProjectsApiWebProjectControllerUpdate**](doc//ProjectApi.md#timecopsyncprojectsapiwebprojectcontrollerupdate) | **PATCH** /projects/{id} | +*TimerApi* | [**timecopsyncProjectsApiWebTimerControllerCreate**](doc//TimerApi.md#timecopsyncprojectsapiwebtimercontrollercreate) | **POST** /timers | +*TimerApi* | [**timecopsyncProjectsApiWebTimerControllerDelete**](doc//TimerApi.md#timecopsyncprojectsapiwebtimercontrollerdelete) | **DELETE** /timers/{id} | +*TimerApi* | [**timecopsyncProjectsApiWebTimerControllerIndex**](doc//TimerApi.md#timecopsyncprojectsapiwebtimercontrollerindex) | **GET** /timers | +*TimerApi* | [**timecopsyncProjectsApiWebTimerControllerShow**](doc//TimerApi.md#timecopsyncprojectsapiwebtimercontrollershow) | **GET** /timers/{id} | +*TimerApi* | [**timecopsyncProjectsApiWebTimerControllerUpdate**](doc//TimerApi.md#timecopsyncprojectsapiwebtimercontrollerupdate) | **PATCH** /timers/{id} | + + +## Documentation For Models + + - [Project](doc//Project.md) + - [ProjectInput](doc//ProjectInput.md) + - [ProjectInputProject](doc//ProjectInputProject.md) + - [ProjectResponse](doc//ProjectResponse.md) + - [Projects](doc//Projects.md) + - [ProjectsMetadata](doc//ProjectsMetadata.md) + - [Timer](doc//Timer.md) + - [TimerInput](doc//TimerInput.md) + - [TimerInputTimer](doc//TimerInputTimer.md) + - [TimerResponse](doc//TimerResponse.md) + - [Timers](doc//Timers.md) + + +## Documentation For Authorization + +Endpoints do not require authorization. + + +## Author + + + diff --git a/rest_client/analysis_options.yaml b/rest_client/analysis_options.yaml new file mode 100644 index 0000000..e69de29 diff --git a/rest_client/doc/Project.md b/rest_client/doc/Project.md new file mode 100644 index 0000000..a6910a6 --- /dev/null +++ b/rest_client/doc/Project.md @@ -0,0 +1,18 @@ +# openapi.model.Project + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**archived** | **bool** | Archived status | [optional] +**colour** | **int** | Colour associated represented by hex values casted into integer | [optional] +**id** | **String** | Project ID | [optional] +**name** | **String** | Project name | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/rest_client/doc/ProjectApi.md b/rest_client/doc/ProjectApi.md new file mode 100644 index 0000000..b93be12 --- /dev/null +++ b/rest_client/doc/ProjectApi.md @@ -0,0 +1,236 @@ +# openapi.api.ProjectApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to */api/v1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**timecopsyncProjectsApiWebProjectControllerCreate**](ProjectApi.md#timecopsyncprojectsapiwebprojectcontrollercreate) | **POST** /projects | +[**timecopsyncProjectsApiWebProjectControllerDelete**](ProjectApi.md#timecopsyncprojectsapiwebprojectcontrollerdelete) | **DELETE** /projects/{id} | +[**timecopsyncProjectsApiWebProjectControllerIndex**](ProjectApi.md#timecopsyncprojectsapiwebprojectcontrollerindex) | **GET** /projects | +[**timecopsyncProjectsApiWebProjectControllerShow**](ProjectApi.md#timecopsyncprojectsapiwebprojectcontrollershow) | **GET** /projects/{id} | +[**timecopsyncProjectsApiWebProjectControllerUpdate**](ProjectApi.md#timecopsyncprojectsapiwebprojectcontrollerupdate) | **PATCH** /projects/{id} | + + +# **timecopsyncProjectsApiWebProjectControllerCreate** +> ProjectResponse timecopsyncProjectsApiWebProjectControllerCreate(body) + + + +Create a new project + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = ProjectApi(); +final body = ProjectInput(); // ProjectInput | Project to create + +try { + final result = api_instance.timecopsyncProjectsApiWebProjectControllerCreate(body); + print(result); +} catch (e) { + print('Exception when calling ProjectApi->timecopsyncProjectsApiWebProjectControllerCreate: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**ProjectInput**](ProjectInput.md)| Project to create | + +### Return type + +[**ProjectResponse**](ProjectResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +[[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) + +# **timecopsyncProjectsApiWebProjectControllerDelete** +> timecopsyncProjectsApiWebProjectControllerDelete(id) + + + +Delete a project + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = ProjectApi(); +final id = id_example; // String | Project ID + +try { + api_instance.timecopsyncProjectsApiWebProjectControllerDelete(id); +} catch (e) { + print('Exception when calling ProjectApi->timecopsyncProjectsApiWebProjectControllerDelete: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **String**| Project ID | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[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) + +# **timecopsyncProjectsApiWebProjectControllerIndex** +> Projects timecopsyncProjectsApiWebProjectControllerIndex(limit, showArchived) + + + +List projects, fetches 100 unarchived projects by default + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = ProjectApi(); +final limit = 1000; // int | Number of results to show +final showArchived = 1; // int | if 1 shows archived projects, defaults to 0 + +try { + final result = api_instance.timecopsyncProjectsApiWebProjectControllerIndex(limit, showArchived); + print(result); +} catch (e) { + print('Exception when calling ProjectApi->timecopsyncProjectsApiWebProjectControllerIndex: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Number of results to show | [optional] + **showArchived** | **int**| if 1 shows archived projects, defaults to 0 | [optional] + +### Return type + +[**Projects**](Projects.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +[[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) + +# **timecopsyncProjectsApiWebProjectControllerShow** +> ProjectResponse timecopsyncProjectsApiWebProjectControllerShow(id) + + + +Get a single project + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = ProjectApi(); +final id = id_example; // String | Project ID + +try { + final result = api_instance.timecopsyncProjectsApiWebProjectControllerShow(id); + print(result); +} catch (e) { + print('Exception when calling ProjectApi->timecopsyncProjectsApiWebProjectControllerShow: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **String**| Project ID | + +### Return type + +[**ProjectResponse**](ProjectResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +[[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) + +# **timecopsyncProjectsApiWebProjectControllerUpdate** +> ProjectResponse timecopsyncProjectsApiWebProjectControllerUpdate(id, body) + + + +Update a project + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = ProjectApi(); +final id = id_example; // String | Project ID +final body = ProjectInput(); // ProjectInput | Project to update + +try { + final result = api_instance.timecopsyncProjectsApiWebProjectControllerUpdate(id, body); + print(result); +} catch (e) { + print('Exception when calling ProjectApi->timecopsyncProjectsApiWebProjectControllerUpdate: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **String**| Project ID | + **body** | [**ProjectInput**](ProjectInput.md)| Project to update | + +### Return type + +[**ProjectResponse**](ProjectResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +[[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) + diff --git a/rest_client/doc/ProjectInput.md b/rest_client/doc/ProjectInput.md new file mode 100644 index 0000000..2f9716d --- /dev/null +++ b/rest_client/doc/ProjectInput.md @@ -0,0 +1,15 @@ +# openapi.model.ProjectInput + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**project** | [**ProjectInputProject**](ProjectInputProject.md) | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/rest_client/doc/ProjectInputProject.md b/rest_client/doc/ProjectInputProject.md new file mode 100644 index 0000000..45de719 --- /dev/null +++ b/rest_client/doc/ProjectInputProject.md @@ -0,0 +1,17 @@ +# openapi.model.ProjectInputProject + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**archived** | **bool** | Archived status | [optional] +**colour** | **int** | Colour associated represented by hex values casted into integer | [optional] +**name** | **String** | Project name | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/rest_client/doc/ProjectResponse.md b/rest_client/doc/ProjectResponse.md new file mode 100644 index 0000000..8a223fb --- /dev/null +++ b/rest_client/doc/ProjectResponse.md @@ -0,0 +1,15 @@ +# openapi.model.ProjectResponse + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**Project**](Project.md) | | [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) + + diff --git a/rest_client/doc/Projects.md b/rest_client/doc/Projects.md new file mode 100644 index 0000000..2fb944d --- /dev/null +++ b/rest_client/doc/Projects.md @@ -0,0 +1,16 @@ +# openapi.model.Projects + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**List**](Project.md) | | [optional] [default to const []] +**metadata** | [**ProjectsMetadata**](ProjectsMetadata.md) | | [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) + + diff --git a/rest_client/doc/ProjectsMetadata.md b/rest_client/doc/ProjectsMetadata.md new file mode 100644 index 0000000..7ecb292 --- /dev/null +++ b/rest_client/doc/ProjectsMetadata.md @@ -0,0 +1,15 @@ +# openapi.model.ProjectsMetadata + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total** | **int** | Total number of projects | [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) + + diff --git a/rest_client/doc/Timer.md b/rest_client/doc/Timer.md new file mode 100644 index 0000000..93ec957 --- /dev/null +++ b/rest_client/doc/Timer.md @@ -0,0 +1,20 @@ +# openapi.model.Timer + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**description** | **String** | Description of the timer | [optional] +**endTime** | **String** | End time of the timer in UTC format, a timer cannot end before it started. If not provided, timer is still running | [optional] +**id** | **String** | Timer ID | [optional] +**notes** | **String** | Notes about the timer, in markdown format | [optional] +**projectId** | **String** | Project ID this timer belongs to | [optional] +**startTime** | **String** | Start time of the timer in UTC format | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/rest_client/doc/TimerApi.md b/rest_client/doc/TimerApi.md new file mode 100644 index 0000000..88cc223 --- /dev/null +++ b/rest_client/doc/TimerApi.md @@ -0,0 +1,230 @@ +# openapi.api.TimerApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to */api/v1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**timecopsyncProjectsApiWebTimerControllerCreate**](TimerApi.md#timecopsyncprojectsapiwebtimercontrollercreate) | **POST** /timers | +[**timecopsyncProjectsApiWebTimerControllerDelete**](TimerApi.md#timecopsyncprojectsapiwebtimercontrollerdelete) | **DELETE** /timers/{id} | +[**timecopsyncProjectsApiWebTimerControllerIndex**](TimerApi.md#timecopsyncprojectsapiwebtimercontrollerindex) | **GET** /timers | +[**timecopsyncProjectsApiWebTimerControllerShow**](TimerApi.md#timecopsyncprojectsapiwebtimercontrollershow) | **GET** /timers/{id} | +[**timecopsyncProjectsApiWebTimerControllerUpdate**](TimerApi.md#timecopsyncprojectsapiwebtimercontrollerupdate) | **PATCH** /timers/{id} | + + +# **timecopsyncProjectsApiWebTimerControllerCreate** +> TimerResponse timecopsyncProjectsApiWebTimerControllerCreate(body) + + + +Create a new timer + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = TimerApi(); +final body = TimerInput(); // TimerInput | Timer to create + +try { + final result = api_instance.timecopsyncProjectsApiWebTimerControllerCreate(body); + print(result); +} catch (e) { + print('Exception when calling TimerApi->timecopsyncProjectsApiWebTimerControllerCreate: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**TimerInput**](TimerInput.md)| Timer to create | + +### Return type + +[**TimerResponse**](TimerResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +[[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) + +# **timecopsyncProjectsApiWebTimerControllerDelete** +> timecopsyncProjectsApiWebTimerControllerDelete(id) + + + +Delete a timer + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = TimerApi(); +final id = id_example; // String | Timer ID + +try { + api_instance.timecopsyncProjectsApiWebTimerControllerDelete(id); +} catch (e) { + print('Exception when calling TimerApi->timecopsyncProjectsApiWebTimerControllerDelete: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **String**| Timer ID | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[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) + +# **timecopsyncProjectsApiWebTimerControllerIndex** +> Timers timecopsyncProjectsApiWebTimerControllerIndex() + + + +List timers + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = TimerApi(); + +try { + final result = api_instance.timecopsyncProjectsApiWebTimerControllerIndex(); + print(result); +} catch (e) { + print('Exception when calling TimerApi->timecopsyncProjectsApiWebTimerControllerIndex: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**Timers**](Timers.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +[[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) + +# **timecopsyncProjectsApiWebTimerControllerShow** +> TimerResponse timecopsyncProjectsApiWebTimerControllerShow(id) + + + +Get a single timer + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = TimerApi(); +final id = id_example; // String | Timer ID + +try { + final result = api_instance.timecopsyncProjectsApiWebTimerControllerShow(id); + print(result); +} catch (e) { + print('Exception when calling TimerApi->timecopsyncProjectsApiWebTimerControllerShow: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **String**| Timer ID | + +### Return type + +[**TimerResponse**](TimerResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +[[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) + +# **timecopsyncProjectsApiWebTimerControllerUpdate** +> TimerResponse timecopsyncProjectsApiWebTimerControllerUpdate(id, body) + + + +Update a timer + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = TimerApi(); +final id = id_example; // String | Timer ID +final body = TimerInput(); // TimerInput | Timer to update + +try { + final result = api_instance.timecopsyncProjectsApiWebTimerControllerUpdate(id, body); + print(result); +} catch (e) { + print('Exception when calling TimerApi->timecopsyncProjectsApiWebTimerControllerUpdate: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **String**| Timer ID | + **body** | [**TimerInput**](TimerInput.md)| Timer to update | + +### Return type + +[**TimerResponse**](TimerResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +[[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) + diff --git a/rest_client/doc/TimerInput.md b/rest_client/doc/TimerInput.md new file mode 100644 index 0000000..26e4891 --- /dev/null +++ b/rest_client/doc/TimerInput.md @@ -0,0 +1,15 @@ +# openapi.model.TimerInput + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**timer** | [**TimerInputTimer**](TimerInputTimer.md) | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/rest_client/doc/TimerInputTimer.md b/rest_client/doc/TimerInputTimer.md new file mode 100644 index 0000000..b901094 --- /dev/null +++ b/rest_client/doc/TimerInputTimer.md @@ -0,0 +1,19 @@ +# openapi.model.TimerInputTimer + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**description** | **String** | Description of the timer | [optional] +**endTime** | **String** | End time of the timer in UTC format, a timer cannot end before it started. If not provided, timer is still running | [optional] +**notes** | **String** | Notes about the timer, in markdown format | [optional] +**projectId** | **String** | Project ID this timer belongs to | [optional] +**startTime** | **String** | Start time of the timer in UTC format | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/rest_client/doc/TimerResponse.md b/rest_client/doc/TimerResponse.md new file mode 100644 index 0000000..aa7db7b --- /dev/null +++ b/rest_client/doc/TimerResponse.md @@ -0,0 +1,15 @@ +# openapi.model.TimerResponse + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**Timer**](Timer.md) | | [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) + + diff --git a/rest_client/doc/Timers.md b/rest_client/doc/Timers.md new file mode 100644 index 0000000..3f429e3 --- /dev/null +++ b/rest_client/doc/Timers.md @@ -0,0 +1,16 @@ +# openapi.model.Timers + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**List**](Timer.md) | | [optional] [default to const []] +**metadata** | [**ProjectsMetadata**](ProjectsMetadata.md) | | [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) + + diff --git a/rest_client/lib/api.dart b/rest_client/lib/api.dart new file mode 100644 index 0000000..86323ec --- /dev/null +++ b/rest_client/lib/api.dart @@ -0,0 +1,59 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +library openapi.api; + +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; + +import 'package:collection/collection.dart'; +import 'package:http/http.dart'; +import 'package:intl/intl.dart'; +import 'package:meta/meta.dart'; + +part 'api_client.dart'; +part 'api_helper.dart'; +part 'api_exception.dart'; +part 'auth/authentication.dart'; +part 'auth/api_key_auth.dart'; +part 'auth/oauth.dart'; +part 'auth/http_basic_auth.dart'; +part 'auth/http_bearer_auth.dart'; + +part 'api/project_api.dart'; +part 'api/timer_api.dart'; + +part 'model/project.dart'; +part 'model/project_input.dart'; +part 'model/project_input_project.dart'; +part 'model/project_response.dart'; +part 'model/projects.dart'; +part 'model/projects_metadata.dart'; +part 'model/timer.dart'; +part 'model/timer_input.dart'; +part 'model/timer_input_timer.dart'; +part 'model/timer_response.dart'; +part 'model/timers.dart'; + + +/// An [ApiClient] instance that uses the default values obtained from +/// the OpenAPI specification file. +var defaultApiClient = ApiClient(); + +const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; +const _dateEpochMarker = 'epoch'; +const _deepEquality = DeepCollectionEquality(); +final _dateFormatter = DateFormat('yyyy-MM-dd'); +final _regList = RegExp(r'^List<(.*)>$'); +final _regSet = RegExp(r'^Set<(.*)>$'); +final _regMap = RegExp(r'^Map$'); + +bool _isEpochMarker(String? pattern) => pattern == _dateEpochMarker || pattern == '/$_dateEpochMarker/'; diff --git a/rest_client/lib/api/project_api.dart b/rest_client/lib/api/project_api.dart new file mode 100644 index 0000000..a047ee3 --- /dev/null +++ b/rest_client/lib/api/project_api.dart @@ -0,0 +1,302 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class ProjectApi { + ProjectApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// Create a new project + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [ProjectInput] body (required): + /// Project to create + Future timecopsyncProjectsApiWebProjectControllerCreateWithHttpInfo(ProjectInput body,) async { + // ignore: prefer_const_declarations + final path = r'/projects'; + + // ignore: prefer_final_locals + Object? postBody = body; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Create a new project + /// + /// Parameters: + /// + /// * [ProjectInput] body (required): + /// Project to create + Future timecopsyncProjectsApiWebProjectControllerCreate(ProjectInput body,) async { + final response = await timecopsyncProjectsApiWebProjectControllerCreateWithHttpInfo(body,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ProjectResponse',) as ProjectResponse; + + } + return null; + } + + /// Delete a project + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] id (required): + /// Project ID + Future timecopsyncProjectsApiWebProjectControllerDeleteWithHttpInfo(String id,) async { + // ignore: prefer_const_declarations + final path = r'/projects/{id}' + .replaceAll('{id}', id); + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'DELETE', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Delete a project + /// + /// Parameters: + /// + /// * [String] id (required): + /// Project ID + Future timecopsyncProjectsApiWebProjectControllerDelete(String id,) async { + final response = await timecopsyncProjectsApiWebProjectControllerDeleteWithHttpInfo(id,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// List projects, fetches 100 unarchived projects by default + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] limit: + /// Number of results to show + /// + /// * [int] showArchived: + /// if 1 shows archived projects, defaults to 0 + Future timecopsyncProjectsApiWebProjectControllerIndexWithHttpInfo({ int? limit, int? showArchived, }) async { + // ignore: prefer_const_declarations + final path = r'/projects'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + if (limit != null) { + queryParams.addAll(_queryParams('', 'limit', limit)); + } + if (showArchived != null) { + queryParams.addAll(_queryParams('', 'show_archived', showArchived)); + } + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// List projects, fetches 100 unarchived projects by default + /// + /// Parameters: + /// + /// * [int] limit: + /// Number of results to show + /// + /// * [int] showArchived: + /// if 1 shows archived projects, defaults to 0 + Future timecopsyncProjectsApiWebProjectControllerIndex({ int? limit, int? showArchived, }) async { + final response = await timecopsyncProjectsApiWebProjectControllerIndexWithHttpInfo( limit: limit, showArchived: showArchived, ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Projects',) as Projects; + + } + return null; + } + + /// Get a single project + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] id (required): + /// Project ID + Future timecopsyncProjectsApiWebProjectControllerShowWithHttpInfo(String id,) async { + // ignore: prefer_const_declarations + final path = r'/projects/{id}' + .replaceAll('{id}', id); + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Get a single project + /// + /// Parameters: + /// + /// * [String] id (required): + /// Project ID + Future timecopsyncProjectsApiWebProjectControllerShow(String id,) async { + final response = await timecopsyncProjectsApiWebProjectControllerShowWithHttpInfo(id,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ProjectResponse',) as ProjectResponse; + + } + return null; + } + + /// Update a project + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] id (required): + /// Project ID + /// + /// * [ProjectInput] body (required): + /// Project to update + Future timecopsyncProjectsApiWebProjectControllerUpdateWithHttpInfo(String id, ProjectInput body,) async { + // ignore: prefer_const_declarations + final path = r'/projects/{id}' + .replaceAll('{id}', id); + + // ignore: prefer_final_locals + Object? postBody = body; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'PATCH', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Update a project + /// + /// Parameters: + /// + /// * [String] id (required): + /// Project ID + /// + /// * [ProjectInput] body (required): + /// Project to update + Future timecopsyncProjectsApiWebProjectControllerUpdate(String id, ProjectInput body,) async { + final response = await timecopsyncProjectsApiWebProjectControllerUpdateWithHttpInfo(id, body,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ProjectResponse',) as ProjectResponse; + + } + return null; + } +} diff --git a/rest_client/lib/api/timer_api.dart b/rest_client/lib/api/timer_api.dart new file mode 100644 index 0000000..7cf6d30 --- /dev/null +++ b/rest_client/lib/api/timer_api.dart @@ -0,0 +1,279 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class TimerApi { + TimerApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// Create a new timer + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [TimerInput] body (required): + /// Timer to create + Future timecopsyncProjectsApiWebTimerControllerCreateWithHttpInfo(TimerInput body,) async { + // ignore: prefer_const_declarations + final path = r'/timers'; + + // ignore: prefer_final_locals + Object? postBody = body; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Create a new timer + /// + /// Parameters: + /// + /// * [TimerInput] body (required): + /// Timer to create + Future timecopsyncProjectsApiWebTimerControllerCreate(TimerInput body,) async { + final response = await timecopsyncProjectsApiWebTimerControllerCreateWithHttpInfo(body,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'TimerResponse',) as TimerResponse; + + } + return null; + } + + /// Delete a timer + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] id (required): + /// Timer ID + Future timecopsyncProjectsApiWebTimerControllerDeleteWithHttpInfo(String id,) async { + // ignore: prefer_const_declarations + final path = r'/timers/{id}' + .replaceAll('{id}', id); + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'DELETE', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Delete a timer + /// + /// Parameters: + /// + /// * [String] id (required): + /// Timer ID + Future timecopsyncProjectsApiWebTimerControllerDelete(String id,) async { + final response = await timecopsyncProjectsApiWebTimerControllerDeleteWithHttpInfo(id,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// List timers + /// + /// Note: This method returns the HTTP [Response]. + Future timecopsyncProjectsApiWebTimerControllerIndexWithHttpInfo() async { + // ignore: prefer_const_declarations + final path = r'/timers'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// List timers + Future timecopsyncProjectsApiWebTimerControllerIndex() async { + final response = await timecopsyncProjectsApiWebTimerControllerIndexWithHttpInfo(); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Timers',) as Timers; + + } + return null; + } + + /// Get a single timer + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] id (required): + /// Timer ID + Future timecopsyncProjectsApiWebTimerControllerShowWithHttpInfo(String id,) async { + // ignore: prefer_const_declarations + final path = r'/timers/{id}' + .replaceAll('{id}', id); + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Get a single timer + /// + /// Parameters: + /// + /// * [String] id (required): + /// Timer ID + Future timecopsyncProjectsApiWebTimerControllerShow(String id,) async { + final response = await timecopsyncProjectsApiWebTimerControllerShowWithHttpInfo(id,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'TimerResponse',) as TimerResponse; + + } + return null; + } + + /// Update a timer + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] id (required): + /// Timer ID + /// + /// * [TimerInput] body (required): + /// Timer to update + Future timecopsyncProjectsApiWebTimerControllerUpdateWithHttpInfo(String id, TimerInput body,) async { + // ignore: prefer_const_declarations + final path = r'/timers/{id}' + .replaceAll('{id}', id); + + // ignore: prefer_final_locals + Object? postBody = body; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'PATCH', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Update a timer + /// + /// Parameters: + /// + /// * [String] id (required): + /// Timer ID + /// + /// * [TimerInput] body (required): + /// Timer to update + Future timecopsyncProjectsApiWebTimerControllerUpdate(String id, TimerInput body,) async { + final response = await timecopsyncProjectsApiWebTimerControllerUpdateWithHttpInfo(id, body,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'TimerResponse',) as TimerResponse; + + } + return null; + } +} diff --git a/rest_client/lib/api_client.dart b/rest_client/lib/api_client.dart new file mode 100644 index 0000000..c9b61c9 --- /dev/null +++ b/rest_client/lib/api_client.dart @@ -0,0 +1,278 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ApiClient { + ApiClient({this.basePath = '/api/v1', this.authentication,}); + + final String basePath; + final Authentication? authentication; + + var _client = Client(); + final _defaultHeaderMap = {}; + + /// Returns the current HTTP [Client] instance to use in this class. + /// + /// The return value is guaranteed to never be null. + Client get client => _client; + + /// Requests to use a new HTTP [Client] in this class. + set client(Client newClient) { + _client = newClient; + } + + Map get defaultHeaderMap => _defaultHeaderMap; + + void addDefaultHeader(String key, String value) { + _defaultHeaderMap[key] = value; + } + + // We don't use a Map for queryParams. + // If collectionFormat is 'multi', a key might appear multiple times. + Future invokeAPI( + String path, + String method, + List queryParams, + Object? body, + Map headerParams, + Map formParams, + String? contentType, + ) async { + await authentication?.applyToParams(queryParams, headerParams); + + headerParams.addAll(_defaultHeaderMap); + if (contentType != null) { + headerParams['Content-Type'] = contentType; + } + + final urlEncodedQueryParams = queryParams.map((param) => '$param'); + final queryString = urlEncodedQueryParams.isNotEmpty ? '?${urlEncodedQueryParams.join('&')}' : ''; + final uri = Uri.parse('$basePath$path$queryString'); + + try { + // Special case for uploading a single file which isn't a 'multipart/form-data'. + if ( + body is MultipartFile && (contentType == null || + !contentType.toLowerCase().startsWith('multipart/form-data')) + ) { + final request = StreamedRequest(method, uri); + request.headers.addAll(headerParams); + request.contentLength = body.length; + body.finalize().listen( + request.sink.add, + onDone: request.sink.close, + // ignore: avoid_types_on_closure_parameters + onError: (Object error, StackTrace trace) => request.sink.close(), + cancelOnError: true, + ); + final response = await _client.send(request); + return Response.fromStream(response); + } + + if (body is MultipartRequest) { + final request = MultipartRequest(method, uri); + request.fields.addAll(body.fields); + request.files.addAll(body.files); + request.headers.addAll(body.headers); + request.headers.addAll(headerParams); + final response = await _client.send(request); + return Response.fromStream(response); + } + + final msgBody = contentType == 'application/x-www-form-urlencoded' + ? formParams + : await serializeAsync(body); + final nullableHeaderParams = headerParams.isEmpty ? null : headerParams; + + switch(method) { + case 'POST': return await _client.post(uri, headers: nullableHeaderParams, body: msgBody,); + case 'PUT': return await _client.put(uri, headers: nullableHeaderParams, body: msgBody,); + case 'DELETE': return await _client.delete(uri, headers: nullableHeaderParams, body: msgBody,); + case 'PATCH': return await _client.patch(uri, headers: nullableHeaderParams, body: msgBody,); + case 'HEAD': return await _client.head(uri, headers: nullableHeaderParams,); + case 'GET': return await _client.get(uri, headers: nullableHeaderParams,); + } + } on SocketException catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'Socket operation failed: $method $path', + error, + trace, + ); + } on TlsException catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'TLS/SSL communication failed: $method $path', + error, + trace, + ); + } on IOException catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'I/O operation failed: $method $path', + error, + trace, + ); + } on ClientException catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'HTTP connection failed: $method $path', + error, + trace, + ); + } on Exception catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'Exception occurred: $method $path', + error, + trace, + ); + } + + throw ApiException( + HttpStatus.badRequest, + 'Invalid HTTP operation: $method $path', + ); + } + + Future deserializeAsync(String value, String targetType, {bool growable = false,}) async => + // ignore: deprecated_member_use_from_same_package + deserialize(value, targetType, growable: growable); + + @Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use deserializeAsync() instead.') + dynamic deserialize(String value, String targetType, {bool growable = false,}) { + // Remove all spaces. Necessary for regular expressions as well. + targetType = targetType.replaceAll(' ', ''); // ignore: parameter_assignments + + // If the expected target type is String, nothing to do... + return targetType == 'String' + ? value + : fromJson(json.decode(value), targetType, growable: growable); + } + + // ignore: deprecated_member_use_from_same_package + Future serializeAsync(Object? value) async => serialize(value); + + @Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use serializeAsync() instead.') + String serialize(Object? value) => value == null ? '' : json.encode(value); + + /// Returns a native instance of an OpenAPI class matching the [specified type][targetType]. + static dynamic fromJson(dynamic value, String targetType, {bool growable = false,}) { + try { + switch (targetType) { + case 'String': + return value is String ? value : value.toString(); + case 'int': + return value is int ? value : int.parse('$value'); + case 'double': + return value is double ? value : double.parse('$value'); + case 'bool': + if (value is bool) { + return value; + } + final valueString = '$value'.toLowerCase(); + return valueString == 'true' || valueString == '1'; + case 'DateTime': + return value is DateTime ? value : DateTime.tryParse(value); + case 'Project': + return Project.fromJson(value); + case 'ProjectInput': + return ProjectInput.fromJson(value); + case 'ProjectInputProject': + return ProjectInputProject.fromJson(value); + case 'ProjectResponse': + return ProjectResponse.fromJson(value); + case 'Projects': + return Projects.fromJson(value); + case 'ProjectsMetadata': + return ProjectsMetadata.fromJson(value); + case 'Timer': + return Timer.fromJson(value); + case 'TimerInput': + return TimerInput.fromJson(value); + case 'TimerInputTimer': + return TimerInputTimer.fromJson(value); + case 'TimerResponse': + return TimerResponse.fromJson(value); + case 'Timers': + return Timers.fromJson(value); + default: + dynamic match; + if (value is List && (match = _regList.firstMatch(targetType)?.group(1)) != null) { + return value + .map((dynamic v) => fromJson(v, match, growable: growable,)) + .toList(growable: growable); + } + if (value is Set && (match = _regSet.firstMatch(targetType)?.group(1)) != null) { + return value + .map((dynamic v) => fromJson(v, match, growable: growable,)) + .toSet(); + } + if (value is Map && (match = _regMap.firstMatch(targetType)?.group(1)) != null) { + return Map.fromIterables( + value.keys.cast(), + value.values.map((dynamic v) => fromJson(v, match, growable: growable,)), + ); + } + } + } on Exception catch (error, trace) { + throw ApiException.withInner(HttpStatus.internalServerError, 'Exception during deserialization.', error, trace,); + } + throw ApiException(HttpStatus.internalServerError, 'Could not find a suitable class for deserialization',); + } +} + +/// Primarily intended for use in an isolate. +class DeserializationMessage { + const DeserializationMessage({ + required this.json, + required this.targetType, + this.growable = false, + }); + + /// The JSON value to deserialize. + final String json; + + /// Target type to deserialize to. + final String targetType; + + /// Whether to make deserialized lists or maps growable. + final bool growable; +} + +/// Primarily intended for use in an isolate. +Future decodeAsync(DeserializationMessage message) async { + // Remove all spaces. Necessary for regular expressions as well. + final targetType = message.targetType.replaceAll(' ', ''); + + // If the expected target type is String, nothing to do... + return targetType == 'String' + ? message.json + : json.decode(message.json); +} + +/// Primarily intended for use in an isolate. +Future deserializeAsync(DeserializationMessage message) async { + // Remove all spaces. Necessary for regular expressions as well. + final targetType = message.targetType.replaceAll(' ', ''); + + // If the expected target type is String, nothing to do... + return targetType == 'String' + ? message.json + : ApiClient.fromJson( + json.decode(message.json), + targetType, + growable: message.growable, + ); +} + +/// Primarily intended for use in an isolate. +Future serializeAsync(Object? value) async => value == null ? '' : json.encode(value); diff --git a/rest_client/lib/api_exception.dart b/rest_client/lib/api_exception.dart new file mode 100644 index 0000000..53077d6 --- /dev/null +++ b/rest_client/lib/api_exception.dart @@ -0,0 +1,33 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ApiException implements Exception { + ApiException(this.code, this.message); + + ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace); + + int code = 0; + String? message; + Exception? innerException; + StackTrace? stackTrace; + + @override + String toString() { + if (message == null) { + return 'ApiException'; + } + if (innerException == null) { + return 'ApiException $code: $message'; + } + return 'ApiException $code: $message (Inner exception: $innerException)\n\n$stackTrace'; + } +} diff --git a/rest_client/lib/api_helper.dart b/rest_client/lib/api_helper.dart new file mode 100644 index 0000000..255f38d --- /dev/null +++ b/rest_client/lib/api_helper.dart @@ -0,0 +1,104 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class QueryParam { + const QueryParam(this.name, this.value); + + final String name; + final String value; + + @override + String toString() => '${Uri.encodeQueryComponent(name)}=${Uri.encodeQueryComponent(value)}'; +} + +// Ported from the Java version. +Iterable _queryParams(String collectionFormat, String name, dynamic value,) { + // Assertions to run in debug mode only. + assert(name.isNotEmpty, 'Parameter cannot be an empty string.'); + + final params = []; + + if (value is List) { + if (collectionFormat == 'multi') { + return value.map((dynamic v) => QueryParam(name, parameterToString(v)),); + } + + // Default collection format is 'csv'. + if (collectionFormat.isEmpty) { + collectionFormat = 'csv'; // ignore: parameter_assignments + } + + final delimiter = _delimiters[collectionFormat] ?? ','; + + params.add(QueryParam(name, value.map(parameterToString).join(delimiter),)); + } else if (value != null) { + params.add(QueryParam(name, parameterToString(value))); + } + + return params; +} + +/// Format the given parameter object into a [String]. +String parameterToString(dynamic value) { + if (value == null) { + return ''; + } + if (value is DateTime) { + return value.toUtc().toIso8601String(); + } + return value.toString(); +} + +/// Returns the decoded body as UTF-8 if the given headers indicate an 'application/json' +/// content type. Otherwise, returns the decoded body as decoded by dart:http package. +Future _decodeBodyBytes(Response response) async { + final contentType = response.headers['content-type']; + return contentType != null && contentType.toLowerCase().startsWith('application/json') + ? response.bodyBytes.isEmpty ? '' : utf8.decode(response.bodyBytes) + : response.body; +} + +/// Returns a valid [T] value found at the specified Map [key], null otherwise. +T? mapValueOfType(dynamic map, String key) { + final dynamic value = map is Map ? map[key] : null; + if (T == double && value is int) { + return value.toDouble() as T; + } + return value is T ? value : null; +} + +/// Returns a valid Map found at the specified Map [key], null otherwise. +Map? mapCastOfType(dynamic map, String key) { + final dynamic value = map is Map ? map[key] : null; + return value is Map ? value.cast() : null; +} + +/// Returns a valid [DateTime] found at the specified Map [key], null otherwise. +DateTime? mapDateTime(dynamic map, String key, [String? pattern]) { + final dynamic value = map is Map ? map[key] : null; + if (value != null) { + int? millis; + if (value is int) { + millis = value; + } else if (value is String) { + if (_isEpochMarker(pattern)) { + millis = int.tryParse(value); + } else { + return DateTime.tryParse(value); + } + } + if (millis != null) { + return DateTime.fromMillisecondsSinceEpoch(millis, isUtc: true); + } + } + return null; +} diff --git a/rest_client/lib/auth/api_key_auth.dart b/rest_client/lib/auth/api_key_auth.dart new file mode 100644 index 0000000..6c56217 --- /dev/null +++ b/rest_client/lib/auth/api_key_auth.dart @@ -0,0 +1,40 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ApiKeyAuth implements Authentication { + ApiKeyAuth(this.location, this.paramName); + + final String location; + final String paramName; + + String apiKeyPrefix = ''; + String apiKey = ''; + + @override + Future applyToParams(List queryParams, Map headerParams,) async { + final paramValue = apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey'; + + if (paramValue.isNotEmpty) { + if (location == 'query') { + queryParams.add(QueryParam(paramName, paramValue)); + } else if (location == 'header') { + headerParams[paramName] = paramValue; + } else if (location == 'cookie') { + headerParams.update( + 'Cookie', + (existingCookie) => '$existingCookie; $paramName=$paramValue', + ifAbsent: () => '$paramName=$paramValue', + ); + } + } + } +} diff --git a/rest_client/lib/auth/authentication.dart b/rest_client/lib/auth/authentication.dart new file mode 100644 index 0000000..5377fb6 --- /dev/null +++ b/rest_client/lib/auth/authentication.dart @@ -0,0 +1,17 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +// ignore: one_member_abstracts +abstract class Authentication { + /// Apply authentication settings to header and query params. + Future applyToParams(List queryParams, Map headerParams); +} diff --git a/rest_client/lib/auth/http_basic_auth.dart b/rest_client/lib/auth/http_basic_auth.dart new file mode 100644 index 0000000..5e8b1c4 --- /dev/null +++ b/rest_client/lib/auth/http_basic_auth.dart @@ -0,0 +1,26 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class HttpBasicAuth implements Authentication { + HttpBasicAuth({this.username = '', this.password = ''}); + + String username; + String password; + + @override + Future applyToParams(List queryParams, Map headerParams,) async { + if (username.isNotEmpty && password.isNotEmpty) { + final credentials = '$username:$password'; + headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; + } + } +} diff --git a/rest_client/lib/auth/http_bearer_auth.dart b/rest_client/lib/auth/http_bearer_auth.dart new file mode 100644 index 0000000..847dc05 --- /dev/null +++ b/rest_client/lib/auth/http_bearer_auth.dart @@ -0,0 +1,49 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +typedef HttpBearerAuthProvider = String Function(); + +class HttpBearerAuth implements Authentication { + HttpBearerAuth(); + + dynamic _accessToken; + + dynamic get accessToken => _accessToken; + + set accessToken(dynamic accessToken) { + if (accessToken is! String && accessToken is! HttpBearerAuthProvider) { + throw ArgumentError('accessToken value must be either a String or a String Function().'); + } + _accessToken = accessToken; + } + + @override + Future applyToParams(List queryParams, Map headerParams,) async { + if (_accessToken == null) { + return; + } + + String accessToken; + + if (_accessToken is String) { + accessToken = _accessToken; + } else if (_accessToken is HttpBearerAuthProvider) { + accessToken = _accessToken!(); + } else { + return; + } + + if (accessToken.isNotEmpty) { + headerParams['Authorization'] = 'Bearer $accessToken'; + } + } +} diff --git a/rest_client/lib/auth/oauth.dart b/rest_client/lib/auth/oauth.dart new file mode 100644 index 0000000..73fd820 --- /dev/null +++ b/rest_client/lib/auth/oauth.dart @@ -0,0 +1,24 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class OAuth implements Authentication { + OAuth({this.accessToken = ''}); + + String accessToken; + + @override + Future applyToParams(List queryParams, Map headerParams,) async { + if (accessToken.isNotEmpty) { + headerParams['Authorization'] = 'Bearer $accessToken'; + } + } +} diff --git a/rest_client/lib/model/project.dart b/rest_client/lib/model/project.dart new file mode 100644 index 0000000..7c4f6ba --- /dev/null +++ b/rest_client/lib/model/project.dart @@ -0,0 +1,164 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Project { + /// Returns a new [Project] instance. + Project({ + this.archived, + this.colour, + this.id, + required this.name, + }); + + /// Archived status + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? archived; + + /// Colour associated represented by hex values casted into integer + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + int? colour; + + /// Project ID + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? id; + + /// Project name + String name; + + @override + bool operator ==(Object other) => identical(this, other) || other is Project && + other.archived == archived && + other.colour == colour && + other.id == id && + other.name == name; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (archived == null ? 0 : archived!.hashCode) + + (colour == null ? 0 : colour!.hashCode) + + (id == null ? 0 : id!.hashCode) + + (name.hashCode); + + @override + String toString() => 'Project[archived=$archived, colour=$colour, id=$id, name=$name]'; + + Map toJson() { + final json = {}; + if (this.archived != null) { + json[r'archived'] = this.archived; + } else { + json[r'archived'] = null; + } + if (this.colour != null) { + json[r'colour'] = this.colour; + } else { + json[r'colour'] = null; + } + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; + } + json[r'name'] = this.name; + return json; + } + + /// Returns a new [Project] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static Project? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Project[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Project[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Project( + archived: mapValueOfType(json, r'archived'), + colour: mapValueOfType(json, r'colour'), + id: mapValueOfType(json, r'id'), + name: mapValueOfType(json, r'name')!, + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Project.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Project.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of Project-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = Project.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'name', + }; +} + diff --git a/rest_client/lib/model/project_input.dart b/rest_client/lib/model/project_input.dart new file mode 100644 index 0000000..d5eef05 --- /dev/null +++ b/rest_client/lib/model/project_input.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ProjectInput { + /// Returns a new [ProjectInput] instance. + ProjectInput({ + required this.project, + }); + + ProjectInputProject project; + + @override + bool operator ==(Object other) => identical(this, other) || other is ProjectInput && + other.project == project; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (project.hashCode); + + @override + String toString() => 'ProjectInput[project=$project]'; + + Map toJson() { + final json = {}; + json[r'project'] = this.project; + return json; + } + + /// Returns a new [ProjectInput] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static ProjectInput? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ProjectInput[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ProjectInput[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ProjectInput( + project: ProjectInputProject.fromJson(json[r'project'])!, + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ProjectInput.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ProjectInput.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of ProjectInput-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = ProjectInput.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'project', + }; +} + diff --git a/rest_client/lib/model/project_input_project.dart b/rest_client/lib/model/project_input_project.dart new file mode 100644 index 0000000..8331dd4 --- /dev/null +++ b/rest_client/lib/model/project_input_project.dart @@ -0,0 +1,146 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ProjectInputProject { + /// Returns a new [ProjectInputProject] instance. + ProjectInputProject({ + this.archived, + this.colour, + required this.name, + }); + + /// Archived status + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? archived; + + /// Colour associated represented by hex values casted into integer + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + int? colour; + + /// Project name + String name; + + @override + bool operator ==(Object other) => identical(this, other) || other is ProjectInputProject && + other.archived == archived && + other.colour == colour && + other.name == name; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (archived == null ? 0 : archived!.hashCode) + + (colour == null ? 0 : colour!.hashCode) + + (name.hashCode); + + @override + String toString() => 'ProjectInputProject[archived=$archived, colour=$colour, name=$name]'; + + Map toJson() { + final json = {}; + if (this.archived != null) { + json[r'archived'] = this.archived; + } else { + json[r'archived'] = null; + } + if (this.colour != null) { + json[r'colour'] = this.colour; + } else { + json[r'colour'] = null; + } + json[r'name'] = this.name; + return json; + } + + /// Returns a new [ProjectInputProject] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static ProjectInputProject? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ProjectInputProject[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ProjectInputProject[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ProjectInputProject( + archived: mapValueOfType(json, r'archived'), + colour: mapValueOfType(json, r'colour'), + name: mapValueOfType(json, r'name')!, + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ProjectInputProject.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ProjectInputProject.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of ProjectInputProject-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = ProjectInputProject.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'name', + }; +} + diff --git a/rest_client/lib/model/project_response.dart b/rest_client/lib/model/project_response.dart new file mode 100644 index 0000000..962649f --- /dev/null +++ b/rest_client/lib/model/project_response.dart @@ -0,0 +1,118 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ProjectResponse { + /// Returns a new [ProjectResponse] instance. + ProjectResponse({ + this.data, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + Project? data; + + @override + bool operator ==(Object other) => identical(this, other) || other is ProjectResponse && + other.data == data; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (data == null ? 0 : data!.hashCode); + + @override + String toString() => 'ProjectResponse[data=$data]'; + + Map toJson() { + final json = {}; + if (this.data != null) { + json[r'data'] = this.data; + } else { + json[r'data'] = null; + } + return json; + } + + /// Returns a new [ProjectResponse] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static ProjectResponse? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ProjectResponse[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ProjectResponse[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ProjectResponse( + data: Project.fromJson(json[r'data']), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ProjectResponse.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ProjectResponse.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of ProjectResponse-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = ProjectResponse.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/rest_client/lib/model/projects.dart b/rest_client/lib/model/projects.dart new file mode 100644 index 0000000..eed9544 --- /dev/null +++ b/rest_client/lib/model/projects.dart @@ -0,0 +1,125 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Projects { + /// Returns a new [Projects] instance. + Projects({ + this.data = const [], + this.metadata, + }); + + List data; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + ProjectsMetadata? metadata; + + @override + bool operator ==(Object other) => identical(this, other) || other is Projects && + _deepEquality.equals(other.data, data) && + other.metadata == metadata; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (data.hashCode) + + (metadata == null ? 0 : metadata!.hashCode); + + @override + String toString() => 'Projects[data=$data, metadata=$metadata]'; + + Map toJson() { + final json = {}; + json[r'data'] = this.data; + if (this.metadata != null) { + json[r'metadata'] = this.metadata; + } else { + json[r'metadata'] = null; + } + return json; + } + + /// Returns a new [Projects] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static Projects? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Projects[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Projects[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Projects( + data: Project.listFromJson(json[r'data']), + metadata: ProjectsMetadata.fromJson(json[r'metadata']), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Projects.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Projects.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of Projects-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = Projects.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/rest_client/lib/model/projects_metadata.dart b/rest_client/lib/model/projects_metadata.dart new file mode 100644 index 0000000..22edf03 --- /dev/null +++ b/rest_client/lib/model/projects_metadata.dart @@ -0,0 +1,119 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ProjectsMetadata { + /// Returns a new [ProjectsMetadata] instance. + ProjectsMetadata({ + this.total, + }); + + /// Total number of projects + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + int? total; + + @override + bool operator ==(Object other) => identical(this, other) || other is ProjectsMetadata && + other.total == total; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (total == null ? 0 : total!.hashCode); + + @override + String toString() => 'ProjectsMetadata[total=$total]'; + + Map toJson() { + final json = {}; + if (this.total != null) { + json[r'total'] = this.total; + } else { + json[r'total'] = null; + } + return json; + } + + /// Returns a new [ProjectsMetadata] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static ProjectsMetadata? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ProjectsMetadata[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ProjectsMetadata[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ProjectsMetadata( + total: mapValueOfType(json, r'total'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ProjectsMetadata.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ProjectsMetadata.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of ProjectsMetadata-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = ProjectsMetadata.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/rest_client/lib/model/timer.dart b/rest_client/lib/model/timer.dart new file mode 100644 index 0000000..31f4d7f --- /dev/null +++ b/rest_client/lib/model/timer.dart @@ -0,0 +1,200 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Timer { + /// Returns a new [Timer] instance. + Timer({ + this.description, + this.endTime, + this.id, + this.notes, + this.projectId, + required this.startTime, + }); + + /// Description of the timer + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? description; + + /// End time of the timer in UTC format, a timer cannot end before it started. If not provided, timer is still running + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? endTime; + + /// Timer ID + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? id; + + /// Notes about the timer, in markdown format + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? notes; + + /// Project ID this timer belongs to + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? projectId; + + /// Start time of the timer in UTC format + String startTime; + + @override + bool operator ==(Object other) => identical(this, other) || other is Timer && + other.description == description && + other.endTime == endTime && + other.id == id && + other.notes == notes && + other.projectId == projectId && + other.startTime == startTime; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (description == null ? 0 : description!.hashCode) + + (endTime == null ? 0 : endTime!.hashCode) + + (id == null ? 0 : id!.hashCode) + + (notes == null ? 0 : notes!.hashCode) + + (projectId == null ? 0 : projectId!.hashCode) + + (startTime.hashCode); + + @override + String toString() => 'Timer[description=$description, endTime=$endTime, id=$id, notes=$notes, projectId=$projectId, startTime=$startTime]'; + + Map toJson() { + final json = {}; + if (this.description != null) { + json[r'description'] = this.description; + } else { + json[r'description'] = null; + } + if (this.endTime != null) { + json[r'end_time'] = this.endTime; + } else { + json[r'end_time'] = null; + } + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; + } + if (this.notes != null) { + json[r'notes'] = this.notes; + } else { + json[r'notes'] = null; + } + if (this.projectId != null) { + json[r'project_id'] = this.projectId; + } else { + json[r'project_id'] = null; + } + json[r'start_time'] = this.startTime; + return json; + } + + /// Returns a new [Timer] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static Timer? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Timer[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Timer[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Timer( + description: mapValueOfType(json, r'description'), + endTime: mapValueOfType(json, r'end_time'), + id: mapValueOfType(json, r'id'), + notes: mapValueOfType(json, r'notes'), + projectId: mapValueOfType(json, r'project_id'), + startTime: mapValueOfType(json, r'start_time')!, + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Timer.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Timer.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of Timer-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = Timer.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'start_time', + }; +} + diff --git a/rest_client/lib/model/timer_input.dart b/rest_client/lib/model/timer_input.dart new file mode 100644 index 0000000..b240f95 --- /dev/null +++ b/rest_client/lib/model/timer_input.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class TimerInput { + /// Returns a new [TimerInput] instance. + TimerInput({ + required this.timer, + }); + + TimerInputTimer timer; + + @override + bool operator ==(Object other) => identical(this, other) || other is TimerInput && + other.timer == timer; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (timer.hashCode); + + @override + String toString() => 'TimerInput[timer=$timer]'; + + Map toJson() { + final json = {}; + json[r'timer'] = this.timer; + return json; + } + + /// Returns a new [TimerInput] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static TimerInput? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "TimerInput[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "TimerInput[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return TimerInput( + timer: TimerInputTimer.fromJson(json[r'timer'])!, + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = TimerInput.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = TimerInput.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of TimerInput-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = TimerInput.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'timer', + }; +} + diff --git a/rest_client/lib/model/timer_input_timer.dart b/rest_client/lib/model/timer_input_timer.dart new file mode 100644 index 0000000..a2a86bd --- /dev/null +++ b/rest_client/lib/model/timer_input_timer.dart @@ -0,0 +1,182 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class TimerInputTimer { + /// Returns a new [TimerInputTimer] instance. + TimerInputTimer({ + this.description, + this.endTime, + this.notes, + this.projectId, + required this.startTime, + }); + + /// Description of the timer + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? description; + + /// End time of the timer in UTC format, a timer cannot end before it started. If not provided, timer is still running + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? endTime; + + /// Notes about the timer, in markdown format + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? notes; + + /// Project ID this timer belongs to + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? projectId; + + /// Start time of the timer in UTC format + String startTime; + + @override + bool operator ==(Object other) => identical(this, other) || other is TimerInputTimer && + other.description == description && + other.endTime == endTime && + other.notes == notes && + other.projectId == projectId && + other.startTime == startTime; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (description == null ? 0 : description!.hashCode) + + (endTime == null ? 0 : endTime!.hashCode) + + (notes == null ? 0 : notes!.hashCode) + + (projectId == null ? 0 : projectId!.hashCode) + + (startTime.hashCode); + + @override + String toString() => 'TimerInputTimer[description=$description, endTime=$endTime, notes=$notes, projectId=$projectId, startTime=$startTime]'; + + Map toJson() { + final json = {}; + if (this.description != null) { + json[r'description'] = this.description; + } else { + json[r'description'] = null; + } + if (this.endTime != null) { + json[r'end_time'] = this.endTime; + } else { + json[r'end_time'] = null; + } + if (this.notes != null) { + json[r'notes'] = this.notes; + } else { + json[r'notes'] = null; + } + if (this.projectId != null) { + json[r'project_id'] = this.projectId; + } else { + json[r'project_id'] = null; + } + json[r'start_time'] = this.startTime; + return json; + } + + /// Returns a new [TimerInputTimer] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static TimerInputTimer? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "TimerInputTimer[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "TimerInputTimer[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return TimerInputTimer( + description: mapValueOfType(json, r'description'), + endTime: mapValueOfType(json, r'end_time'), + notes: mapValueOfType(json, r'notes'), + projectId: mapValueOfType(json, r'project_id'), + startTime: mapValueOfType(json, r'start_time')!, + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = TimerInputTimer.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = TimerInputTimer.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of TimerInputTimer-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = TimerInputTimer.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'start_time', + }; +} + diff --git a/rest_client/lib/model/timer_response.dart b/rest_client/lib/model/timer_response.dart new file mode 100644 index 0000000..a2e48c0 --- /dev/null +++ b/rest_client/lib/model/timer_response.dart @@ -0,0 +1,118 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class TimerResponse { + /// Returns a new [TimerResponse] instance. + TimerResponse({ + this.data, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + Timer? data; + + @override + bool operator ==(Object other) => identical(this, other) || other is TimerResponse && + other.data == data; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (data == null ? 0 : data!.hashCode); + + @override + String toString() => 'TimerResponse[data=$data]'; + + Map toJson() { + final json = {}; + if (this.data != null) { + json[r'data'] = this.data; + } else { + json[r'data'] = null; + } + return json; + } + + /// Returns a new [TimerResponse] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static TimerResponse? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "TimerResponse[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "TimerResponse[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return TimerResponse( + data: Timer.fromJson(json[r'data']), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = TimerResponse.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = TimerResponse.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of TimerResponse-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = TimerResponse.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/rest_client/lib/model/timers.dart b/rest_client/lib/model/timers.dart new file mode 100644 index 0000000..73f8913 --- /dev/null +++ b/rest_client/lib/model/timers.dart @@ -0,0 +1,125 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Timers { + /// Returns a new [Timers] instance. + Timers({ + this.data = const [], + this.metadata, + }); + + List data; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + ProjectsMetadata? metadata; + + @override + bool operator ==(Object other) => identical(this, other) || other is Timers && + _deepEquality.equals(other.data, data) && + other.metadata == metadata; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (data.hashCode) + + (metadata == null ? 0 : metadata!.hashCode); + + @override + String toString() => 'Timers[data=$data, metadata=$metadata]'; + + Map toJson() { + final json = {}; + json[r'data'] = this.data; + if (this.metadata != null) { + json[r'metadata'] = this.metadata; + } else { + json[r'metadata'] = null; + } + return json; + } + + /// Returns a new [Timers] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static Timers? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Timers[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Timers[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Timers( + data: Timer.listFromJson(json[r'data']), + metadata: ProjectsMetadata.fromJson(json[r'metadata']), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Timers.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Timers.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of Timers-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = Timers.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/rest_client/pubspec.yaml b/rest_client/pubspec.yaml new file mode 100644 index 0000000..8a72109 --- /dev/null +++ b/rest_client/pubspec.yaml @@ -0,0 +1,17 @@ +# +# AUTO-GENERATED FILE, DO NOT MODIFY! +# + +name: 'openapi' +version: '1.0.0' +description: 'OpenAPI API client' +homepage: 'homepage' +environment: + sdk: '>=2.12.0 <4.0.0' +dependencies: + collection: '>=1.17.0 <2.0.0' + http: '>=0.13.0 <2.0.0' + intl: any + meta: '>=1.1.8 <2.0.0' +dev_dependencies: + test: '>=1.21.6 <1.22.0' diff --git a/rest_client/test/project_api_test.dart b/rest_client/test/project_api_test.dart new file mode 100644 index 0000000..90cbae6 --- /dev/null +++ b/rest_client/test/project_api_test.dart @@ -0,0 +1,56 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for ProjectApi +void main() { + // final instance = ProjectApi(); + + group('tests for ProjectApi', () { + // Create a new project + // + //Future timecopsyncProjectsApiWebProjectControllerCreate(ProjectInput body) async + test('test timecopsyncProjectsApiWebProjectControllerCreate', () async { + // TODO + }); + + // Delete a project + // + //Future timecopsyncProjectsApiWebProjectControllerDelete(String id) async + test('test timecopsyncProjectsApiWebProjectControllerDelete', () async { + // TODO + }); + + // List projects, fetches 100 unarchived projects by default + // + //Future timecopsyncProjectsApiWebProjectControllerIndex({ int limit, int showArchived }) async + test('test timecopsyncProjectsApiWebProjectControllerIndex', () async { + // TODO + }); + + // Get a single project + // + //Future timecopsyncProjectsApiWebProjectControllerShow(String id) async + test('test timecopsyncProjectsApiWebProjectControllerShow', () async { + // TODO + }); + + // Update a project + // + //Future timecopsyncProjectsApiWebProjectControllerUpdate(String id, ProjectInput body) async + test('test timecopsyncProjectsApiWebProjectControllerUpdate', () async { + // TODO + }); + + }); +} diff --git a/rest_client/test/project_input_project_test.dart b/rest_client/test/project_input_project_test.dart new file mode 100644 index 0000000..f5bd46b --- /dev/null +++ b/rest_client/test/project_input_project_test.dart @@ -0,0 +1,40 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ProjectInputProject +void main() { + // final instance = ProjectInputProject(); + + group('test ProjectInputProject', () { + // Archived status + // bool archived + test('to test the property `archived`', () async { + // TODO + }); + + // Colour associated represented by hex values casted into integer + // int colour + test('to test the property `colour`', () async { + // TODO + }); + + // Project name + // String name + test('to test the property `name`', () async { + // TODO + }); + + + }); + +} diff --git a/rest_client/test/project_input_test.dart b/rest_client/test/project_input_test.dart new file mode 100644 index 0000000..7ce1e6d --- /dev/null +++ b/rest_client/test/project_input_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ProjectInput +void main() { + // final instance = ProjectInput(); + + group('test ProjectInput', () { + // ProjectInputProject project + test('to test the property `project`', () async { + // TODO + }); + + + }); + +} diff --git a/rest_client/test/project_response_test.dart b/rest_client/test/project_response_test.dart new file mode 100644 index 0000000..c98c096 --- /dev/null +++ b/rest_client/test/project_response_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ProjectResponse +void main() { + // final instance = ProjectResponse(); + + group('test ProjectResponse', () { + // Project data + test('to test the property `data`', () async { + // TODO + }); + + + }); + +} diff --git a/rest_client/test/project_test.dart b/rest_client/test/project_test.dart new file mode 100644 index 0000000..67400e3 --- /dev/null +++ b/rest_client/test/project_test.dart @@ -0,0 +1,46 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Project +void main() { + // final instance = Project(); + + group('test Project', () { + // Archived status + // bool archived + test('to test the property `archived`', () async { + // TODO + }); + + // Colour associated represented by hex values casted into integer + // int colour + test('to test the property `colour`', () async { + // TODO + }); + + // Project ID + // String id + test('to test the property `id`', () async { + // TODO + }); + + // Project name + // String name + test('to test the property `name`', () async { + // TODO + }); + + + }); + +} diff --git a/rest_client/test/projects_metadata_test.dart b/rest_client/test/projects_metadata_test.dart new file mode 100644 index 0000000..398de6a --- /dev/null +++ b/rest_client/test/projects_metadata_test.dart @@ -0,0 +1,28 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ProjectsMetadata +void main() { + // final instance = ProjectsMetadata(); + + group('test ProjectsMetadata', () { + // Total number of projects + // int total + test('to test the property `total`', () async { + // TODO + }); + + + }); + +} diff --git a/rest_client/test/projects_test.dart b/rest_client/test/projects_test.dart new file mode 100644 index 0000000..b539e89 --- /dev/null +++ b/rest_client/test/projects_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Projects +void main() { + // final instance = Projects(); + + group('test Projects', () { + // List data (default value: const []) + test('to test the property `data`', () async { + // TODO + }); + + // ProjectsMetadata metadata + test('to test the property `metadata`', () async { + // TODO + }); + + + }); + +} diff --git a/rest_client/test/timer_api_test.dart b/rest_client/test/timer_api_test.dart new file mode 100644 index 0000000..a7b44fb --- /dev/null +++ b/rest_client/test/timer_api_test.dart @@ -0,0 +1,56 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for TimerApi +void main() { + // final instance = TimerApi(); + + group('tests for TimerApi', () { + // Create a new timer + // + //Future timecopsyncProjectsApiWebTimerControllerCreate(TimerInput body) async + test('test timecopsyncProjectsApiWebTimerControllerCreate', () async { + // TODO + }); + + // Delete a timer + // + //Future timecopsyncProjectsApiWebTimerControllerDelete(String id) async + test('test timecopsyncProjectsApiWebTimerControllerDelete', () async { + // TODO + }); + + // List timers + // + //Future timecopsyncProjectsApiWebTimerControllerIndex() async + test('test timecopsyncProjectsApiWebTimerControllerIndex', () async { + // TODO + }); + + // Get a single timer + // + //Future timecopsyncProjectsApiWebTimerControllerShow(String id) async + test('test timecopsyncProjectsApiWebTimerControllerShow', () async { + // TODO + }); + + // Update a timer + // + //Future timecopsyncProjectsApiWebTimerControllerUpdate(String id, TimerInput body) async + test('test timecopsyncProjectsApiWebTimerControllerUpdate', () async { + // TODO + }); + + }); +} diff --git a/rest_client/test/timer_input_test.dart b/rest_client/test/timer_input_test.dart new file mode 100644 index 0000000..dd56cd4 --- /dev/null +++ b/rest_client/test/timer_input_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for TimerInput +void main() { + // final instance = TimerInput(); + + group('test TimerInput', () { + // TimerInputTimer timer + test('to test the property `timer`', () async { + // TODO + }); + + + }); + +} diff --git a/rest_client/test/timer_input_timer_test.dart b/rest_client/test/timer_input_timer_test.dart new file mode 100644 index 0000000..74daf49 --- /dev/null +++ b/rest_client/test/timer_input_timer_test.dart @@ -0,0 +1,52 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for TimerInputTimer +void main() { + // final instance = TimerInputTimer(); + + group('test TimerInputTimer', () { + // Description of the timer + // String description + test('to test the property `description`', () async { + // TODO + }); + + // End time of the timer in UTC format, a timer cannot end before it started. If not provided, timer is still running + // String endTime + test('to test the property `endTime`', () async { + // TODO + }); + + // Notes about the timer, in markdown format + // String notes + test('to test the property `notes`', () async { + // TODO + }); + + // Project ID this timer belongs to + // String projectId + test('to test the property `projectId`', () async { + // TODO + }); + + // Start time of the timer in UTC format + // String startTime + test('to test the property `startTime`', () async { + // TODO + }); + + + }); + +} diff --git a/rest_client/test/timer_response_test.dart b/rest_client/test/timer_response_test.dart new file mode 100644 index 0000000..bb444a1 --- /dev/null +++ b/rest_client/test/timer_response_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for TimerResponse +void main() { + // final instance = TimerResponse(); + + group('test TimerResponse', () { + // Timer data + test('to test the property `data`', () async { + // TODO + }); + + + }); + +} diff --git a/rest_client/test/timer_test.dart b/rest_client/test/timer_test.dart new file mode 100644 index 0000000..4c70060 --- /dev/null +++ b/rest_client/test/timer_test.dart @@ -0,0 +1,58 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Timer +void main() { + // final instance = Timer(); + + group('test Timer', () { + // Description of the timer + // String description + test('to test the property `description`', () async { + // TODO + }); + + // End time of the timer in UTC format, a timer cannot end before it started. If not provided, timer is still running + // String endTime + test('to test the property `endTime`', () async { + // TODO + }); + + // Timer ID + // String id + test('to test the property `id`', () async { + // TODO + }); + + // Notes about the timer, in markdown format + // String notes + test('to test the property `notes`', () async { + // TODO + }); + + // Project ID this timer belongs to + // String projectId + test('to test the property `projectId`', () async { + // TODO + }); + + // Start time of the timer in UTC format + // String startTime + test('to test the property `startTime`', () async { + // TODO + }); + + + }); + +} diff --git a/rest_client/test/timers_test.dart b/rest_client/test/timers_test.dart new file mode 100644 index 0000000..22db4c8 --- /dev/null +++ b/rest_client/test/timers_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Timers +void main() { + // final instance = Timers(); + + group('test Timers', () { + // List data (default value: const []) + test('to test the property `data`', () async { + // TODO + }); + + // ProjectsMetadata metadata + test('to test the property `metadata`', () async { + // TODO + }); + + + }); + +} From 5067f435438699318f58417af69262689d11c1b6 Mon Sep 17 00:00:00 2001 From: WoodenMaiden Date: Wed, 22 Jan 2025 18:59:29 +0100 Subject: [PATCH 4/8] feat: setup editorconfig --- .editorconfig | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..ee917fc --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +# Space indents +[*.{yml,yaml,dart}] +charset = utf-8 +indent_size = 2 +indent_style = space + +# Since Makefiles need to have a tab +[Makefile] +indent_style = tab From 14e6694d43512d1524d44fe7738cba4bd01c5c4b Mon Sep 17 00:00:00 2001 From: WoodenMaiden Date: Wed, 22 Jan 2025 19:19:31 +0100 Subject: [PATCH 5/8] mv: change client name --- Makefile | 13 ++++++------- {rest_client => openapi}/.gitignore | 0 {rest_client => openapi}/.openapi-generator-ignore | 0 {rest_client => openapi}/.openapi-generator/FILES | 0 {rest_client => openapi}/.openapi-generator/VERSION | 0 {rest_client => openapi}/README.md | 0 {rest_client => openapi}/analysis_options.yaml | 0 {rest_client => openapi}/doc/Project.md | 0 {rest_client => openapi}/doc/ProjectApi.md | 0 {rest_client => openapi}/doc/ProjectInput.md | 0 {rest_client => openapi}/doc/ProjectInputProject.md | 0 {rest_client => openapi}/doc/ProjectResponse.md | 0 {rest_client => openapi}/doc/Projects.md | 0 {rest_client => openapi}/doc/ProjectsMetadata.md | 0 {rest_client => openapi}/doc/Timer.md | 0 {rest_client => openapi}/doc/TimerApi.md | 0 {rest_client => openapi}/doc/TimerInput.md | 0 {rest_client => openapi}/doc/TimerInputTimer.md | 0 {rest_client => openapi}/doc/TimerResponse.md | 0 {rest_client => openapi}/doc/Timers.md | 0 {rest_client => openapi}/lib/api.dart | 0 {rest_client => openapi}/lib/api/project_api.dart | 0 {rest_client => openapi}/lib/api/timer_api.dart | 0 {rest_client => openapi}/lib/api_client.dart | 0 {rest_client => openapi}/lib/api_exception.dart | 0 {rest_client => openapi}/lib/api_helper.dart | 0 {rest_client => openapi}/lib/auth/api_key_auth.dart | 0 .../lib/auth/authentication.dart | 0 .../lib/auth/http_basic_auth.dart | 0 .../lib/auth/http_bearer_auth.dart | 0 {rest_client => openapi}/lib/auth/oauth.dart | 0 {rest_client => openapi}/lib/model/project.dart | 0 .../lib/model/project_input.dart | 0 .../lib/model/project_input_project.dart | 0 .../lib/model/project_response.dart | 0 {rest_client => openapi}/lib/model/projects.dart | 0 .../lib/model/projects_metadata.dart | 0 {rest_client => openapi}/lib/model/timer.dart | 0 {rest_client => openapi}/lib/model/timer_input.dart | 0 .../lib/model/timer_input_timer.dart | 0 .../lib/model/timer_response.dart | 0 {rest_client => openapi}/lib/model/timers.dart | 0 {rest_client => openapi}/pubspec.yaml | 0 {rest_client => openapi}/test/project_api_test.dart | 0 .../test/project_input_project_test.dart | 0 .../test/project_input_test.dart | 0 .../test/project_response_test.dart | 0 {rest_client => openapi}/test/project_test.dart | 0 .../test/projects_metadata_test.dart | 0 {rest_client => openapi}/test/projects_test.dart | 0 {rest_client => openapi}/test/timer_api_test.dart | 0 {rest_client => openapi}/test/timer_input_test.dart | 0 .../test/timer_input_timer_test.dart | 0 .../test/timer_response_test.dart | 0 {rest_client => openapi}/test/timer_test.dart | 0 {rest_client => openapi}/test/timers_test.dart | 0 pubspec.yaml | 4 ++-- 57 files changed, 8 insertions(+), 9 deletions(-) rename {rest_client => openapi}/.gitignore (100%) rename {rest_client => openapi}/.openapi-generator-ignore (100%) rename {rest_client => openapi}/.openapi-generator/FILES (100%) rename {rest_client => openapi}/.openapi-generator/VERSION (100%) rename {rest_client => openapi}/README.md (100%) rename {rest_client => openapi}/analysis_options.yaml (100%) rename {rest_client => openapi}/doc/Project.md (100%) rename {rest_client => openapi}/doc/ProjectApi.md (100%) rename {rest_client => openapi}/doc/ProjectInput.md (100%) rename {rest_client => openapi}/doc/ProjectInputProject.md (100%) rename {rest_client => openapi}/doc/ProjectResponse.md (100%) rename {rest_client => openapi}/doc/Projects.md (100%) rename {rest_client => openapi}/doc/ProjectsMetadata.md (100%) rename {rest_client => openapi}/doc/Timer.md (100%) rename {rest_client => openapi}/doc/TimerApi.md (100%) rename {rest_client => openapi}/doc/TimerInput.md (100%) rename {rest_client => openapi}/doc/TimerInputTimer.md (100%) rename {rest_client => openapi}/doc/TimerResponse.md (100%) rename {rest_client => openapi}/doc/Timers.md (100%) rename {rest_client => openapi}/lib/api.dart (100%) rename {rest_client => openapi}/lib/api/project_api.dart (100%) rename {rest_client => openapi}/lib/api/timer_api.dart (100%) rename {rest_client => openapi}/lib/api_client.dart (100%) rename {rest_client => openapi}/lib/api_exception.dart (100%) rename {rest_client => openapi}/lib/api_helper.dart (100%) rename {rest_client => openapi}/lib/auth/api_key_auth.dart (100%) rename {rest_client => openapi}/lib/auth/authentication.dart (100%) rename {rest_client => openapi}/lib/auth/http_basic_auth.dart (100%) rename {rest_client => openapi}/lib/auth/http_bearer_auth.dart (100%) rename {rest_client => openapi}/lib/auth/oauth.dart (100%) rename {rest_client => openapi}/lib/model/project.dart (100%) rename {rest_client => openapi}/lib/model/project_input.dart (100%) rename {rest_client => openapi}/lib/model/project_input_project.dart (100%) rename {rest_client => openapi}/lib/model/project_response.dart (100%) rename {rest_client => openapi}/lib/model/projects.dart (100%) rename {rest_client => openapi}/lib/model/projects_metadata.dart (100%) rename {rest_client => openapi}/lib/model/timer.dart (100%) rename {rest_client => openapi}/lib/model/timer_input.dart (100%) rename {rest_client => openapi}/lib/model/timer_input_timer.dart (100%) rename {rest_client => openapi}/lib/model/timer_response.dart (100%) rename {rest_client => openapi}/lib/model/timers.dart (100%) rename {rest_client => openapi}/pubspec.yaml (100%) rename {rest_client => openapi}/test/project_api_test.dart (100%) rename {rest_client => openapi}/test/project_input_project_test.dart (100%) rename {rest_client => openapi}/test/project_input_test.dart (100%) rename {rest_client => openapi}/test/project_response_test.dart (100%) rename {rest_client => openapi}/test/project_test.dart (100%) rename {rest_client => openapi}/test/projects_metadata_test.dart (100%) rename {rest_client => openapi}/test/projects_test.dart (100%) rename {rest_client => openapi}/test/timer_api_test.dart (100%) rename {rest_client => openapi}/test/timer_input_test.dart (100%) rename {rest_client => openapi}/test/timer_input_timer_test.dart (100%) rename {rest_client => openapi}/test/timer_response_test.dart (100%) rename {rest_client => openapi}/test/timer_test.dart (100%) rename {rest_client => openapi}/test/timers_test.dart (100%) diff --git a/Makefile b/Makefile index 76208b3..2cb4625 100644 --- a/Makefile +++ b/Makefile @@ -3,9 +3,12 @@ FLUTTER := $(shell which flutter) FLUTTER_BIN_DIR := $(shell dirname $(FLUTTER)) FLUTTER_DIR := $(FLUTTER_BIN_DIR:/bin=) DART := $(FLUTTER_BIN_DIR)/cache/dart-sdk/bin/dart -CLIENT_DIR := rest_client +CLIENT_DIR := openapi + +.PHONY: run +run: + $(FLUTTER) run -# Flutter .PHONY: analyze analyze: $(FLUTTER) analyze @@ -24,6 +27,7 @@ codegen: -i https://raw.githubusercontent.com/TimeCopSync/timecopsync_projects_api/refs/heads/main/priv/static/swagger.json \ -g dart \ -o $(CLIENT_DIR) \ + -pubName=$(CLIENT_DIR) \ -pubAuthor=timecopsync-project \ -pubAuthorEmail=yann.pomie@laposte.net \ -pubDescription="Api client to interact with a timecopsync endpoint (generated with openapi-generator)" \ @@ -31,8 +35,3 @@ codegen: --minimal-update rm -v $(CLIENT_DIR)/.travis.yml rm -v $(CLIENT_DIR)/git_push.sh - -.PHONY: run -run: - $(FLUTTER) run - diff --git a/rest_client/.gitignore b/openapi/.gitignore similarity index 100% rename from rest_client/.gitignore rename to openapi/.gitignore diff --git a/rest_client/.openapi-generator-ignore b/openapi/.openapi-generator-ignore similarity index 100% rename from rest_client/.openapi-generator-ignore rename to openapi/.openapi-generator-ignore diff --git a/rest_client/.openapi-generator/FILES b/openapi/.openapi-generator/FILES similarity index 100% rename from rest_client/.openapi-generator/FILES rename to openapi/.openapi-generator/FILES diff --git a/rest_client/.openapi-generator/VERSION b/openapi/.openapi-generator/VERSION similarity index 100% rename from rest_client/.openapi-generator/VERSION rename to openapi/.openapi-generator/VERSION diff --git a/rest_client/README.md b/openapi/README.md similarity index 100% rename from rest_client/README.md rename to openapi/README.md diff --git a/rest_client/analysis_options.yaml b/openapi/analysis_options.yaml similarity index 100% rename from rest_client/analysis_options.yaml rename to openapi/analysis_options.yaml diff --git a/rest_client/doc/Project.md b/openapi/doc/Project.md similarity index 100% rename from rest_client/doc/Project.md rename to openapi/doc/Project.md diff --git a/rest_client/doc/ProjectApi.md b/openapi/doc/ProjectApi.md similarity index 100% rename from rest_client/doc/ProjectApi.md rename to openapi/doc/ProjectApi.md diff --git a/rest_client/doc/ProjectInput.md b/openapi/doc/ProjectInput.md similarity index 100% rename from rest_client/doc/ProjectInput.md rename to openapi/doc/ProjectInput.md diff --git a/rest_client/doc/ProjectInputProject.md b/openapi/doc/ProjectInputProject.md similarity index 100% rename from rest_client/doc/ProjectInputProject.md rename to openapi/doc/ProjectInputProject.md diff --git a/rest_client/doc/ProjectResponse.md b/openapi/doc/ProjectResponse.md similarity index 100% rename from rest_client/doc/ProjectResponse.md rename to openapi/doc/ProjectResponse.md diff --git a/rest_client/doc/Projects.md b/openapi/doc/Projects.md similarity index 100% rename from rest_client/doc/Projects.md rename to openapi/doc/Projects.md diff --git a/rest_client/doc/ProjectsMetadata.md b/openapi/doc/ProjectsMetadata.md similarity index 100% rename from rest_client/doc/ProjectsMetadata.md rename to openapi/doc/ProjectsMetadata.md diff --git a/rest_client/doc/Timer.md b/openapi/doc/Timer.md similarity index 100% rename from rest_client/doc/Timer.md rename to openapi/doc/Timer.md diff --git a/rest_client/doc/TimerApi.md b/openapi/doc/TimerApi.md similarity index 100% rename from rest_client/doc/TimerApi.md rename to openapi/doc/TimerApi.md diff --git a/rest_client/doc/TimerInput.md b/openapi/doc/TimerInput.md similarity index 100% rename from rest_client/doc/TimerInput.md rename to openapi/doc/TimerInput.md diff --git a/rest_client/doc/TimerInputTimer.md b/openapi/doc/TimerInputTimer.md similarity index 100% rename from rest_client/doc/TimerInputTimer.md rename to openapi/doc/TimerInputTimer.md diff --git a/rest_client/doc/TimerResponse.md b/openapi/doc/TimerResponse.md similarity index 100% rename from rest_client/doc/TimerResponse.md rename to openapi/doc/TimerResponse.md diff --git a/rest_client/doc/Timers.md b/openapi/doc/Timers.md similarity index 100% rename from rest_client/doc/Timers.md rename to openapi/doc/Timers.md diff --git a/rest_client/lib/api.dart b/openapi/lib/api.dart similarity index 100% rename from rest_client/lib/api.dart rename to openapi/lib/api.dart diff --git a/rest_client/lib/api/project_api.dart b/openapi/lib/api/project_api.dart similarity index 100% rename from rest_client/lib/api/project_api.dart rename to openapi/lib/api/project_api.dart diff --git a/rest_client/lib/api/timer_api.dart b/openapi/lib/api/timer_api.dart similarity index 100% rename from rest_client/lib/api/timer_api.dart rename to openapi/lib/api/timer_api.dart diff --git a/rest_client/lib/api_client.dart b/openapi/lib/api_client.dart similarity index 100% rename from rest_client/lib/api_client.dart rename to openapi/lib/api_client.dart diff --git a/rest_client/lib/api_exception.dart b/openapi/lib/api_exception.dart similarity index 100% rename from rest_client/lib/api_exception.dart rename to openapi/lib/api_exception.dart diff --git a/rest_client/lib/api_helper.dart b/openapi/lib/api_helper.dart similarity index 100% rename from rest_client/lib/api_helper.dart rename to openapi/lib/api_helper.dart diff --git a/rest_client/lib/auth/api_key_auth.dart b/openapi/lib/auth/api_key_auth.dart similarity index 100% rename from rest_client/lib/auth/api_key_auth.dart rename to openapi/lib/auth/api_key_auth.dart diff --git a/rest_client/lib/auth/authentication.dart b/openapi/lib/auth/authentication.dart similarity index 100% rename from rest_client/lib/auth/authentication.dart rename to openapi/lib/auth/authentication.dart diff --git a/rest_client/lib/auth/http_basic_auth.dart b/openapi/lib/auth/http_basic_auth.dart similarity index 100% rename from rest_client/lib/auth/http_basic_auth.dart rename to openapi/lib/auth/http_basic_auth.dart diff --git a/rest_client/lib/auth/http_bearer_auth.dart b/openapi/lib/auth/http_bearer_auth.dart similarity index 100% rename from rest_client/lib/auth/http_bearer_auth.dart rename to openapi/lib/auth/http_bearer_auth.dart diff --git a/rest_client/lib/auth/oauth.dart b/openapi/lib/auth/oauth.dart similarity index 100% rename from rest_client/lib/auth/oauth.dart rename to openapi/lib/auth/oauth.dart diff --git a/rest_client/lib/model/project.dart b/openapi/lib/model/project.dart similarity index 100% rename from rest_client/lib/model/project.dart rename to openapi/lib/model/project.dart diff --git a/rest_client/lib/model/project_input.dart b/openapi/lib/model/project_input.dart similarity index 100% rename from rest_client/lib/model/project_input.dart rename to openapi/lib/model/project_input.dart diff --git a/rest_client/lib/model/project_input_project.dart b/openapi/lib/model/project_input_project.dart similarity index 100% rename from rest_client/lib/model/project_input_project.dart rename to openapi/lib/model/project_input_project.dart diff --git a/rest_client/lib/model/project_response.dart b/openapi/lib/model/project_response.dart similarity index 100% rename from rest_client/lib/model/project_response.dart rename to openapi/lib/model/project_response.dart diff --git a/rest_client/lib/model/projects.dart b/openapi/lib/model/projects.dart similarity index 100% rename from rest_client/lib/model/projects.dart rename to openapi/lib/model/projects.dart diff --git a/rest_client/lib/model/projects_metadata.dart b/openapi/lib/model/projects_metadata.dart similarity index 100% rename from rest_client/lib/model/projects_metadata.dart rename to openapi/lib/model/projects_metadata.dart diff --git a/rest_client/lib/model/timer.dart b/openapi/lib/model/timer.dart similarity index 100% rename from rest_client/lib/model/timer.dart rename to openapi/lib/model/timer.dart diff --git a/rest_client/lib/model/timer_input.dart b/openapi/lib/model/timer_input.dart similarity index 100% rename from rest_client/lib/model/timer_input.dart rename to openapi/lib/model/timer_input.dart diff --git a/rest_client/lib/model/timer_input_timer.dart b/openapi/lib/model/timer_input_timer.dart similarity index 100% rename from rest_client/lib/model/timer_input_timer.dart rename to openapi/lib/model/timer_input_timer.dart diff --git a/rest_client/lib/model/timer_response.dart b/openapi/lib/model/timer_response.dart similarity index 100% rename from rest_client/lib/model/timer_response.dart rename to openapi/lib/model/timer_response.dart diff --git a/rest_client/lib/model/timers.dart b/openapi/lib/model/timers.dart similarity index 100% rename from rest_client/lib/model/timers.dart rename to openapi/lib/model/timers.dart diff --git a/rest_client/pubspec.yaml b/openapi/pubspec.yaml similarity index 100% rename from rest_client/pubspec.yaml rename to openapi/pubspec.yaml diff --git a/rest_client/test/project_api_test.dart b/openapi/test/project_api_test.dart similarity index 100% rename from rest_client/test/project_api_test.dart rename to openapi/test/project_api_test.dart diff --git a/rest_client/test/project_input_project_test.dart b/openapi/test/project_input_project_test.dart similarity index 100% rename from rest_client/test/project_input_project_test.dart rename to openapi/test/project_input_project_test.dart diff --git a/rest_client/test/project_input_test.dart b/openapi/test/project_input_test.dart similarity index 100% rename from rest_client/test/project_input_test.dart rename to openapi/test/project_input_test.dart diff --git a/rest_client/test/project_response_test.dart b/openapi/test/project_response_test.dart similarity index 100% rename from rest_client/test/project_response_test.dart rename to openapi/test/project_response_test.dart diff --git a/rest_client/test/project_test.dart b/openapi/test/project_test.dart similarity index 100% rename from rest_client/test/project_test.dart rename to openapi/test/project_test.dart diff --git a/rest_client/test/projects_metadata_test.dart b/openapi/test/projects_metadata_test.dart similarity index 100% rename from rest_client/test/projects_metadata_test.dart rename to openapi/test/projects_metadata_test.dart diff --git a/rest_client/test/projects_test.dart b/openapi/test/projects_test.dart similarity index 100% rename from rest_client/test/projects_test.dart rename to openapi/test/projects_test.dart diff --git a/rest_client/test/timer_api_test.dart b/openapi/test/timer_api_test.dart similarity index 100% rename from rest_client/test/timer_api_test.dart rename to openapi/test/timer_api_test.dart diff --git a/rest_client/test/timer_input_test.dart b/openapi/test/timer_input_test.dart similarity index 100% rename from rest_client/test/timer_input_test.dart rename to openapi/test/timer_input_test.dart diff --git a/rest_client/test/timer_input_timer_test.dart b/openapi/test/timer_input_timer_test.dart similarity index 100% rename from rest_client/test/timer_input_timer_test.dart rename to openapi/test/timer_input_timer_test.dart diff --git a/rest_client/test/timer_response_test.dart b/openapi/test/timer_response_test.dart similarity index 100% rename from rest_client/test/timer_response_test.dart rename to openapi/test/timer_response_test.dart diff --git a/rest_client/test/timer_test.dart b/openapi/test/timer_test.dart similarity index 100% rename from rest_client/test/timer_test.dart rename to openapi/test/timer_test.dart diff --git a/rest_client/test/timers_test.dart b/openapi/test/timers_test.dart similarity index 100% rename from rest_client/test/timers_test.dart rename to openapi/test/timers_test.dart diff --git a/pubspec.yaml b/pubspec.yaml index 9ebdde3..c66648d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -46,8 +46,8 @@ dependencies: permission_handler: ^11.0.0 dynamic_color: ^1.6.8 pdf: ^3.10.6 - rest_client: - path: ./rest_client + openapi: + path: ./openapi dependency_overrides: intl: 0.18.1 From 32a41a0a822416b1af22d89f16f16422f1e61079 Mon Sep 17 00:00:00 2001 From: WoodenMaiden Date: Wed, 22 Jan 2025 23:15:36 +0100 Subject: [PATCH 6/8] feat: ci --- .github/workflows/ci.yml | 14 ++++++++++++++ Makefile | 17 +++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b49555c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,14 @@ +name: CI +on: push + +jobs: + main: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: subosito/flutter-action@v1 + with: + flutter-version: '3.27.3' + - name: Run tests + run: | + make ci diff --git a/Makefile b/Makefile index 2cb4625..ec99eef 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ ROOT := $(shell git rev-parse --show-toplevel) FLUTTER := $(shell which flutter) +DART := $(shell which dart) FLUTTER_BIN_DIR := $(shell dirname $(FLUTTER)) FLUTTER_DIR := $(FLUTTER_BIN_DIR:/bin=) -DART := $(FLUTTER_BIN_DIR)/cache/dart-sdk/bin/dart CLIENT_DIR := openapi .PHONY: run @@ -15,7 +15,12 @@ analyze: .PHONY: format format: - $(FLUTTER) format . + $(DART) format . + +.PHONY: check-format +check-format: + $(DART) format . --set-exit-if-changed + .PHONY: test test: @@ -35,3 +40,11 @@ codegen: --minimal-update rm -v $(CLIENT_DIR)/.travis.yml rm -v $(CLIENT_DIR)/git_push.sh + $(DART) format $(CLIENT_DIR) + +.PHONY: ci +ci: + $(FLUTTER) pub get + $(DART) format . -o none --set-exit-if-changed + $(FLUTTER) analyze + $(FLUTTER) test From ed67cbf04cca4a6a0ee4c4ade0c56bc7bed4738a Mon Sep 17 00:00:00 2001 From: WoodenMaiden Date: Wed, 22 Jan 2025 23:15:56 +0100 Subject: [PATCH 7/8] chore: ran ``make ci`` --- openapi/lib/api.dart | 4 +- openapi/lib/api/project_api.dart | 125 ++++++++----- openapi/lib/api/timer_api.dart | 112 ++++++++---- openapi/lib/api_client.dart | 175 +++++++++++++------ openapi/lib/api_exception.dart | 3 +- openapi/lib/api_helper.dart | 27 ++- openapi/lib/auth/api_key_auth.dart | 5 +- openapi/lib/auth/authentication.dart | 3 +- openapi/lib/auth/http_basic_auth.dart | 8 +- openapi/lib/auth/http_bearer_auth.dart | 8 +- openapi/lib/auth/oauth.dart | 5 +- openapi/lib/model/project.dart | 49 ++++-- openapi/lib/model/project_input.dart | 33 ++-- openapi/lib/model/project_input_project.dart | 45 +++-- openapi/lib/model/project_response.dart | 33 ++-- openapi/lib/model/projects.dart | 40 +++-- openapi/lib/model/projects_metadata.dart | 34 ++-- openapi/lib/model/timer.dart | 57 +++--- openapi/lib/model/timer_input.dart | 32 ++-- openapi/lib/model/timer_input_timer.dart | 53 +++--- openapi/lib/model/timer_response.dart | 33 ++-- openapi/lib/model/timers.dart | 40 +++-- openapi/test/project_api_test.dart | 2 - openapi/test/project_input_project_test.dart | 3 - openapi/test/project_input_test.dart | 3 - openapi/test/project_response_test.dart | 3 - openapi/test/project_test.dart | 3 - openapi/test/projects_metadata_test.dart | 3 - openapi/test/projects_test.dart | 3 - openapi/test/timer_api_test.dart | 2 - openapi/test/timer_input_test.dart | 3 - openapi/test/timer_input_timer_test.dart | 3 - openapi/test/timer_response_test.dart | 3 - openapi/test/timer_test.dart | 3 - openapi/test/timers_test.dart | 3 - pubspec.lock | 109 +++++++----- test_driver/screenshots.dart | 6 +- 37 files changed, 686 insertions(+), 390 deletions(-) diff --git a/openapi/lib/api.dart b/openapi/lib/api.dart index 86323ec..8d1338c 100644 --- a/openapi/lib/api.dart +++ b/openapi/lib/api.dart @@ -43,7 +43,6 @@ part 'model/timer_input_timer.dart'; part 'model/timer_response.dart'; part 'model/timers.dart'; - /// An [ApiClient] instance that uses the default values obtained from /// the OpenAPI specification file. var defaultApiClient = ApiClient(); @@ -56,4 +55,5 @@ final _regList = RegExp(r'^List<(.*)>$'); final _regSet = RegExp(r'^Set<(.*)>$'); final _regMap = RegExp(r'^Map$'); -bool _isEpochMarker(String? pattern) => pattern == _dateEpochMarker || pattern == '/$_dateEpochMarker/'; +bool _isEpochMarker(String? pattern) => + pattern == _dateEpochMarker || pattern == '/$_dateEpochMarker/'; diff --git a/openapi/lib/api/project_api.dart b/openapi/lib/api/project_api.dart index a047ee3..17e7c4b 100644 --- a/openapi/lib/api/project_api.dart +++ b/openapi/lib/api/project_api.dart @@ -10,9 +10,9 @@ part of openapi.api; - class ProjectApi { - ProjectApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; + ProjectApi([ApiClient? apiClient]) + : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; @@ -24,7 +24,9 @@ class ProjectApi { /// /// * [ProjectInput] body (required): /// Project to create - Future timecopsyncProjectsApiWebProjectControllerCreateWithHttpInfo(ProjectInput body,) async { + Future timecopsyncProjectsApiWebProjectControllerCreateWithHttpInfo( + ProjectInput body, + ) async { // ignore: prefer_const_declarations final path = r'/projects'; @@ -37,7 +39,6 @@ class ProjectApi { const contentTypes = []; - return apiClient.invokeAPI( path, 'POST', @@ -55,17 +56,25 @@ class ProjectApi { /// /// * [ProjectInput] body (required): /// Project to create - Future timecopsyncProjectsApiWebProjectControllerCreate(ProjectInput body,) async { - final response = await timecopsyncProjectsApiWebProjectControllerCreateWithHttpInfo(body,); + Future timecopsyncProjectsApiWebProjectControllerCreate( + ProjectInput body, + ) async { + final response = + await timecopsyncProjectsApiWebProjectControllerCreateWithHttpInfo( + body, + ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { - return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ProjectResponse',) as ProjectResponse; - + if (response.body.isNotEmpty && + response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync( + await _decodeBodyBytes(response), + 'ProjectResponse', + ) as ProjectResponse; } return null; } @@ -78,10 +87,11 @@ class ProjectApi { /// /// * [String] id (required): /// Project ID - Future timecopsyncProjectsApiWebProjectControllerDeleteWithHttpInfo(String id,) async { + Future timecopsyncProjectsApiWebProjectControllerDeleteWithHttpInfo( + String id, + ) async { // ignore: prefer_const_declarations - final path = r'/projects/{id}' - .replaceAll('{id}', id); + final path = r'/projects/{id}'.replaceAll('{id}', id); // ignore: prefer_final_locals Object? postBody; @@ -92,7 +102,6 @@ class ProjectApi { const contentTypes = []; - return apiClient.invokeAPI( path, 'DELETE', @@ -110,8 +119,13 @@ class ProjectApi { /// /// * [String] id (required): /// Project ID - Future timecopsyncProjectsApiWebProjectControllerDelete(String id,) async { - final response = await timecopsyncProjectsApiWebProjectControllerDeleteWithHttpInfo(id,); + Future timecopsyncProjectsApiWebProjectControllerDelete( + String id, + ) async { + final response = + await timecopsyncProjectsApiWebProjectControllerDeleteWithHttpInfo( + id, + ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } @@ -128,7 +142,10 @@ class ProjectApi { /// /// * [int] showArchived: /// if 1 shows archived projects, defaults to 0 - Future timecopsyncProjectsApiWebProjectControllerIndexWithHttpInfo({ int? limit, int? showArchived, }) async { + Future timecopsyncProjectsApiWebProjectControllerIndexWithHttpInfo({ + int? limit, + int? showArchived, + }) async { // ignore: prefer_const_declarations final path = r'/projects'; @@ -148,7 +165,6 @@ class ProjectApi { const contentTypes = []; - return apiClient.invokeAPI( path, 'GET', @@ -169,17 +185,27 @@ class ProjectApi { /// /// * [int] showArchived: /// if 1 shows archived projects, defaults to 0 - Future timecopsyncProjectsApiWebProjectControllerIndex({ int? limit, int? showArchived, }) async { - final response = await timecopsyncProjectsApiWebProjectControllerIndexWithHttpInfo( limit: limit, showArchived: showArchived, ); + Future timecopsyncProjectsApiWebProjectControllerIndex({ + int? limit, + int? showArchived, + }) async { + final response = + await timecopsyncProjectsApiWebProjectControllerIndexWithHttpInfo( + limit: limit, + showArchived: showArchived, + ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { - return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Projects',) as Projects; - + if (response.body.isNotEmpty && + response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync( + await _decodeBodyBytes(response), + 'Projects', + ) as Projects; } return null; } @@ -192,10 +218,11 @@ class ProjectApi { /// /// * [String] id (required): /// Project ID - Future timecopsyncProjectsApiWebProjectControllerShowWithHttpInfo(String id,) async { + Future timecopsyncProjectsApiWebProjectControllerShowWithHttpInfo( + String id, + ) async { // ignore: prefer_const_declarations - final path = r'/projects/{id}' - .replaceAll('{id}', id); + final path = r'/projects/{id}'.replaceAll('{id}', id); // ignore: prefer_final_locals Object? postBody; @@ -206,7 +233,6 @@ class ProjectApi { const contentTypes = []; - return apiClient.invokeAPI( path, 'GET', @@ -224,17 +250,25 @@ class ProjectApi { /// /// * [String] id (required): /// Project ID - Future timecopsyncProjectsApiWebProjectControllerShow(String id,) async { - final response = await timecopsyncProjectsApiWebProjectControllerShowWithHttpInfo(id,); + Future timecopsyncProjectsApiWebProjectControllerShow( + String id, + ) async { + final response = + await timecopsyncProjectsApiWebProjectControllerShowWithHttpInfo( + id, + ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { - return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ProjectResponse',) as ProjectResponse; - + if (response.body.isNotEmpty && + response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync( + await _decodeBodyBytes(response), + 'ProjectResponse', + ) as ProjectResponse; } return null; } @@ -250,10 +284,12 @@ class ProjectApi { /// /// * [ProjectInput] body (required): /// Project to update - Future timecopsyncProjectsApiWebProjectControllerUpdateWithHttpInfo(String id, ProjectInput body,) async { + Future timecopsyncProjectsApiWebProjectControllerUpdateWithHttpInfo( + String id, + ProjectInput body, + ) async { // ignore: prefer_const_declarations - final path = r'/projects/{id}' - .replaceAll('{id}', id); + final path = r'/projects/{id}'.replaceAll('{id}', id); // ignore: prefer_final_locals Object? postBody = body; @@ -264,7 +300,6 @@ class ProjectApi { const contentTypes = []; - return apiClient.invokeAPI( path, 'PATCH', @@ -285,17 +320,27 @@ class ProjectApi { /// /// * [ProjectInput] body (required): /// Project to update - Future timecopsyncProjectsApiWebProjectControllerUpdate(String id, ProjectInput body,) async { - final response = await timecopsyncProjectsApiWebProjectControllerUpdateWithHttpInfo(id, body,); + Future timecopsyncProjectsApiWebProjectControllerUpdate( + String id, + ProjectInput body, + ) async { + final response = + await timecopsyncProjectsApiWebProjectControllerUpdateWithHttpInfo( + id, + body, + ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { - return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ProjectResponse',) as ProjectResponse; - + if (response.body.isNotEmpty && + response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync( + await _decodeBodyBytes(response), + 'ProjectResponse', + ) as ProjectResponse; } return null; } diff --git a/openapi/lib/api/timer_api.dart b/openapi/lib/api/timer_api.dart index 7cf6d30..6bae414 100644 --- a/openapi/lib/api/timer_api.dart +++ b/openapi/lib/api/timer_api.dart @@ -10,7 +10,6 @@ part of openapi.api; - class TimerApi { TimerApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; @@ -24,7 +23,9 @@ class TimerApi { /// /// * [TimerInput] body (required): /// Timer to create - Future timecopsyncProjectsApiWebTimerControllerCreateWithHttpInfo(TimerInput body,) async { + Future timecopsyncProjectsApiWebTimerControllerCreateWithHttpInfo( + TimerInput body, + ) async { // ignore: prefer_const_declarations final path = r'/timers'; @@ -37,7 +38,6 @@ class TimerApi { const contentTypes = []; - return apiClient.invokeAPI( path, 'POST', @@ -55,17 +55,25 @@ class TimerApi { /// /// * [TimerInput] body (required): /// Timer to create - Future timecopsyncProjectsApiWebTimerControllerCreate(TimerInput body,) async { - final response = await timecopsyncProjectsApiWebTimerControllerCreateWithHttpInfo(body,); + Future timecopsyncProjectsApiWebTimerControllerCreate( + TimerInput body, + ) async { + final response = + await timecopsyncProjectsApiWebTimerControllerCreateWithHttpInfo( + body, + ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { - return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'TimerResponse',) as TimerResponse; - + if (response.body.isNotEmpty && + response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync( + await _decodeBodyBytes(response), + 'TimerResponse', + ) as TimerResponse; } return null; } @@ -78,10 +86,11 @@ class TimerApi { /// /// * [String] id (required): /// Timer ID - Future timecopsyncProjectsApiWebTimerControllerDeleteWithHttpInfo(String id,) async { + Future timecopsyncProjectsApiWebTimerControllerDeleteWithHttpInfo( + String id, + ) async { // ignore: prefer_const_declarations - final path = r'/timers/{id}' - .replaceAll('{id}', id); + final path = r'/timers/{id}'.replaceAll('{id}', id); // ignore: prefer_final_locals Object? postBody; @@ -92,7 +101,6 @@ class TimerApi { const contentTypes = []; - return apiClient.invokeAPI( path, 'DELETE', @@ -110,8 +118,13 @@ class TimerApi { /// /// * [String] id (required): /// Timer ID - Future timecopsyncProjectsApiWebTimerControllerDelete(String id,) async { - final response = await timecopsyncProjectsApiWebTimerControllerDeleteWithHttpInfo(id,); + Future timecopsyncProjectsApiWebTimerControllerDelete( + String id, + ) async { + final response = + await timecopsyncProjectsApiWebTimerControllerDeleteWithHttpInfo( + id, + ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } @@ -120,7 +133,8 @@ class TimerApi { /// List timers /// /// Note: This method returns the HTTP [Response]. - Future timecopsyncProjectsApiWebTimerControllerIndexWithHttpInfo() async { + Future + timecopsyncProjectsApiWebTimerControllerIndexWithHttpInfo() async { // ignore: prefer_const_declarations final path = r'/timers'; @@ -133,7 +147,6 @@ class TimerApi { const contentTypes = []; - return apiClient.invokeAPI( path, 'GET', @@ -147,16 +160,20 @@ class TimerApi { /// List timers Future timecopsyncProjectsApiWebTimerControllerIndex() async { - final response = await timecopsyncProjectsApiWebTimerControllerIndexWithHttpInfo(); + final response = + await timecopsyncProjectsApiWebTimerControllerIndexWithHttpInfo(); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { - return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Timers',) as Timers; - + if (response.body.isNotEmpty && + response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync( + await _decodeBodyBytes(response), + 'Timers', + ) as Timers; } return null; } @@ -169,10 +186,11 @@ class TimerApi { /// /// * [String] id (required): /// Timer ID - Future timecopsyncProjectsApiWebTimerControllerShowWithHttpInfo(String id,) async { + Future timecopsyncProjectsApiWebTimerControllerShowWithHttpInfo( + String id, + ) async { // ignore: prefer_const_declarations - final path = r'/timers/{id}' - .replaceAll('{id}', id); + final path = r'/timers/{id}'.replaceAll('{id}', id); // ignore: prefer_final_locals Object? postBody; @@ -183,7 +201,6 @@ class TimerApi { const contentTypes = []; - return apiClient.invokeAPI( path, 'GET', @@ -201,17 +218,25 @@ class TimerApi { /// /// * [String] id (required): /// Timer ID - Future timecopsyncProjectsApiWebTimerControllerShow(String id,) async { - final response = await timecopsyncProjectsApiWebTimerControllerShowWithHttpInfo(id,); + Future timecopsyncProjectsApiWebTimerControllerShow( + String id, + ) async { + final response = + await timecopsyncProjectsApiWebTimerControllerShowWithHttpInfo( + id, + ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { - return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'TimerResponse',) as TimerResponse; - + if (response.body.isNotEmpty && + response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync( + await _decodeBodyBytes(response), + 'TimerResponse', + ) as TimerResponse; } return null; } @@ -227,10 +252,12 @@ class TimerApi { /// /// * [TimerInput] body (required): /// Timer to update - Future timecopsyncProjectsApiWebTimerControllerUpdateWithHttpInfo(String id, TimerInput body,) async { + Future timecopsyncProjectsApiWebTimerControllerUpdateWithHttpInfo( + String id, + TimerInput body, + ) async { // ignore: prefer_const_declarations - final path = r'/timers/{id}' - .replaceAll('{id}', id); + final path = r'/timers/{id}'.replaceAll('{id}', id); // ignore: prefer_final_locals Object? postBody = body; @@ -241,7 +268,6 @@ class TimerApi { const contentTypes = []; - return apiClient.invokeAPI( path, 'PATCH', @@ -262,17 +288,27 @@ class TimerApi { /// /// * [TimerInput] body (required): /// Timer to update - Future timecopsyncProjectsApiWebTimerControllerUpdate(String id, TimerInput body,) async { - final response = await timecopsyncProjectsApiWebTimerControllerUpdateWithHttpInfo(id, body,); + Future timecopsyncProjectsApiWebTimerControllerUpdate( + String id, + TimerInput body, + ) async { + final response = + await timecopsyncProjectsApiWebTimerControllerUpdateWithHttpInfo( + id, + body, + ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } // When a remote server returns no body with a status of 204, we shall not decode it. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. - if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { - return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'TimerResponse',) as TimerResponse; - + if (response.body.isNotEmpty && + response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync( + await _decodeBodyBytes(response), + 'TimerResponse', + ) as TimerResponse; } return null; } diff --git a/openapi/lib/api_client.dart b/openapi/lib/api_client.dart index c9b61c9..0d1c74b 100644 --- a/openapi/lib/api_client.dart +++ b/openapi/lib/api_client.dart @@ -11,7 +11,10 @@ part of openapi.api; class ApiClient { - ApiClient({this.basePath = '/api/v1', this.authentication,}); + ApiClient({ + this.basePath = '/api/v1', + this.authentication, + }); final String basePath; final Authentication? authentication; @@ -32,7 +35,7 @@ class ApiClient { Map get defaultHeaderMap => _defaultHeaderMap; void addDefaultHeader(String key, String value) { - _defaultHeaderMap[key] = value; + _defaultHeaderMap[key] = value; } // We don't use a Map for queryParams. @@ -54,25 +57,26 @@ class ApiClient { } final urlEncodedQueryParams = queryParams.map((param) => '$param'); - final queryString = urlEncodedQueryParams.isNotEmpty ? '?${urlEncodedQueryParams.join('&')}' : ''; + final queryString = urlEncodedQueryParams.isNotEmpty + ? '?${urlEncodedQueryParams.join('&')}' + : ''; final uri = Uri.parse('$basePath$path$queryString'); try { // Special case for uploading a single file which isn't a 'multipart/form-data'. - if ( - body is MultipartFile && (contentType == null || - !contentType.toLowerCase().startsWith('multipart/form-data')) - ) { + if (body is MultipartFile && + (contentType == null || + !contentType.toLowerCase().startsWith('multipart/form-data'))) { final request = StreamedRequest(method, uri); request.headers.addAll(headerParams); request.contentLength = body.length; body.finalize().listen( - request.sink.add, - onDone: request.sink.close, - // ignore: avoid_types_on_closure_parameters - onError: (Object error, StackTrace trace) => request.sink.close(), - cancelOnError: true, - ); + request.sink.add, + onDone: request.sink.close, + // ignore: avoid_types_on_closure_parameters + onError: (Object error, StackTrace trace) => request.sink.close(), + cancelOnError: true, + ); final response = await _client.send(request); return Response.fromStream(response); } @@ -88,17 +92,45 @@ class ApiClient { } final msgBody = contentType == 'application/x-www-form-urlencoded' - ? formParams - : await serializeAsync(body); + ? formParams + : await serializeAsync(body); final nullableHeaderParams = headerParams.isEmpty ? null : headerParams; - switch(method) { - case 'POST': return await _client.post(uri, headers: nullableHeaderParams, body: msgBody,); - case 'PUT': return await _client.put(uri, headers: nullableHeaderParams, body: msgBody,); - case 'DELETE': return await _client.delete(uri, headers: nullableHeaderParams, body: msgBody,); - case 'PATCH': return await _client.patch(uri, headers: nullableHeaderParams, body: msgBody,); - case 'HEAD': return await _client.head(uri, headers: nullableHeaderParams,); - case 'GET': return await _client.get(uri, headers: nullableHeaderParams,); + switch (method) { + case 'POST': + return await _client.post( + uri, + headers: nullableHeaderParams, + body: msgBody, + ); + case 'PUT': + return await _client.put( + uri, + headers: nullableHeaderParams, + body: msgBody, + ); + case 'DELETE': + return await _client.delete( + uri, + headers: nullableHeaderParams, + body: msgBody, + ); + case 'PATCH': + return await _client.patch( + uri, + headers: nullableHeaderParams, + body: msgBody, + ); + case 'HEAD': + return await _client.head( + uri, + headers: nullableHeaderParams, + ); + case 'GET': + return await _client.get( + uri, + headers: nullableHeaderParams, + ); } } on SocketException catch (error, trace) { throw ApiException.withInner( @@ -143,29 +175,44 @@ class ApiClient { ); } - Future deserializeAsync(String value, String targetType, {bool growable = false,}) async => - // ignore: deprecated_member_use_from_same_package - deserialize(value, targetType, growable: growable); - - @Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use deserializeAsync() instead.') - dynamic deserialize(String value, String targetType, {bool growable = false,}) { + Future deserializeAsync( + String value, + String targetType, { + bool growable = false, + }) async => + // ignore: deprecated_member_use_from_same_package + deserialize(value, targetType, growable: growable); + + @Deprecated( + 'Scheduled for removal in OpenAPI Generator 6.x. Use deserializeAsync() instead.') + dynamic deserialize( + String value, + String targetType, { + bool growable = false, + }) { // Remove all spaces. Necessary for regular expressions as well. - targetType = targetType.replaceAll(' ', ''); // ignore: parameter_assignments + targetType = + targetType.replaceAll(' ', ''); // ignore: parameter_assignments // If the expected target type is String, nothing to do... return targetType == 'String' - ? value - : fromJson(json.decode(value), targetType, growable: growable); + ? value + : fromJson(json.decode(value), targetType, growable: growable); } // ignore: deprecated_member_use_from_same_package Future serializeAsync(Object? value) async => serialize(value); - @Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use serializeAsync() instead.') + @Deprecated( + 'Scheduled for removal in OpenAPI Generator 6.x. Use serializeAsync() instead.') String serialize(Object? value) => value == null ? '' : json.encode(value); /// Returns a native instance of an OpenAPI class matching the [specified type][targetType]. - static dynamic fromJson(dynamic value, String targetType, {bool growable = false,}) { + static dynamic fromJson( + dynamic value, + String targetType, { + bool growable = false, + }) { try { switch (targetType) { case 'String': @@ -206,27 +253,50 @@ class ApiClient { return Timers.fromJson(value); default: dynamic match; - if (value is List && (match = _regList.firstMatch(targetType)?.group(1)) != null) { + if (value is List && + (match = _regList.firstMatch(targetType)?.group(1)) != null) { return value - .map((dynamic v) => fromJson(v, match, growable: growable,)) - .toList(growable: growable); + .map((dynamic v) => fromJson( + v, + match, + growable: growable, + )) + .toList(growable: growable); } - if (value is Set && (match = _regSet.firstMatch(targetType)?.group(1)) != null) { + if (value is Set && + (match = _regSet.firstMatch(targetType)?.group(1)) != null) { return value - .map((dynamic v) => fromJson(v, match, growable: growable,)) - .toSet(); + .map((dynamic v) => fromJson( + v, + match, + growable: growable, + )) + .toSet(); } - if (value is Map && (match = _regMap.firstMatch(targetType)?.group(1)) != null) { + if (value is Map && + (match = _regMap.firstMatch(targetType)?.group(1)) != null) { return Map.fromIterables( value.keys.cast(), - value.values.map((dynamic v) => fromJson(v, match, growable: growable,)), + value.values.map((dynamic v) => fromJson( + v, + match, + growable: growable, + )), ); } } } on Exception catch (error, trace) { - throw ApiException.withInner(HttpStatus.internalServerError, 'Exception during deserialization.', error, trace,); + throw ApiException.withInner( + HttpStatus.internalServerError, + 'Exception during deserialization.', + error, + trace, + ); } - throw ApiException(HttpStatus.internalServerError, 'Could not find a suitable class for deserialization',); + throw ApiException( + HttpStatus.internalServerError, + 'Could not find a suitable class for deserialization', + ); } } @@ -254,9 +324,7 @@ Future decodeAsync(DeserializationMessage message) async { final targetType = message.targetType.replaceAll(' ', ''); // If the expected target type is String, nothing to do... - return targetType == 'String' - ? message.json - : json.decode(message.json); + return targetType == 'String' ? message.json : json.decode(message.json); } /// Primarily intended for use in an isolate. @@ -266,13 +334,14 @@ Future deserializeAsync(DeserializationMessage message) async { // If the expected target type is String, nothing to do... return targetType == 'String' - ? message.json - : ApiClient.fromJson( - json.decode(message.json), - targetType, - growable: message.growable, - ); + ? message.json + : ApiClient.fromJson( + json.decode(message.json), + targetType, + growable: message.growable, + ); } /// Primarily intended for use in an isolate. -Future serializeAsync(Object? value) async => value == null ? '' : json.encode(value); +Future serializeAsync(Object? value) async => + value == null ? '' : json.encode(value); diff --git a/openapi/lib/api_exception.dart b/openapi/lib/api_exception.dart index 53077d6..d20b872 100644 --- a/openapi/lib/api_exception.dart +++ b/openapi/lib/api_exception.dart @@ -13,7 +13,8 @@ part of openapi.api; class ApiException implements Exception { ApiException(this.code, this.message); - ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace); + ApiException.withInner( + this.code, this.message, this.innerException, this.stackTrace); int code = 0; String? message; diff --git a/openapi/lib/api_helper.dart b/openapi/lib/api_helper.dart index 255f38d..355d53d 100644 --- a/openapi/lib/api_helper.dart +++ b/openapi/lib/api_helper.dart @@ -17,11 +17,16 @@ class QueryParam { final String value; @override - String toString() => '${Uri.encodeQueryComponent(name)}=${Uri.encodeQueryComponent(value)}'; + String toString() => + '${Uri.encodeQueryComponent(name)}=${Uri.encodeQueryComponent(value)}'; } // Ported from the Java version. -Iterable _queryParams(String collectionFormat, String name, dynamic value,) { +Iterable _queryParams( + String collectionFormat, + String name, + dynamic value, +) { // Assertions to run in debug mode only. assert(name.isNotEmpty, 'Parameter cannot be an empty string.'); @@ -29,7 +34,9 @@ Iterable _queryParams(String collectionFormat, String name, dynamic if (value is List) { if (collectionFormat == 'multi') { - return value.map((dynamic v) => QueryParam(name, parameterToString(v)),); + return value.map( + (dynamic v) => QueryParam(name, parameterToString(v)), + ); } // Default collection format is 'csv'. @@ -39,7 +46,10 @@ Iterable _queryParams(String collectionFormat, String name, dynamic final delimiter = _delimiters[collectionFormat] ?? ','; - params.add(QueryParam(name, value.map(parameterToString).join(delimiter),)); + params.add(QueryParam( + name, + value.map(parameterToString).join(delimiter), + )); } else if (value != null) { params.add(QueryParam(name, parameterToString(value))); } @@ -62,9 +72,12 @@ String parameterToString(dynamic value) { /// content type. Otherwise, returns the decoded body as decoded by dart:http package. Future _decodeBodyBytes(Response response) async { final contentType = response.headers['content-type']; - return contentType != null && contentType.toLowerCase().startsWith('application/json') - ? response.bodyBytes.isEmpty ? '' : utf8.decode(response.bodyBytes) - : response.body; + return contentType != null && + contentType.toLowerCase().startsWith('application/json') + ? response.bodyBytes.isEmpty + ? '' + : utf8.decode(response.bodyBytes) + : response.body; } /// Returns a valid [T] value found at the specified Map [key], null otherwise. diff --git a/openapi/lib/auth/api_key_auth.dart b/openapi/lib/auth/api_key_auth.dart index 6c56217..00105ec 100644 --- a/openapi/lib/auth/api_key_auth.dart +++ b/openapi/lib/auth/api_key_auth.dart @@ -20,7 +20,10 @@ class ApiKeyAuth implements Authentication { String apiKey = ''; @override - Future applyToParams(List queryParams, Map headerParams,) async { + Future applyToParams( + List queryParams, + Map headerParams, + ) async { final paramValue = apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey'; if (paramValue.isNotEmpty) { diff --git a/openapi/lib/auth/authentication.dart b/openapi/lib/auth/authentication.dart index 5377fb6..3d8cb17 100644 --- a/openapi/lib/auth/authentication.dart +++ b/openapi/lib/auth/authentication.dart @@ -13,5 +13,6 @@ part of openapi.api; // ignore: one_member_abstracts abstract class Authentication { /// Apply authentication settings to header and query params. - Future applyToParams(List queryParams, Map headerParams); + Future applyToParams( + List queryParams, Map headerParams); } diff --git a/openapi/lib/auth/http_basic_auth.dart b/openapi/lib/auth/http_basic_auth.dart index 5e8b1c4..cf02eb3 100644 --- a/openapi/lib/auth/http_basic_auth.dart +++ b/openapi/lib/auth/http_basic_auth.dart @@ -17,10 +17,14 @@ class HttpBasicAuth implements Authentication { String password; @override - Future applyToParams(List queryParams, Map headerParams,) async { + Future applyToParams( + List queryParams, + Map headerParams, + ) async { if (username.isNotEmpty && password.isNotEmpty) { final credentials = '$username:$password'; - headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; + headerParams['Authorization'] = + 'Basic ${base64.encode(utf8.encode(credentials))}'; } } } diff --git a/openapi/lib/auth/http_bearer_auth.dart b/openapi/lib/auth/http_bearer_auth.dart index 847dc05..61b6a23 100644 --- a/openapi/lib/auth/http_bearer_auth.dart +++ b/openapi/lib/auth/http_bearer_auth.dart @@ -21,13 +21,17 @@ class HttpBearerAuth implements Authentication { set accessToken(dynamic accessToken) { if (accessToken is! String && accessToken is! HttpBearerAuthProvider) { - throw ArgumentError('accessToken value must be either a String or a String Function().'); + throw ArgumentError( + 'accessToken value must be either a String or a String Function().'); } _accessToken = accessToken; } @override - Future applyToParams(List queryParams, Map headerParams,) async { + Future applyToParams( + List queryParams, + Map headerParams, + ) async { if (_accessToken == null) { return; } diff --git a/openapi/lib/auth/oauth.dart b/openapi/lib/auth/oauth.dart index 73fd820..c7de2bf 100644 --- a/openapi/lib/auth/oauth.dart +++ b/openapi/lib/auth/oauth.dart @@ -16,7 +16,10 @@ class OAuth implements Authentication { String accessToken; @override - Future applyToParams(List queryParams, Map headerParams,) async { + Future applyToParams( + List queryParams, + Map headerParams, + ) async { if (accessToken.isNotEmpty) { headerParams['Authorization'] = 'Bearer $accessToken'; } diff --git a/openapi/lib/model/project.dart b/openapi/lib/model/project.dart index 7c4f6ba..9570252 100644 --- a/openapi/lib/model/project.dart +++ b/openapi/lib/model/project.dart @@ -50,22 +50,25 @@ class Project { String name; @override - bool operator ==(Object other) => identical(this, other) || other is Project && - other.archived == archived && - other.colour == colour && - other.id == id && - other.name == name; + bool operator ==(Object other) => + identical(this, other) || + other is Project && + other.archived == archived && + other.colour == colour && + other.id == id && + other.name == name; @override int get hashCode => - // ignore: unnecessary_parenthesis - (archived == null ? 0 : archived!.hashCode) + - (colour == null ? 0 : colour!.hashCode) + - (id == null ? 0 : id!.hashCode) + - (name.hashCode); + // ignore: unnecessary_parenthesis + (archived == null ? 0 : archived!.hashCode) + + (colour == null ? 0 : colour!.hashCode) + + (id == null ? 0 : id!.hashCode) + + (name.hashCode); @override - String toString() => 'Project[archived=$archived, colour=$colour, id=$id, name=$name]'; + String toString() => + 'Project[archived=$archived, colour=$colour, id=$id, name=$name]'; Map toJson() { final json = {}; @@ -84,7 +87,7 @@ class Project { } else { json[r'id'] = null; } - json[r'name'] = this.name; + json[r'name'] = this.name; return json; } @@ -100,8 +103,10 @@ class Project { // Note 2: this code is stripped in release mode! assert(() { requiredKeys.forEach((key) { - assert(json.containsKey(key), 'Required key "Project[$key]" is missing from JSON.'); - assert(json[key] != null, 'Required key "Project[$key]" has a null value in JSON.'); + assert(json.containsKey(key), + 'Required key "Project[$key]" is missing from JSON.'); + assert(json[key] != null, + 'Required key "Project[$key]" has a null value in JSON.'); }); return true; }()); @@ -116,7 +121,10 @@ class Project { return null; } - static List listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson( + dynamic json, { + bool growable = false, + }) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -144,13 +152,19 @@ class Project { } // maps a json object with a list of Project-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + static Map> mapListFromJson( + dynamic json, { + bool growable = false, + }) { final map = >{}; if (json is Map && json.isNotEmpty) { // ignore: parameter_assignments json = json.cast(); for (final entry in json.entries) { - map[entry.key] = Project.listFromJson(entry.value, growable: growable,); + map[entry.key] = Project.listFromJson( + entry.value, + growable: growable, + ); } } return map; @@ -161,4 +175,3 @@ class Project { 'name', }; } - diff --git a/openapi/lib/model/project_input.dart b/openapi/lib/model/project_input.dart index d5eef05..f898bad 100644 --- a/openapi/lib/model/project_input.dart +++ b/openapi/lib/model/project_input.dart @@ -19,20 +19,21 @@ class ProjectInput { ProjectInputProject project; @override - bool operator ==(Object other) => identical(this, other) || other is ProjectInput && - other.project == project; + bool operator ==(Object other) => + identical(this, other) || + other is ProjectInput && other.project == project; @override int get hashCode => - // ignore: unnecessary_parenthesis - (project.hashCode); + // ignore: unnecessary_parenthesis + (project.hashCode); @override String toString() => 'ProjectInput[project=$project]'; Map toJson() { final json = {}; - json[r'project'] = this.project; + json[r'project'] = this.project; return json; } @@ -48,8 +49,10 @@ class ProjectInput { // Note 2: this code is stripped in release mode! assert(() { requiredKeys.forEach((key) { - assert(json.containsKey(key), 'Required key "ProjectInput[$key]" is missing from JSON.'); - assert(json[key] != null, 'Required key "ProjectInput[$key]" has a null value in JSON.'); + assert(json.containsKey(key), + 'Required key "ProjectInput[$key]" is missing from JSON.'); + assert(json[key] != null, + 'Required key "ProjectInput[$key]" has a null value in JSON.'); }); return true; }()); @@ -61,7 +64,10 @@ class ProjectInput { return null; } - static List listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson( + dynamic json, { + bool growable = false, + }) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -89,13 +95,19 @@ class ProjectInput { } // maps a json object with a list of ProjectInput-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + static Map> mapListFromJson( + dynamic json, { + bool growable = false, + }) { final map = >{}; if (json is Map && json.isNotEmpty) { // ignore: parameter_assignments json = json.cast(); for (final entry in json.entries) { - map[entry.key] = ProjectInput.listFromJson(entry.value, growable: growable,); + map[entry.key] = ProjectInput.listFromJson( + entry.value, + growable: growable, + ); } } return map; @@ -106,4 +118,3 @@ class ProjectInput { 'project', }; } - diff --git a/openapi/lib/model/project_input_project.dart b/openapi/lib/model/project_input_project.dart index 8331dd4..23835ec 100644 --- a/openapi/lib/model/project_input_project.dart +++ b/openapi/lib/model/project_input_project.dart @@ -40,20 +40,23 @@ class ProjectInputProject { String name; @override - bool operator ==(Object other) => identical(this, other) || other is ProjectInputProject && - other.archived == archived && - other.colour == colour && - other.name == name; + bool operator ==(Object other) => + identical(this, other) || + other is ProjectInputProject && + other.archived == archived && + other.colour == colour && + other.name == name; @override int get hashCode => - // ignore: unnecessary_parenthesis - (archived == null ? 0 : archived!.hashCode) + - (colour == null ? 0 : colour!.hashCode) + - (name.hashCode); + // ignore: unnecessary_parenthesis + (archived == null ? 0 : archived!.hashCode) + + (colour == null ? 0 : colour!.hashCode) + + (name.hashCode); @override - String toString() => 'ProjectInputProject[archived=$archived, colour=$colour, name=$name]'; + String toString() => + 'ProjectInputProject[archived=$archived, colour=$colour, name=$name]'; Map toJson() { final json = {}; @@ -67,7 +70,7 @@ class ProjectInputProject { } else { json[r'colour'] = null; } - json[r'name'] = this.name; + json[r'name'] = this.name; return json; } @@ -83,8 +86,10 @@ class ProjectInputProject { // Note 2: this code is stripped in release mode! assert(() { requiredKeys.forEach((key) { - assert(json.containsKey(key), 'Required key "ProjectInputProject[$key]" is missing from JSON.'); - assert(json[key] != null, 'Required key "ProjectInputProject[$key]" has a null value in JSON.'); + assert(json.containsKey(key), + 'Required key "ProjectInputProject[$key]" is missing from JSON.'); + assert(json[key] != null, + 'Required key "ProjectInputProject[$key]" has a null value in JSON.'); }); return true; }()); @@ -98,7 +103,10 @@ class ProjectInputProject { return null; } - static List listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson( + dynamic json, { + bool growable = false, + }) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -126,13 +134,19 @@ class ProjectInputProject { } // maps a json object with a list of ProjectInputProject-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + static Map> mapListFromJson( + dynamic json, { + bool growable = false, + }) { final map = >{}; if (json is Map && json.isNotEmpty) { // ignore: parameter_assignments json = json.cast(); for (final entry in json.entries) { - map[entry.key] = ProjectInputProject.listFromJson(entry.value, growable: growable,); + map[entry.key] = ProjectInputProject.listFromJson( + entry.value, + growable: growable, + ); } } return map; @@ -143,4 +157,3 @@ class ProjectInputProject { 'name', }; } - diff --git a/openapi/lib/model/project_response.dart b/openapi/lib/model/project_response.dart index 962649f..7f3c170 100644 --- a/openapi/lib/model/project_response.dart +++ b/openapi/lib/model/project_response.dart @@ -25,13 +25,13 @@ class ProjectResponse { Project? data; @override - bool operator ==(Object other) => identical(this, other) || other is ProjectResponse && - other.data == data; + bool operator ==(Object other) => + identical(this, other) || other is ProjectResponse && other.data == data; @override int get hashCode => - // ignore: unnecessary_parenthesis - (data == null ? 0 : data!.hashCode); + // ignore: unnecessary_parenthesis + (data == null ? 0 : data!.hashCode); @override String toString() => 'ProjectResponse[data=$data]'; @@ -58,8 +58,10 @@ class ProjectResponse { // Note 2: this code is stripped in release mode! assert(() { requiredKeys.forEach((key) { - assert(json.containsKey(key), 'Required key "ProjectResponse[$key]" is missing from JSON.'); - assert(json[key] != null, 'Required key "ProjectResponse[$key]" has a null value in JSON.'); + assert(json.containsKey(key), + 'Required key "ProjectResponse[$key]" is missing from JSON.'); + assert(json[key] != null, + 'Required key "ProjectResponse[$key]" has a null value in JSON.'); }); return true; }()); @@ -71,7 +73,10 @@ class ProjectResponse { return null; } - static List listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson( + dynamic json, { + bool growable = false, + }) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -99,20 +104,24 @@ class ProjectResponse { } // maps a json object with a list of ProjectResponse-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + static Map> mapListFromJson( + dynamic json, { + bool growable = false, + }) { final map = >{}; if (json is Map && json.isNotEmpty) { // ignore: parameter_assignments json = json.cast(); for (final entry in json.entries) { - map[entry.key] = ProjectResponse.listFromJson(entry.value, growable: growable,); + map[entry.key] = ProjectResponse.listFromJson( + entry.value, + growable: growable, + ); } } return map; } /// The list of required keys that must be present in a JSON. - static const requiredKeys = { - }; + static const requiredKeys = {}; } - diff --git a/openapi/lib/model/projects.dart b/openapi/lib/model/projects.dart index eed9544..0e4c015 100644 --- a/openapi/lib/model/projects.dart +++ b/openapi/lib/model/projects.dart @@ -28,22 +28,23 @@ class Projects { ProjectsMetadata? metadata; @override - bool operator ==(Object other) => identical(this, other) || other is Projects && - _deepEquality.equals(other.data, data) && - other.metadata == metadata; + bool operator ==(Object other) => + identical(this, other) || + other is Projects && + _deepEquality.equals(other.data, data) && + other.metadata == metadata; @override int get hashCode => - // ignore: unnecessary_parenthesis - (data.hashCode) + - (metadata == null ? 0 : metadata!.hashCode); + // ignore: unnecessary_parenthesis + (data.hashCode) + (metadata == null ? 0 : metadata!.hashCode); @override String toString() => 'Projects[data=$data, metadata=$metadata]'; Map toJson() { final json = {}; - json[r'data'] = this.data; + json[r'data'] = this.data; if (this.metadata != null) { json[r'metadata'] = this.metadata; } else { @@ -64,8 +65,10 @@ class Projects { // Note 2: this code is stripped in release mode! assert(() { requiredKeys.forEach((key) { - assert(json.containsKey(key), 'Required key "Projects[$key]" is missing from JSON.'); - assert(json[key] != null, 'Required key "Projects[$key]" has a null value in JSON.'); + assert(json.containsKey(key), + 'Required key "Projects[$key]" is missing from JSON.'); + assert(json[key] != null, + 'Required key "Projects[$key]" has a null value in JSON.'); }); return true; }()); @@ -78,7 +81,10 @@ class Projects { return null; } - static List listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson( + dynamic json, { + bool growable = false, + }) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -106,20 +112,24 @@ class Projects { } // maps a json object with a list of Projects-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + static Map> mapListFromJson( + dynamic json, { + bool growable = false, + }) { final map = >{}; if (json is Map && json.isNotEmpty) { // ignore: parameter_assignments json = json.cast(); for (final entry in json.entries) { - map[entry.key] = Projects.listFromJson(entry.value, growable: growable,); + map[entry.key] = Projects.listFromJson( + entry.value, + growable: growable, + ); } } return map; } /// The list of required keys that must be present in a JSON. - static const requiredKeys = { - }; + static const requiredKeys = {}; } - diff --git a/openapi/lib/model/projects_metadata.dart b/openapi/lib/model/projects_metadata.dart index 22edf03..d36e9dc 100644 --- a/openapi/lib/model/projects_metadata.dart +++ b/openapi/lib/model/projects_metadata.dart @@ -26,13 +26,14 @@ class ProjectsMetadata { int? total; @override - bool operator ==(Object other) => identical(this, other) || other is ProjectsMetadata && - other.total == total; + bool operator ==(Object other) => + identical(this, other) || + other is ProjectsMetadata && other.total == total; @override int get hashCode => - // ignore: unnecessary_parenthesis - (total == null ? 0 : total!.hashCode); + // ignore: unnecessary_parenthesis + (total == null ? 0 : total!.hashCode); @override String toString() => 'ProjectsMetadata[total=$total]'; @@ -59,8 +60,10 @@ class ProjectsMetadata { // Note 2: this code is stripped in release mode! assert(() { requiredKeys.forEach((key) { - assert(json.containsKey(key), 'Required key "ProjectsMetadata[$key]" is missing from JSON.'); - assert(json[key] != null, 'Required key "ProjectsMetadata[$key]" has a null value in JSON.'); + assert(json.containsKey(key), + 'Required key "ProjectsMetadata[$key]" is missing from JSON.'); + assert(json[key] != null, + 'Required key "ProjectsMetadata[$key]" has a null value in JSON.'); }); return true; }()); @@ -72,7 +75,10 @@ class ProjectsMetadata { return null; } - static List listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson( + dynamic json, { + bool growable = false, + }) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -100,20 +106,24 @@ class ProjectsMetadata { } // maps a json object with a list of ProjectsMetadata-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + static Map> mapListFromJson( + dynamic json, { + bool growable = false, + }) { final map = >{}; if (json is Map && json.isNotEmpty) { // ignore: parameter_assignments json = json.cast(); for (final entry in json.entries) { - map[entry.key] = ProjectsMetadata.listFromJson(entry.value, growable: growable,); + map[entry.key] = ProjectsMetadata.listFromJson( + entry.value, + growable: growable, + ); } } return map; } /// The list of required keys that must be present in a JSON. - static const requiredKeys = { - }; + static const requiredKeys = {}; } - diff --git a/openapi/lib/model/timer.dart b/openapi/lib/model/timer.dart index 31f4d7f..80667cd 100644 --- a/openapi/lib/model/timer.dart +++ b/openapi/lib/model/timer.dart @@ -70,26 +70,29 @@ class Timer { String startTime; @override - bool operator ==(Object other) => identical(this, other) || other is Timer && - other.description == description && - other.endTime == endTime && - other.id == id && - other.notes == notes && - other.projectId == projectId && - other.startTime == startTime; + bool operator ==(Object other) => + identical(this, other) || + other is Timer && + other.description == description && + other.endTime == endTime && + other.id == id && + other.notes == notes && + other.projectId == projectId && + other.startTime == startTime; @override int get hashCode => - // ignore: unnecessary_parenthesis - (description == null ? 0 : description!.hashCode) + - (endTime == null ? 0 : endTime!.hashCode) + - (id == null ? 0 : id!.hashCode) + - (notes == null ? 0 : notes!.hashCode) + - (projectId == null ? 0 : projectId!.hashCode) + - (startTime.hashCode); + // ignore: unnecessary_parenthesis + (description == null ? 0 : description!.hashCode) + + (endTime == null ? 0 : endTime!.hashCode) + + (id == null ? 0 : id!.hashCode) + + (notes == null ? 0 : notes!.hashCode) + + (projectId == null ? 0 : projectId!.hashCode) + + (startTime.hashCode); @override - String toString() => 'Timer[description=$description, endTime=$endTime, id=$id, notes=$notes, projectId=$projectId, startTime=$startTime]'; + String toString() => + 'Timer[description=$description, endTime=$endTime, id=$id, notes=$notes, projectId=$projectId, startTime=$startTime]'; Map toJson() { final json = {}; @@ -118,7 +121,7 @@ class Timer { } else { json[r'project_id'] = null; } - json[r'start_time'] = this.startTime; + json[r'start_time'] = this.startTime; return json; } @@ -134,8 +137,10 @@ class Timer { // Note 2: this code is stripped in release mode! assert(() { requiredKeys.forEach((key) { - assert(json.containsKey(key), 'Required key "Timer[$key]" is missing from JSON.'); - assert(json[key] != null, 'Required key "Timer[$key]" has a null value in JSON.'); + assert(json.containsKey(key), + 'Required key "Timer[$key]" is missing from JSON.'); + assert(json[key] != null, + 'Required key "Timer[$key]" has a null value in JSON.'); }); return true; }()); @@ -152,7 +157,10 @@ class Timer { return null; } - static List listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson( + dynamic json, { + bool growable = false, + }) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -180,13 +188,19 @@ class Timer { } // maps a json object with a list of Timer-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + static Map> mapListFromJson( + dynamic json, { + bool growable = false, + }) { final map = >{}; if (json is Map && json.isNotEmpty) { // ignore: parameter_assignments json = json.cast(); for (final entry in json.entries) { - map[entry.key] = Timer.listFromJson(entry.value, growable: growable,); + map[entry.key] = Timer.listFromJson( + entry.value, + growable: growable, + ); } } return map; @@ -197,4 +211,3 @@ class Timer { 'start_time', }; } - diff --git a/openapi/lib/model/timer_input.dart b/openapi/lib/model/timer_input.dart index b240f95..0cea5af 100644 --- a/openapi/lib/model/timer_input.dart +++ b/openapi/lib/model/timer_input.dart @@ -19,20 +19,20 @@ class TimerInput { TimerInputTimer timer; @override - bool operator ==(Object other) => identical(this, other) || other is TimerInput && - other.timer == timer; + bool operator ==(Object other) => + identical(this, other) || other is TimerInput && other.timer == timer; @override int get hashCode => - // ignore: unnecessary_parenthesis - (timer.hashCode); + // ignore: unnecessary_parenthesis + (timer.hashCode); @override String toString() => 'TimerInput[timer=$timer]'; Map toJson() { final json = {}; - json[r'timer'] = this.timer; + json[r'timer'] = this.timer; return json; } @@ -48,8 +48,10 @@ class TimerInput { // Note 2: this code is stripped in release mode! assert(() { requiredKeys.forEach((key) { - assert(json.containsKey(key), 'Required key "TimerInput[$key]" is missing from JSON.'); - assert(json[key] != null, 'Required key "TimerInput[$key]" has a null value in JSON.'); + assert(json.containsKey(key), + 'Required key "TimerInput[$key]" is missing from JSON.'); + assert(json[key] != null, + 'Required key "TimerInput[$key]" has a null value in JSON.'); }); return true; }()); @@ -61,7 +63,10 @@ class TimerInput { return null; } - static List listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson( + dynamic json, { + bool growable = false, + }) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -89,13 +94,19 @@ class TimerInput { } // maps a json object with a list of TimerInput-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + static Map> mapListFromJson( + dynamic json, { + bool growable = false, + }) { final map = >{}; if (json is Map && json.isNotEmpty) { // ignore: parameter_assignments json = json.cast(); for (final entry in json.entries) { - map[entry.key] = TimerInput.listFromJson(entry.value, growable: growable,); + map[entry.key] = TimerInput.listFromJson( + entry.value, + growable: growable, + ); } } return map; @@ -106,4 +117,3 @@ class TimerInput { 'timer', }; } - diff --git a/openapi/lib/model/timer_input_timer.dart b/openapi/lib/model/timer_input_timer.dart index a2a86bd..de08c97 100644 --- a/openapi/lib/model/timer_input_timer.dart +++ b/openapi/lib/model/timer_input_timer.dart @@ -60,24 +60,27 @@ class TimerInputTimer { String startTime; @override - bool operator ==(Object other) => identical(this, other) || other is TimerInputTimer && - other.description == description && - other.endTime == endTime && - other.notes == notes && - other.projectId == projectId && - other.startTime == startTime; + bool operator ==(Object other) => + identical(this, other) || + other is TimerInputTimer && + other.description == description && + other.endTime == endTime && + other.notes == notes && + other.projectId == projectId && + other.startTime == startTime; @override int get hashCode => - // ignore: unnecessary_parenthesis - (description == null ? 0 : description!.hashCode) + - (endTime == null ? 0 : endTime!.hashCode) + - (notes == null ? 0 : notes!.hashCode) + - (projectId == null ? 0 : projectId!.hashCode) + - (startTime.hashCode); + // ignore: unnecessary_parenthesis + (description == null ? 0 : description!.hashCode) + + (endTime == null ? 0 : endTime!.hashCode) + + (notes == null ? 0 : notes!.hashCode) + + (projectId == null ? 0 : projectId!.hashCode) + + (startTime.hashCode); @override - String toString() => 'TimerInputTimer[description=$description, endTime=$endTime, notes=$notes, projectId=$projectId, startTime=$startTime]'; + String toString() => + 'TimerInputTimer[description=$description, endTime=$endTime, notes=$notes, projectId=$projectId, startTime=$startTime]'; Map toJson() { final json = {}; @@ -101,7 +104,7 @@ class TimerInputTimer { } else { json[r'project_id'] = null; } - json[r'start_time'] = this.startTime; + json[r'start_time'] = this.startTime; return json; } @@ -117,8 +120,10 @@ class TimerInputTimer { // Note 2: this code is stripped in release mode! assert(() { requiredKeys.forEach((key) { - assert(json.containsKey(key), 'Required key "TimerInputTimer[$key]" is missing from JSON.'); - assert(json[key] != null, 'Required key "TimerInputTimer[$key]" has a null value in JSON.'); + assert(json.containsKey(key), + 'Required key "TimerInputTimer[$key]" is missing from JSON.'); + assert(json[key] != null, + 'Required key "TimerInputTimer[$key]" has a null value in JSON.'); }); return true; }()); @@ -134,7 +139,10 @@ class TimerInputTimer { return null; } - static List listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson( + dynamic json, { + bool growable = false, + }) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -162,13 +170,19 @@ class TimerInputTimer { } // maps a json object with a list of TimerInputTimer-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + static Map> mapListFromJson( + dynamic json, { + bool growable = false, + }) { final map = >{}; if (json is Map && json.isNotEmpty) { // ignore: parameter_assignments json = json.cast(); for (final entry in json.entries) { - map[entry.key] = TimerInputTimer.listFromJson(entry.value, growable: growable,); + map[entry.key] = TimerInputTimer.listFromJson( + entry.value, + growable: growable, + ); } } return map; @@ -179,4 +193,3 @@ class TimerInputTimer { 'start_time', }; } - diff --git a/openapi/lib/model/timer_response.dart b/openapi/lib/model/timer_response.dart index a2e48c0..a21298a 100644 --- a/openapi/lib/model/timer_response.dart +++ b/openapi/lib/model/timer_response.dart @@ -25,13 +25,13 @@ class TimerResponse { Timer? data; @override - bool operator ==(Object other) => identical(this, other) || other is TimerResponse && - other.data == data; + bool operator ==(Object other) => + identical(this, other) || other is TimerResponse && other.data == data; @override int get hashCode => - // ignore: unnecessary_parenthesis - (data == null ? 0 : data!.hashCode); + // ignore: unnecessary_parenthesis + (data == null ? 0 : data!.hashCode); @override String toString() => 'TimerResponse[data=$data]'; @@ -58,8 +58,10 @@ class TimerResponse { // Note 2: this code is stripped in release mode! assert(() { requiredKeys.forEach((key) { - assert(json.containsKey(key), 'Required key "TimerResponse[$key]" is missing from JSON.'); - assert(json[key] != null, 'Required key "TimerResponse[$key]" has a null value in JSON.'); + assert(json.containsKey(key), + 'Required key "TimerResponse[$key]" is missing from JSON.'); + assert(json[key] != null, + 'Required key "TimerResponse[$key]" has a null value in JSON.'); }); return true; }()); @@ -71,7 +73,10 @@ class TimerResponse { return null; } - static List listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson( + dynamic json, { + bool growable = false, + }) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -99,20 +104,24 @@ class TimerResponse { } // maps a json object with a list of TimerResponse-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + static Map> mapListFromJson( + dynamic json, { + bool growable = false, + }) { final map = >{}; if (json is Map && json.isNotEmpty) { // ignore: parameter_assignments json = json.cast(); for (final entry in json.entries) { - map[entry.key] = TimerResponse.listFromJson(entry.value, growable: growable,); + map[entry.key] = TimerResponse.listFromJson( + entry.value, + growable: growable, + ); } } return map; } /// The list of required keys that must be present in a JSON. - static const requiredKeys = { - }; + static const requiredKeys = {}; } - diff --git a/openapi/lib/model/timers.dart b/openapi/lib/model/timers.dart index 73f8913..8d4bb80 100644 --- a/openapi/lib/model/timers.dart +++ b/openapi/lib/model/timers.dart @@ -28,22 +28,23 @@ class Timers { ProjectsMetadata? metadata; @override - bool operator ==(Object other) => identical(this, other) || other is Timers && - _deepEquality.equals(other.data, data) && - other.metadata == metadata; + bool operator ==(Object other) => + identical(this, other) || + other is Timers && + _deepEquality.equals(other.data, data) && + other.metadata == metadata; @override int get hashCode => - // ignore: unnecessary_parenthesis - (data.hashCode) + - (metadata == null ? 0 : metadata!.hashCode); + // ignore: unnecessary_parenthesis + (data.hashCode) + (metadata == null ? 0 : metadata!.hashCode); @override String toString() => 'Timers[data=$data, metadata=$metadata]'; Map toJson() { final json = {}; - json[r'data'] = this.data; + json[r'data'] = this.data; if (this.metadata != null) { json[r'metadata'] = this.metadata; } else { @@ -64,8 +65,10 @@ class Timers { // Note 2: this code is stripped in release mode! assert(() { requiredKeys.forEach((key) { - assert(json.containsKey(key), 'Required key "Timers[$key]" is missing from JSON.'); - assert(json[key] != null, 'Required key "Timers[$key]" has a null value in JSON.'); + assert(json.containsKey(key), + 'Required key "Timers[$key]" is missing from JSON.'); + assert(json[key] != null, + 'Required key "Timers[$key]" has a null value in JSON.'); }); return true; }()); @@ -78,7 +81,10 @@ class Timers { return null; } - static List listFromJson(dynamic json, {bool growable = false,}) { + static List listFromJson( + dynamic json, { + bool growable = false, + }) { final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { @@ -106,20 +112,24 @@ class Timers { } // maps a json object with a list of Timers-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + static Map> mapListFromJson( + dynamic json, { + bool growable = false, + }) { final map = >{}; if (json is Map && json.isNotEmpty) { // ignore: parameter_assignments json = json.cast(); for (final entry in json.entries) { - map[entry.key] = Timers.listFromJson(entry.value, growable: growable,); + map[entry.key] = Timers.listFromJson( + entry.value, + growable: growable, + ); } } return map; } /// The list of required keys that must be present in a JSON. - static const requiredKeys = { - }; + static const requiredKeys = {}; } - diff --git a/openapi/test/project_api_test.dart b/openapi/test/project_api_test.dart index 90cbae6..03739db 100644 --- a/openapi/test/project_api_test.dart +++ b/openapi/test/project_api_test.dart @@ -11,7 +11,6 @@ import 'package:openapi/api.dart'; import 'package:test/test.dart'; - /// tests for ProjectApi void main() { // final instance = ProjectApi(); @@ -51,6 +50,5 @@ void main() { test('test timecopsyncProjectsApiWebProjectControllerUpdate', () async { // TODO }); - }); } diff --git a/openapi/test/project_input_project_test.dart b/openapi/test/project_input_project_test.dart index f5bd46b..55f853a 100644 --- a/openapi/test/project_input_project_test.dart +++ b/openapi/test/project_input_project_test.dart @@ -33,8 +33,5 @@ void main() { test('to test the property `name`', () async { // TODO }); - - }); - } diff --git a/openapi/test/project_input_test.dart b/openapi/test/project_input_test.dart index 7ce1e6d..6008e76 100644 --- a/openapi/test/project_input_test.dart +++ b/openapi/test/project_input_test.dart @@ -20,8 +20,5 @@ void main() { test('to test the property `project`', () async { // TODO }); - - }); - } diff --git a/openapi/test/project_response_test.dart b/openapi/test/project_response_test.dart index c98c096..70a76f7 100644 --- a/openapi/test/project_response_test.dart +++ b/openapi/test/project_response_test.dart @@ -20,8 +20,5 @@ void main() { test('to test the property `data`', () async { // TODO }); - - }); - } diff --git a/openapi/test/project_test.dart b/openapi/test/project_test.dart index 67400e3..8b85364 100644 --- a/openapi/test/project_test.dart +++ b/openapi/test/project_test.dart @@ -39,8 +39,5 @@ void main() { test('to test the property `name`', () async { // TODO }); - - }); - } diff --git a/openapi/test/projects_metadata_test.dart b/openapi/test/projects_metadata_test.dart index 398de6a..92b0e51 100644 --- a/openapi/test/projects_metadata_test.dart +++ b/openapi/test/projects_metadata_test.dart @@ -21,8 +21,5 @@ void main() { test('to test the property `total`', () async { // TODO }); - - }); - } diff --git a/openapi/test/projects_test.dart b/openapi/test/projects_test.dart index b539e89..a71c545 100644 --- a/openapi/test/projects_test.dart +++ b/openapi/test/projects_test.dart @@ -25,8 +25,5 @@ void main() { test('to test the property `metadata`', () async { // TODO }); - - }); - } diff --git a/openapi/test/timer_api_test.dart b/openapi/test/timer_api_test.dart index a7b44fb..ceff53a 100644 --- a/openapi/test/timer_api_test.dart +++ b/openapi/test/timer_api_test.dart @@ -11,7 +11,6 @@ import 'package:openapi/api.dart'; import 'package:test/test.dart'; - /// tests for TimerApi void main() { // final instance = TimerApi(); @@ -51,6 +50,5 @@ void main() { test('test timecopsyncProjectsApiWebTimerControllerUpdate', () async { // TODO }); - }); } diff --git a/openapi/test/timer_input_test.dart b/openapi/test/timer_input_test.dart index dd56cd4..ba0d2a3 100644 --- a/openapi/test/timer_input_test.dart +++ b/openapi/test/timer_input_test.dart @@ -20,8 +20,5 @@ void main() { test('to test the property `timer`', () async { // TODO }); - - }); - } diff --git a/openapi/test/timer_input_timer_test.dart b/openapi/test/timer_input_timer_test.dart index 74daf49..21adb33 100644 --- a/openapi/test/timer_input_timer_test.dart +++ b/openapi/test/timer_input_timer_test.dart @@ -45,8 +45,5 @@ void main() { test('to test the property `startTime`', () async { // TODO }); - - }); - } diff --git a/openapi/test/timer_response_test.dart b/openapi/test/timer_response_test.dart index bb444a1..41643cd 100644 --- a/openapi/test/timer_response_test.dart +++ b/openapi/test/timer_response_test.dart @@ -20,8 +20,5 @@ void main() { test('to test the property `data`', () async { // TODO }); - - }); - } diff --git a/openapi/test/timer_test.dart b/openapi/test/timer_test.dart index 4c70060..e768a24 100644 --- a/openapi/test/timer_test.dart +++ b/openapi/test/timer_test.dart @@ -51,8 +51,5 @@ void main() { test('to test the property `startTime`', () async { // TODO }); - - }); - } diff --git a/openapi/test/timers_test.dart b/openapi/test/timers_test.dart index 22db4c8..ad47538 100644 --- a/openapi/test/timers_test.dart +++ b/openapi/test/timers_test.dart @@ -25,8 +25,5 @@ void main() { test('to test the property `metadata`', () async { // TODO }); - - }); - } diff --git a/pubspec.lock b/pubspec.lock index 1834a48..81feb30 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -125,10 +125,10 @@ packages: dependency: "direct main" description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.19.0" convert: dependency: transitive description: @@ -141,10 +141,10 @@ packages: dependency: transitive description: name: coverage - sha256: "2fb815080e44a09b85e0f2ca8a820b15053982b2e714b59267719e8a9ff17097" + sha256: e3493833ea012784c740e341952298f1cc77f1f01b1bbc3eb4eecf6984fb7f43 url: "https://pub.dev" source: hosted - version: "1.6.3" + version: "1.11.1" cross_file: dependency: "direct main" description: @@ -213,10 +213,10 @@ packages: dependency: transitive description: name: file - sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" url: "https://pub.dev" source: hosted - version: "6.1.4" + version: "7.0.0" file_picker: dependency: "direct main" description: @@ -532,6 +532,30 @@ packages: url: "https://pub.dev" source: hosted version: "4.8.1" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" + url: "https://pub.dev" + source: hosted + version: "10.0.7" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" + url: "https://pub.dev" + source: hosted + version: "3.0.8" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" lints: dependency: transitive description: @@ -560,26 +584,26 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.11.1" meta: dependency: transitive description: name: meta - sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.15.0" mime: dependency: transitive description: @@ -612,6 +636,13 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.2" + openapi: + dependency: "direct main" + description: + path: openapi + relative: true + source: path + version: "1.0.0" package_config: dependency: transitive description: @@ -640,10 +671,10 @@ packages: dependency: "direct main" description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" path_parsing: dependency: transitive description: @@ -768,10 +799,10 @@ packages: dependency: transitive description: name: platform - sha256: ae68c7bfcd7383af3629daafb32fb4e8681c7154428da4febcff06200585f102 + sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.1.5" plugin_platform_interface: dependency: transitive description: @@ -808,10 +839,10 @@ packages: dependency: transitive description: name: process - sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" + sha256: "21e54fd2faf1b5bdd5102afd25012184a6793927648ea81eea80552ac9405b32" url: "https://pub.dev" source: hosted - version: "4.2.4" + version: "5.0.2" provider: dependency: transitive description: @@ -888,10 +919,10 @@ packages: dependency: transitive description: name: shared_preferences_linux - sha256: "71d6806d1449b0a9d4e85e0c7a917771e672a3d5dc61149cc9fac871115018e1" + sha256: "9f2cbcf46d4270ea8be39fa156d86379077c8a5228d9dfdb1164ae0bb93f1faa" url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.3.2" shared_preferences_platform_interface: dependency: transitive description: @@ -912,10 +943,10 @@ packages: dependency: transitive description: name: shared_preferences_windows - sha256: f95e6a43162bce43c9c3405f3eb6f39e5b5d11f65fab19196cf8225e2777624d + sha256: "841ad54f3c8381c480d0c9b508b89a34036f512482c407e6df7a9c4aa2ef8f59" url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.3.2" shelf: dependency: transitive description: @@ -960,7 +991,7 @@ packages: dependency: transitive description: flutter source: sdk - version: "0.0.99" + version: "0.0.0" source_map_stack_trace: dependency: transitive description: @@ -1021,10 +1052,10 @@ packages: dependency: transitive description: name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" url: "https://pub.dev" source: hosted - version: "1.11.1" + version: "1.12.0" stream_channel: dependency: transitive description: @@ -1037,10 +1068,10 @@ packages: dependency: transitive description: name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.0" sync_http: dependency: transitive description: @@ -1069,26 +1100,26 @@ packages: dependency: "direct dev" description: name: test - sha256: a1f7595805820fcc05e5c52e3a231aedd0b72972cb333e8c738a8b1239448b6f + sha256: "713a8789d62f3233c46b4a90b174737b2c04cb6ae4500f2aa8b1be8f03f5e67f" url: "https://pub.dev" source: hosted - version: "1.24.9" + version: "1.25.8" test_api: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.7.3" test_core: dependency: transitive description: name: test_core - sha256: a757b14fc47507060a162cc2530d9a4a2f92f5100a952c7443b5cad5ef5b106a + sha256: "12391302411737c176b0b5d6491f466b0dd56d4763e347b6714efbaa74d7953d" url: "https://pub.dev" source: hosted - version: "0.5.9" + version: "0.6.5" timezone: dependency: transitive description: @@ -1213,10 +1244,10 @@ packages: dependency: transitive description: name: vm_service - sha256: c538be99af830f478718b51630ec1b6bee5e74e52c8a802d328d9e71d35d2583 + sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b url: "https://pub.dev" source: hosted - version: "11.10.0" + version: "14.3.0" watcher: dependency: transitive description: @@ -1245,10 +1276,10 @@ packages: dependency: transitive description: name: webdriver - sha256: "3c923e918918feeb90c4c9fdf1fe39220fa4c0e8e2c0fffaded174498ef86c49" + sha256: "3d773670966f02a646319410766d3b5e1037efb7f07cc68f844d5e06cd4d61c8" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.4" webkit_inspection_protocol: dependency: transitive description: @@ -1290,5 +1321,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.2.0 <4.0.0" - flutter: ">=3.16.0" + dart: ">=3.4.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/test_driver/screenshots.dart b/test_driver/screenshots.dart index f6e162f..fd3e88b 100644 --- a/test_driver/screenshots.dart +++ b/test_driver/screenshots.dart @@ -11,7 +11,8 @@ import 'package:flutter_driver/driver_extension.dart'; import 'dart:ui' as ui; Future main() async { - enableFlutterDriverExtension(handler: (String? query) async { + enableFlutterDriverExtension( + handler: (String? query) async { if (query == "direction") { if (ui.window.locale.languageCode == "ar") { return "rtl"; @@ -27,6 +28,7 @@ Future main() async { final SettingsProvider settings = MockSettingsProvider(); await settings.setBool("collapseDays", false); final DataProvider data = MockDataProvider(ui.window.locale); - final NotificationsProvider notifications = NotificationsProvider(FlutterLocalNotificationsPlugin()); + final NotificationsProvider notifications = + NotificationsProvider(FlutterLocalNotificationsPlugin()); return runMain(settings, data, notifications); } From 421855188ae3c0152c38a0742be3e9cc7a669b2e Mon Sep 17 00:00:00 2001 From: WoodenMaiden Date: Wed, 22 Jan 2025 23:34:08 +0100 Subject: [PATCH 8/8] feat: git hook --- Makefile | 4 ++ pubspec.lock | 99 +++++++++++++++++++++++++++++++-------- pubspec.yaml | 1 + tool/setup_git_hooks.dart | 19 ++++++++ 4 files changed, 104 insertions(+), 19 deletions(-) create mode 100644 tool/setup_git_hooks.dart diff --git a/Makefile b/Makefile index ec99eef..03472f8 100644 --- a/Makefile +++ b/Makefile @@ -42,6 +42,10 @@ codegen: rm -v $(CLIENT_DIR)/git_push.sh $(DART) format $(CLIENT_DIR) +.PHONY: setup +setup: codegen + $(DART) run tool/setup_git_hooks.dart + .PHONY: ci ci: $(FLUTTER) pub get diff --git a/pubspec.lock b/pubspec.lock index 81feb30..663a10c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,10 +5,15 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a + sha256: "16e298750b6d0af7ce8a3ba7c18c69c3785d11b15ec83f6dcd0ad2a0009b3cab" url: "https://pub.dev" source: hosted - version: "61.0.0" + version: "76.0.0" + _macros: + dependency: transitive + description: dart + source: sdk + version: "0.3.3" about: dependency: "direct main" description: @@ -21,10 +26,10 @@ packages: dependency: transitive description: name: analyzer - sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562 + sha256: "1f14db053a8c23e260789e9b0980fa27f2680dd640932cae5e1137cce0e46e1e" url: "https://pub.dev" source: hosted - version: "5.13.0" + version: "6.11.0" archive: dependency: transitive description: @@ -37,10 +42,10 @@ packages: dependency: transitive description: name: args - sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6 url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "2.6.0" async: dependency: transitive description: @@ -129,14 +134,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.19.0" + console: + dependency: transitive + description: + name: console + sha256: e04e7824384c5b39389acdd6dc7d33f3efe6b232f6f16d7626f194f6a01ad69a + url: "https://pub.dev" + source: hosted + version: "4.1.0" convert: dependency: transitive description: name: convert - sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.1.2" coverage: dependency: transitive description: @@ -157,10 +170,10 @@ packages: dependency: transitive description: name: crypto - sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "3.0.6" csv: dependency: "direct main" description: @@ -169,6 +182,14 @@ packages: url: "https://pub.dev" source: hosted version: "5.1.1" + dart_pre_commit: + dependency: "direct dev" + description: + name: dart_pre_commit + sha256: "29af5a06c93226d1182c8bea1c81bc04d7e46dca9fed0bce11c1cd6ea2845e98" + url: "https://pub.dev" + source: hosted + version: "5.4.2" dbus: dependency: transitive description: @@ -434,6 +455,14 @@ packages: url: "https://pub.dev" source: hosted version: "10.6.0" + freezed_annotation: + dependency: transitive + description: + name: freezed_annotation + sha256: c2e2d632dd9b8a2b7751117abcfc2b4888ecfe181bd9fca7170d9ef02e595fe2 + url: "https://pub.dev" + source: hosted + version: "2.4.4" frontend_server_client: dependency: transitive description: @@ -528,10 +557,10 @@ packages: dependency: transitive description: name: json_annotation - sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" url: "https://pub.dev" source: hosted - version: "4.8.1" + version: "4.9.0" leak_tracker: dependency: transitive description: @@ -568,10 +597,18 @@ packages: dependency: transitive description: name: logging - sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.0" + macros: + dependency: transitive + description: + name: macros + sha256: "1d9e801cd66f7ea3663c45fc708450db1fa57f988142c64289142c9b7ee80656" + url: "https://pub.dev" + source: hosted + version: "0.1.3-main.0" markdown: dependency: transitive description: @@ -855,10 +892,18 @@ packages: dependency: transitive description: name: pub_semver - sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + sha256: "7b3cfbf654f3edd0c6298ecd5be782ce997ddf0e00531b9464b55245185bbbbd" url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.1.5" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: "0560ba233314abbed0a48a2956f7f022cce7c3e1e73df540277da7544cad4082" + url: "https://pub.dev" + source: hosted + version: "1.5.0" qr: dependency: transitive description: @@ -875,6 +920,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.6-nullsafety" + riverpod: + dependency: transitive + description: + name: riverpod + sha256: "59062512288d3056b2321804332a13ffdd1bf16df70dcc8e506e411280a72959" + url: "https://pub.dev" + source: hosted + version: "2.6.1" share_plus: dependency: "direct main" description: @@ -1056,6 +1109,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.12.0" + state_notifier: + dependency: transitive + description: + name: state_notifier + sha256: b8677376aa54f2d7c58280d5a007f9e8774f1968d1fb1c096adcb4792fba29bb + url: "https://pub.dev" + source: hosted + version: "1.0.0" stream_channel: dependency: transitive description: @@ -1316,10 +1377,10 @@ packages: dependency: transitive description: name: yaml - sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.1.3" sdks: - dart: ">=3.4.0 <4.0.0" + dart: ">=3.6.0 <4.0.0" flutter: ">=3.18.0-18.0.pre.54" diff --git a/pubspec.yaml b/pubspec.yaml index c66648d..72ec0c1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -62,6 +62,7 @@ dev_dependencies: sdk: flutter flutter_test: sdk: flutter + dart_pre_commit: ^5.4.2 #until screenshots updates on the package repo.. #screenshots: ^2.1.1 diff --git a/tool/setup_git_hooks.dart b/tool/setup_git_hooks.dart new file mode 100644 index 0000000..bff2fe2 --- /dev/null +++ b/tool/setup_git_hooks.dart @@ -0,0 +1,19 @@ +import 'dart:io'; + +Future main() async { + final preCommitHook = File('.git/hooks/pre-commit'); + await preCommitHook.parent.create(); + await preCommitHook.writeAsString( + ''' +#!/bin/sh +exec make check-format +''', + ); + + if (!Platform.isWindows) { + final result = await Process.run('chmod', ['a+x', preCommitHook.path]); + stdout.write(result.stdout); + stderr.write(result.stderr); + exitCode = result.exitCode; + } +}