diff --git a/packages/discovery-provider/src/api/v1/transactions.py b/packages/discovery-provider/src/api/v1/transactions.py index 739443b78cc..de48d4a5674 100644 --- a/packages/discovery-provider/src/api/v1/transactions.py +++ b/packages/discovery-provider/src/api/v1/transactions.py @@ -71,9 +71,9 @@ class GetTransactionHistory(Resource): description="""Gets the user's $AUDIO transaction history within the App""", params={"id": "A User ID"}, ) + @auth_middleware(transaction_history_parser) @full_user_ns.expect(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) @@ -102,9 +102,9 @@ class LegacyGetTransactionHistory(GetTransactionHistory): id="""Get Audio Transaction History""", deprecated=True, ) + @auth_middleware(transaction_history_parser) @full_ns.expect(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 @@ -129,9 +129,9 @@ class GetTransactionHistoryCount(Resource): description="""Gets the count of the user's $AUDIO transaction history within the App""", params={"id": "A User ID"}, ) + @auth_middleware(transaction_history_count_parser) @full_user_ns.expect(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: @@ -149,9 +149,9 @@ class LegacyGetTransactionHistoryCount(Resource): id="""Get Audio Transaction History Count""", deprecated=True, ) + @auth_middleware(transaction_history_count_parser) @full_ns.expect(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. @@ -203,9 +203,9 @@ class GetUSDCTransactionHistory(Resource): description="""Gets the user's $USDC transaction history within the App""", params={"id": "A User ID"}, ) + @auth_middleware(usdc_transaction_history_parser) @full_user_ns.expect(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: @@ -243,9 +243,9 @@ class GetUSDCTransactionHistoryCount(Resource): description="""Gets the count of the user's $USDC transaction history within the App""", params={"id": "A User ID"}, ) + @auth_middleware(usdc_transaction_history_count_parser) @full_user_ns.expect(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..1081e7ef61f 100644 --- a/packages/discovery-provider/src/api/v1/users.py +++ b/packages/discovery-provider/src/api/v1/users.py @@ -342,9 +342,9 @@ class TrackList(Resource): }, responses={200: "Success", 400: "Bad request", 500: "Server error"}, ) + @auth_middleware(user_tracks_route_parser) @ns.expect(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) @@ -400,9 +400,9 @@ class FullTrackList(Resource): }, responses={200: "Success", 400: "Bad request", 500: "Server error"}, ) + @auth_middleware(user_tracks_route_parser) @full_ns.expect(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""", @@ -490,6 +489,7 @@ def _get(self, handle, authed_user_id=None): }, responses={200: "Success", 400: "Bad request", 500: "Server error"}, ) + @auth_middleware(user_tracks_route_parser) @full_ns.expect(user_tracks_route_parser) @full_ns.marshal_with(full_tracks_response) def get(self, handle, authed_user_id=None): @@ -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""", @@ -507,6 +506,7 @@ class HandleTrackList(HandleFullTrackList): }, responses={200: "Success", 400: "Bad request", 500: "Server error"}, ) + @auth_middleware(user_tracks_route_parser) @ns.expect(user_tracks_route_parser) @ns.marshal_with(tracks_response) def get(self, 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""", @@ -559,6 +558,7 @@ def _get(self, handle, authed_user_id=None): }, responses={200: "Success", 400: "Bad request", 500: "Server error"}, ) + @auth_middleware(user_tracks_route_parser) @full_ns.expect(user_tracks_route_parser) @full_ns.marshal_with(full_tracks_response) def get(self, handle, authed_user_id=None): @@ -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""", @@ -576,6 +575,7 @@ class HandleAITrackList(HandleFullAITrackList): }, responses={200: "Success", 400: "Bad request", 500: "Server error"}, ) + @auth_middleware(user_tracks_route_parser) @ns.expect(user_tracks_route_parser) @ns.marshal_with(tracks_response) def get(self, handle, authed_user_id): @@ -807,9 +807,9 @@ class UserTracksLibraryFull(Resource): params={"id": "A user ID"}, responses={200: "Success", 400: "Bad request", 500: "Server error"}, ) + @auth_middleware(user_tracks_library_parser) @full_ns.expect(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.""" @@ -882,9 +882,9 @@ class UserPlaylistsLibraryFull(Resource): params={"id": "A user ID"}, responses={200: "Success", 400: "Bad request", 500: "Server error"}, ) + @auth_middleware(user_collections_library_parser) @full_ns.expect(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.""" @@ -900,9 +900,9 @@ class UserAlbumsLibraryFull(Resource): params={"id": "A user ID"}, responses={200: "Success", 400: "Bad request", 500: "Server error"}, ) + @auth_middleware(user_collections_library_parser) @full_ns.expect(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() @@ -1037,6 +1036,7 @@ def _get(self, id, authed_user_id): params={"id": "A User ID"}, responses={200: "Success", 400: "Bad request", 500: "Server error"}, ) + @auth_middleware(track_history_parser) @full_ns.expect(track_history_parser) @full_ns.marshal_with(history_response_full) def get(self, id): @@ -1051,9 +1051,9 @@ class TrackHistory(TrackHistoryFull): params={"id": "A User ID"}, responses={200: "Success", 400: "Bad request", 500: "Server error"}, ) + @auth_middleware(track_history_parser) @ns.expect(track_history_parser) @ns.marshal_with(history_response) - @auth_middleware() def get(self, id, authed_user_id): return super()._get(id, authed_user_id) @@ -2142,9 +2142,9 @@ class FullPurchases(Resource): description="Gets the purchases the user has made", params={"id": "A User ID"}, ) + @auth_middleware(purchases_and_sales_parser) @full_ns.expect(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: @@ -2172,9 +2172,9 @@ class FullPurchasesCount(Resource): description="Gets the count of purchases the user has made", params={"id": "A User ID"}, ) + @auth_middleware(purchases_and_sales_count_parser) @full_ns.expect(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: @@ -2194,9 +2194,9 @@ class FullSales(Resource): description="Gets the sales the user has made", params={"id": "A User ID"}, ) + @auth_middleware(purchases_and_sales_parser) @full_ns.expect(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: @@ -2224,9 +2224,9 @@ class FullSalesCount(Resource): description="Gets the count of sales the user has made", params={"id": "A User ID"}, ) + @auth_middleware(purchases_and_sales_count_parser) @full_ns.expect(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: @@ -2250,8 +2250,8 @@ class FullPurchasesDownload(Resource): params={"id": "A User ID"}, ) @ns.produces(["text/csv"]) + @auth_middleware(csv_download_parser) @ns.expect(csv_download_parser) - @auth_middleware() def get(self, id, authed_user_id=None): decoded_id = decode_with_abort(id, ns) if decoded_id != authed_user_id: @@ -2271,8 +2271,8 @@ class FullSalesDownload(Resource): params={"id": "A User ID"}, ) @ns.produces(["text/csv"]) + @auth_middleware(csv_download_parser) @ns.expect(csv_download_parser) - @auth_middleware() def get(self, id, authed_user_id=None): decoded_id = decode_with_abort(id, ns) if decoded_id != authed_user_id: @@ -2292,8 +2292,8 @@ class FullWithdrawalsDownload(Resource): params={"id": "A User ID"}, ) @ns.produces(["text/csv"]) + @auth_middleware(csv_download_parser) @ns.expect(csv_download_parser) - @auth_middleware() 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..c2df87680ab 100644 --- a/packages/discovery-provider/src/utils/auth_middleware.py +++ b/packages/discovery-provider/src/utils/auth_middleware.py @@ -1,8 +1,10 @@ import functools import logging +from typing import Optional 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 +15,49 @@ SIGNATURE_HEADER = "Encoded-Data-Signature" -def auth_middleware(**kwargs): +def auth_middleware(parser: Optional[reqparse.RequestParser]): """ 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. + + @auth_middleware(request_parser) + @ns.expect(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 decorator(func): + if parser: + parser.add_argument( + MESSAGE_HEADER, + required=True, + description="The data that was signed by the user for signature recovery", + location="headers", + ) + parser.add_argument( + SIGNATURE_HEADER, + required=True, + description="The signature of data, used for signature recovery", + location="headers", + ) - def outer_wrap(func): + # @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..067beef77a3 100644 --- a/packages/libs/src/sdk/api/generated/default/apis/UsersApi.ts +++ b/packages/libs/src/sdk/api/generated/default/apis/UsersApi.ts @@ -78,16 +78,22 @@ export interface DownloadPurchasesAsCSVRequest { export interface DownloadSalesAsCSVRequest { id: string; + encodedDataMessage: string; + encodedDataSignature: string; userId?: string; } export interface DownloadUSDCWithdrawalsAsCSVRequest { id: string; + encodedDataMessage: string; + encodedDataSignature: string; userId?: string; } export interface GetAIAttributedTracksByUserHandleRequest { handle: string; + encodedDataMessage: string; + encodedDataSignature: string; offset?: number; limit?: number; userId?: string; @@ -248,6 +254,14 @@ export class UsersApi extends runtime.BaseAPI { throw new runtime.RequiredError('id','Required parameter params.id was null or undefined when calling downloadSalesAsCSV.'); } + 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) { @@ -256,6 +270,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', @@ -282,6 +304,14 @@ export class UsersApi extends runtime.BaseAPI { throw new runtime.RequiredError('id','Required parameter params.id was null or undefined when calling downloadUSDCWithdrawalsAsCSV.'); } + 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 +320,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', @@ -316,6 +354,14 @@ export class UsersApi extends runtime.BaseAPI { throw new runtime.RequiredError('handle','Required parameter params.handle was null or undefined when calling getAIAttributedTracksByUserHandle.'); } + if (params.encodedDataMessage === null || params.encodedDataMessage === undefined) { + throw new runtime.RequiredError('encodedDataMessage','Required parameter params.encodedDataMessage was null or undefined when calling getAIAttributedTracksByUserHandle.'); + } + + if (params.encodedDataSignature === null || params.encodedDataSignature === undefined) { + throw new runtime.RequiredError('encodedDataSignature','Required parameter params.encodedDataSignature was null or undefined when calling getAIAttributedTracksByUserHandle.'); + } + const queryParameters: any = {}; if (params.offset !== undefined) { @@ -352,6 +398,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', 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..3b7f43418a0 100644 --- a/packages/libs/src/sdk/api/generated/full/apis/TransactionsApi.ts +++ b/packages/libs/src/sdk/api/generated/full/apis/TransactionsApi.ts @@ -27,12 +27,19 @@ import { } from '../models'; export interface GetAudioTransactionHistoryRequest { + encodedDataMessage: string; + encodedDataSignature: string; offset?: number; limit?: number; sortMethod?: GetAudioTransactionHistorySortMethodEnum; sortDirection?: GetAudioTransactionHistorySortDirectionEnum; } +export interface GetAudioTransactionHistoryCountRequest { + encodedDataMessage: string; + encodedDataSignature: string; +} + /** * */ @@ -45,6 +52,14 @@ export class TransactionsApi extends runtime.BaseAPI { * Gets the user\'s $AUDIO transaction history within the App */ async getAudioTransactionHistoryRaw(params: GetAudioTransactionHistoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (params.encodedDataMessage === null || params.encodedDataMessage === undefined) { + throw new runtime.RequiredError('encodedDataMessage','Required parameter params.encodedDataMessage was null or undefined when calling getAudioTransactionHistory.'); + } + + if (params.encodedDataSignature === null || params.encodedDataSignature === undefined) { + throw new runtime.RequiredError('encodedDataSignature','Required parameter params.encodedDataSignature was null or undefined when calling getAudioTransactionHistory.'); + } + const queryParameters: any = {}; if (params.offset !== undefined) { @@ -65,6 +80,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', @@ -80,7 +103,7 @@ export class TransactionsApi extends runtime.BaseAPI { * Deprecated: Use `/users/{id}/transactions/audio` or `sdk.full.users.getAudioTransactions()` instead. * Gets the user\'s $AUDIO transaction history within the App */ - async getAudioTransactionHistory(params: GetAudioTransactionHistoryRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + async getAudioTransactionHistory(params: GetAudioTransactionHistoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getAudioTransactionHistoryRaw(params, initOverrides); return await response.value(); } @@ -91,11 +114,27 @@ 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> { + if (params.encodedDataMessage === null || params.encodedDataMessage === undefined) { + throw new runtime.RequiredError('encodedDataMessage','Required parameter params.encodedDataMessage was null or undefined when calling getAudioTransactionHistoryCount.'); + } + + if (params.encodedDataSignature === null || params.encodedDataSignature === undefined) { + throw new runtime.RequiredError('encodedDataSignature','Required parameter params.encodedDataSignature was null or undefined when calling getAudioTransactionHistoryCount.'); + } + 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 +150,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..7d633070650 100644 --- a/packages/libs/src/sdk/api/generated/full/apis/UsersApi.ts +++ b/packages/libs/src/sdk/api/generated/full/apis/UsersApi.ts @@ -93,6 +93,8 @@ export interface BulkGetSubscribersViaJSONRequestRequest { export interface GetAIAttributedTracksByUserHandleRequest { handle: string; + encodedDataMessage: string; + encodedDataSignature: string; offset?: number; limit?: number; userId?: string; @@ -176,6 +178,8 @@ export interface GetRepostsByHandleRequest { export interface GetSalesRequest { id: string; + encodedDataMessage: string; + encodedDataSignature: string; offset?: number; limit?: number; userId?: string; @@ -185,6 +189,8 @@ export interface GetSalesRequest { export interface GetSalesCountRequest { id: string; + encodedDataMessage: string; + encodedDataSignature: string; userId?: string; } @@ -235,6 +241,8 @@ export interface GetTopUsersInGenreRequest { export interface GetTracksByUserRequest { id: string; + encodedDataMessage: string; + encodedDataSignature: string; offset?: number; limit?: number; userId?: string; @@ -247,6 +255,8 @@ export interface GetTracksByUserRequest { export interface GetTracksByUserHandleRequest { handle: string; + encodedDataMessage: string; + encodedDataSignature: string; offset?: number; limit?: number; userId?: string; @@ -259,8 +269,6 @@ export interface GetTracksByUserHandleRequest { export interface GetUSDCTransactionCountRequest { id: string; - encodedDataMessage: string; - encodedDataSignature: string; type?: Array; includeSystemTransactions?: boolean; method?: GetUSDCTransactionCountMethodEnum; @@ -268,6 +276,8 @@ export interface GetUSDCTransactionCountRequest { export interface GetUSDCTransactionsRequest { id: string; + encodedDataMessage: string; + encodedDataSignature: string; offset?: number; limit?: number; sortMethod?: GetUSDCTransactionsSortMethodEnum; @@ -289,6 +299,8 @@ export interface GetUserByHandleRequest { export interface GetUserLibraryAlbumsRequest { id: string; + encodedDataMessage: string; + encodedDataSignature: string; offset?: number; limit?: number; userId?: string; @@ -419,6 +431,14 @@ export class UsersApi extends runtime.BaseAPI { throw new runtime.RequiredError('handle','Required parameter params.handle was null or undefined when calling getAIAttributedTracksByUserHandle.'); } + if (params.encodedDataMessage === null || params.encodedDataMessage === undefined) { + throw new runtime.RequiredError('encodedDataMessage','Required parameter params.encodedDataMessage was null or undefined when calling getAIAttributedTracksByUserHandle.'); + } + + if (params.encodedDataSignature === null || params.encodedDataSignature === undefined) { + throw new runtime.RequiredError('encodedDataSignature','Required parameter params.encodedDataSignature was null or undefined when calling getAIAttributedTracksByUserHandle.'); + } + const queryParameters: any = {}; if (params.offset !== undefined) { @@ -455,6 +475,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', @@ -916,6 +944,14 @@ export class UsersApi extends runtime.BaseAPI { throw new runtime.RequiredError('id','Required parameter params.id was null or undefined when calling getSales.'); } + if (params.encodedDataMessage === null || params.encodedDataMessage === undefined) { + throw new runtime.RequiredError('encodedDataMessage','Required parameter params.encodedDataMessage was null or undefined when calling getSales.'); + } + + if (params.encodedDataSignature === null || params.encodedDataSignature === undefined) { + throw new runtime.RequiredError('encodedDataSignature','Required parameter params.encodedDataSignature was null or undefined when calling getSales.'); + } + const queryParameters: any = {}; if (params.offset !== undefined) { @@ -940,6 +976,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', @@ -967,6 +1011,14 @@ export class UsersApi extends runtime.BaseAPI { throw new runtime.RequiredError('id','Required parameter params.id was null or undefined when calling getSalesCount.'); } + if (params.encodedDataMessage === null || params.encodedDataMessage === undefined) { + throw new runtime.RequiredError('encodedDataMessage','Required parameter params.encodedDataMessage was null or undefined when calling getSalesCount.'); + } + + if (params.encodedDataSignature === null || params.encodedDataSignature === undefined) { + throw new runtime.RequiredError('encodedDataSignature','Required parameter params.encodedDataSignature was null or undefined when calling getSalesCount.'); + } + const queryParameters: any = {}; if (params.userId !== undefined) { @@ -975,6 +1027,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', @@ -1287,6 +1347,14 @@ export class UsersApi extends runtime.BaseAPI { throw new runtime.RequiredError('id','Required parameter params.id was null or undefined when calling getTracksByUser.'); } + if (params.encodedDataMessage === null || params.encodedDataMessage === undefined) { + throw new runtime.RequiredError('encodedDataMessage','Required parameter params.encodedDataMessage was null or undefined when calling getTracksByUser.'); + } + + if (params.encodedDataSignature === null || params.encodedDataSignature === undefined) { + throw new runtime.RequiredError('encodedDataSignature','Required parameter params.encodedDataSignature was null or undefined when calling getTracksByUser.'); + } + const queryParameters: any = {}; if (params.offset !== undefined) { @@ -1323,6 +1391,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', @@ -1350,6 +1426,14 @@ export class UsersApi extends runtime.BaseAPI { throw new runtime.RequiredError('handle','Required parameter params.handle was null or undefined when calling getTracksByUserHandle.'); } + if (params.encodedDataMessage === null || params.encodedDataMessage === undefined) { + throw new runtime.RequiredError('encodedDataMessage','Required parameter params.encodedDataMessage was null or undefined when calling getTracksByUserHandle.'); + } + + if (params.encodedDataSignature === null || params.encodedDataSignature === undefined) { + throw new runtime.RequiredError('encodedDataSignature','Required parameter params.encodedDataSignature was null or undefined when calling getTracksByUserHandle.'); + } + const queryParameters: any = {}; if (params.offset !== undefined) { @@ -1386,6 +1470,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', @@ -1456,6 +1548,14 @@ export class UsersApi extends runtime.BaseAPI { throw new runtime.RequiredError('id','Required parameter params.id was null or undefined when calling getUSDCTransactions.'); } + if (params.encodedDataMessage === null || params.encodedDataMessage === undefined) { + throw new runtime.RequiredError('encodedDataMessage','Required parameter params.encodedDataMessage was null or undefined when calling getUSDCTransactions.'); + } + + if (params.encodedDataSignature === null || params.encodedDataSignature === undefined) { + throw new runtime.RequiredError('encodedDataSignature','Required parameter params.encodedDataSignature was null or undefined when calling getUSDCTransactions.'); + } + const queryParameters: any = {}; if (params.offset !== undefined) { @@ -1488,6 +1588,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', @@ -1586,6 +1694,14 @@ export class UsersApi extends runtime.BaseAPI { throw new runtime.RequiredError('id','Required parameter params.id was null or undefined when calling getUserLibraryAlbums.'); } + if (params.encodedDataMessage === null || params.encodedDataMessage === undefined) { + throw new runtime.RequiredError('encodedDataMessage','Required parameter params.encodedDataMessage was null or undefined when calling getUserLibraryAlbums.'); + } + + if (params.encodedDataSignature === null || params.encodedDataSignature === undefined) { + throw new runtime.RequiredError('encodedDataSignature','Required parameter params.encodedDataSignature was null or undefined when calling getUserLibraryAlbums.'); + } + const queryParameters: any = {}; if (params.offset !== undefined) { @@ -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', 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)),