Skip to content

Commit 62f4424

Browse files
authored
Playlist/Album Uploads and typefixes (#13720)
Tried to make commit messages helpful tl;dr - fixes upload playlist/album and fixes types
1 parent 6b2f97f commit 62f4424

17 files changed

Lines changed: 755 additions & 286 deletions

packages/sdk/src/sdk/api/albums/AlbumsApi.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ import type {
77
SolanaRelayService,
88
StorageService
99
} from '../../services'
10-
import type {
11-
EntityManagerService,
12-
AdvancedOptions
13-
} from '../../services/EntityManager/types'
10+
import type { EntityManagerService } from '../../services/EntityManager/types'
1411
import type { LoggerService } from '../../services/Logger'
1512
import type { SolanaClient } from '../../services/Solana/programs/SolanaClient'
1613
import { parseParams } from '../../utils/parseParams'
@@ -112,10 +109,7 @@ export class AlbumsApi {
112109
* Upload an album
113110
* Uploads the specified tracks and combines them into an album
114111
*/
115-
async uploadAlbum(
116-
params: UploadAlbumRequest,
117-
advancedOptions?: AdvancedOptions
118-
) {
112+
async uploadAlbum(params: UploadAlbumRequest) {
119113
await parseParams('uploadAlbum', UploadAlbumSchema)(params)
120114

121115
const { albumName, ...playlistMetadata } = params.metadata
@@ -129,10 +123,7 @@ export class AlbumsApi {
129123
}
130124
}
131125

132-
return await this.playlistsApi.uploadPlaylist(
133-
playlistParams,
134-
advancedOptions
135-
)
126+
return await this.playlistsApi.uploadPlaylist(playlistParams)
136127
}
137128

138129
/** @hidden

packages/sdk/src/sdk/api/generated/default/.openapi-generator/FILES

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.openapi-generator-ignore
12
apis/ChallengesApi.ts
23
apis/CoinsApi.ts
34
apis/CommentsApi.ts
@@ -73,6 +74,8 @@ models/CreateDeveloperAppRequestBody.ts
7374
models/CreateDeveloperAppResponse.ts
7475
models/CreateGrantRequestBody.ts
7576
models/CreatePlaylistRequestBody.ts
77+
models/CreatePlaylistRequestBodyCopyrightLine.ts
78+
models/CreatePlaylistRequestBodyProducerCopyrightLine.ts
7679
models/CreatePlaylistResponse.ts
7780
models/CreateRewardCodeRequestBody.ts
7881
models/CreateRewardCodeResponse.ts
@@ -85,6 +88,8 @@ models/CreateUserRequestBodyEvents.ts
8588
models/CreateUserResponse.ts
8689
models/DashboardWalletUser.ts
8790
models/DashboardWalletUsersResponse.ts
91+
models/DdexCopyright.ts
92+
models/DdexResourceContributor.ts
8893
models/DeactivateAccessKeyRequestBody.ts
8994
models/DeactivateAccessKeyResponse.ts
9095
models/DecodedUserToken.ts

packages/sdk/src/sdk/api/generated/default/apis/TracksApi.ts

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,16 @@ export interface GetTrendingUSDCPurchaseTracksWithVersionRequest {
270270
time?: GetTrendingUSDCPurchaseTracksWithVersionTimeEnum;
271271
}
272272

273+
export interface GetTrendingUndergroundWinnersRequest {
274+
week?: Date;
275+
userId?: string;
276+
}
277+
278+
export interface GetTrendingWinnersRequest {
279+
week?: Date;
280+
userId?: string;
281+
}
282+
273283
export interface GetUndergroundTrendingTracksRequest {
274284
offset?: number;
275285
limit?: number;
@@ -1524,6 +1534,76 @@ export class TracksApi extends runtime.BaseAPI {
15241534
return await response.value();
15251535
}
15261536

1537+
/**
1538+
* @hidden
1539+
* Gets weekly trending underground winners from the trending_results table. Returns full track objects for the specified week. Defaults to the most recent week with data when no week is provided.
1540+
*/
1541+
async getTrendingUndergroundWinnersRaw(params: GetTrendingUndergroundWinnersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TracksResponse>> {
1542+
const queryParameters: any = {};
1543+
1544+
if (params.week !== undefined) {
1545+
queryParameters['week'] = (params.week as any).toISOString().substr(0,10);
1546+
}
1547+
1548+
if (params.userId !== undefined) {
1549+
queryParameters['user_id'] = params.userId;
1550+
}
1551+
1552+
const headerParameters: runtime.HTTPHeaders = {};
1553+
1554+
const response = await this.request({
1555+
path: `/tracks/trending/underground/winners`,
1556+
method: 'GET',
1557+
headers: headerParameters,
1558+
query: queryParameters,
1559+
}, initOverrides);
1560+
1561+
return new runtime.JSONApiResponse(response, (jsonValue) => TracksResponseFromJSON(jsonValue));
1562+
}
1563+
1564+
/**
1565+
* Gets weekly trending underground winners from the trending_results table. Returns full track objects for the specified week. Defaults to the most recent week with data when no week is provided.
1566+
*/
1567+
async getTrendingUndergroundWinners(params: GetTrendingUndergroundWinnersRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TracksResponse> {
1568+
const response = await this.getTrendingUndergroundWinnersRaw(params, initOverrides);
1569+
return await response.value();
1570+
}
1571+
1572+
/**
1573+
* @hidden
1574+
* Gets weekly trending winners from the trending_results table. Returns full track objects for the specified week. Defaults to the most recent week with data when no week is provided.
1575+
*/
1576+
async getTrendingWinnersRaw(params: GetTrendingWinnersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TracksResponse>> {
1577+
const queryParameters: any = {};
1578+
1579+
if (params.week !== undefined) {
1580+
queryParameters['week'] = (params.week as any).toISOString().substr(0,10);
1581+
}
1582+
1583+
if (params.userId !== undefined) {
1584+
queryParameters['user_id'] = params.userId;
1585+
}
1586+
1587+
const headerParameters: runtime.HTTPHeaders = {};
1588+
1589+
const response = await this.request({
1590+
path: `/tracks/trending/winners`,
1591+
method: 'GET',
1592+
headers: headerParameters,
1593+
query: queryParameters,
1594+
}, initOverrides);
1595+
1596+
return new runtime.JSONApiResponse(response, (jsonValue) => TracksResponseFromJSON(jsonValue));
1597+
}
1598+
1599+
/**
1600+
* Gets weekly trending winners from the trending_results table. Returns full track objects for the specified week. Defaults to the most recent week with data when no week is provided.
1601+
*/
1602+
async getTrendingWinners(params: GetTrendingWinnersRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TracksResponse> {
1603+
const response = await this.getTrendingWinnersRaw(params, initOverrides);
1604+
return await response.value();
1605+
}
1606+
15271607
/**
15281608
* @hidden
15291609
* Gets the top 100 trending underground tracks on Audius

packages/sdk/src/sdk/api/generated/default/models/CreatePlaylistRequestBody.ts

Lines changed: 51 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,24 @@ import {
2020
AccessGateFromJSONTyped,
2121
AccessGateToJSON,
2222
} from './AccessGate';
23+
import type { CreatePlaylistRequestBodyCopyrightLine } from './CreatePlaylistRequestBodyCopyrightLine';
24+
import {
25+
CreatePlaylistRequestBodyCopyrightLineFromJSON,
26+
CreatePlaylistRequestBodyCopyrightLineFromJSONTyped,
27+
CreatePlaylistRequestBodyCopyrightLineToJSON,
28+
} from './CreatePlaylistRequestBodyCopyrightLine';
29+
import type { CreatePlaylistRequestBodyProducerCopyrightLine } from './CreatePlaylistRequestBodyProducerCopyrightLine';
30+
import {
31+
CreatePlaylistRequestBodyProducerCopyrightLineFromJSON,
32+
CreatePlaylistRequestBodyProducerCopyrightLineFromJSONTyped,
33+
CreatePlaylistRequestBodyProducerCopyrightLineToJSON,
34+
} from './CreatePlaylistRequestBodyProducerCopyrightLine';
35+
import type { DdexResourceContributor } from './DdexResourceContributor';
36+
import {
37+
DdexResourceContributorFromJSON,
38+
DdexResourceContributorFromJSONTyped,
39+
DdexResourceContributorToJSON,
40+
} from './DdexResourceContributor';
2341
import type { Genre } from './Genre';
2442
import {
2543
GenreFromJSON,
@@ -50,7 +68,7 @@ export interface CreatePlaylistRequestBody {
5068
* @type {string}
5169
* @memberof CreatePlaylistRequestBody
5270
*/
53-
playlistId?: string | null;
71+
playlistId?: string;
5472
/**
5573
* Playlist or album name
5674
* @type {string}
@@ -62,67 +80,67 @@ export interface CreatePlaylistRequestBody {
6280
* @type {string}
6381
* @memberof CreatePlaylistRequestBody
6482
*/
65-
description?: string | null;
83+
description?: string;
6684
/**
6785
* Whether the playlist is private
6886
* @type {boolean}
6987
* @memberof CreatePlaylistRequestBody
7088
*/
71-
isPrivate?: boolean | null;
89+
isPrivate?: boolean;
7290
/**
7391
* Whether this is an album
7492
* @type {boolean}
7593
* @memberof CreatePlaylistRequestBody
7694
*/
77-
isAlbum?: boolean | null;
95+
isAlbum?: boolean;
7896
/**
7997
*
8098
* @type {Genre}
8199
* @memberof CreatePlaylistRequestBody
82100
*/
83-
genre?: Genre | null;
101+
genre?: Genre;
84102
/**
85103
*
86104
* @type {Mood}
87105
* @memberof CreatePlaylistRequestBody
88106
*/
89-
mood?: Mood | null;
107+
mood?: Mood;
90108
/**
91109
* Comma-separated tags
92110
* @type {string}
93111
* @memberof CreatePlaylistRequestBody
94112
*/
95-
tags?: string | null;
113+
tags?: string;
96114
/**
97115
* License type
98116
* @type {string}
99117
* @memberof CreatePlaylistRequestBody
100118
*/
101-
license?: string | null;
119+
license?: string;
102120
/**
103121
* Universal Product Code (for albums)
104122
* @type {string}
105123
* @memberof CreatePlaylistRequestBody
106124
*/
107-
upc?: string | null;
125+
upc?: string;
108126
/**
109127
* Release date
110128
* @type {Date}
111129
* @memberof CreatePlaylistRequestBody
112130
*/
113-
releaseDate?: Date | null;
131+
releaseDate?: Date;
114132
/**
115133
* IPFS CID for cover art
116134
* @type {string}
117135
* @memberof CreatePlaylistRequestBody
118136
*/
119-
coverArtCid?: string | null;
137+
coverArtCid?: string;
120138
/**
121139
* Array of tracks in the playlist
122140
* @type {Array<PlaylistAddedTimestamp>}
123141
* @memberof CreatePlaylistRequestBody
124142
*/
125-
playlistContents?: Array<PlaylistAddedTimestamp> | null;
143+
playlistContents?: Array<PlaylistAddedTimestamp>;
126144
/**
127145
* Whether streaming is restricted behind an access gate
128146
* @type {boolean}
@@ -146,31 +164,31 @@ export interface CreatePlaylistRequestBody {
146164
* @type {string}
147165
* @memberof CreatePlaylistRequestBody
148166
*/
149-
ddexApp?: string | null;
167+
ddexApp?: string;
150168
/**
151169
* DDEX release identifiers
152-
* @type {object}
170+
* @type {{ [key: string]: string; }}
153171
* @memberof CreatePlaylistRequestBody
154172
*/
155-
ddexReleaseIds?: object | null;
173+
ddexReleaseIds?: { [key: string]: string; } | null;
156174
/**
157175
* DDEX resource contributors / artists
158-
* @type {Array<object>}
176+
* @type {Array<DdexResourceContributor>}
159177
* @memberof CreatePlaylistRequestBody
160178
*/
161-
artists?: Array<object> | null;
179+
artists?: Array<DdexResourceContributor> | null;
162180
/**
163-
* DDEX copyright line
164-
* @type {object}
181+
*
182+
* @type {CreatePlaylistRequestBodyCopyrightLine}
165183
* @memberof CreatePlaylistRequestBody
166184
*/
167-
copyrightLine?: object | null;
185+
copyrightLine?: CreatePlaylistRequestBodyCopyrightLine | null;
168186
/**
169-
* DDEX producer copyright line
170-
* @type {object}
187+
*
188+
* @type {CreatePlaylistRequestBodyProducerCopyrightLine}
171189
* @memberof CreatePlaylistRequestBody
172190
*/
173-
producerCopyrightLine?: object | null;
191+
producerCopyrightLine?: CreatePlaylistRequestBodyProducerCopyrightLine | null;
174192
/**
175193
* Parental warning type
176194
* @type {string}
@@ -215,17 +233,17 @@ export function CreatePlaylistRequestBodyFromJSONTyped(json: any, ignoreDiscrimi
215233
'tags': !exists(json, 'tags') ? undefined : json['tags'],
216234
'license': !exists(json, 'license') ? undefined : json['license'],
217235
'upc': !exists(json, 'upc') ? undefined : json['upc'],
218-
'releaseDate': !exists(json, 'release_date') ? undefined : (json['release_date'] === null ? null : new Date(json['release_date'])),
236+
'releaseDate': !exists(json, 'release_date') ? undefined : (new Date(json['release_date'])),
219237
'coverArtCid': !exists(json, 'cover_art_cid') ? undefined : json['cover_art_cid'],
220-
'playlistContents': !exists(json, 'playlist_contents') ? undefined : (json['playlist_contents'] === null ? null : (json['playlist_contents'] as Array<any>).map(PlaylistAddedTimestampFromJSON)),
238+
'playlistContents': !exists(json, 'playlist_contents') ? undefined : ((json['playlist_contents'] as Array<any>).map(PlaylistAddedTimestampFromJSON)),
221239
'isStreamGated': !exists(json, 'is_stream_gated') ? undefined : json['is_stream_gated'],
222240
'isScheduledRelease': !exists(json, 'is_scheduled_release') ? undefined : json['is_scheduled_release'],
223241
'streamConditions': !exists(json, 'stream_conditions') ? undefined : AccessGateFromJSON(json['stream_conditions']),
224242
'ddexApp': !exists(json, 'ddex_app') ? undefined : json['ddex_app'],
225243
'ddexReleaseIds': !exists(json, 'ddex_release_ids') ? undefined : json['ddex_release_ids'],
226-
'artists': !exists(json, 'artists') ? undefined : json['artists'],
227-
'copyrightLine': !exists(json, 'copyright_line') ? undefined : json['copyright_line'],
228-
'producerCopyrightLine': !exists(json, 'producer_copyright_line') ? undefined : json['producer_copyright_line'],
244+
'artists': !exists(json, 'artists') ? undefined : (json['artists'] === null ? null : (json['artists'] as Array<any>).map(DdexResourceContributorFromJSON)),
245+
'copyrightLine': !exists(json, 'copyright_line') ? undefined : CreatePlaylistRequestBodyCopyrightLineFromJSON(json['copyright_line']),
246+
'producerCopyrightLine': !exists(json, 'producer_copyright_line') ? undefined : CreatePlaylistRequestBodyProducerCopyrightLineFromJSON(json['producer_copyright_line']),
229247
'parentalWarningType': !exists(json, 'parental_warning_type') ? undefined : json['parental_warning_type'],
230248
'isImageAutogenerated': !exists(json, 'is_image_autogenerated') ? undefined : json['is_image_autogenerated'],
231249
};
@@ -250,17 +268,17 @@ export function CreatePlaylistRequestBodyToJSON(value?: CreatePlaylistRequestBod
250268
'tags': value.tags,
251269
'license': value.license,
252270
'upc': value.upc,
253-
'release_date': value.releaseDate === undefined ? undefined : (value.releaseDate === null ? null : value.releaseDate.toISOString().substr(0,10)),
271+
'release_date': value.releaseDate === undefined ? undefined : (value.releaseDate.toISOString().substr(0,10)),
254272
'cover_art_cid': value.coverArtCid,
255-
'playlist_contents': value.playlistContents === undefined ? undefined : (value.playlistContents === null ? null : (value.playlistContents as Array<any>).map(PlaylistAddedTimestampToJSON)),
273+
'playlist_contents': value.playlistContents === undefined ? undefined : ((value.playlistContents as Array<any>).map(PlaylistAddedTimestampToJSON)),
256274
'is_stream_gated': value.isStreamGated,
257275
'is_scheduled_release': value.isScheduledRelease,
258276
'stream_conditions': AccessGateToJSON(value.streamConditions),
259277
'ddex_app': value.ddexApp,
260278
'ddex_release_ids': value.ddexReleaseIds,
261-
'artists': value.artists,
262-
'copyright_line': value.copyrightLine,
263-
'producer_copyright_line': value.producerCopyrightLine,
279+
'artists': value.artists === undefined ? undefined : (value.artists === null ? null : (value.artists as Array<any>).map(DdexResourceContributorToJSON)),
280+
'copyright_line': CreatePlaylistRequestBodyCopyrightLineToJSON(value.copyrightLine),
281+
'producer_copyright_line': CreatePlaylistRequestBodyProducerCopyrightLineToJSON(value.producerCopyrightLine),
264282
'parental_warning_type': value.parentalWarningType,
265283
'is_image_autogenerated': value.isImageAutogenerated,
266284
};

0 commit comments

Comments
 (0)