diff --git a/packages/discovery-provider/src/api/v1/transactions.py b/packages/discovery-provider/src/api/v1/transactions.py index 739443b78cc..791427faa94 100644 --- a/packages/discovery-provider/src/api/v1/transactions.py +++ b/packages/discovery-provider/src/api/v1/transactions.py @@ -72,8 +72,8 @@ class GetTransactionHistory(Resource): params={"id": "A User ID"}, ) @full_user_ns.expect(transaction_history_parser) + @auth_middleware(transaction_history_parser) @full_user_ns.marshal_with(transaction_history_response) - @auth_middleware() def get(self, id, authed_user_id=None): user_id = decode_with_abort(id, full_user_ns) return self._get(user_id, authed_user_id) @@ -103,8 +103,8 @@ class LegacyGetTransactionHistory(GetTransactionHistory): deprecated=True, ) @full_ns.expect(transaction_history_parser) + @auth_middleware(transaction_history_parser) @full_ns.marshal_with(transaction_history_response) - @auth_middleware() def get(self, authed_user_id=None): """Gets the user's $AUDIO transaction history within the App @@ -130,8 +130,8 @@ class GetTransactionHistoryCount(Resource): params={"id": "A User ID"}, ) @full_user_ns.expect(transaction_history_count_parser) + @auth_middleware(transaction_history_count_parser) @full_user_ns.marshal_with(transaction_history_count_response) - @auth_middleware() def get(self, id, authed_user_id=None): user_id = decode_with_abort(id, full_ns) if authed_user_id is None: @@ -150,8 +150,8 @@ class LegacyGetTransactionHistoryCount(Resource): deprecated=True, ) @full_ns.expect(transaction_history_count_parser) + @auth_middleware(transaction_history_count_parser) @full_ns.marshal_with(transaction_history_count_response) - @auth_middleware() def get(self, authed_user_id=None): """Gets the count of the user's $AUDIO transaction history within the App. @@ -204,8 +204,8 @@ class GetUSDCTransactionHistory(Resource): params={"id": "A User ID"}, ) @full_user_ns.expect(usdc_transaction_history_parser) + @auth_middleware(usdc_transaction_history_parser) @full_user_ns.marshal_with(transaction_history_response) - @auth_middleware() def get(self, id, authed_user_id=None): user_id = decode_with_abort(id, full_ns) if authed_user_id is None: @@ -244,8 +244,8 @@ class GetUSDCTransactionHistoryCount(Resource): params={"id": "A User ID"}, ) @full_user_ns.expect(usdc_transaction_history_count_parser) + @auth_middleware(usdc_transaction_history_count_parser) @full_user_ns.marshal_with(transaction_history_count_response) - @auth_middleware() def get(self, id, authed_user_id=None): user_id = decode_with_abort(id, full_ns) if authed_user_id is None: diff --git a/packages/discovery-provider/src/api/v1/users.py b/packages/discovery-provider/src/api/v1/users.py index 24e64a30f50..8b5915e2c39 100644 --- a/packages/discovery-provider/src/api/v1/users.py +++ b/packages/discovery-provider/src/api/v1/users.py @@ -343,8 +343,8 @@ class TrackList(Resource): responses={200: "Success", 400: "Bad request", 500: "Server error"}, ) @ns.expect(user_tracks_route_parser) + @auth_middleware(user_tracks_route_parser) @ns.marshal_with(tracks_response) - @auth_middleware() @cache(ttl_sec=5) def get(self, id, authed_user_id=None): decoded_id = decode_with_abort(id, ns) @@ -401,8 +401,8 @@ class FullTrackList(Resource): responses={200: "Success", 400: "Bad request", 500: "Server error"}, ) @full_ns.expect(user_tracks_route_parser) + @auth_middleware(user_tracks_route_parser) @full_ns.marshal_with(full_tracks_response) - @auth_middleware() @cache(ttl_sec=5) def get(self, id, authed_user_id=None): decoded_id = decode_with_abort(id, ns) @@ -481,7 +481,6 @@ def _get(self, handle, authed_user_id=None): tracks = list(map(extend_track, tracks)) return success_response(tracks) - @auth_middleware() @full_ns.doc( id="""Get Tracks by User Handle""", description="""Gets the tracks created by a user using the user's handle""", @@ -491,6 +490,7 @@ def _get(self, handle, authed_user_id=None): responses={200: "Success", 400: "Bad request", 500: "Server error"}, ) @full_ns.expect(user_tracks_route_parser) + @auth_middleware(user_tracks_route_parser) @full_ns.marshal_with(full_tracks_response) def get(self, handle, authed_user_id=None): return self._get(handle, authed_user_id) @@ -498,7 +498,6 @@ def get(self, handle, authed_user_id=None): @ns.route(USER_HANDLE_TRACKS, doc=False) class HandleTrackList(HandleFullTrackList): - @auth_middleware() @ns.doc( id="""Get Tracks by User Handle""", description="""Gets the tracks created by a user using the user's handle""", @@ -508,6 +507,7 @@ class HandleTrackList(HandleFullTrackList): responses={200: "Success", 400: "Bad request", 500: "Server error"}, ) @ns.expect(user_tracks_route_parser) + @auth_middleware(user_tracks_route_parser) @ns.marshal_with(tracks_response) def get(self, handle, authed_user_id): return super()._get(handle, authed_user_id) @@ -550,7 +550,6 @@ def _get(self, handle, authed_user_id=None): tracks = list(map(extend_track, tracks)) return success_response(tracks) - @auth_middleware() @full_ns.doc( id="""Get AI Attributed Tracks by User Handle""", description="""Gets the AI generated tracks attributed to a user using the user's handle""", @@ -560,6 +559,7 @@ def _get(self, handle, authed_user_id=None): responses={200: "Success", 400: "Bad request", 500: "Server error"}, ) @full_ns.expect(user_tracks_route_parser) + @auth_middleware(user_tracks_route_parser) @full_ns.marshal_with(full_tracks_response) def get(self, handle, authed_user_id=None): return self._get(handle, authed_user_id) @@ -567,7 +567,6 @@ def get(self, handle, authed_user_id=None): @ns.route(USER_AI_ATTRIBUTED_TRACKS) class HandleAITrackList(HandleFullAITrackList): - @auth_middleware() @ns.doc( id="""Get AI Attributed Tracks by User Handle""", description="""Gets the AI generated tracks attributed to a user using the user's handle""", @@ -577,6 +576,7 @@ class HandleAITrackList(HandleFullAITrackList): responses={200: "Success", 400: "Bad request", 500: "Server error"}, ) @ns.expect(user_tracks_route_parser) + @auth_middleware(user_tracks_route_parser) @ns.marshal_with(tracks_response) def get(self, handle, authed_user_id): return super()._get(handle, authed_user_id) @@ -808,8 +808,8 @@ class UserTracksLibraryFull(Resource): responses={200: "Success", 400: "Bad request", 500: "Server error"}, ) @full_ns.expect(user_tracks_library_parser) + @auth_middleware(user_tracks_library_parser) @full_ns.marshal_with(track_library_full_response) - @auth_middleware() @cache(ttl_sec=5) def get(self, id: str, authed_user_id: Optional[int] = None): """Fetch a user's full library tracks.""" @@ -883,8 +883,8 @@ class UserPlaylistsLibraryFull(Resource): responses={200: "Success", 400: "Bad request", 500: "Server error"}, ) @full_ns.expect(user_collections_library_parser) + @auth_middleware(user_collections_library_parser) @full_ns.marshal_with(collection_library_full_response) - @auth_middleware() @cache(ttl_sec=5) def get(self, id: str, authed_user_id: Optional[int] = None): """Fetch a user's full library playlists.""" @@ -901,8 +901,8 @@ class UserAlbumsLibraryFull(Resource): responses={200: "Success", 400: "Bad request", 500: "Server error"}, ) @full_ns.expect(user_collections_library_parser) + @auth_middleware(user_collections_library_parser) @full_ns.marshal_with(collection_library_full_response) - @auth_middleware() @cache(ttl_sec=5) def get(self, id: str, authed_user_id: Optional[int] = None): """Fetch a user's full library playlists.""" @@ -1005,7 +1005,6 @@ def get(self, id): @full_ns.route(USER_HISTORY_TRACKS_ROUTE) class TrackHistoryFull(Resource): @record_metrics - @auth_middleware() @cache(ttl_sec=5) def _get(self, id, authed_user_id): args = track_history_parser.parse_args() @@ -1038,6 +1037,7 @@ def _get(self, id, authed_user_id): responses={200: "Success", 400: "Bad request", 500: "Server error"}, ) @full_ns.expect(track_history_parser) + @auth_middleware(track_history_parser) @full_ns.marshal_with(history_response_full) def get(self, id): return self._get(id) @@ -1052,8 +1052,8 @@ class TrackHistory(TrackHistoryFull): responses={200: "Success", 400: "Bad request", 500: "Server error"}, ) @ns.expect(track_history_parser) + @auth_middleware(track_history_parser) @ns.marshal_with(history_response) - @auth_middleware() def get(self, id, authed_user_id): return super()._get(id, authed_user_id) @@ -2122,9 +2122,6 @@ def get(self, id): ) -purchases_and_sales_count_parser = current_user_parser.copy() - - purchases_response = make_full_response( "purchases_response", full_ns, fields.List(fields.Nested(purchase)) ) @@ -2143,8 +2140,8 @@ class FullPurchases(Resource): params={"id": "A User ID"}, ) @full_ns.expect(purchases_and_sales_parser) + @auth_middleware(purchases_and_sales_parser) @full_ns.marshal_with(purchases_response) - @auth_middleware() def get(self, id, authed_user_id=None): decoded_id = decode_with_abort(id, full_ns) if decoded_id != authed_user_id: @@ -2165,6 +2162,9 @@ def get(self, id, authed_user_id=None): return success_response(list(map(extend_purchase, purchases))) +purchases_and_sales_count_parser = current_user_parser.copy() + + @full_ns.route("//purchases/count") class FullPurchasesCount(Resource): @full_ns.doc( @@ -2173,8 +2173,8 @@ class FullPurchasesCount(Resource): params={"id": "A User ID"}, ) @full_ns.expect(purchases_and_sales_count_parser) + @auth_middleware(purchases_and_sales_count_parser) @full_ns.marshal_with(purchases_count_response) - @auth_middleware() def get(self, id, authed_user_id=None): decoded_id = decode_with_abort(id, full_ns) if decoded_id != authed_user_id: @@ -2195,8 +2195,8 @@ class FullSales(Resource): params={"id": "A User ID"}, ) @full_ns.expect(purchases_and_sales_parser) + @auth_middleware(purchases_and_sales_parser) @full_ns.marshal_with(purchases_response) - @auth_middleware() def get(self, id, authed_user_id=None): decoded_id = decode_with_abort(id, full_ns) if decoded_id != authed_user_id: @@ -2225,8 +2225,8 @@ class FullSalesCount(Resource): params={"id": "A User ID"}, ) @full_ns.expect(purchases_and_sales_count_parser) + @auth_middleware(purchases_and_sales_count_parser) @full_ns.marshal_with(purchases_count_response) - @auth_middleware() def get(self, id, authed_user_id=None): decoded_id = decode_with_abort(id, full_ns) if decoded_id != authed_user_id: @@ -2239,19 +2239,19 @@ def get(self, id, authed_user_id=None): return success_response(count) -csv_download_parser = current_user_parser.copy() +purchases_download_parser = current_user_parser.copy() @ns.route("//purchases/download") -class FullPurchasesDownload(Resource): +class PurchasesDownload(Resource): @ns.doc( id="Download Purchases as CSV", description="Downloads the purchases the user has made as a CSV file", params={"id": "A User ID"}, ) @ns.produces(["text/csv"]) - @ns.expect(csv_download_parser) - @auth_middleware() + @ns.expect(purchases_download_parser) + @auth_middleware(purchases_download_parser) def get(self, id, authed_user_id=None): decoded_id = decode_with_abort(id, ns) if decoded_id != authed_user_id: @@ -2263,16 +2263,19 @@ def get(self, id, authed_user_id=None): return response +sales_download_parser = current_user_parser.copy() + + @ns.route("//sales/download") -class FullSalesDownload(Resource): +class SalesDownload(Resource): @ns.doc( id="Download Sales as CSV", description="Downloads the sales the user has made as a CSV file", params={"id": "A User ID"}, ) @ns.produces(["text/csv"]) - @ns.expect(csv_download_parser) - @auth_middleware() + @ns.expect(sales_download_parser) + @auth_middleware(sales_download_parser) def get(self, id, authed_user_id=None): decoded_id = decode_with_abort(id, ns) if decoded_id != authed_user_id: @@ -2284,16 +2287,19 @@ def get(self, id, authed_user_id=None): return response +withdrawals_download_parser = current_user_parser.copy() + + @ns.route("//withdrawals/download") -class FullWithdrawalsDownload(Resource): +class WithdrawalsDownload(Resource): @ns.doc( id="""Download USDC Withdrawals as CSV""", description="""Downloads the USDC withdrawals the user has made as a CSV file""", params={"id": "A User ID"}, ) @ns.produces(["text/csv"]) - @ns.expect(csv_download_parser) - @auth_middleware() + @ns.expect(withdrawals_download_parser) + @auth_middleware(withdrawals_download_parser) def get(self, id, authed_user_id=None): decoded_id = decode_with_abort(id, ns) if decoded_id != authed_user_id: diff --git a/packages/discovery-provider/src/utils/auth_middleware.py b/packages/discovery-provider/src/utils/auth_middleware.py index 74f02a7bfff..0231ba99f38 100644 --- a/packages/discovery-provider/src/utils/auth_middleware.py +++ b/packages/discovery-provider/src/utils/auth_middleware.py @@ -3,6 +3,7 @@ from eth_account.messages import encode_defunct from flask.globals import request +from flask_restx import reqparse from src.models.users.user import User from src.utils import db_session, web3_provider @@ -13,28 +14,50 @@ SIGNATURE_HEADER = "Encoded-Data-Signature" -def auth_middleware(**kwargs): +def auth_middleware(parser: reqparse.RequestParser = None): """ Auth middleware decorator. Should decorate a route and be used to supply an authed user to the query behind a route. - Example: + e.g. - @auth_middleware + @auth_middleware() + def get(self, authed_user_id): + print(authed_user_id) + + If a flask restx RequestParser is passed, header arguments + Encoded-Data-Message and Encoded-Data-Signature are expected on the parser. + + e.g. + + @ns.expect(request_parser) + @auth_middleware(request_parser) def get(self): - args = track_slug_parser.parse_args() - slug, handle = (args.get("slug"), args.get("handle")) - routes = args.get("route") + request.headers.get("Encoded-Data-Message") - @functools.wraps simply ensures that if Python introspects `inner_wrap`, it refers to - `func` rather than `inner_wrap`. """ - def outer_wrap(func): + def decorator(func): + if parser: + parser.add_argument( + MESSAGE_HEADER, + required=False, + description="The data that was signed by the user for signature recovery", + location="headers", + ) + parser.add_argument( + SIGNATURE_HEADER, + required=False, + description="The signature of data, used for signature recovery", + location="headers", + ) + + # @functools.wraps simply ensures that if Python introspects `wrapper`, it refers to + # `func` rather than `wrapper`. @functools.wraps(func) - def inner_wrap(*args, **kwargs): + def wrapper(*args, **kwargs): message = request.headers.get(MESSAGE_HEADER) signature = request.headers.get(SIGNATURE_HEADER) @@ -66,6 +89,6 @@ def inner_wrap(*args, **kwargs): ) return func(*args, **kwargs, authed_user_id=authed_user_id) - return inner_wrap + return wrapper - return outer_wrap + return decorator diff --git a/packages/libs/src/sdk/api/generated/default/.openapi-generator/VERSION b/packages/libs/src/sdk/api/generated/default/.openapi-generator/VERSION index 08bfd0643b8..fff4bdd7ab5 100644 --- a/packages/libs/src/sdk/api/generated/default/.openapi-generator/VERSION +++ b/packages/libs/src/sdk/api/generated/default/.openapi-generator/VERSION @@ -1 +1 @@ -7.5.0-SNAPSHOT +7.3.0-SNAPSHOT \ No newline at end of file diff --git a/packages/libs/src/sdk/api/generated/default/apis/UsersApi.ts b/packages/libs/src/sdk/api/generated/default/apis/UsersApi.ts index d46f5957078..3bba20c4b3a 100644 --- a/packages/libs/src/sdk/api/generated/default/apis/UsersApi.ts +++ b/packages/libs/src/sdk/api/generated/default/apis/UsersApi.ts @@ -74,16 +74,22 @@ import { export interface DownloadPurchasesAsCSVRequest { id: string; userId?: string; + encodedDataMessage?: string; + encodedDataSignature?: string; } export interface DownloadSalesAsCSVRequest { id: string; userId?: string; + encodedDataMessage?: string; + encodedDataSignature?: string; } export interface DownloadUSDCWithdrawalsAsCSVRequest { id: string; userId?: string; + encodedDataMessage?: string; + encodedDataSignature?: string; } export interface GetAIAttributedTracksByUserHandleRequest { @@ -96,6 +102,8 @@ export interface GetAIAttributedTracksByUserHandleRequest { sortMethod?: GetAIAttributedTracksByUserHandleSortMethodEnum; sortDirection?: GetAIAttributedTracksByUserHandleSortDirectionEnum; filterTracks?: GetAIAttributedTracksByUserHandleFilterTracksEnum; + encodedDataMessage?: string; + encodedDataSignature?: string; } export interface GetAuthorizedAppsRequest { @@ -177,6 +185,8 @@ export interface GetTracksByUserRequest { sortMethod?: GetTracksByUserSortMethodEnum; sortDirection?: GetTracksByUserSortDirectionEnum; filterTracks?: GetTracksByUserFilterTracksEnum; + encodedDataMessage?: string; + encodedDataSignature?: string; } export interface GetUserRequest { @@ -222,6 +232,14 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (params.encodedDataMessage !== undefined && params.encodedDataMessage !== null) { + headerParameters['Encoded-Data-Message'] = String(params.encodedDataMessage); + } + + if (params.encodedDataSignature !== undefined && params.encodedDataSignature !== null) { + headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); + } + const response = await this.request({ path: `/users/{id}/purchases/download`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -256,6 +274,14 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (params.encodedDataMessage !== undefined && params.encodedDataMessage !== null) { + headerParameters['Encoded-Data-Message'] = String(params.encodedDataMessage); + } + + if (params.encodedDataSignature !== undefined && params.encodedDataSignature !== null) { + headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); + } + const response = await this.request({ path: `/users/{id}/sales/download`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -290,6 +316,14 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (params.encodedDataMessage !== undefined && params.encodedDataMessage !== null) { + headerParameters['Encoded-Data-Message'] = String(params.encodedDataMessage); + } + + if (params.encodedDataSignature !== undefined && params.encodedDataSignature !== null) { + headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); + } + const response = await this.request({ path: `/users/{id}/withdrawals/download`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -352,6 +386,14 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (params.encodedDataMessage !== undefined && params.encodedDataMessage !== null) { + headerParameters['Encoded-Data-Message'] = String(params.encodedDataMessage); + } + + if (params.encodedDataSignature !== undefined && params.encodedDataSignature !== null) { + headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); + } + const response = await this.request({ path: `/users/handle/{handle}/tracks/ai_attributed`.replace(`{${"handle"}}`, encodeURIComponent(String(params.handle))), method: 'GET', @@ -873,6 +915,14 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (params.encodedDataMessage !== undefined && params.encodedDataMessage !== null) { + headerParameters['Encoded-Data-Message'] = String(params.encodedDataMessage); + } + + if (params.encodedDataSignature !== undefined && params.encodedDataSignature !== null) { + headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); + } + const response = await this.request({ path: `/users/{id}/tracks`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', diff --git a/packages/libs/src/sdk/api/generated/full/.openapi-generator/VERSION b/packages/libs/src/sdk/api/generated/full/.openapi-generator/VERSION index 08bfd0643b8..fff4bdd7ab5 100644 --- a/packages/libs/src/sdk/api/generated/full/.openapi-generator/VERSION +++ b/packages/libs/src/sdk/api/generated/full/.openapi-generator/VERSION @@ -1 +1 @@ -7.5.0-SNAPSHOT +7.3.0-SNAPSHOT \ No newline at end of file diff --git a/packages/libs/src/sdk/api/generated/full/apis/TransactionsApi.ts b/packages/libs/src/sdk/api/generated/full/apis/TransactionsApi.ts index 340e78f0b27..b426e36753e 100644 --- a/packages/libs/src/sdk/api/generated/full/apis/TransactionsApi.ts +++ b/packages/libs/src/sdk/api/generated/full/apis/TransactionsApi.ts @@ -31,6 +31,13 @@ export interface GetAudioTransactionHistoryRequest { limit?: number; sortMethod?: GetAudioTransactionHistorySortMethodEnum; sortDirection?: GetAudioTransactionHistorySortDirectionEnum; + encodedDataMessage?: string; + encodedDataSignature?: string; +} + +export interface GetAudioTransactionHistoryCountRequest { + encodedDataMessage?: string; + encodedDataSignature?: string; } /** @@ -65,6 +72,14 @@ export class TransactionsApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (params.encodedDataMessage !== undefined && params.encodedDataMessage !== null) { + headerParameters['Encoded-Data-Message'] = String(params.encodedDataMessage); + } + + if (params.encodedDataSignature !== undefined && params.encodedDataSignature !== null) { + headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); + } + const response = await this.request({ path: `/transactions`, method: 'GET', @@ -91,11 +106,19 @@ export class TransactionsApi extends runtime.BaseAPI { * Deprecated: Use `/users/{id}/transactions/audio/count` or `sdk.full.users.getAudioTransactionCount()` instead. * Gets the count of the user\'s $AUDIO transaction history within the App */ - async getAudioTransactionHistoryCountRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getAudioTransactionHistoryCountRaw(params: GetAudioTransactionHistoryCountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; + if (params.encodedDataMessage !== undefined && params.encodedDataMessage !== null) { + headerParameters['Encoded-Data-Message'] = String(params.encodedDataMessage); + } + + if (params.encodedDataSignature !== undefined && params.encodedDataSignature !== null) { + headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); + } + const response = await this.request({ path: `/transactions/count`, method: 'GET', @@ -111,8 +134,8 @@ export class TransactionsApi extends runtime.BaseAPI { * Deprecated: Use `/users/{id}/transactions/audio/count` or `sdk.full.users.getAudioTransactionCount()` instead. * Gets the count of the user\'s $AUDIO transaction history within the App */ - async getAudioTransactionHistoryCount(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getAudioTransactionHistoryCountRaw(initOverrides); + async getAudioTransactionHistoryCount(params: GetAudioTransactionHistoryCountRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getAudioTransactionHistoryCountRaw(params, initOverrides); return await response.value(); } diff --git a/packages/libs/src/sdk/api/generated/full/apis/UsersApi.ts b/packages/libs/src/sdk/api/generated/full/apis/UsersApi.ts index 0ea32a4e1d1..f0fa404f406 100644 --- a/packages/libs/src/sdk/api/generated/full/apis/UsersApi.ts +++ b/packages/libs/src/sdk/api/generated/full/apis/UsersApi.ts @@ -101,10 +101,14 @@ export interface GetAIAttributedTracksByUserHandleRequest { sortMethod?: GetAIAttributedTracksByUserHandleSortMethodEnum; sortDirection?: GetAIAttributedTracksByUserHandleSortDirectionEnum; filterTracks?: GetAIAttributedTracksByUserHandleFilterTracksEnum; + encodedDataMessage?: string; + encodedDataSignature?: string; } export interface GetAudioTransactionCountRequest { id: string; + encodedDataMessage?: string; + encodedDataSignature?: string; } export interface GetAudioTransactionsRequest { @@ -113,6 +117,8 @@ export interface GetAudioTransactionsRequest { limit?: number; sortMethod?: GetAudioTransactionsSortMethodEnum; sortDirection?: GetAudioTransactionsSortDirectionEnum; + encodedDataMessage?: string; + encodedDataSignature?: string; } export interface GetFavoritesRequest { @@ -146,11 +152,15 @@ export interface GetPurchasesRequest { userId?: string; sortMethod?: GetPurchasesSortMethodEnum; sortDirection?: GetPurchasesSortDirectionEnum; + encodedDataMessage?: string; + encodedDataSignature?: string; } export interface GetPurchasesCountRequest { id: string; userId?: string; + encodedDataMessage?: string; + encodedDataSignature?: string; } export interface GetRelatedUsersRequest { @@ -181,11 +191,15 @@ export interface GetSalesRequest { userId?: string; sortMethod?: GetSalesSortMethodEnum; sortDirection?: GetSalesSortDirectionEnum; + encodedDataMessage?: string; + encodedDataSignature?: string; } export interface GetSalesCountRequest { id: string; userId?: string; + encodedDataMessage?: string; + encodedDataSignature?: string; } export interface GetSubscribersRequest { @@ -243,6 +257,8 @@ export interface GetTracksByUserRequest { sortMethod?: GetTracksByUserSortMethodEnum; sortDirection?: GetTracksByUserSortDirectionEnum; filterTracks?: GetTracksByUserFilterTracksEnum; + encodedDataMessage?: string; + encodedDataSignature?: string; } export interface GetTracksByUserHandleRequest { @@ -255,15 +271,17 @@ export interface GetTracksByUserHandleRequest { sortMethod?: GetTracksByUserHandleSortMethodEnum; sortDirection?: GetTracksByUserHandleSortDirectionEnum; filterTracks?: GetTracksByUserHandleFilterTracksEnum; + encodedDataMessage?: string; + encodedDataSignature?: string; } export interface GetUSDCTransactionCountRequest { id: string; - encodedDataMessage: string; - encodedDataSignature: string; type?: Array; includeSystemTransactions?: boolean; method?: GetUSDCTransactionCountMethodEnum; + encodedDataMessage?: string; + encodedDataSignature?: string; } export interface GetUSDCTransactionsRequest { @@ -272,6 +290,8 @@ export interface GetUSDCTransactionsRequest { limit?: number; sortMethod?: GetUSDCTransactionsSortMethodEnum; sortDirection?: GetUSDCTransactionsSortDirectionEnum; + encodedDataMessage?: string; + encodedDataSignature?: string; type?: Array; includeSystemTransactions?: boolean; method?: GetUSDCTransactionsMethodEnum; @@ -296,6 +316,8 @@ export interface GetUserLibraryAlbumsRequest { sortDirection?: GetUserLibraryAlbumsSortDirectionEnum; type?: GetUserLibraryAlbumsTypeEnum; sortMethod?: GetUserLibraryAlbumsSortMethodEnum; + encodedDataMessage?: string; + encodedDataSignature?: string; } export interface GetUserLibraryPlaylistsRequest { @@ -307,6 +329,8 @@ export interface GetUserLibraryPlaylistsRequest { sortDirection?: GetUserLibraryPlaylistsSortDirectionEnum; type?: GetUserLibraryPlaylistsTypeEnum; sortMethod?: GetUserLibraryPlaylistsSortMethodEnum; + encodedDataMessage?: string; + encodedDataSignature?: string; } export interface GetUserLibraryTracksRequest { @@ -318,6 +342,8 @@ export interface GetUserLibraryTracksRequest { sortMethod?: GetUserLibraryTracksSortMethodEnum; sortDirection?: GetUserLibraryTracksSortDirectionEnum; type?: GetUserLibraryTracksTypeEnum; + encodedDataMessage?: string; + encodedDataSignature?: string; } export interface GetUserReplicaSetRequest { @@ -333,6 +359,8 @@ export interface GetUsersTrackHistoryRequest { query?: string; sortMethod?: GetUsersTrackHistorySortMethodEnum; sortDirection?: GetUsersTrackHistorySortDirectionEnum; + encodedDataMessage?: string; + encodedDataSignature?: string; } /** @@ -455,6 +483,14 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (params.encodedDataMessage !== undefined && params.encodedDataMessage !== null) { + headerParameters['Encoded-Data-Message'] = String(params.encodedDataMessage); + } + + if (params.encodedDataSignature !== undefined && params.encodedDataSignature !== null) { + headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); + } + const response = await this.request({ path: `/users/handle/{handle}/tracks/ai_attributed`.replace(`{${"handle"}}`, encodeURIComponent(String(params.handle))), method: 'GET', @@ -486,6 +522,14 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (params.encodedDataMessage !== undefined && params.encodedDataMessage !== null) { + headerParameters['Encoded-Data-Message'] = String(params.encodedDataMessage); + } + + if (params.encodedDataSignature !== undefined && params.encodedDataSignature !== null) { + headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); + } + const response = await this.request({ path: `/users/{id}/transactions/audio/count`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -533,6 +577,14 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (params.encodedDataMessage !== undefined && params.encodedDataMessage !== null) { + headerParameters['Encoded-Data-Message'] = String(params.encodedDataMessage); + } + + if (params.encodedDataSignature !== undefined && params.encodedDataSignature !== null) { + headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); + } + const response = await this.request({ path: `/users/{id}/transactions/audio`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -725,6 +777,14 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (params.encodedDataMessage !== undefined && params.encodedDataMessage !== null) { + headerParameters['Encoded-Data-Message'] = String(params.encodedDataMessage); + } + + if (params.encodedDataSignature !== undefined && params.encodedDataSignature !== null) { + headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); + } + const response = await this.request({ path: `/users/{id}/purchases`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -760,6 +820,14 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (params.encodedDataMessage !== undefined && params.encodedDataMessage !== null) { + headerParameters['Encoded-Data-Message'] = String(params.encodedDataMessage); + } + + if (params.encodedDataSignature !== undefined && params.encodedDataSignature !== null) { + headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); + } + const response = await this.request({ path: `/users/{id}/purchases/count`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -940,6 +1008,14 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (params.encodedDataMessage !== undefined && params.encodedDataMessage !== null) { + headerParameters['Encoded-Data-Message'] = String(params.encodedDataMessage); + } + + if (params.encodedDataSignature !== undefined && params.encodedDataSignature !== null) { + headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); + } + const response = await this.request({ path: `/users/{id}/sales`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -975,6 +1051,14 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (params.encodedDataMessage !== undefined && params.encodedDataMessage !== null) { + headerParameters['Encoded-Data-Message'] = String(params.encodedDataMessage); + } + + if (params.encodedDataSignature !== undefined && params.encodedDataSignature !== null) { + headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); + } + const response = await this.request({ path: `/users/{id}/sales/count`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -1323,6 +1407,14 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (params.encodedDataMessage !== undefined && params.encodedDataMessage !== null) { + headerParameters['Encoded-Data-Message'] = String(params.encodedDataMessage); + } + + if (params.encodedDataSignature !== undefined && params.encodedDataSignature !== null) { + headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); + } + const response = await this.request({ path: `/users/{id}/tracks`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -1386,6 +1478,14 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (params.encodedDataMessage !== undefined && params.encodedDataMessage !== null) { + headerParameters['Encoded-Data-Message'] = String(params.encodedDataMessage); + } + + if (params.encodedDataSignature !== undefined && params.encodedDataSignature !== null) { + headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); + } + const response = await this.request({ path: `/users/handle/{handle}/tracks`.replace(`{${"handle"}}`, encodeURIComponent(String(params.handle))), method: 'GET', @@ -1429,6 +1529,14 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (params.encodedDataMessage !== undefined && params.encodedDataMessage !== null) { + headerParameters['Encoded-Data-Message'] = String(params.encodedDataMessage); + } + + if (params.encodedDataSignature !== undefined && params.encodedDataSignature !== null) { + headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); + } + const response = await this.request({ path: `/users/{id}/transactions/usdc/count`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -1488,6 +1596,14 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (params.encodedDataMessage !== undefined && params.encodedDataMessage !== null) { + headerParameters['Encoded-Data-Message'] = String(params.encodedDataMessage); + } + + if (params.encodedDataSignature !== undefined && params.encodedDataSignature !== null) { + headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); + } + const response = await this.request({ path: `/users/{id}/transactions/usdc`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -1618,6 +1734,14 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (params.encodedDataMessage !== undefined && params.encodedDataMessage !== null) { + headerParameters['Encoded-Data-Message'] = String(params.encodedDataMessage); + } + + if (params.encodedDataSignature !== undefined && params.encodedDataSignature !== null) { + headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); + } + const response = await this.request({ path: `/users/{id}/library/albums`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -1679,6 +1803,14 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (params.encodedDataMessage !== undefined && params.encodedDataMessage !== null) { + headerParameters['Encoded-Data-Message'] = String(params.encodedDataMessage); + } + + if (params.encodedDataSignature !== undefined && params.encodedDataSignature !== null) { + headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); + } + const response = await this.request({ path: `/users/{id}/library/playlists`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -1740,6 +1872,14 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (params.encodedDataMessage !== undefined && params.encodedDataMessage !== null) { + headerParameters['Encoded-Data-Message'] = String(params.encodedDataMessage); + } + + if (params.encodedDataSignature !== undefined && params.encodedDataSignature !== null) { + headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); + } + const response = await this.request({ path: `/users/{id}/library/tracks`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -1831,6 +1971,14 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (params.encodedDataMessage !== undefined && params.encodedDataMessage !== null) { + headerParameters['Encoded-Data-Message'] = String(params.encodedDataMessage); + } + + if (params.encodedDataSignature !== undefined && params.encodedDataSignature !== null) { + headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); + } + const response = await this.request({ path: `/users/{id}/history/tracks`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', diff --git a/packages/libs/src/sdk/api/generated/full/models/PlaylistFullWithoutTracks.ts b/packages/libs/src/sdk/api/generated/full/models/PlaylistFullWithoutTracks.ts index 014d1a32cf9..300a4aea6e7 100644 --- a/packages/libs/src/sdk/api/generated/full/models/PlaylistFullWithoutTracks.ts +++ b/packages/libs/src/sdk/api/generated/full/models/PlaylistFullWithoutTracks.ts @@ -315,11 +315,8 @@ export function PlaylistFullWithoutTracksFromJSONTyped(json: any, ignoreDiscrimi 'totalPlayCount': json['total_play_count'], 'user': UserFullFromJSON(json['user']), 'ddexApp': !exists(json, 'ddex_app') ? undefined : json['ddex_app'], -<<<<<<< HEAD -======= 'access': !exists(json, 'access') ? undefined : AccessFromJSON(json['access']), 'upc': !exists(json, 'upc') ? undefined : json['upc'], ->>>>>>> origin/main 'blocknumber': json['blocknumber'], 'createdAt': !exists(json, 'created_at') ? undefined : json['created_at'], 'followeeReposts': ((json['followee_reposts'] as Array).map(RepostFromJSON)), @@ -363,11 +360,8 @@ export function PlaylistFullWithoutTracksToJSON(value?: PlaylistFullWithoutTrack 'total_play_count': value.totalPlayCount, 'user': UserFullToJSON(value.user), 'ddex_app': value.ddexApp, -<<<<<<< HEAD -======= 'access': AccessToJSON(value.access), 'upc': value.upc, ->>>>>>> origin/main 'blocknumber': value.blocknumber, 'created_at': value.createdAt, 'followee_reposts': ((value.followeeReposts as Array).map(RepostToJSON)), diff --git a/packages/libs/src/sdk/api/users/UsersApi.ts b/packages/libs/src/sdk/api/users/UsersApi.ts index 2e0b80499d2..267021df8e1 100644 --- a/packages/libs/src/sdk/api/users/UsersApi.ts +++ b/packages/libs/src/sdk/api/users/UsersApi.ts @@ -220,12 +220,52 @@ export class UsersApi extends GeneratedUsersApi { ) } + if ( + params.encodedDataMessage === null || + params.encodedDataMessage === undefined + ) { + throw new runtime.RequiredError( + 'encodedDataMessage', + 'Required parameter params.encodedDataMessage was null or undefined when calling downloadSalesAsCSV.' + ) + } + + if ( + params.encodedDataSignature === null || + params.encodedDataSignature === undefined + ) { + throw new runtime.RequiredError( + 'encodedDataSignature', + 'Required parameter params.encodedDataSignature was null or undefined when calling downloadSalesAsCSV.' + ) + } + const queryParameters: any = {} if (params.userId !== undefined) { queryParameters.user_id = params.userId } + const headerParameters: runtime.HTTPHeaders = {} + + if ( + params.encodedDataMessage !== undefined && + params.encodedDataMessage !== null + ) { + headerParameters['Encoded-Data-Message'] = String( + params.encodedDataMessage + ) + } + + if ( + params.encodedDataSignature !== undefined && + params.encodedDataSignature !== null + ) { + headerParameters['Encoded-Data-Signature'] = String( + params.encodedDataSignature + ) + } + const host = await this.discoveryNodeSelectorService.getSelectedEndpoint() const path = `/users/{id}/sales/download`.replace( `{${'id'}}`, @@ -233,7 +273,8 @@ export class UsersApi extends GeneratedUsersApi { ) const url = `${host}${BASE_PATH}${path}` const response = await fetch(url, { - method: 'GET' + method: 'GET', + headers: headerParameters }) return response.blob() } @@ -251,12 +292,52 @@ export class UsersApi extends GeneratedUsersApi { ) } + if ( + params.encodedDataMessage === null || + params.encodedDataMessage === undefined + ) { + throw new runtime.RequiredError( + 'encodedDataMessage', + 'Required parameter params.encodedDataMessage was null or undefined when calling downloadPurchasesAsCSV.' + ) + } + + if ( + params.encodedDataSignature === null || + params.encodedDataSignature === undefined + ) { + throw new runtime.RequiredError( + 'encodedDataSignature', + 'Required parameter params.encodedDataSignature was null or undefined when calling downloadPurchasesAsCSV.' + ) + } + const queryParameters: any = {} if (params.userId !== undefined) { queryParameters.user_id = params.userId } + const headerParameters: runtime.HTTPHeaders = {} + + if ( + params.encodedDataMessage !== undefined && + params.encodedDataMessage !== null + ) { + headerParameters['Encoded-Data-Message'] = String( + params.encodedDataMessage + ) + } + + if ( + params.encodedDataSignature !== undefined && + params.encodedDataSignature !== null + ) { + headerParameters['Encoded-Data-Signature'] = String( + params.encodedDataSignature + ) + } + const host = await this.discoveryNodeSelectorService.getSelectedEndpoint() const path = `/users/{id}/purchases/download`.replace( `{${'id'}}`, @@ -264,7 +345,8 @@ export class UsersApi extends GeneratedUsersApi { ) const url = `${host}${BASE_PATH}${path}` const response = await fetch(url, { - method: 'GET' + method: 'GET', + headers: headerParameters }) return response.blob() } @@ -282,6 +364,26 @@ export class UsersApi extends GeneratedUsersApi { ) } + if ( + params.encodedDataMessage === null || + params.encodedDataMessage === undefined + ) { + throw new runtime.RequiredError( + 'encodedDataMessage', + 'Required parameter params.encodedDataMessage was null or undefined when calling downloadUSDCWithdrawalsAsCSV.' + ) + } + + if ( + params.encodedDataSignature === null || + params.encodedDataSignature === undefined + ) { + throw new runtime.RequiredError( + 'encodedDataSignature', + 'Required parameter params.encodedDataSignature was null or undefined when calling downloadUSDCWithdrawalsAsCSV.' + ) + } + const queryParameters: any = {} if (params.userId !== undefined) { @@ -290,6 +392,24 @@ export class UsersApi extends GeneratedUsersApi { const headerParameters: runtime.HTTPHeaders = {} + if ( + params.encodedDataMessage !== undefined && + params.encodedDataMessage !== null + ) { + headerParameters['Encoded-Data-Message'] = String( + params.encodedDataMessage + ) + } + + if ( + params.encodedDataSignature !== undefined && + params.encodedDataSignature !== null + ) { + headerParameters['Encoded-Data-Signature'] = String( + params.encodedDataSignature + ) + } + const host = await this.discoveryNodeSelectorService.getSelectedEndpoint() const path = `/users/{id}/withdrawals/download`.replace( `{${'id'}}`,