From 6c85e1334b7c23dbeb52b9666d709bd6f76359fb Mon Sep 17 00:00:00 2001 From: izzy Date: Mon, 22 Jun 2026 12:24:51 +0100 Subject: [PATCH] chore: mise lock & open-api --- .devcontainer/devcontainer-lock.json | 9 ++ mise.lock | 103 +-------------- mise.toml | 2 +- mobile/openapi/README.md | 9 +- mobile/openapi/lib/api.dart | 4 + mobile/openapi/lib/api/onboarding_api.dart | 68 ++++++++++ mobile/openapi/lib/api/repository_api.dart | 69 +++++++++- mobile/openapi/lib/api_client.dart | 8 ++ mobile/openapi/lib/api_helper.dart | 6 + mobile/openapi/lib/model/backend_dto.dart | 10 +- .../openapi/lib/model/bootstrap_status.dart | 88 +++++++++++++ .../model/inspected_local_repository_dto.dart | 18 ++- .../lib/model/local_repository_dto.dart | 18 ++- .../model/onboarding_status_response_dto.dart | 38 +++++- .../lib/model/repository_meter_dto.dart | 123 ++++++++++++++++++ ...imary_backend_reconfigure_request_dto.dart | 99 ++++++++++++++ .../lib/model/server_features_dto.dart | 11 +- .../lib/model/system_config_backups_dto.dart | 11 +- mobile/openapi/lib/model/telemetry_level.dart | 85 ++++++++++++ packages/sdk/src/fetch-client.ts | 58 ++++++++- 20 files changed, 724 insertions(+), 113 deletions(-) create mode 100644 .devcontainer/devcontainer-lock.json create mode 100644 mobile/openapi/lib/model/bootstrap_status.dart create mode 100644 mobile/openapi/lib/model/repository_meter_dto.dart create mode 100644 mobile/openapi/lib/model/repository_primary_backend_reconfigure_request_dto.dart create mode 100644 mobile/openapi/lib/model/telemetry_level.dart diff --git a/.devcontainer/devcontainer-lock.json b/.devcontainer/devcontainer-lock.json new file mode 100644 index 0000000000..5c9909954c --- /dev/null +++ b/.devcontainer/devcontainer-lock.json @@ -0,0 +1,9 @@ +{ + "features": { + "ghcr.io/devcontainers/features/docker-in-docker:2": { + "version": "2.17.0", + "resolved": "ghcr.io/devcontainers/features/docker-in-docker@sha256:25b9f05705ffba7dbe503230ac76081419306f8c8bc88e0ce78c4ecd99a0c78c", + "integrity": "sha256:25b9f05705ffba7dbe503230ac76081419306f8c8bc88e0ce78c4ecd99a0c78c" + } + } +} diff --git a/mise.lock b/mise.lock index b3652bc3a1..d1f497e50d 100644 --- a/mise.lock +++ b/mise.lock @@ -85,54 +85,6 @@ backend = "github:jellyfin/jellyfin-ffmpeg" [tools."github:jellyfin/jellyfin-ffmpeg".options] asset_pattern = "jellyfin-ffmpeg_*_portable_linux64-gpl.tar.xz" -[tools."github:jellyfin/jellyfin-ffmpeg"."platforms.linux-x64"] -checksum = "sha256:39e99a7927468a6abec5f65d00f55010e8ff2ae3c2605294f179c94f6ae21af2" -url = "https://github.com/jellyfin/jellyfin-ffmpeg/releases/download/v7.1.3-6/jellyfin-ffmpeg_7.1.3-6_portable_linux64-gpl.tar.xz" -url_api = "https://api.github.com/repos/jellyfin/jellyfin-ffmpeg/releases/assets/409048879" - -[tools."github:jellyfin/jellyfin-ffmpeg"."platforms.linux-x64-musl"] -checksum = "sha256:39e99a7927468a6abec5f65d00f55010e8ff2ae3c2605294f179c94f6ae21af2" -url = "https://github.com/jellyfin/jellyfin-ffmpeg/releases/download/v7.1.3-6/jellyfin-ffmpeg_7.1.3-6_portable_linux64-gpl.tar.xz" -url_api = "https://api.github.com/repos/jellyfin/jellyfin-ffmpeg/releases/assets/409048879" - -[[tools."github:jellyfin/jellyfin-ffmpeg"]] -version = "7.1.3-6" -backend = "github:jellyfin/jellyfin-ffmpeg" - -[tools."github:jellyfin/jellyfin-ffmpeg".options] -asset_pattern = "jellyfin-ffmpeg_*_portable_linuxarm64-gpl.tar.xz" - -[tools."github:jellyfin/jellyfin-ffmpeg"."platforms.linux-arm64"] -checksum = "sha256:bea03c670e8cc5bfe9edc0c5d624d4735421610cef5e808db93e7d8596952886" -url = "https://github.com/jellyfin/jellyfin-ffmpeg/releases/download/v7.1.3-6/jellyfin-ffmpeg_7.1.3-6_portable_linuxarm64-gpl.tar.xz" -url_api = "https://api.github.com/repos/jellyfin/jellyfin-ffmpeg/releases/assets/409048876" - -[tools."github:jellyfin/jellyfin-ffmpeg"."platforms.linux-arm64-musl"] -checksum = "sha256:bea03c670e8cc5bfe9edc0c5d624d4735421610cef5e808db93e7d8596952886" -url = "https://github.com/jellyfin/jellyfin-ffmpeg/releases/download/v7.1.3-6/jellyfin-ffmpeg_7.1.3-6_portable_linuxarm64-gpl.tar.xz" -url_api = "https://api.github.com/repos/jellyfin/jellyfin-ffmpeg/releases/assets/409048876" - -[[tools."github:jellyfin/jellyfin-ffmpeg"]] -version = "7.1.3-6" -backend = "github:jellyfin/jellyfin-ffmpeg" - -[tools."github:jellyfin/jellyfin-ffmpeg"."platforms.windows-x64"] -checksum = "sha256:7b7168149689610296f3a187c717056ce0786cc125a31caf28056737e9ba1cc1" -url = "https://github.com/jellyfin/jellyfin-ffmpeg/releases/download/v7.1.3-6/jellyfin-ffmpeg_7.1.3-6_portable_win64-clang-gpl.zip" -url_api = "https://api.github.com/repos/jellyfin/jellyfin-ffmpeg/releases/assets/409036094" - -[[tools."github:jellyfin/jellyfin-ffmpeg"]] -version = "7.1.3-6" -backend = "github:jellyfin/jellyfin-ffmpeg" - -[tools."github:jellyfin/jellyfin-ffmpeg".options] -asset_pattern = "jellyfin-ffmpeg_*_portable_mac64-gpl.tar.xz" - -[tools."github:jellyfin/jellyfin-ffmpeg"."platforms.macos-x64"] -checksum = "sha256:066ede9774aaae97a18098aaeea8b7e0d286653eb8618f640476e99c59a536c2" -url = "https://github.com/jellyfin/jellyfin-ffmpeg/releases/download/v7.1.3-6/jellyfin-ffmpeg_7.1.3-6_portable_mac64-gpl.tar.xz" -url_api = "https://api.github.com/repos/jellyfin/jellyfin-ffmpeg/releases/assets/408995889" - [[tools."github:webassembly/binaryen"]] version = "version_124" backend = "github:webassembly/binaryen" @@ -176,25 +128,8 @@ url_api = "https://api.github.com/repos/WebAssembly/binaryen/releases/assets/288 version = "21.0.2" backend = "core:java" -[tools.java."platforms.linux-arm64"] -checksum = "sha256:08db1392a48d4eb5ea5315cf8f18b89dbaf36cda663ba882cf03c704c9257ec2" -url = "https://download.java.net/java/GA/jdk21.0.2/f2283984656d49d69e91c558476027ac/13/GPL/openjdk-21.0.2_linux-aarch64_bin.tar.gz" - -[tools.java."platforms.linux-x64"] -checksum = "sha256:a2def047a73941e01a73739f92755f86b895811afb1f91243db214cff5bdac3f" -url = "https://download.java.net/java/GA/jdk21.0.2/f2283984656d49d69e91c558476027ac/13/GPL/openjdk-21.0.2_linux-x64_bin.tar.gz" - -[tools.java."platforms.macos-arm64"] -checksum = "sha256:b3d588e16ec1e0ef9805d8a696591bd518a5cea62567da8f53b5ce32d11d22e4" -url = "https://download.java.net/java/GA/jdk21.0.2/f2283984656d49d69e91c558476027ac/13/GPL/openjdk-21.0.2_macos-aarch64_bin.tar.gz" - -[tools.java."platforms.macos-x64"] -checksum = "sha256:8fd09e15dc406387a0aba70bf5d99692874e999bf9cd9208b452b5d76ac922d3" -url = "https://download.java.net/java/GA/jdk21.0.2/f2283984656d49d69e91c558476027ac/13/GPL/openjdk-21.0.2_macos-x64_bin.tar.gz" - -[tools.java."platforms.windows-x64"] -checksum = "sha256:b6c17e747ae78cdd6de4d7532b3164b277daee97c007d3eaa2b39cca99882664" -url = "https://download.java.net/java/GA/jdk21.0.2/f2283984656d49d69e91c558476027ac/13/GPL/openjdk-21.0.2_windows-x64_bin.zip" +[tools.java.options] +shorthand_vendor = "openjdk" [[tools.node]] version = "24.15.0" @@ -265,38 +200,12 @@ checksum = "sha256:27323f70c875b8251bfd7e61a4cffc3ebff4e56ed1e611b955016f0c70773 url = "https://github.com/opentofu/opentofu/releases/download/v1.11.6/tofu_1.11.6_windows_amd64.tar.gz" [[tools.pnpm]] -version = "11.6.0" +version = "11.5.2" backend = "aqua:pnpm/pnpm" -[tools.pnpm."platforms.linux-arm64"] -checksum = "sha256:2fec653ff6dadab340d1c3d2214688a7451cc471f39710839440b293ca7c53b0" -url = "https://github.com/pnpm/pnpm/releases/download/v11.6.0/pnpm-linux-arm64.tar.gz" -provenance = "github-attestations" - -[tools.pnpm."platforms.linux-arm64-musl"] -checksum = "sha256:56a78c08cf22adf29e7dacb6f7f100139731693863d20fb94a7883463a62169e" -url = "https://github.com/pnpm/pnpm/releases/download/v11.6.0/pnpm-linux-arm64-musl.tar.gz" -provenance = "github-attestations" - -[tools.pnpm."platforms.linux-x64"] -checksum = "sha256:74d64c1646385fb21691f32f0ab6aca1a9f5c829ba54d3cda3a24838a228e68c" -url = "https://github.com/pnpm/pnpm/releases/download/v11.6.0/pnpm-linux-x64.tar.gz" -provenance = "github-attestations" - -[tools.pnpm."platforms.linux-x64-musl"] -checksum = "sha256:7a0c463a09d912fba6b7d9eca0a946bc228ea50f3015a05c09a29e7e85a932d7" -url = "https://github.com/pnpm/pnpm/releases/download/v11.6.0/pnpm-linux-x64-musl.tar.gz" -provenance = "github-attestations" - -[tools.pnpm."platforms.macos-arm64"] -checksum = "sha256:87c901635a14481fb30566a3749041134ffd4317bc6fe866c345b69fdf9b6b85" -url = "https://github.com/pnpm/pnpm/releases/download/v11.6.0/pnpm-darwin-arm64.tar.gz" -provenance = "github-attestations" - -[tools.pnpm."platforms.windows-x64"] -checksum = "sha256:91c753435542b04859c689304fae0dd64eba6b40937cfa426a48485b712e4e9c" -url = "https://github.com/pnpm/pnpm/releases/download/v11.6.0/pnpm-win32-x64.zip" -provenance = "github-attestations" +[[tools.restic]] +version = "0.19.0" +backend = "aqua:restic/restic" [[tools.terragrunt]] version = "1.0.3" diff --git a/mise.toml b/mise.toml index 72c13abef7..aeaffd1895 100644 --- a/mise.toml +++ b/mise.toml @@ -16,7 +16,7 @@ config_roots = [ [tools] node = "24.15.0" -pnpm = "11.6.0" +pnpm = "11.5.2" terragrunt = "1.0.3" opentofu = "1.11.6" "npm:oazapfts" = "7.5.0" diff --git a/mobile/openapi/README.md b/mobile/openapi/README.md index 70170ee61b..a9f3c76f64 100644 --- a/mobile/openapi/README.md +++ b/mobile/openapi/README.md @@ -3,7 +3,7 @@ Immich API This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 3.0.0-rc.0 +- API version: 3.0.0-rc.2 - Generator version: 7.22.0 - Build package: org.openapitools.codegen.languages.DartClientCodegen @@ -220,8 +220,10 @@ Class | Method | HTTP request | Description *NotificationsAdminApi* | [**sendTestEmailAdmin**](doc//NotificationsAdminApi.md#sendtestemailadmin) | **POST** /admin/notifications/test-email | Send test email *OnboardingApi* | [**confirmRecoveryKey**](doc//OnboardingApi.md#confirmrecoverykey) | **POST** /yucca/onboarding/recovery-key | *OnboardingApi* | [**currentRecoveryKey**](doc//OnboardingApi.md#currentrecoverykey) | **GET** /yucca/onboarding/recovery-key | +*OnboardingApi* | [**enableTelemetry**](doc//OnboardingApi.md#enabletelemetry) | **POST** /yucca/onboarding/telemetry | *OnboardingApi* | [**importRecoveryKey**](doc//OnboardingApi.md#importrecoverykey) | **PUT** /yucca/onboarding/recovery-key | *OnboardingApi* | [**onboardingStatus**](doc//OnboardingApi.md#onboardingstatus) | **GET** /yucca/onboarding | +*OnboardingApi* | [**reportError**](doc//OnboardingApi.md#reporterror) | **POST** /yucca/onboarding/report-error | *OnboardingApi* | [**skipOnboardingExtraConfig**](doc//OnboardingApi.md#skiponboardingextraconfig) | **POST** /yucca/onboarding/skip | *PartnersApi* | [**createPartner**](doc//PartnersApi.md#createpartner) | **POST** /partners | Create a partner *PartnersApi* | [**createPartnerDeprecated**](doc//PartnersApi.md#createpartnerdeprecated) | **POST** /partners/{id} | Create a partner @@ -260,6 +262,7 @@ Class | Method | HTTP request | Description *RepositoryApi* | [**importRepository**](doc//RepositoryApi.md#importrepository) | **POST** /yucca/repository/{id}/import | *RepositoryApi* | [**inspectRepositories**](doc//RepositoryApi.md#inspectrepositories) | **GET** /yucca/repository/inspect | *RepositoryApi* | [**pruneRepository**](doc//RepositoryApi.md#prunerepository) | **POST** /yucca/repository/{id}/snapshots/prune | +*RepositoryApi* | [**reconfigureRepositoryPrimaryBackend**](doc//RepositoryApi.md#reconfigurerepositoryprimarybackend) | **PUT** /yucca/repository/{id}/backend | *RepositoryApi* | [**restoreFromPoint**](doc//RepositoryApi.md#restorefrompoint) | **POST** /yucca/repository/{id}/snapshots/{snapshot}/restore-from-point | *RepositoryApi* | [**restoreSnapshot**](doc//RepositoryApi.md#restoresnapshot) | **POST** /yucca/repository/{id}/snapshots/{snapshot} | *RepositoryApi* | [**updateRepository**](doc//RepositoryApi.md#updaterepository) | **PATCH** /yucca/repository/{id} | @@ -454,6 +457,7 @@ Class | Method | HTTP request | Description - [BackendResponseDto](doc//BackendResponseDto.md) - [BackendType](doc//BackendType.md) - [BackendsResponseDto](doc//BackendsResponseDto.md) + - [BootstrapStatus](doc//BootstrapStatus.md) - [BulkIdErrorReason](doc//BulkIdErrorReason.md) - [BulkIdResponseDto](doc//BulkIdResponseDto.md) - [BulkIdsDto](doc//BulkIdsDto.md) @@ -614,7 +618,9 @@ Class | Method | HTTP request | Description - [RepositoryCreateResponseDto](doc//RepositoryCreateResponseDto.md) - [RepositoryInspectResponseDto](doc//RepositoryInspectResponseDto.md) - [RepositoryListResponseDto](doc//RepositoryListResponseDto.md) + - [RepositoryMeterDto](doc//RepositoryMeterDto.md) - [RepositoryMetricsDto](doc//RepositoryMetricsDto.md) + - [RepositoryPrimaryBackendReconfigureRequestDto](doc//RepositoryPrimaryBackendReconfigureRequestDto.md) - [RepositorySnapshotRestoreFromPointRequestDto](doc//RepositorySnapshotRestoreFromPointRequestDto.md) - [RepositorySnapshotRestoreRequestDto](doc//RepositorySnapshotRestoreRequestDto.md) - [RepositoryUpdateRequestDto](doc//RepositoryUpdateRequestDto.md) @@ -763,6 +769,7 @@ Class | Method | HTTP request | Description - [TagsUpdate](doc//TagsUpdate.md) - [TaskStatus](doc//TaskStatus.md) - [TaskType](doc//TaskType.md) + - [TelemetryLevel](doc//TelemetryLevel.md) - [TemplateDto](doc//TemplateDto.md) - [TemplateResponseDto](doc//TemplateResponseDto.md) - [TestEmailResponseDto](doc//TestEmailResponseDto.md) diff --git a/mobile/openapi/lib/api.dart b/mobile/openapi/lib/api.dart index 938e5ecf7b..7b771bc599 100644 --- a/mobile/openapi/lib/api.dart +++ b/mobile/openapi/lib/api.dart @@ -150,6 +150,7 @@ part 'model/backend_dto.dart'; part 'model/backend_response_dto.dart'; part 'model/backend_type.dart'; part 'model/backends_response_dto.dart'; +part 'model/bootstrap_status.dart'; part 'model/bulk_id_error_reason.dart'; part 'model/bulk_id_response_dto.dart'; part 'model/bulk_ids_dto.dart'; @@ -310,7 +311,9 @@ part 'model/repository_create_request_dto.dart'; part 'model/repository_create_response_dto.dart'; part 'model/repository_inspect_response_dto.dart'; part 'model/repository_list_response_dto.dart'; +part 'model/repository_meter_dto.dart'; part 'model/repository_metrics_dto.dart'; +part 'model/repository_primary_backend_reconfigure_request_dto.dart'; part 'model/repository_snapshot_restore_from_point_request_dto.dart'; part 'model/repository_snapshot_restore_request_dto.dart'; part 'model/repository_update_request_dto.dart'; @@ -459,6 +462,7 @@ part 'model/tags_response.dart'; part 'model/tags_update.dart'; part 'model/task_status.dart'; part 'model/task_type.dart'; +part 'model/telemetry_level.dart'; part 'model/template_dto.dart'; part 'model/template_response_dto.dart'; part 'model/test_email_response_dto.dart'; diff --git a/mobile/openapi/lib/api/onboarding_api.dart b/mobile/openapi/lib/api/onboarding_api.dart index f2c94a31d5..78292fdec8 100644 --- a/mobile/openapi/lib/api/onboarding_api.dart +++ b/mobile/openapi/lib/api/onboarding_api.dart @@ -92,6 +92,40 @@ class OnboardingApi { return null; } + /// Performs an HTTP 'POST /yucca/onboarding/telemetry' operation and returns the [Response]. + Future enableTelemetryWithHttpInfo({ Future? abortTrigger, }) async { + // ignore: prefer_const_declarations + final apiPath = r'/yucca/onboarding/telemetry'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + apiPath, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + abortTrigger: abortTrigger, + ); + } + + Future enableTelemetry({ Future? abortTrigger, }) async { + final response = await enableTelemetryWithHttpInfo(abortTrigger: abortTrigger,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + /// Performs an HTTP 'PUT /yucca/onboarding/recovery-key' operation and returns the [Response]. /// Parameters: /// @@ -174,6 +208,40 @@ class OnboardingApi { return null; } + /// Performs an HTTP 'POST /yucca/onboarding/report-error' operation and returns the [Response]. + Future reportErrorWithHttpInfo({ Future? abortTrigger, }) async { + // ignore: prefer_const_declarations + final apiPath = r'/yucca/onboarding/report-error'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + apiPath, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + abortTrigger: abortTrigger, + ); + } + + Future reportError({ Future? abortTrigger, }) async { + final response = await reportErrorWithHttpInfo(abortTrigger: abortTrigger,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + /// Performs an HTTP 'POST /yucca/onboarding/skip' operation and returns the [Response]. Future skipOnboardingExtraConfigWithHttpInfo({ Future? abortTrigger, }) async { // ignore: prefer_const_declarations diff --git a/mobile/openapi/lib/api/repository_api.dart b/mobile/openapi/lib/api/repository_api.dart index e485d542b8..d606493757 100644 --- a/mobile/openapi/lib/api/repository_api.dart +++ b/mobile/openapi/lib/api/repository_api.dart @@ -529,7 +529,10 @@ class RepositoryApi { } /// Performs an HTTP 'GET /yucca/repository/inspect' operation and returns the [Response]. - Future inspectRepositoriesWithHttpInfo({ Future? abortTrigger, }) async { + /// Parameters: + /// + /// * [String] backend: + Future inspectRepositoriesWithHttpInfo({ String? backend, Future? abortTrigger, }) async { // ignore: prefer_const_declarations final apiPath = r'/yucca/repository/inspect'; @@ -540,6 +543,10 @@ class RepositoryApi { final headerParams = {}; final formParams = {}; + if (backend != null) { + queryParams.addAll(_queryParams('', 'backend', backend)); + } + const contentTypes = []; @@ -555,8 +562,11 @@ class RepositoryApi { ); } - Future inspectRepositories({ Future? abortTrigger, }) async { - final response = await inspectRepositoriesWithHttpInfo(abortTrigger: abortTrigger,); + /// Parameters: + /// + /// * [String] backend: + Future inspectRepositories({ String? backend, Future? abortTrigger, }) async { + final response = await inspectRepositoriesWithHttpInfo(backend: backend, abortTrigger: abortTrigger,); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } @@ -619,6 +629,59 @@ class RepositoryApi { return null; } + /// Performs an HTTP 'PUT /yucca/repository/{id}/backend' operation and returns the [Response]. + /// Parameters: + /// + /// * [String] id (required): + /// + /// * [RepositoryPrimaryBackendReconfigureRequestDto] repositoryPrimaryBackendReconfigureRequestDto (required): + Future reconfigureRepositoryPrimaryBackendWithHttpInfo(String id, RepositoryPrimaryBackendReconfigureRequestDto repositoryPrimaryBackendReconfigureRequestDto, { Future? abortTrigger, }) async { + // ignore: prefer_const_declarations + final apiPath = r'/yucca/repository/{id}/backend' + .replaceAll('{id}', id); + + // ignore: prefer_final_locals + Object? postBody = repositoryPrimaryBackendReconfigureRequestDto; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + apiPath, + 'PUT', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + abortTrigger: abortTrigger, + ); + } + + /// Parameters: + /// + /// * [String] id (required): + /// + /// * [RepositoryPrimaryBackendReconfigureRequestDto] repositoryPrimaryBackendReconfigureRequestDto (required): + Future reconfigureRepositoryPrimaryBackend(String id, RepositoryPrimaryBackendReconfigureRequestDto repositoryPrimaryBackendReconfigureRequestDto, { Future? abortTrigger, }) async { + final response = await reconfigureRepositoryPrimaryBackendWithHttpInfo(id, repositoryPrimaryBackendReconfigureRequestDto, abortTrigger: abortTrigger,); + 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), 'RepositoryCreateResponseDto',) as RepositoryCreateResponseDto; + + } + return null; + } + /// Performs an HTTP 'POST /yucca/repository/{id}/snapshots/{snapshot}/restore-from-point' operation and returns the [Response]. /// Parameters: /// diff --git a/mobile/openapi/lib/api_client.dart b/mobile/openapi/lib/api_client.dart index 1af864b0ba..59ca26ec7e 100644 --- a/mobile/openapi/lib/api_client.dart +++ b/mobile/openapi/lib/api_client.dart @@ -325,6 +325,8 @@ class ApiClient { return BackendTypeTypeTransformer().decode(value); case 'BackendsResponseDto': return BackendsResponseDto.fromJson(value); + case 'BootstrapStatus': + return BootstrapStatusTypeTransformer().decode(value); case 'BulkIdErrorReason': return BulkIdErrorReasonTypeTransformer().decode(value); case 'BulkIdResponseDto': @@ -645,8 +647,12 @@ class ApiClient { return RepositoryInspectResponseDto.fromJson(value); case 'RepositoryListResponseDto': return RepositoryListResponseDto.fromJson(value); + case 'RepositoryMeterDto': + return RepositoryMeterDto.fromJson(value); case 'RepositoryMetricsDto': return RepositoryMetricsDto.fromJson(value); + case 'RepositoryPrimaryBackendReconfigureRequestDto': + return RepositoryPrimaryBackendReconfigureRequestDto.fromJson(value); case 'RepositorySnapshotRestoreFromPointRequestDto': return RepositorySnapshotRestoreFromPointRequestDto.fromJson(value); case 'RepositorySnapshotRestoreRequestDto': @@ -943,6 +949,8 @@ class ApiClient { return TaskStatusTypeTransformer().decode(value); case 'TaskType': return TaskTypeTypeTransformer().decode(value); + case 'TelemetryLevel': + return TelemetryLevelTypeTransformer().decode(value); case 'TemplateDto': return TemplateDto.fromJson(value); case 'TemplateResponseDto': diff --git a/mobile/openapi/lib/api_helper.dart b/mobile/openapi/lib/api_helper.dart index abeebb6958..0c21f01afb 100644 --- a/mobile/openapi/lib/api_helper.dart +++ b/mobile/openapi/lib/api_helper.dart @@ -97,6 +97,9 @@ String parameterToString(dynamic value) { if (value is BackendType) { return BackendTypeTypeTransformer().encode(value).toString(); } + if (value is BootstrapStatus) { + return BootstrapStatusTypeTransformer().encode(value).toString(); + } if (value is BulkIdErrorReason) { return BulkIdErrorReasonTypeTransformer().encode(value).toString(); } @@ -202,6 +205,9 @@ String parameterToString(dynamic value) { if (value is TaskType) { return TaskTypeTypeTransformer().encode(value).toString(); } + if (value is TelemetryLevel) { + return TelemetryLevelTypeTransformer().encode(value).toString(); + } if (value is ToneMapping) { return ToneMappingTypeTransformer().encode(value).toString(); } diff --git a/mobile/openapi/lib/model/backend_dto.dart b/mobile/openapi/lib/model/backend_dto.dart index a07f295f9c..e02b7739a7 100644 --- a/mobile/openapi/lib/model/backend_dto.dart +++ b/mobile/openapi/lib/model/backend_dto.dart @@ -13,12 +13,15 @@ part of openapi.api; class BackendDto { /// Returns a new [BackendDto] instance. BackendDto({ + required this.description, this.error = const Optional.absent(), required this.id, required this.isOnline, required this.type, }); + String description; + /// /// 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 @@ -35,6 +38,7 @@ class BackendDto { @override bool operator ==(Object other) => identical(this, other) || other is BackendDto && + other.description == description && other.error == error && other.id == id && other.isOnline == isOnline && @@ -43,16 +47,18 @@ class BackendDto { @override int get hashCode => // ignore: unnecessary_parenthesis + (description.hashCode) + (error == null ? 0 : error!.hashCode) + (id.hashCode) + (isOnline.hashCode) + (type.hashCode); @override - String toString() => 'BackendDto[error=$error, id=$id, isOnline=$isOnline, type=$type]'; + String toString() => 'BackendDto[description=$description, error=$error, id=$id, isOnline=$isOnline, type=$type]'; Map toJson() { final json = {}; + json[r'description'] = this.description; if (this.error.isPresent) { final value = this.error.value; json[r'error'] = value; @@ -72,6 +78,7 @@ class BackendDto { final json = value.cast(); return BackendDto( + description: mapValueOfType(json, r'description')!, error: json.containsKey(r'error') ? Optional.present(mapValueOfType(json, r'error')) : const Optional.absent(), id: mapValueOfType(json, r'id')!, isOnline: mapValueOfType(json, r'isOnline')!, @@ -123,6 +130,7 @@ class BackendDto { /// The list of required keys that must be present in a JSON. static const requiredKeys = { + 'description', 'id', 'isOnline', 'type', diff --git a/mobile/openapi/lib/model/bootstrap_status.dart b/mobile/openapi/lib/model/bootstrap_status.dart new file mode 100644 index 0000000000..8a2ae0a7ec --- /dev/null +++ b/mobile/openapi/lib/model/bootstrap_status.dart @@ -0,0 +1,88 @@ +// +// 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 BootstrapStatus { + /// Instantiate a new enum with the provided [value]. + const BootstrapStatus._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const notReady = BootstrapStatus._(r'not-ready'); + static const ready = BootstrapStatus._(r'ready'); + static const error = BootstrapStatus._(r'error'); + + /// List of all possible values in this [enum][BootstrapStatus]. + static const values = [ + notReady, + ready, + error, + ]; + + static BootstrapStatus? fromJson(dynamic value) => BootstrapStatusTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = BootstrapStatus.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [BootstrapStatus] to String, +/// and [decode] dynamic data back to [BootstrapStatus]. +class BootstrapStatusTypeTransformer { + factory BootstrapStatusTypeTransformer() => _instance ??= const BootstrapStatusTypeTransformer._(); + + const BootstrapStatusTypeTransformer._(); + + String encode(BootstrapStatus data) => data.value; + + /// Decodes a [dynamic value][data] to a BootstrapStatus. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + BootstrapStatus? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case r'not-ready': return BootstrapStatus.notReady; + case r'ready': return BootstrapStatus.ready; + case r'error': return BootstrapStatus.error; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [BootstrapStatusTypeTransformer] instance. + static BootstrapStatusTypeTransformer? _instance; +} + diff --git a/mobile/openapi/lib/model/inspected_local_repository_dto.dart b/mobile/openapi/lib/model/inspected_local_repository_dto.dart index 11193fe500..55e8a50d49 100644 --- a/mobile/openapi/lib/model/inspected_local_repository_dto.dart +++ b/mobile/openapi/lib/model/inspected_local_repository_dto.dart @@ -16,6 +16,7 @@ class InspectedLocalRepositoryDto { this.backends = const Optional.absent(), this.configuration = const Optional.absent(), required this.id, + this.meter = const Optional.absent(), required this.metrics, required this.name, this.snapshots = const [], @@ -40,6 +41,14 @@ class InspectedLocalRepositoryDto { String 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. + /// + Optional meter; + RepositoryMetricsDto metrics; String name; @@ -53,6 +62,7 @@ class InspectedLocalRepositoryDto { other.backends == backends && other.configuration == configuration && other.id == id && + other.meter == meter && other.metrics == metrics && other.name == name && _deepEquality.equals(other.snapshots, snapshots) && @@ -64,13 +74,14 @@ class InspectedLocalRepositoryDto { (backends == null ? 0 : backends!.hashCode) + (configuration == null ? 0 : configuration!.hashCode) + (id.hashCode) + + (meter == null ? 0 : meter!.hashCode) + (metrics.hashCode) + (name.hashCode) + (snapshots.hashCode) + (worm.hashCode); @override - String toString() => 'InspectedLocalRepositoryDto[backends=$backends, configuration=$configuration, id=$id, metrics=$metrics, name=$name, snapshots=$snapshots, worm=$worm]'; + String toString() => 'InspectedLocalRepositoryDto[backends=$backends, configuration=$configuration, id=$id, meter=$meter, metrics=$metrics, name=$name, snapshots=$snapshots, worm=$worm]'; Map toJson() { final json = {}; @@ -83,6 +94,10 @@ class InspectedLocalRepositoryDto { json[r'configuration'] = value; } json[r'id'] = this.id; + if (this.meter.isPresent) { + final value = this.meter.value; + json[r'meter'] = value; + } json[r'metrics'] = this.metrics; json[r'name'] = this.name; json[r'snapshots'] = this.snapshots; @@ -102,6 +117,7 @@ class InspectedLocalRepositoryDto { backends: json.containsKey(r'backends') ? Optional.present(RepositoryBackendsDto.fromJson(json[r'backends'])) : const Optional.absent(), configuration: json.containsKey(r'configuration') ? Optional.present(RepositoryConfigurationDto.fromJson(json[r'configuration'])) : const Optional.absent(), id: mapValueOfType(json, r'id')!, + meter: json.containsKey(r'meter') ? Optional.present(RepositoryMeterDto.fromJson(json[r'meter'])) : const Optional.absent(), metrics: RepositoryMetricsDto.fromJson(json[r'metrics'])!, name: mapValueOfType(json, r'name')!, snapshots: SnapshotDto.listFromJson(json[r'snapshots']), diff --git a/mobile/openapi/lib/model/local_repository_dto.dart b/mobile/openapi/lib/model/local_repository_dto.dart index 3f6f29e133..614a564945 100644 --- a/mobile/openapi/lib/model/local_repository_dto.dart +++ b/mobile/openapi/lib/model/local_repository_dto.dart @@ -16,6 +16,7 @@ class LocalRepositoryDto { this.backends = const Optional.absent(), this.configuration = const Optional.absent(), required this.id, + this.meter = const Optional.absent(), required this.metrics, required this.name, required this.worm, @@ -39,6 +40,14 @@ class LocalRepositoryDto { String 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. + /// + Optional meter; + RepositoryMetricsDto metrics; String name; @@ -50,6 +59,7 @@ class LocalRepositoryDto { other.backends == backends && other.configuration == configuration && other.id == id && + other.meter == meter && other.metrics == metrics && other.name == name && other.worm == worm; @@ -60,12 +70,13 @@ class LocalRepositoryDto { (backends == null ? 0 : backends!.hashCode) + (configuration == null ? 0 : configuration!.hashCode) + (id.hashCode) + + (meter == null ? 0 : meter!.hashCode) + (metrics.hashCode) + (name.hashCode) + (worm.hashCode); @override - String toString() => 'LocalRepositoryDto[backends=$backends, configuration=$configuration, id=$id, metrics=$metrics, name=$name, worm=$worm]'; + String toString() => 'LocalRepositoryDto[backends=$backends, configuration=$configuration, id=$id, meter=$meter, metrics=$metrics, name=$name, worm=$worm]'; Map toJson() { final json = {}; @@ -78,6 +89,10 @@ class LocalRepositoryDto { json[r'configuration'] = value; } json[r'id'] = this.id; + if (this.meter.isPresent) { + final value = this.meter.value; + json[r'meter'] = value; + } json[r'metrics'] = this.metrics; json[r'name'] = this.name; json[r'worm'] = this.worm; @@ -96,6 +111,7 @@ class LocalRepositoryDto { backends: json.containsKey(r'backends') ? Optional.present(RepositoryBackendsDto.fromJson(json[r'backends'])) : const Optional.absent(), configuration: json.containsKey(r'configuration') ? Optional.present(RepositoryConfigurationDto.fromJson(json[r'configuration'])) : const Optional.absent(), id: mapValueOfType(json, r'id')!, + meter: json.containsKey(r'meter') ? Optional.present(RepositoryMeterDto.fromJson(json[r'meter'])) : const Optional.absent(), metrics: RepositoryMetricsDto.fromJson(json[r'metrics'])!, name: mapValueOfType(json, r'name')!, worm: mapValueOfType(json, r'worm')!, diff --git a/mobile/openapi/lib/model/onboarding_status_response_dto.dart b/mobile/openapi/lib/model/onboarding_status_response_dto.dart index 8249e015b6..eb82790013 100644 --- a/mobile/openapi/lib/model/onboarding_status_response_dto.dart +++ b/mobile/openapi/lib/model/onboarding_status_response_dto.dart @@ -13,13 +13,24 @@ part of openapi.api; class OnboardingStatusResponseDto { /// Returns a new [OnboardingStatusResponseDto] instance. OnboardingStatusResponseDto({ + this.error = const Optional.absent(), required this.hasBackend, required this.hasBackup, required this.hasOnboardedKey, required this.hasSchedule, required this.hasSkippedExtraConfig, + required this.hasTelemetry, + required this.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. + /// + Optional error; + bool hasBackend; bool hasBackup; @@ -30,33 +41,49 @@ class OnboardingStatusResponseDto { bool hasSkippedExtraConfig; + TelemetryLevel hasTelemetry; + + BootstrapStatus status; + @override bool operator ==(Object other) => identical(this, other) || other is OnboardingStatusResponseDto && + other.error == error && other.hasBackend == hasBackend && other.hasBackup == hasBackup && other.hasOnboardedKey == hasOnboardedKey && other.hasSchedule == hasSchedule && - other.hasSkippedExtraConfig == hasSkippedExtraConfig; + other.hasSkippedExtraConfig == hasSkippedExtraConfig && + other.hasTelemetry == hasTelemetry && + other.status == status; @override int get hashCode => // ignore: unnecessary_parenthesis + (error == null ? 0 : error!.hashCode) + (hasBackend.hashCode) + (hasBackup.hashCode) + (hasOnboardedKey.hashCode) + (hasSchedule.hashCode) + - (hasSkippedExtraConfig.hashCode); + (hasSkippedExtraConfig.hashCode) + + (hasTelemetry.hashCode) + + (status.hashCode); @override - String toString() => 'OnboardingStatusResponseDto[hasBackend=$hasBackend, hasBackup=$hasBackup, hasOnboardedKey=$hasOnboardedKey, hasSchedule=$hasSchedule, hasSkippedExtraConfig=$hasSkippedExtraConfig]'; + String toString() => 'OnboardingStatusResponseDto[error=$error, hasBackend=$hasBackend, hasBackup=$hasBackup, hasOnboardedKey=$hasOnboardedKey, hasSchedule=$hasSchedule, hasSkippedExtraConfig=$hasSkippedExtraConfig, hasTelemetry=$hasTelemetry, status=$status]'; Map toJson() { final json = {}; + if (this.error.isPresent) { + final value = this.error.value; + json[r'error'] = value; + } json[r'hasBackend'] = this.hasBackend; json[r'hasBackup'] = this.hasBackup; json[r'hasOnboardedKey'] = this.hasOnboardedKey; json[r'hasSchedule'] = this.hasSchedule; json[r'hasSkippedExtraConfig'] = this.hasSkippedExtraConfig; + json[r'hasTelemetry'] = this.hasTelemetry; + json[r'status'] = this.status; return json; } @@ -69,11 +96,14 @@ class OnboardingStatusResponseDto { final json = value.cast(); return OnboardingStatusResponseDto( + error: json.containsKey(r'error') ? Optional.present(mapValueOfType(json, r'error')) : const Optional.absent(), hasBackend: mapValueOfType(json, r'hasBackend')!, hasBackup: mapValueOfType(json, r'hasBackup')!, hasOnboardedKey: mapValueOfType(json, r'hasOnboardedKey')!, hasSchedule: mapValueOfType(json, r'hasSchedule')!, hasSkippedExtraConfig: mapValueOfType(json, r'hasSkippedExtraConfig')!, + hasTelemetry: TelemetryLevel.fromJson(json[r'hasTelemetry'])!, + status: BootstrapStatus.fromJson(json[r'status'])!, ); } return null; @@ -126,6 +156,8 @@ class OnboardingStatusResponseDto { 'hasOnboardedKey', 'hasSchedule', 'hasSkippedExtraConfig', + 'hasTelemetry', + 'status', }; } diff --git a/mobile/openapi/lib/model/repository_meter_dto.dart b/mobile/openapi/lib/model/repository_meter_dto.dart new file mode 100644 index 0000000000..31e4a451ba --- /dev/null +++ b/mobile/openapi/lib/model/repository_meter_dto.dart @@ -0,0 +1,123 @@ +// +// 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 RepositoryMeterDto { + /// Returns a new [RepositoryMeterDto] instance. + RepositoryMeterDto({ + this.lastUpdated = const Optional.absent(), + required this.objectCount, + required this.sizeBytes, + }); + + /// + /// 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. + /// + Optional lastUpdated; + + num objectCount; + + num sizeBytes; + + @override + bool operator ==(Object other) => identical(this, other) || other is RepositoryMeterDto && + other.lastUpdated == lastUpdated && + other.objectCount == objectCount && + other.sizeBytes == sizeBytes; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (lastUpdated == null ? 0 : lastUpdated!.hashCode) + + (objectCount.hashCode) + + (sizeBytes.hashCode); + + @override + String toString() => 'RepositoryMeterDto[lastUpdated=$lastUpdated, objectCount=$objectCount, sizeBytes=$sizeBytes]'; + + Map toJson() { + final json = {}; + if (this.lastUpdated.isPresent) { + final value = this.lastUpdated.value; + json[r'lastUpdated'] = value; + } + json[r'objectCount'] = this.objectCount; + json[r'sizeBytes'] = this.sizeBytes; + return json; + } + + /// Returns a new [RepositoryMeterDto] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static RepositoryMeterDto? fromJson(dynamic value) { + upgradeDto(value, "RepositoryMeterDto"); + if (value is Map) { + final json = value.cast(); + + return RepositoryMeterDto( + lastUpdated: json.containsKey(r'lastUpdated') ? Optional.present(mapValueOfType(json, r'lastUpdated')) : const Optional.absent(), + objectCount: num.parse('${json[r'objectCount']}'), + sizeBytes: num.parse('${json[r'sizeBytes']}'), + ); + } + 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 = RepositoryMeterDto.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 = RepositoryMeterDto.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of RepositoryMeterDto-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] = RepositoryMeterDto.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'objectCount', + 'sizeBytes', + }; +} + diff --git a/mobile/openapi/lib/model/repository_primary_backend_reconfigure_request_dto.dart b/mobile/openapi/lib/model/repository_primary_backend_reconfigure_request_dto.dart new file mode 100644 index 0000000000..f792c25c0d --- /dev/null +++ b/mobile/openapi/lib/model/repository_primary_backend_reconfigure_request_dto.dart @@ -0,0 +1,99 @@ +// +// 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 RepositoryPrimaryBackendReconfigureRequestDto { + /// Returns a new [RepositoryPrimaryBackendReconfigureRequestDto] instance. + RepositoryPrimaryBackendReconfigureRequestDto({ + required this.backendId, + }); + + String backendId; + + @override + bool operator ==(Object other) => identical(this, other) || other is RepositoryPrimaryBackendReconfigureRequestDto && + other.backendId == backendId; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (backendId.hashCode); + + @override + String toString() => 'RepositoryPrimaryBackendReconfigureRequestDto[backendId=$backendId]'; + + Map toJson() { + final json = {}; + json[r'backendId'] = this.backendId; + return json; + } + + /// Returns a new [RepositoryPrimaryBackendReconfigureRequestDto] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static RepositoryPrimaryBackendReconfigureRequestDto? fromJson(dynamic value) { + upgradeDto(value, "RepositoryPrimaryBackendReconfigureRequestDto"); + if (value is Map) { + final json = value.cast(); + + return RepositoryPrimaryBackendReconfigureRequestDto( + backendId: mapValueOfType(json, r'backendId')!, + ); + } + 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 = RepositoryPrimaryBackendReconfigureRequestDto.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 = RepositoryPrimaryBackendReconfigureRequestDto.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of RepositoryPrimaryBackendReconfigureRequestDto-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] = RepositoryPrimaryBackendReconfigureRequestDto.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'backendId', + }; +} + diff --git a/mobile/openapi/lib/model/server_features_dto.dart b/mobile/openapi/lib/model/server_features_dto.dart index 9b75ef2b32..4efabf1d66 100644 --- a/mobile/openapi/lib/model/server_features_dto.dart +++ b/mobile/openapi/lib/model/server_features_dto.dart @@ -13,6 +13,7 @@ part of openapi.api; class ServerFeaturesDto { /// Returns a new [ServerFeaturesDto] instance. ServerFeaturesDto({ + required this.backups, required this.configFile, required this.duplicateDetection, required this.email, @@ -31,6 +32,9 @@ class ServerFeaturesDto { required this.trash, }); + /// Whether the backups feature is enabled + bool backups; + /// Whether config file is available bool configFile; @@ -81,6 +85,7 @@ class ServerFeaturesDto { @override bool operator ==(Object other) => identical(this, other) || other is ServerFeaturesDto && + other.backups == backups && other.configFile == configFile && other.duplicateDetection == duplicateDetection && other.email == email && @@ -101,6 +106,7 @@ class ServerFeaturesDto { @override int get hashCode => // ignore: unnecessary_parenthesis + (backups.hashCode) + (configFile.hashCode) + (duplicateDetection.hashCode) + (email.hashCode) + @@ -119,10 +125,11 @@ class ServerFeaturesDto { (trash.hashCode); @override - String toString() => 'ServerFeaturesDto[configFile=$configFile, duplicateDetection=$duplicateDetection, email=$email, facialRecognition=$facialRecognition, importFaces=$importFaces, map=$map, oauth=$oauth, oauthAutoLaunch=$oauthAutoLaunch, ocr=$ocr, passwordLogin=$passwordLogin, realtimeTranscoding=$realtimeTranscoding, reverseGeocoding=$reverseGeocoding, search=$search, sidecar=$sidecar, smartSearch=$smartSearch, trash=$trash]'; + String toString() => 'ServerFeaturesDto[backups=$backups, configFile=$configFile, duplicateDetection=$duplicateDetection, email=$email, facialRecognition=$facialRecognition, importFaces=$importFaces, map=$map, oauth=$oauth, oauthAutoLaunch=$oauthAutoLaunch, ocr=$ocr, passwordLogin=$passwordLogin, realtimeTranscoding=$realtimeTranscoding, reverseGeocoding=$reverseGeocoding, search=$search, sidecar=$sidecar, smartSearch=$smartSearch, trash=$trash]'; Map toJson() { final json = {}; + json[r'backups'] = this.backups; json[r'configFile'] = this.configFile; json[r'duplicateDetection'] = this.duplicateDetection; json[r'email'] = this.email; @@ -151,6 +158,7 @@ class ServerFeaturesDto { final json = value.cast(); return ServerFeaturesDto( + backups: mapValueOfType(json, r'backups')!, configFile: mapValueOfType(json, r'configFile')!, duplicateDetection: mapValueOfType(json, r'duplicateDetection')!, email: mapValueOfType(json, r'email')!, @@ -214,6 +222,7 @@ class ServerFeaturesDto { /// The list of required keys that must be present in a JSON. static const requiredKeys = { + 'backups', 'configFile', 'duplicateDetection', 'email', diff --git a/mobile/openapi/lib/model/system_config_backups_dto.dart b/mobile/openapi/lib/model/system_config_backups_dto.dart index 82cd6e59eb..de5c8e7c01 100644 --- a/mobile/openapi/lib/model/system_config_backups_dto.dart +++ b/mobile/openapi/lib/model/system_config_backups_dto.dart @@ -13,25 +13,32 @@ part of openapi.api; class SystemConfigBackupsDto { /// Returns a new [SystemConfigBackupsDto] instance. SystemConfigBackupsDto({ + required this.beta, required this.database, }); + /// Whether the backups feature is enabled + bool beta; + DatabaseBackupConfig database; @override bool operator ==(Object other) => identical(this, other) || other is SystemConfigBackupsDto && + other.beta == beta && other.database == database; @override int get hashCode => // ignore: unnecessary_parenthesis + (beta.hashCode) + (database.hashCode); @override - String toString() => 'SystemConfigBackupsDto[database=$database]'; + String toString() => 'SystemConfigBackupsDto[beta=$beta, database=$database]'; Map toJson() { final json = {}; + json[r'beta'] = this.beta; json[r'database'] = this.database; return json; } @@ -45,6 +52,7 @@ class SystemConfigBackupsDto { final json = value.cast(); return SystemConfigBackupsDto( + beta: mapValueOfType(json, r'beta')!, database: DatabaseBackupConfig.fromJson(json[r'database'])!, ); } @@ -93,6 +101,7 @@ class SystemConfigBackupsDto { /// The list of required keys that must be present in a JSON. static const requiredKeys = { + 'beta', 'database', }; } diff --git a/mobile/openapi/lib/model/telemetry_level.dart b/mobile/openapi/lib/model/telemetry_level.dart new file mode 100644 index 0000000000..b18b26be77 --- /dev/null +++ b/mobile/openapi/lib/model/telemetry_level.dart @@ -0,0 +1,85 @@ +// +// 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 TelemetryLevel { + /// Instantiate a new enum with the provided [value]. + const TelemetryLevel._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const full = TelemetryLevel._(r'full'); + static const none = TelemetryLevel._(r'none'); + + /// List of all possible values in this [enum][TelemetryLevel]. + static const values = [ + full, + none, + ]; + + static TelemetryLevel? fromJson(dynamic value) => TelemetryLevelTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = TelemetryLevel.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [TelemetryLevel] to String, +/// and [decode] dynamic data back to [TelemetryLevel]. +class TelemetryLevelTypeTransformer { + factory TelemetryLevelTypeTransformer() => _instance ??= const TelemetryLevelTypeTransformer._(); + + const TelemetryLevelTypeTransformer._(); + + String encode(TelemetryLevel data) => data.value; + + /// Decodes a [dynamic value][data] to a TelemetryLevel. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + TelemetryLevel? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case r'full': return TelemetryLevel.full; + case r'none': return TelemetryLevel.none; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [TelemetryLevelTypeTransformer] instance. + static TelemetryLevelTypeTransformer? _instance; +} + diff --git a/packages/sdk/src/fetch-client.ts b/packages/sdk/src/fetch-client.ts index 5342f610e4..2ce78c1391 100644 --- a/packages/sdk/src/fetch-client.ts +++ b/packages/sdk/src/fetch-client.ts @@ -2289,7 +2289,7 @@ export type DatabaseBackupConfig = { keepLastAmount: number; }; export type SystemConfigBackupsDto = { - /** Whether the backups feature is in beta */ + /** Whether the backups feature is enabled */ beta: boolean; database: DatabaseBackupConfig; }; @@ -2843,6 +2843,7 @@ export type DeviceFlowResponseDto = { verificationUri: string; }; export type BackendDto = { + description: string; error?: string; id: string; isOnline: boolean; @@ -2922,11 +2923,14 @@ export type RunResponseDto = { run: RunDto; }; export type OnboardingStatusResponseDto = { + error?: string; hasBackend: boolean; hasBackup: boolean; hasOnboardedKey: boolean; hasSchedule: boolean; hasSkippedExtraConfig: boolean; + hasTelemetry: TelemetryLevel; + status: BootstrapStatus; }; export type CurrentRecoveryKeyResponse = { recoveryKey: string; @@ -2947,6 +2951,11 @@ export type RepositoryConfigurationDto = { paths: string[]; retentionPolicy?: (RetentionPolicyDto) | null; }; +export type RepositoryMeterDto = { + lastUpdated?: string; + objectCount: number; + sizeBytes: number; +}; export type RepositoryMetricsDto = { lastBackup?: string; lastBackupDuration?: number; @@ -2957,6 +2966,7 @@ export type LocalRepositoryDto = { backends?: RepositoryBackendsDto; configuration?: RepositoryConfigurationDto; id: string; + meter?: RepositoryMeterDto; metrics: RepositoryMetricsDto; name: string; worm: boolean; @@ -2990,6 +3000,7 @@ export type InspectedLocalRepositoryDto = { backends?: RepositoryBackendsDto; configuration?: RepositoryConfigurationDto; id: string; + meter?: RepositoryMeterDto; metrics: RepositoryMetricsDto; name: string; snapshots: SnapshotDto[]; @@ -3009,6 +3020,9 @@ export type RepositoryUpdateResponseDto = { export type LogResponseDto = { logId: string; }; +export type RepositoryPrimaryBackendReconfigureRequestDto = { + backendId: string; +}; export type RepositoryCheckImportResponseDto = { readable: boolean; }; @@ -7402,12 +7416,24 @@ export function importRecoveryKey({ importRecoveryKeyRequest }: { body: importRecoveryKeyRequest }))); } +export function reportError(opts?: Oazapfts.RequestOpts) { + return oazapfts.ok(oazapfts.fetchText("/yucca/onboarding/report-error", { + ...opts, + method: "POST" + })); +} export function skipOnboardingExtraConfig(opts?: Oazapfts.RequestOpts) { return oazapfts.ok(oazapfts.fetchText("/yucca/onboarding/skip", { ...opts, method: "POST" })); } +export function enableTelemetry(opts?: Oazapfts.RequestOpts) { + return oazapfts.ok(oazapfts.fetchText("/yucca/onboarding/telemetry", { + ...opts, + method: "POST" + })); +} export function getRepositories(opts?: Oazapfts.RequestOpts) { return oazapfts.ok(oazapfts.fetchJson<{ status: 200; @@ -7431,11 +7457,15 @@ export function createRepository({ backend, repositoryCreateRequestDto }: { body: repositoryCreateRequestDto }))); } -export function inspectRepositories(opts?: Oazapfts.RequestOpts) { +export function inspectRepositories({ backend }: { + backend?: string; +}, opts?: Oazapfts.RequestOpts) { return oazapfts.ok(oazapfts.fetchJson<{ status: 200; data: RepositoryInspectResponseDto; - }>("/yucca/repository/inspect", { + }>(`/yucca/repository/inspect${QS.query(QS.explode({ + backend + }))}`, { ...opts })); } @@ -7474,6 +7504,19 @@ export function createBackup({ id }: { method: "POST" })); } +export function reconfigureRepositoryPrimaryBackend({ id, repositoryPrimaryBackendReconfigureRequestDto }: { + id: string; + repositoryPrimaryBackendReconfigureRequestDto: RepositoryPrimaryBackendReconfigureRequestDto; +}, opts?: Oazapfts.RequestOpts) { + return oazapfts.ok(oazapfts.fetchJson<{ + status: 200; + data: RepositoryCreateResponseDto; + }>(`/yucca/repository/${encodeURIComponent(id)}/backend`, oazapfts.json({ + ...opts, + method: "PUT", + body: repositoryPrimaryBackendReconfigureRequestDto + }))); +} export function checkImportRepository({ backend, id }: { backend: string; id: string; @@ -8265,6 +8308,15 @@ export enum RunType { Backup = "backup", Forget = "forget" } +export enum TelemetryLevel { + Full = "full", + None = "none" +} +export enum BootstrapStatus { + NotReady = "not-ready", + Ready = "ready", + Error = "error" +} export enum TaskStatus { Incomplete = "incomplete", Complete = "complete",