From 326e574bf0c0f6fd1873a33df173b4e7409ef51d Mon Sep 17 00:00:00 2001 From: Dell Date: Thu, 28 May 2026 14:45:07 -0400 Subject: [PATCH] fixing errors for OpenAPI Clients --- mobile/openapi/README.md | 4 + mobile/openapi/lib/api.dart | 3 + mobile/openapi/lib/api/users_api.dart | 71 ++++++++++ mobile/openapi/lib/api_client.dart | 6 + .../model/user_upload_stats_response_dto.dart | 134 ++++++++++++++++++ ...pload_stats_response_dto_series_inner.dart | 112 +++++++++++++++ ...ser_upload_stats_response_dto_summary.dart | 103 ++++++++++++++ packages/sdk/src/fetch-client.ts | 35 +++++ 8 files changed, 468 insertions(+) create mode 100644 mobile/openapi/lib/model/user_upload_stats_response_dto.dart create mode 100644 mobile/openapi/lib/model/user_upload_stats_response_dto_series_inner.dart create mode 100644 mobile/openapi/lib/model/user_upload_stats_response_dto_summary.dart diff --git a/mobile/openapi/README.md b/mobile/openapi/README.md index ecc75dd945..ea56c388a3 100644 --- a/mobile/openapi/README.md +++ b/mobile/openapi/README.md @@ -289,6 +289,7 @@ Class | Method | HTTP request | Description *UsersApi* | [**deleteUserLicense**](doc//UsersApi.md#deleteuserlicense) | **DELETE** /users/me/license | Delete user product key *UsersApi* | [**deleteUserOnboarding**](doc//UsersApi.md#deleteuseronboarding) | **DELETE** /users/me/onboarding | Delete user onboarding *UsersApi* | [**getMyPreferences**](doc//UsersApi.md#getmypreferences) | **GET** /users/me/preferences | Get my preferences +*UsersApi* | [**getMyUploadStatistics**](doc//UsersApi.md#getmyuploadstatistics) | **GET** /users/me/stats/uploads | Get current user upload statistics *UsersApi* | [**getMyUser**](doc//UsersApi.md#getmyuser) | **GET** /users/me | Get current user *UsersApi* | [**getProfileImage**](doc//UsersApi.md#getprofileimage) | **GET** /users/{id}/profile-image | Retrieve user profile image *UsersApi* | [**getUser**](doc//UsersApi.md#getuser) | **GET** /users/{id} | Retrieve a user @@ -656,6 +657,9 @@ Class | Method | HTTP request | Description - [UserResponseDto](doc//UserResponseDto.md) - [UserStatus](doc//UserStatus.md) - [UserUpdateMeDto](doc//UserUpdateMeDto.md) + - [UserUploadStatsResponseDto](doc//UserUploadStatsResponseDto.md) + - [UserUploadStatsResponseDtoSeriesInner](doc//UserUploadStatsResponseDtoSeriesInner.md) + - [UserUploadStatsResponseDtoSummary](doc//UserUploadStatsResponseDtoSummary.md) - [ValidateAccessTokenResponseDto](doc//ValidateAccessTokenResponseDto.md) - [ValidateLibraryDto](doc//ValidateLibraryDto.md) - [ValidateLibraryImportPathResponseDto](doc//ValidateLibraryImportPathResponseDto.md) diff --git a/mobile/openapi/lib/api.dart b/mobile/openapi/lib/api.dart index 1769c8af75..b8c845c178 100644 --- a/mobile/openapi/lib/api.dart +++ b/mobile/openapi/lib/api.dart @@ -402,6 +402,9 @@ part 'model/user_preferences_update_dto.dart'; part 'model/user_response_dto.dart'; part 'model/user_status.dart'; part 'model/user_update_me_dto.dart'; +part 'model/user_upload_stats_response_dto.dart'; +part 'model/user_upload_stats_response_dto_series_inner.dart'; +part 'model/user_upload_stats_response_dto_summary.dart'; part 'model/validate_access_token_response_dto.dart'; part 'model/validate_library_dto.dart'; part 'model/validate_library_import_path_response_dto.dart'; diff --git a/mobile/openapi/lib/api/users_api.dart b/mobile/openapi/lib/api/users_api.dart index 401cf4e94b..f169c380df 100644 --- a/mobile/openapi/lib/api/users_api.dart +++ b/mobile/openapi/lib/api/users_api.dart @@ -252,6 +252,77 @@ class UsersApi { return null; } + /// Get current user upload statistics + /// + /// Retrieve daily upload counts for the current user. + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [DateTime] from: + /// Start date in UTC + /// + /// * [DateTime] to: + /// End date in UTC + Future getMyUploadStatisticsWithHttpInfo({ DateTime? from, DateTime? to, }) async { + // ignore: prefer_const_declarations + final apiPath = r'/users/me/stats/uploads'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + if (from != null) { + queryParams.addAll(_queryParams('', 'from', from)); + } + if (to != null) { + queryParams.addAll(_queryParams('', 'to', to)); + } + + const contentTypes = []; + + + return apiClient.invokeAPI( + apiPath, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Get current user upload statistics + /// + /// Retrieve daily upload counts for the current user. + /// + /// Parameters: + /// + /// * [DateTime] from: + /// Start date in UTC + /// + /// * [DateTime] to: + /// End date in UTC + Future getMyUploadStatistics({ DateTime? from, DateTime? to, }) async { + final response = await getMyUploadStatisticsWithHttpInfo( from: from, to: to, ); + 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), 'UserUploadStatsResponseDto',) as UserUploadStatsResponseDto; + + } + return null; + } + /// Get current user /// /// Retrieve information about the user making the API request. diff --git a/mobile/openapi/lib/api_client.dart b/mobile/openapi/lib/api_client.dart index 103a5db5f4..3de62e23ea 100644 --- a/mobile/openapi/lib/api_client.dart +++ b/mobile/openapi/lib/api_client.dart @@ -850,6 +850,12 @@ class ApiClient { return UserStatusTypeTransformer().decode(value); case 'UserUpdateMeDto': return UserUpdateMeDto.fromJson(value); + case 'UserUploadStatsResponseDto': + return UserUploadStatsResponseDto.fromJson(value); + case 'UserUploadStatsResponseDtoSeriesInner': + return UserUploadStatsResponseDtoSeriesInner.fromJson(value); + case 'UserUploadStatsResponseDtoSummary': + return UserUploadStatsResponseDtoSummary.fromJson(value); case 'ValidateAccessTokenResponseDto': return ValidateAccessTokenResponseDto.fromJson(value); case 'ValidateLibraryDto': diff --git a/mobile/openapi/lib/model/user_upload_stats_response_dto.dart b/mobile/openapi/lib/model/user_upload_stats_response_dto.dart new file mode 100644 index 0000000000..2ae1b23e40 --- /dev/null +++ b/mobile/openapi/lib/model/user_upload_stats_response_dto.dart @@ -0,0 +1,134 @@ +// +// 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 UserUploadStatsResponseDto { + /// Returns a new [UserUploadStatsResponseDto] instance. + UserUploadStatsResponseDto({ + required this.from, + this.series = const [], + required this.summary, + required this.to, + required this.userId, + }); + + /// Start date in UTC + String from; + + List series; + + UserUploadStatsResponseDtoSummary summary; + + /// End date in UTC + String to; + + /// User ID + String userId; + + @override + bool operator ==(Object other) => identical(this, other) || other is UserUploadStatsResponseDto && + other.from == from && + _deepEquality.equals(other.series, series) && + other.summary == summary && + other.to == to && + other.userId == userId; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (from.hashCode) + + (series.hashCode) + + (summary.hashCode) + + (to.hashCode) + + (userId.hashCode); + + @override + String toString() => 'UserUploadStatsResponseDto[from=$from, series=$series, summary=$summary, to=$to, userId=$userId]'; + + Map toJson() { + final json = {}; + json[r'from'] = this.from; + json[r'series'] = this.series; + json[r'summary'] = this.summary; + json[r'to'] = this.to; + json[r'userId'] = this.userId; + return json; + } + + /// Returns a new [UserUploadStatsResponseDto] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static UserUploadStatsResponseDto? fromJson(dynamic value) { + upgradeDto(value, "UserUploadStatsResponseDto"); + if (value is Map) { + final json = value.cast(); + + return UserUploadStatsResponseDto( + from: mapValueOfType(json, r'from')!, + series: UserUploadStatsResponseDtoSeriesInner.listFromJson(json[r'series']), + summary: UserUploadStatsResponseDtoSummary.fromJson(json[r'summary'])!, + to: mapValueOfType(json, r'to')!, + userId: mapValueOfType(json, r'userId')!, + ); + } + 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 = UserUploadStatsResponseDto.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 = UserUploadStatsResponseDto.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of UserUploadStatsResponseDto-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] = UserUploadStatsResponseDto.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'from', + 'series', + 'summary', + 'to', + 'userId', + }; +} + diff --git a/mobile/openapi/lib/model/user_upload_stats_response_dto_series_inner.dart b/mobile/openapi/lib/model/user_upload_stats_response_dto_series_inner.dart new file mode 100644 index 0000000000..9ba615601b --- /dev/null +++ b/mobile/openapi/lib/model/user_upload_stats_response_dto_series_inner.dart @@ -0,0 +1,112 @@ +// +// 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 UserUploadStatsResponseDtoSeriesInner { + /// Returns a new [UserUploadStatsResponseDtoSeriesInner] instance. + UserUploadStatsResponseDtoSeriesInner({ + required this.count, + required this.date, + }); + + /// Number of uploads + /// + /// Minimum value: -9007199254740991 + /// Maximum value: 9007199254740991 + int count; + + /// Date in UTC + String date; + + @override + bool operator ==(Object other) => identical(this, other) || other is UserUploadStatsResponseDtoSeriesInner && + other.count == count && + other.date == date; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (count.hashCode) + + (date.hashCode); + + @override + String toString() => 'UserUploadStatsResponseDtoSeriesInner[count=$count, date=$date]'; + + Map toJson() { + final json = {}; + json[r'count'] = this.count; + json[r'date'] = this.date; + return json; + } + + /// Returns a new [UserUploadStatsResponseDtoSeriesInner] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static UserUploadStatsResponseDtoSeriesInner? fromJson(dynamic value) { + upgradeDto(value, "UserUploadStatsResponseDtoSeriesInner"); + if (value is Map) { + final json = value.cast(); + + return UserUploadStatsResponseDtoSeriesInner( + count: mapValueOfType(json, r'count')!, + date: mapValueOfType(json, r'date')!, + ); + } + 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 = UserUploadStatsResponseDtoSeriesInner.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 = UserUploadStatsResponseDtoSeriesInner.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of UserUploadStatsResponseDtoSeriesInner-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] = UserUploadStatsResponseDtoSeriesInner.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'count', + 'date', + }; +} + diff --git a/mobile/openapi/lib/model/user_upload_stats_response_dto_summary.dart b/mobile/openapi/lib/model/user_upload_stats_response_dto_summary.dart new file mode 100644 index 0000000000..11abb45a0c --- /dev/null +++ b/mobile/openapi/lib/model/user_upload_stats_response_dto_summary.dart @@ -0,0 +1,103 @@ +// +// 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 UserUploadStatsResponseDtoSummary { + /// Returns a new [UserUploadStatsResponseDtoSummary] instance. + UserUploadStatsResponseDtoSummary({ + required this.totalCount, + }); + + /// Total number of uploads + /// + /// Minimum value: -9007199254740991 + /// Maximum value: 9007199254740991 + int totalCount; + + @override + bool operator ==(Object other) => identical(this, other) || other is UserUploadStatsResponseDtoSummary && + other.totalCount == totalCount; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (totalCount.hashCode); + + @override + String toString() => 'UserUploadStatsResponseDtoSummary[totalCount=$totalCount]'; + + Map toJson() { + final json = {}; + json[r'totalCount'] = this.totalCount; + return json; + } + + /// Returns a new [UserUploadStatsResponseDtoSummary] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static UserUploadStatsResponseDtoSummary? fromJson(dynamic value) { + upgradeDto(value, "UserUploadStatsResponseDtoSummary"); + if (value is Map) { + final json = value.cast(); + + return UserUploadStatsResponseDtoSummary( + totalCount: mapValueOfType(json, r'totalCount')!, + ); + } + 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 = UserUploadStatsResponseDtoSummary.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 = UserUploadStatsResponseDtoSummary.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of UserUploadStatsResponseDtoSummary-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] = UserUploadStatsResponseDtoSummary.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'totalCount', + }; +} + diff --git a/packages/sdk/src/fetch-client.ts b/packages/sdk/src/fetch-client.ts index e82074d02c..44e368f3f6 100644 --- a/packages/sdk/src/fetch-client.ts +++ b/packages/sdk/src/fetch-client.ts @@ -2655,6 +2655,24 @@ export type OnboardingDto = { /** Is user onboarded */ isOnboarded: boolean; }; +export type UserUploadStatsResponseDto = { + /** Start date in UTC */ + "from": string; + series: { + /** Number of uploads */ + count: number; + /** Date in UTC */ + date: string; + }[]; + summary: { + /** Total number of uploads */ + totalCount: number; + }; + /** End date in UTC */ + to: string; + /** User ID */ + userId: string; +}; export type CreateProfileImageDto = { /** Profile image file */ file: Blob; @@ -6535,6 +6553,23 @@ export function updateMyPreferences({ userPreferencesUpdateDto }: { body: userPreferencesUpdateDto }))); } +/** + * Get current user upload statistics + */ +export function getMyUploadStatistics({ $from, to }: { + $from?: string; + to?: string; +}, opts?: Oazapfts.RequestOpts) { + return oazapfts.ok(oazapfts.fetchJson<{ + status: 200; + data: UserUploadStatsResponseDto; + }>(`/users/me/stats/uploads${QS.query(QS.explode({ + "from": $from, + to + }))}`, { + ...opts + })); +} /** * Delete user profile image */