From b133d6e988eca62ae444186b0ddf3dc8cfb9a0cc Mon Sep 17 00:00:00 2001 From: Marcus Pasell <3690498+rickyrombo@users.noreply.github.com> Date: Tue, 17 Mar 2026 13:41:31 -0700 Subject: [PATCH 1/6] fix(sdk): rename generator script to .cjs to fix ESM compatibility The SDK package has "type": "module" in package.json, which causes Node to treat .js files as ESM. The generator script uses require() (CJS syntax), so rename it to gen.cjs to fix the runtime error. Co-Authored-By: Claude Sonnet 4.6 --- packages/sdk/package.json | 4 ++-- packages/sdk/src/sdk/api/generator/{gen.js => gen.cjs} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename packages/sdk/src/sdk/api/generator/{gen.js => gen.cjs} (100%) diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 6b1f7b0dbb4..3cd5057fbe8 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -60,8 +60,8 @@ "sdk:config": "tsx ./src/sdk/scripts/generateServicesConfig.ts", "sdk:verify-user": "tsx ./src/sdk/scripts/verifyUser.ts", "gen": "npm run gen:prod", - "gen:dev": "node ./src/sdk/api/generator/gen.js --env dev", - "gen:prod": "node ./src/sdk/api/generator/gen.js", + "gen:dev": "node ./src/sdk/api/generator/gen.cjs --env dev", + "gen:prod": "node ./src/sdk/api/generator/gen.cjs", "prepare": "patch-package", "prepack": "turbo run build" }, diff --git a/packages/sdk/src/sdk/api/generator/gen.js b/packages/sdk/src/sdk/api/generator/gen.cjs similarity index 100% rename from packages/sdk/src/sdk/api/generator/gen.js rename to packages/sdk/src/sdk/api/generator/gen.cjs From 93aaaba0de3647d007e1c52dd81d47c5720c6f8c Mon Sep 17 00:00:00 2001 From: Marcus Pasell <3690498+rickyrombo@users.noreply.github.com> Date: Tue, 17 Mar 2026 13:42:14 -0700 Subject: [PATCH 2/6] feat(sdk): regenerate API types, add OauthApi for /oauth/me endpoint Regenerated SDK types from updated swagger spec that adds /oauth/me as a documented endpoint. This adds the new OauthApi class and updates other generated API files. Co-Authored-By: Claude Sonnet 4.6 --- .../default/.openapi-generator/FILES | 1 + .../generated/default/apis/ChallengesApi.ts | 10 + .../api/generated/default/apis/CommentsApi.ts | 45 +++ .../default/apis/DeveloperAppsApi.ts | 5 + .../api/generated/default/apis/EventsApi.ts | 15 + .../api/generated/default/apis/ExploreApi.ts | 5 + .../api/generated/default/apis/OauthApi.ts | 64 ++++ .../generated/default/apis/PlaylistsApi.ts | 75 +++++ .../api/generated/default/apis/SearchApi.ts | 15 + .../sdk/api/generated/default/apis/TipsApi.ts | 5 + .../api/generated/default/apis/TracksApi.ts | 200 ++++++++++++ .../api/generated/default/apis/UsersApi.ts | 290 ++++++++++++++++++ .../sdk/api/generated/default/apis/index.ts | 1 + .../src/sdk/api/generated/default/runtime.ts | 2 +- 14 files changed, 732 insertions(+), 1 deletion(-) create mode 100644 packages/sdk/src/sdk/api/generated/default/apis/OauthApi.ts diff --git a/packages/sdk/src/sdk/api/generated/default/.openapi-generator/FILES b/packages/sdk/src/sdk/api/generated/default/.openapi-generator/FILES index a6f4a5f9dc1..baea29b8df7 100644 --- a/packages/sdk/src/sdk/api/generated/default/.openapi-generator/FILES +++ b/packages/sdk/src/sdk/api/generated/default/.openapi-generator/FILES @@ -8,6 +8,7 @@ apis/DeveloperAppsApi.ts apis/EventsApi.ts apis/ExploreApi.ts apis/NotificationsApi.ts +apis/OauthApi.ts apis/PlaylistsApi.ts apis/PrizesApi.ts apis/ReactionsApi.ts diff --git a/packages/sdk/src/sdk/api/generated/default/apis/ChallengesApi.ts b/packages/sdk/src/sdk/api/generated/default/apis/ChallengesApi.ts index 3d29e91ea42..4a0c7e730ab 100644 --- a/packages/sdk/src/sdk/api/generated/default/apis/ChallengesApi.ts +++ b/packages/sdk/src/sdk/api/generated/default/apis/ChallengesApi.ts @@ -90,6 +90,11 @@ export class ChallengesApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/challenges/{challenge_id}/attest`.replace(`{${"challenge_id"}}`, encodeURIComponent(String(params.challengeId))), method: 'GET', @@ -137,6 +142,11 @@ export class ChallengesApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/challenges/undisbursed`, method: 'GET', diff --git a/packages/sdk/src/sdk/api/generated/default/apis/CommentsApi.ts b/packages/sdk/src/sdk/api/generated/default/apis/CommentsApi.ts index 2efe4fc2709..4ef7b9f42a0 100644 --- a/packages/sdk/src/sdk/api/generated/default/apis/CommentsApi.ts +++ b/packages/sdk/src/sdk/api/generated/default/apis/CommentsApi.ts @@ -130,6 +130,11 @@ export class CommentsApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -181,6 +186,11 @@ export class CommentsApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -266,6 +276,11 @@ export class CommentsApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/comments/{comment_id}/replies`.replace(`{${"comment_id"}}`, encodeURIComponent(String(params.commentId))), method: 'GET', @@ -338,6 +353,11 @@ export class CommentsApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -395,6 +415,11 @@ export class CommentsApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -446,6 +471,11 @@ export class CommentsApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -502,6 +532,11 @@ export class CommentsApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -559,6 +594,11 @@ export class CommentsApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -616,6 +656,11 @@ export class CommentsApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } diff --git a/packages/sdk/src/sdk/api/generated/default/apis/DeveloperAppsApi.ts b/packages/sdk/src/sdk/api/generated/default/apis/DeveloperAppsApi.ts index eef2cabd4b0..a368f62329a 100644 --- a/packages/sdk/src/sdk/api/generated/default/apis/DeveloperAppsApi.ts +++ b/packages/sdk/src/sdk/api/generated/default/apis/DeveloperAppsApi.ts @@ -358,6 +358,11 @@ export class DeveloperAppsApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } diff --git a/packages/sdk/src/sdk/api/generated/default/apis/EventsApi.ts b/packages/sdk/src/sdk/api/generated/default/apis/EventsApi.ts index d38ca58844f..acd74a46dea 100644 --- a/packages/sdk/src/sdk/api/generated/default/apis/EventsApi.ts +++ b/packages/sdk/src/sdk/api/generated/default/apis/EventsApi.ts @@ -83,6 +83,11 @@ export class EventsApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/events/all`, method: 'GET', @@ -123,6 +128,11 @@ export class EventsApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/events`, method: 'GET', @@ -179,6 +189,11 @@ export class EventsApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/events/entity`, method: 'GET', diff --git a/packages/sdk/src/sdk/api/generated/default/apis/ExploreApi.ts b/packages/sdk/src/sdk/api/generated/default/apis/ExploreApi.ts index 0ed5bcfe39f..9776f49664b 100644 --- a/packages/sdk/src/sdk/api/generated/default/apis/ExploreApi.ts +++ b/packages/sdk/src/sdk/api/generated/default/apis/ExploreApi.ts @@ -60,6 +60,11 @@ export class ExploreApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/explore/best-selling`, method: 'GET', diff --git a/packages/sdk/src/sdk/api/generated/default/apis/OauthApi.ts b/packages/sdk/src/sdk/api/generated/default/apis/OauthApi.ts new file mode 100644 index 00000000000..4b7d34fa3e2 --- /dev/null +++ b/packages/sdk/src/sdk/api/generated/default/apis/OauthApi.ts @@ -0,0 +1,64 @@ +/* tslint:disable */ +// @ts-nocheck +/* eslint-disable */ +/** + * Audius API + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import type { + UserResponseSingle, +} from '../models'; +import { + UserResponseSingleFromJSON, + UserResponseSingleToJSON, +} from '../models'; + +/** + * + */ +export class OauthApi extends runtime.BaseAPI { + + /** + * @hidden + * Returns the full profile of the currently authenticated user based on the Bearer access token obtained via OAuth. + * Get authenticated user + */ + async getAuthenticatedUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + + const response = await this.request({ + path: `/oauth/me`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => UserResponseSingleFromJSON(jsonValue)); + } + + /** + * Returns the full profile of the currently authenticated user based on the Bearer access token obtained via OAuth. + * Get authenticated user + */ + async getAuthenticatedUser(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getAuthenticatedUserRaw(initOverrides); + return await response.value(); + } + +} diff --git a/packages/sdk/src/sdk/api/generated/default/apis/PlaylistsApi.ts b/packages/sdk/src/sdk/api/generated/default/apis/PlaylistsApi.ts index 0dfccee9dab..e1f889e6b34 100644 --- a/packages/sdk/src/sdk/api/generated/default/apis/PlaylistsApi.ts +++ b/packages/sdk/src/sdk/api/generated/default/apis/PlaylistsApi.ts @@ -189,6 +189,11 @@ export class PlaylistsApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -240,6 +245,11 @@ export class PlaylistsApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -292,6 +302,11 @@ export class PlaylistsApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -347,6 +362,11 @@ export class PlaylistsApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/playlists`, method: 'GET', @@ -382,6 +402,11 @@ export class PlaylistsApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/playlists/{playlist_id}`.replace(`{${"playlist_id"}}`, encodeURIComponent(String(params.playlistId))), method: 'GET', @@ -417,6 +442,11 @@ export class PlaylistsApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/playlists/{playlist_id}/access-info`.replace(`{${"playlist_id"}}`, encodeURIComponent(String(params.playlistId))), method: 'GET', @@ -499,6 +529,11 @@ export class PlaylistsApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/playlists/trending`, method: 'GET', @@ -546,6 +581,11 @@ export class PlaylistsApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/playlists/trending/{version}`.replace(`{${"version"}}`, encodeURIComponent(String(params.version))), method: 'GET', @@ -589,6 +629,11 @@ export class PlaylistsApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/playlists/{playlist_id}/favorites`.replace(`{${"playlist_id"}}`, encodeURIComponent(String(params.playlistId))), method: 'GET', @@ -632,6 +677,11 @@ export class PlaylistsApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/playlists/{playlist_id}/reposts`.replace(`{${"playlist_id"}}`, encodeURIComponent(String(params.playlistId))), method: 'GET', @@ -673,6 +723,11 @@ export class PlaylistsApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -783,6 +838,11 @@ export class PlaylistsApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -833,6 +893,11 @@ export class PlaylistsApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -883,6 +948,11 @@ export class PlaylistsApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -939,6 +1009,11 @@ export class PlaylistsApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } diff --git a/packages/sdk/src/sdk/api/generated/default/apis/SearchApi.ts b/packages/sdk/src/sdk/api/generated/default/apis/SearchApi.ts index 188e4244420..09617623d80 100644 --- a/packages/sdk/src/sdk/api/generated/default/apis/SearchApi.ts +++ b/packages/sdk/src/sdk/api/generated/default/apis/SearchApi.ts @@ -153,6 +153,11 @@ export class SearchApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/search/full`, method: 'GET', @@ -241,6 +246,11 @@ export class SearchApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/search/autocomplete`, method: 'GET', @@ -329,6 +339,11 @@ export class SearchApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/search/tags`, method: 'GET', diff --git a/packages/sdk/src/sdk/api/generated/default/apis/TipsApi.ts b/packages/sdk/src/sdk/api/generated/default/apis/TipsApi.ts index 62677cd6957..4abbf600586 100644 --- a/packages/sdk/src/sdk/api/generated/default/apis/TipsApi.ts +++ b/packages/sdk/src/sdk/api/generated/default/apis/TipsApi.ts @@ -89,6 +89,11 @@ export class TipsApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tips`, method: 'GET', diff --git a/packages/sdk/src/sdk/api/generated/default/apis/TracksApi.ts b/packages/sdk/src/sdk/api/generated/default/apis/TracksApi.ts index 3a95a90307e..b16b1f6ed3c 100644 --- a/packages/sdk/src/sdk/api/generated/default/apis/TracksApi.ts +++ b/packages/sdk/src/sdk/api/generated/default/apis/TracksApi.ts @@ -437,6 +437,11 @@ export class TracksApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -488,6 +493,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -551,6 +561,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/{track_id}/download`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), method: 'GET', @@ -592,6 +607,11 @@ export class TracksApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -651,6 +671,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/best_new_releases`, method: 'GET', @@ -694,6 +719,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks`, method: 'GET', @@ -737,6 +767,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/feeling-lucky`, method: 'GET', @@ -776,6 +811,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/most_loved`, method: 'GET', @@ -819,6 +859,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/most-shared`, method: 'GET', @@ -858,6 +903,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/recent-premium`, method: 'GET', @@ -905,6 +955,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/recommended`, method: 'GET', @@ -956,6 +1011,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/recommended/{version}`.replace(`{${"version"}}`, encodeURIComponent(String(params.version))), method: 'GET', @@ -995,6 +1055,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/remixables`, method: 'GET', @@ -1030,6 +1095,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/{track_id}`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), method: 'GET', @@ -1065,6 +1135,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/{track_id}/access-info`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), method: 'GET', @@ -1100,6 +1175,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/{track_id}/comment_count`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), method: 'GET', @@ -1135,6 +1215,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/{track_id}/comment_notification_setting`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), method: 'GET', @@ -1182,6 +1267,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/{track_id}/comments`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), method: 'GET', @@ -1225,6 +1315,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/{track_id}/remixing`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), method: 'GET', @@ -1280,6 +1375,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/{track_id}/remixes`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), method: 'GET', @@ -1354,6 +1454,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/{track_id}/top_listeners`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), method: 'GET', @@ -1393,6 +1498,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/recent-comments`, method: 'GET', @@ -1479,6 +1589,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/trending`, method: 'GET', @@ -1573,6 +1688,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/trending/{version}`.replace(`{${"version"}}`, encodeURIComponent(String(params.version))), method: 'GET', @@ -1620,6 +1740,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/usdc-purchase`, method: 'GET', @@ -1671,6 +1796,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/usdc-purchase/{version}`.replace(`{${"version"}}`, encodeURIComponent(String(params.version))), method: 'GET', @@ -1706,6 +1836,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/trending/underground/winners`, method: 'GET', @@ -1741,6 +1876,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/trending/winners`, method: 'GET', @@ -1792,6 +1932,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/under_the_radar`, method: 'GET', @@ -1831,6 +1976,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/trending/underground`, method: 'GET', @@ -1874,6 +2024,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/trending/underground/{version}`.replace(`{${"version"}}`, encodeURIComponent(String(params.version))), method: 'GET', @@ -1917,6 +2072,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/{track_id}/favorites`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), method: 'GET', @@ -1960,6 +2120,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/{track_id}/reposts`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), method: 'GET', @@ -2075,6 +2240,11 @@ export class TracksApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -2128,6 +2298,11 @@ export class TracksApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -2258,6 +2433,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -2337,6 +2517,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/tracks/{track_id}/stream`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), method: 'GET', @@ -2377,6 +2562,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -2427,6 +2617,11 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -2483,6 +2678,11 @@ export class TracksApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } diff --git a/packages/sdk/src/sdk/api/generated/default/apis/UsersApi.ts b/packages/sdk/src/sdk/api/generated/default/apis/UsersApi.ts index bbd1074fcaa..6d1ca1b3f08 100644 --- a/packages/sdk/src/sdk/api/generated/default/apis/UsersApi.ts +++ b/packages/sdk/src/sdk/api/generated/default/apis/UsersApi.ts @@ -818,6 +818,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -867,6 +872,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -986,6 +996,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -1031,6 +1046,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -1086,6 +1106,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); } + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/purchases/download`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -1128,6 +1153,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); } + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/sales/download`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -1174,6 +1204,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); } + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/sales/download/json`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -1217,6 +1252,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); } + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/withdrawals/download`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -1255,6 +1295,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -1337,6 +1382,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); } + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/handle/{handle}/tracks/ai_attributed`.replace(`{${"handle"}}`, encodeURIComponent(String(params.handle))), method: 'GET', @@ -1396,6 +1446,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); } + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/albums`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -1556,6 +1611,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users`, method: 'GET', @@ -1630,6 +1690,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/followers`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -1673,6 +1738,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/following`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -1849,6 +1919,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/mutuals`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -1908,6 +1983,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); } + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/playlists`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -1959,6 +2039,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/purchasers`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -2010,6 +2095,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/purchasers/count`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -2073,6 +2163,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); } + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/purchases`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -2120,6 +2215,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); } + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/purchases/count`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -2167,6 +2267,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/related`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -2214,6 +2319,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/remixers`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -2253,6 +2363,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/remixers/count`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -2296,6 +2411,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/reposts`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -2339,6 +2459,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/handle/{handle}/reposts`.replace(`{${"handle"}}`, encodeURIComponent(String(params.handle))), method: 'GET', @@ -2402,6 +2527,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); } + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/sales`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -2453,6 +2583,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); } + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/sales/aggregate`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -2500,6 +2635,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); } + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/sales/count`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -2543,6 +2683,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/subscribers`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -2586,6 +2731,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/supporting`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -2625,6 +2775,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/supporters/{supporter_user_id}`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))).replace(`{${"supporter_user_id"}}`, encodeURIComponent(String(params.supporterUserId))), method: 'GET', @@ -2668,6 +2823,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/supporters`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -2707,6 +2867,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/supporting/{supported_user_id}`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))).replace(`{${"supported_user_id"}}`, encodeURIComponent(String(params.supportedUserId))), method: 'GET', @@ -2747,6 +2912,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/tags`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -2787,6 +2957,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/top`, method: 'GET', @@ -2901,6 +3076,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); } + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/tracks`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -2972,6 +3152,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); } + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/handle/{handle}/tracks`.replace(`{${"handle"}}`, encodeURIComponent(String(params.handle))), method: 'GET', @@ -3023,6 +3208,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); } + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/tracks/count`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -3176,6 +3366,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -3270,6 +3465,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); } + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/balance/history`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -3305,6 +3505,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/handle/{handle}`.replace(`{${"handle"}}`, encodeURIComponent(String(params.handle))), method: 'GET', @@ -3488,6 +3693,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/comments`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -3578,6 +3788,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/favorites/tracks`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -3676,6 +3891,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); } + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/feed`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -3779,6 +3999,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); } + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/library/albums`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -3848,6 +4073,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); } + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/library/playlists`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -3917,6 +4147,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); } + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/library/tracks`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -4012,6 +4247,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/recommended-tracks`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -4055,6 +4295,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/tracks/remixed`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -4118,6 +4363,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); } + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + const response = await this.request({ path: `/users/{id}/history/tracks`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), method: 'GET', @@ -4157,6 +4407,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -4203,6 +4458,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -4249,6 +4509,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -4350,6 +4615,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -4400,6 +4670,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -4450,6 +4725,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -4500,6 +4780,11 @@ export class UsersApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } @@ -4556,6 +4841,11 @@ export class UsersApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["write"]); + } + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } diff --git a/packages/sdk/src/sdk/api/generated/default/apis/index.ts b/packages/sdk/src/sdk/api/generated/default/apis/index.ts index e42b90893e7..6b212bad876 100644 --- a/packages/sdk/src/sdk/api/generated/default/apis/index.ts +++ b/packages/sdk/src/sdk/api/generated/default/apis/index.ts @@ -9,6 +9,7 @@ export * from './DeveloperAppsApi'; export * from './EventsApi'; export * from './ExploreApi'; export * from './NotificationsApi'; +export * from './OauthApi'; export * from './PlaylistsApi'; export * from './PrizesApi'; export * from './ReactionsApi'; diff --git a/packages/sdk/src/sdk/api/generated/default/runtime.ts b/packages/sdk/src/sdk/api/generated/default/runtime.ts index d6de2a77230..b2a0be1082e 100644 --- a/packages/sdk/src/sdk/api/generated/default/runtime.ts +++ b/packages/sdk/src/sdk/api/generated/default/runtime.ts @@ -12,7 +12,7 @@ */ -export const BASE_PATH = "https://api.audius.co/v1".replace(/\/+$/, ""); +export const BASE_PATH = "/v1".replace(/\/+$/, ""); export interface ConfigurationParameters { basePath?: string; // override base path From 0ac8ff8f81013487be84033442f871650ea15f14 Mon Sep 17 00:00:00 2001 From: Marcus Pasell <3690498+rickyrombo@users.noreply.github.com> Date: Tue, 17 Mar 2026 13:42:36 -0700 Subject: [PATCH 3/6] feat(sdk): update OAuth.getUser() to return standard User type The /oauth/me endpoint now returns a standard { data: User } response (matching all other API endpoints) instead of a custom JWT-shaped object. Update getUser() to parse the response with UserFromJSON and return the full User profile instead of DecodedUserToken. Co-Authored-By: Claude Sonnet 4.6 --- packages/sdk/src/sdk/oauth/OAuth.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/sdk/src/sdk/oauth/OAuth.ts b/packages/sdk/src/sdk/oauth/OAuth.ts index ebd2759d9d2..ecf1b6f89c3 100644 --- a/packages/sdk/src/sdk/oauth/OAuth.ts +++ b/packages/sdk/src/sdk/oauth/OAuth.ts @@ -1,5 +1,5 @@ -import type { DecodedUserToken } from '../api/generated/default' -import { FetchError, ResponseError } from '../api/generated/default/runtime' +import { FetchError, ResponseError, UserFromJSON } from '../api/generated/default' +import type { User } from '../api/generated/default' import { Logger, type LoggerService } from '../services/Logger' import { isOAuthScopeValid } from '../utils/oauthScope' @@ -315,7 +315,7 @@ export class OAuth { * if no token is stored or the token has expired), or `FetchError` if the * request fails at the network level. */ - async getUser(): Promise { + async getUser(): Promise { const accessToken = await this.config.tokenStore.getAccessToken() const headers: Record = {} if (accessToken) { @@ -333,7 +333,8 @@ export class OAuth { if (!res.ok) { throw new ResponseError(res, 'Failed to fetch user profile.') } - return (await res.json()) as DecodedUserToken + const json = await res.json() + return UserFromJSON(json.data) } /** From 9f2150337f941fad83cc3c9dadadc0c10bc00b5c Mon Sep 17 00:00:00 2001 From: Marcus Pasell <3690498+rickyrombo@users.noreply.github.com> Date: Tue, 17 Mar 2026 13:59:31 -0700 Subject: [PATCH 4/6] test(sdk): update getUser mock to return { data: User } response shape Co-Authored-By: Claude Sonnet 4.6 --- packages/sdk/src/sdk/oauth/OAuth.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sdk/src/sdk/oauth/OAuth.test.ts b/packages/sdk/src/sdk/oauth/OAuth.test.ts index 74eff04f22b..8f190e7654d 100644 --- a/packages/sdk/src/sdk/oauth/OAuth.test.ts +++ b/packages/sdk/src/sdk/oauth/OAuth.test.ts @@ -536,7 +536,7 @@ describe('OAuth.getUser', () => { const fetchSpy = vi .fn() .mockResolvedValueOnce( - new Response(JSON.stringify(userData), { status: 200 }) + new Response(JSON.stringify({ data: userData }), { status: 200 }) ) vi.stubGlobal('fetch', fetchSpy) From 68a4e47913bb144a11cbb847ce3e2eee8969c77c Mon Sep 17 00:00:00 2001 From: Marcus Pasell <3690498+rickyrombo@users.noreply.github.com> Date: Tue, 17 Mar 2026 17:02:24 -0700 Subject: [PATCH 5/6] regen --- .../default/.openapi-generator/FILES | 4 +- .../api/generated/default/apis/OauthApi.ts | 64 ------------- .../api/generated/default/apis/TracksApi.ts | 90 +++++++++++++++++++ .../api/generated/default/apis/UsersApi.ts | 34 +++++++ .../sdk/api/generated/default/apis/index.ts | 1 - .../models/TrackDownloadCountResponse.ts | 73 +++++++++++++++ .../models/TrackDownloadCountResponseData.ts | 75 ++++++++++++++++ .../models/TrackDownloadCountsResponse.ts | 73 +++++++++++++++ .../sdk/api/generated/default/models/index.ts | 3 + 9 files changed, 351 insertions(+), 66 deletions(-) delete mode 100644 packages/sdk/src/sdk/api/generated/default/apis/OauthApi.ts create mode 100644 packages/sdk/src/sdk/api/generated/default/models/TrackDownloadCountResponse.ts create mode 100644 packages/sdk/src/sdk/api/generated/default/models/TrackDownloadCountResponseData.ts create mode 100644 packages/sdk/src/sdk/api/generated/default/models/TrackDownloadCountsResponse.ts diff --git a/packages/sdk/src/sdk/api/generated/default/.openapi-generator/FILES b/packages/sdk/src/sdk/api/generated/default/.openapi-generator/FILES index baea29b8df7..a5871ad8c49 100644 --- a/packages/sdk/src/sdk/api/generated/default/.openapi-generator/FILES +++ b/packages/sdk/src/sdk/api/generated/default/.openapi-generator/FILES @@ -8,7 +8,6 @@ apis/DeveloperAppsApi.ts apis/EventsApi.ts apis/ExploreApi.ts apis/NotificationsApi.ts -apis/OauthApi.ts apis/PlaylistsApi.ts apis/PrizesApi.ts apis/ReactionsApi.ts @@ -343,6 +342,9 @@ models/TrackArtwork.ts models/TrackCommentCountResponse.ts models/TrackCommentNotificationResponse.ts models/TrackCommentsResponse.ts +models/TrackDownloadCountResponse.ts +models/TrackDownloadCountResponseData.ts +models/TrackDownloadCountsResponse.ts models/TrackDownloadRequestBody.ts models/TrackElementWrite.ts models/TrackFavoritesResponse.ts diff --git a/packages/sdk/src/sdk/api/generated/default/apis/OauthApi.ts b/packages/sdk/src/sdk/api/generated/default/apis/OauthApi.ts deleted file mode 100644 index 4b7d34fa3e2..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/apis/OauthApi.ts +++ /dev/null @@ -1,64 +0,0 @@ -/* tslint:disable */ -// @ts-nocheck -/* eslint-disable */ -/** - * Audius API - * - * The version of the OpenAPI document: 1.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import * as runtime from '../runtime'; -import type { - UserResponseSingle, -} from '../models'; -import { - UserResponseSingleFromJSON, - UserResponseSingleToJSON, -} from '../models'; - -/** - * - */ -export class OauthApi extends runtime.BaseAPI { - - /** - * @hidden - * Returns the full profile of the currently authenticated user based on the Bearer access token obtained via OAuth. - * Get authenticated user - */ - async getAuthenticatedUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.accessToken) { - // oauth required - headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); - } - - const response = await this.request({ - path: `/oauth/me`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => UserResponseSingleFromJSON(jsonValue)); - } - - /** - * Returns the full profile of the currently authenticated user based on the Bearer access token obtained via OAuth. - * Get authenticated user - */ - async getAuthenticatedUser(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getAuthenticatedUserRaw(initOverrides); - return await response.value(); - } - -} diff --git a/packages/sdk/src/sdk/api/generated/default/apis/TracksApi.ts b/packages/sdk/src/sdk/api/generated/default/apis/TracksApi.ts index b16b1f6ed3c..27b905acd55 100644 --- a/packages/sdk/src/sdk/api/generated/default/apis/TracksApi.ts +++ b/packages/sdk/src/sdk/api/generated/default/apis/TracksApi.ts @@ -29,6 +29,8 @@ import type { TrackCommentCountResponse, TrackCommentNotificationResponse, TrackCommentsResponse, + TrackDownloadCountResponse, + TrackDownloadCountsResponse, TrackDownloadRequestBody, TrackFavoritesResponse, TrackInspect, @@ -70,6 +72,10 @@ import { TrackCommentNotificationResponseToJSON, TrackCommentsResponseFromJSON, TrackCommentsResponseToJSON, + TrackDownloadCountResponseFromJSON, + TrackDownloadCountResponseToJSON, + TrackDownloadCountsResponseFromJSON, + TrackDownloadCountsResponseToJSON, TrackDownloadRequestBodyFromJSON, TrackDownloadRequestBodyToJSON, TrackFavoritesResponseFromJSON, @@ -210,6 +216,14 @@ export interface GetTrackCommentsRequest { sortMethod?: GetTrackCommentsSortMethodEnum; } +export interface GetTrackDownloadCountRequest { + trackId: string; +} + +export interface GetTrackDownloadCountsRequest { + id: Array; +} + export interface GetTrackRemixParentsRequest { trackId: string; offset?: number; @@ -1290,6 +1304,82 @@ export class TracksApi extends runtime.BaseAPI { return await response.value(); } + /** + * @hidden + * Gets the download count for a single track. Full track + all stems (parent) or stem-only (stem). + */ + async getTrackDownloadCountRaw(params: GetTrackDownloadCountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (params.trackId === null || params.trackId === undefined) { + throw new runtime.RequiredError('trackId','Required parameter params.trackId was null or undefined when calling getTrackDownloadCount.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + + const response = await this.request({ + path: `/tracks/{track_id}/download_count`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => TrackDownloadCountResponseFromJSON(jsonValue)); + } + + /** + * Gets the download count for a single track. Full track + all stems (parent) or stem-only (stem). + */ + async getTrackDownloadCount(params: GetTrackDownloadCountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getTrackDownloadCountRaw(params, initOverrides); + return await response.value(); + } + + /** + * @hidden + * Gets download counts for tracks by ID. Use this instead of loading full track objects when only download counts are needed. + */ + async getTrackDownloadCountsRaw(params: GetTrackDownloadCountsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (params.id === null || params.id === undefined) { + throw new runtime.RequiredError('id','Required parameter params.id was null or undefined when calling getTrackDownloadCounts.'); + } + + const queryParameters: any = {}; + + if (params.id) { + queryParameters['id'] = params.id; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + + const response = await this.request({ + path: `/tracks/download_counts`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => TrackDownloadCountsResponseFromJSON(jsonValue)); + } + + /** + * Gets download counts for tracks by ID. Use this instead of loading full track objects when only download counts are needed. + */ + async getTrackDownloadCounts(params: GetTrackDownloadCountsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getTrackDownloadCountsRaw(params, initOverrides); + return await response.value(); + } + /** * @hidden * Gets all the tracks that the given track remixes diff --git a/packages/sdk/src/sdk/api/generated/default/apis/UsersApi.ts b/packages/sdk/src/sdk/api/generated/default/apis/UsersApi.ts index 6d1ca1b3f08..d65306e2266 100644 --- a/packages/sdk/src/sdk/api/generated/default/apis/UsersApi.ts +++ b/packages/sdk/src/sdk/api/generated/default/apis/UsersApi.ts @@ -1855,6 +1855,40 @@ export class UsersApi extends runtime.BaseAPI { return await response.value(); } + /** + * @hidden + * Returns the full profile of the currently authenticated user based on the Bearer access token obtained via OAuth. + * Get authenticated user + */ + async getMeRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.accessToken) { + // oauth required + headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["read"]); + } + + const response = await this.request({ + path: `/me`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => UserResponseSingleFromJSON(jsonValue)); + } + + /** + * Returns the full profile of the currently authenticated user based on the Bearer access token obtained via OAuth. + * Get authenticated user + */ + async getMe(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getMeRaw(initOverrides); + return await response.value(); + } + /** * @hidden * Gets users muted by the given user diff --git a/packages/sdk/src/sdk/api/generated/default/apis/index.ts b/packages/sdk/src/sdk/api/generated/default/apis/index.ts index 6b212bad876..e42b90893e7 100644 --- a/packages/sdk/src/sdk/api/generated/default/apis/index.ts +++ b/packages/sdk/src/sdk/api/generated/default/apis/index.ts @@ -9,7 +9,6 @@ export * from './DeveloperAppsApi'; export * from './EventsApi'; export * from './ExploreApi'; export * from './NotificationsApi'; -export * from './OauthApi'; export * from './PlaylistsApi'; export * from './PrizesApi'; export * from './ReactionsApi'; diff --git a/packages/sdk/src/sdk/api/generated/default/models/TrackDownloadCountResponse.ts b/packages/sdk/src/sdk/api/generated/default/models/TrackDownloadCountResponse.ts new file mode 100644 index 00000000000..d62f368aab5 --- /dev/null +++ b/packages/sdk/src/sdk/api/generated/default/models/TrackDownloadCountResponse.ts @@ -0,0 +1,73 @@ +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck +/** + * Audius API + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { TrackDownloadCountResponseData } from './TrackDownloadCountResponseData'; +import { + TrackDownloadCountResponseDataFromJSON, + TrackDownloadCountResponseDataFromJSONTyped, + TrackDownloadCountResponseDataToJSON, +} from './TrackDownloadCountResponseData'; + +/** + * + * @export + * @interface TrackDownloadCountResponse + */ +export interface TrackDownloadCountResponse { + /** + * + * @type {TrackDownloadCountResponseData} + * @memberof TrackDownloadCountResponse + */ + data: TrackDownloadCountResponseData; +} + +/** + * Check if a given object implements the TrackDownloadCountResponse interface. + */ +export function instanceOfTrackDownloadCountResponse(value: object): value is TrackDownloadCountResponse { + let isInstance = true; + isInstance = isInstance && "data" in value && value["data"] !== undefined; + + return isInstance; +} + +export function TrackDownloadCountResponseFromJSON(json: any): TrackDownloadCountResponse { + return TrackDownloadCountResponseFromJSONTyped(json, false); +} + +export function TrackDownloadCountResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): TrackDownloadCountResponse { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'data': TrackDownloadCountResponseDataFromJSON(json['data']), + }; +} + +export function TrackDownloadCountResponseToJSON(value?: TrackDownloadCountResponse | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'data': TrackDownloadCountResponseDataToJSON(value.data), + }; +} + diff --git a/packages/sdk/src/sdk/api/generated/default/models/TrackDownloadCountResponseData.ts b/packages/sdk/src/sdk/api/generated/default/models/TrackDownloadCountResponseData.ts new file mode 100644 index 00000000000..4eb2be42261 --- /dev/null +++ b/packages/sdk/src/sdk/api/generated/default/models/TrackDownloadCountResponseData.ts @@ -0,0 +1,75 @@ +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck +/** + * Audius API + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface TrackDownloadCountResponseData + */ +export interface TrackDownloadCountResponseData { + /** + * Track ID (hash) + * @type {string} + * @memberof TrackDownloadCountResponseData + */ + id: string; + /** + * Full track + all stems (parent) or stem-only (stem) + * @type {number} + * @memberof TrackDownloadCountResponseData + */ + downloadCount: number; +} + +/** + * Check if a given object implements the TrackDownloadCountResponseData interface. + */ +export function instanceOfTrackDownloadCountResponseData(value: object): value is TrackDownloadCountResponseData { + let isInstance = true; + isInstance = isInstance && "id" in value && value["id"] !== undefined; + isInstance = isInstance && "downloadCount" in value && value["downloadCount"] !== undefined; + + return isInstance; +} + +export function TrackDownloadCountResponseDataFromJSON(json: any): TrackDownloadCountResponseData { + return TrackDownloadCountResponseDataFromJSONTyped(json, false); +} + +export function TrackDownloadCountResponseDataFromJSONTyped(json: any, ignoreDiscriminator: boolean): TrackDownloadCountResponseData { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'id': json['id'], + 'downloadCount': json['download_count'], + }; +} + +export function TrackDownloadCountResponseDataToJSON(value?: TrackDownloadCountResponseData | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'id': value.id, + 'download_count': value.downloadCount, + }; +} + diff --git a/packages/sdk/src/sdk/api/generated/default/models/TrackDownloadCountsResponse.ts b/packages/sdk/src/sdk/api/generated/default/models/TrackDownloadCountsResponse.ts new file mode 100644 index 00000000000..efd5a68ed99 --- /dev/null +++ b/packages/sdk/src/sdk/api/generated/default/models/TrackDownloadCountsResponse.ts @@ -0,0 +1,73 @@ +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck +/** + * Audius API + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { TrackDownloadCountResponseData } from './TrackDownloadCountResponseData'; +import { + TrackDownloadCountResponseDataFromJSON, + TrackDownloadCountResponseDataFromJSONTyped, + TrackDownloadCountResponseDataToJSON, +} from './TrackDownloadCountResponseData'; + +/** + * + * @export + * @interface TrackDownloadCountsResponse + */ +export interface TrackDownloadCountsResponse { + /** + * + * @type {Array} + * @memberof TrackDownloadCountsResponse + */ + data: Array; +} + +/** + * Check if a given object implements the TrackDownloadCountsResponse interface. + */ +export function instanceOfTrackDownloadCountsResponse(value: object): value is TrackDownloadCountsResponse { + let isInstance = true; + isInstance = isInstance && "data" in value && value["data"] !== undefined; + + return isInstance; +} + +export function TrackDownloadCountsResponseFromJSON(json: any): TrackDownloadCountsResponse { + return TrackDownloadCountsResponseFromJSONTyped(json, false); +} + +export function TrackDownloadCountsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): TrackDownloadCountsResponse { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'data': ((json['data'] as Array).map(TrackDownloadCountResponseDataFromJSON)), + }; +} + +export function TrackDownloadCountsResponseToJSON(value?: TrackDownloadCountsResponse | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'data': ((value.data as Array).map(TrackDownloadCountResponseDataToJSON)), + }; +} + diff --git a/packages/sdk/src/sdk/api/generated/default/models/index.ts b/packages/sdk/src/sdk/api/generated/default/models/index.ts index d6acc8e2522..93fa118b26a 100644 --- a/packages/sdk/src/sdk/api/generated/default/models/index.ts +++ b/packages/sdk/src/sdk/api/generated/default/models/index.ts @@ -321,6 +321,9 @@ export * from './TrackArtwork'; export * from './TrackCommentCountResponse'; export * from './TrackCommentNotificationResponse'; export * from './TrackCommentsResponse'; +export * from './TrackDownloadCountResponse'; +export * from './TrackDownloadCountResponseData'; +export * from './TrackDownloadCountsResponse'; export * from './TrackDownloadRequestBody'; export * from './TrackElementWrite'; export * from './TrackFavoritesResponse'; From 608f817f85ad65e7ff95a2639a7508bbe38dce22 Mon Sep 17 00:00:00 2001 From: Marcus Pasell <3690498+rickyrombo@users.noreply.github.com> Date: Tue, 17 Mar 2026 17:34:41 -0700 Subject: [PATCH 6/6] chore(sdk): add changeset for generated API additions Co-Authored-By: Claude Sonnet 4.6 --- .changeset/generated-api-updates.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .changeset/generated-api-updates.md diff --git a/.changeset/generated-api-updates.md b/.changeset/generated-api-updates.md new file mode 100644 index 00000000000..0277a7f5c4c --- /dev/null +++ b/.changeset/generated-api-updates.md @@ -0,0 +1,9 @@ +--- +'@audius/sdk': minor +--- + +Generated API updates: track download counts, /me endpoint + +- Added `TracksApi.getTrackDownloadCount()` and `getTrackDownloadCounts()` from swagger +- Added `UsersApi.getMe()` for the authenticated user endpoint +- Fixed generator script (`gen.js` → `gen.cjs`) for ESM compatibility — the SDK package uses `"type": "module"` which caused Node to treat `.js` files as ESM, breaking the `require()`-based generator