diff --git a/packages/common/src/adapters/user.ts b/packages/common/src/adapters/user.ts index 409dc346643..70e344122aa 100644 --- a/packages/common/src/adapters/user.ts +++ b/packages/common/src/adapters/user.ts @@ -1,7 +1,6 @@ import { HashId, OptionalHashId, - OptionalId, type full, type User, type UpdateUserRequest @@ -233,9 +232,9 @@ export const userMetadataToSdk = ( ), bio: input.bio ?? undefined, website: input.website ?? undefined, - artistPickTrackId: OptionalId.parse(input.artist_pick_track_id ?? undefined), + artistPickTrackId: input.artist_pick_track_id ?? undefined, events: { - referrer: OptionalId.parse(input.events?.referrer ?? undefined), + referrer: input.events?.referrer ?? undefined, isMobileUser: input.events?.is_mobile_user ?? undefined }, location: input.location ?? undefined, diff --git a/packages/common/src/api/tan-query/comments/usePinComment.ts b/packages/common/src/api/tan-query/comments/usePinComment.ts index b9e25b51133..b59c8acd111 100644 --- a/packages/common/src/api/tan-query/comments/usePinComment.ts +++ b/packages/common/src/api/tan-query/comments/usePinComment.ts @@ -35,7 +35,8 @@ export const usePinComment = () => { userId: Id.parse(userId)!, commentId: Id.parse(commentId)!, metadata: { - entityId: trackId + entityId: trackId, + entityType: 'Track' } }) } else { @@ -43,7 +44,8 @@ export const usePinComment = () => { userId: Id.parse(userId)!, commentId: Id.parse(commentId)!, metadata: { - entityId: trackId + entityId: trackId, + entityType: 'Track' } }) } diff --git a/packages/sdk/src/sdk/api/developer-apps/DeveloperAppsApi.ts b/packages/sdk/src/sdk/api/developer-apps/DeveloperAppsApi.ts index 6548b279708..e9acd907913 100644 --- a/packages/sdk/src/sdk/api/developer-apps/DeveloperAppsApi.ts +++ b/packages/sdk/src/sdk/api/developer-apps/DeveloperAppsApi.ts @@ -90,7 +90,7 @@ export class DeveloperAppsApi extends GeneratedDeveloperAppsApi { ) { if (this.entityManager) { return await this.createDeveloperAppWithEntityManager({ - ...params.createDeveloperAppRequestBody, + ...params.metadata, userId: params.userId }) } else { @@ -133,7 +133,7 @@ export class DeveloperAppsApi extends GeneratedDeveloperAppsApi { ) { if (this.entityManager) { return await this.updateDeveloperAppWithEntityManager({ - ...params.updateDeveloperAppRequestBody, + ...params.metadata, userId: params.userId, appApiKey: params.address }) 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 0e60311f3de..17978a7a286 100644 --- a/packages/sdk/src/sdk/api/generated/default/.openapi-generator/FILES +++ b/packages/sdk/src/sdk/api/generated/default/.openapi-generator/FILES @@ -79,6 +79,9 @@ models/CreateTrackResponse.ts models/CreateUserDeveloperAppRequestBody.ts models/CreateUserDeveloperAppResponse.ts models/CreateUserRequestBody.ts +models/CreateUserRequestBodyEvents.ts +models/CreateUserRequestBodyPlaylistLibrary.ts +models/CreateUserRequestBodyPlaylistLibraryContentsInner.ts models/CreateUserResponse.ts models/DashboardWalletUser.ts models/DashboardWalletUsersResponse.ts @@ -114,9 +117,13 @@ models/MediaLink.ts models/MonthlyAggregatePlay.ts models/Mood.ts models/MutualFollowersResponse.ts +models/PinCommentRequestBody.ts models/Playlist.ts models/PlaylistAddedTimestamp.ts models/PlaylistArtwork.ts +models/PlaylistLibraryExplorePlaylistIdentifier.ts +models/PlaylistLibraryFolder.ts +models/PlaylistLibraryPlaylistIdentifier.ts models/PlaylistResponse.ts models/PlaylistSearchResult.ts models/PlaylistTracksResponse.ts @@ -127,6 +134,7 @@ models/PrizePublic.ts models/PrizesResponse.ts models/ProfilePicture.ts models/PurchasersResponse.ts +models/ReactCommentRequestBody.ts models/RedeemAmountResponse.ts models/RelatedArtistResponse.ts models/RemixParent.ts @@ -190,6 +198,7 @@ models/UpdateDeveloperAppRequestBody.ts models/UpdatePlaylistRequestBody.ts models/UpdateTrackRequestBody.ts models/UpdateUserRequestBody.ts +models/UpdateUserRequestBodyPlaylistLibrary.ts models/User.ts models/UserCoin.ts models/UserCoinAccount.ts 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 3c7cb32c3ee..2585c251cb1 100644 --- a/packages/sdk/src/sdk/api/generated/default/apis/UsersApi.ts +++ b/packages/sdk/src/sdk/api/generated/default/apis/UsersApi.ts @@ -156,7 +156,6 @@ import { } from '../models'; export interface CreateUserRequest { - userId: string; metadata: CreateUserRequestBody; } @@ -549,20 +548,12 @@ export class UsersApi extends runtime.BaseAPI { * Creates a new user */ async createUserRaw(params: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling createUser.'); - } - if (params.metadata === null || params.metadata === undefined) { throw new runtime.RequiredError('metadata','Required parameter params.metadata was null or undefined when calling createUser.'); } const queryParameters: any = {}; - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; diff --git a/packages/sdk/src/sdk/api/generated/default/models/CreateUserRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/CreateUserRequestBody.ts index 2f6c6156aba..8081128a150 100644 --- a/packages/sdk/src/sdk/api/generated/default/models/CreateUserRequestBody.ts +++ b/packages/sdk/src/sdk/api/generated/default/models/CreateUserRequestBody.ts @@ -14,6 +14,19 @@ */ import { exists, mapValues } from '../runtime'; +import type { CreateUserRequestBodyEvents } from './CreateUserRequestBodyEvents'; +import { + CreateUserRequestBodyEventsFromJSON, + CreateUserRequestBodyEventsFromJSONTyped, + CreateUserRequestBodyEventsToJSON, +} from './CreateUserRequestBodyEvents'; +import type { CreateUserRequestBodyPlaylistLibrary } from './CreateUserRequestBodyPlaylistLibrary'; +import { + CreateUserRequestBodyPlaylistLibraryFromJSON, + CreateUserRequestBodyPlaylistLibraryFromJSONTyped, + CreateUserRequestBodyPlaylistLibraryToJSON, +} from './CreateUserRequestBodyPlaylistLibrary'; + /** * * @export @@ -128,6 +141,18 @@ export interface CreateUserRequestBody { * @memberof CreateUserRequestBody */ splUsdcPayoutWallet?: string; + /** + * + * @type {CreateUserRequestBodyPlaylistLibrary} + * @memberof CreateUserRequestBody + */ + playlistLibrary?: CreateUserRequestBodyPlaylistLibrary; + /** + * + * @type {CreateUserRequestBodyEvents} + * @memberof CreateUserRequestBody + */ + events?: CreateUserRequestBodyEvents; } @@ -179,6 +204,8 @@ export function CreateUserRequestBodyFromJSONTyped(json: any, ignoreDiscriminato 'profileType': !exists(json, 'profile_type') ? undefined : json['profile_type'], 'allowAiAttribution': !exists(json, 'allow_ai_attribution') ? undefined : json['allow_ai_attribution'], 'splUsdcPayoutWallet': !exists(json, 'spl_usdc_payout_wallet') ? undefined : json['spl_usdc_payout_wallet'], + 'playlistLibrary': !exists(json, 'playlist_library') ? undefined : CreateUserRequestBodyPlaylistLibraryFromJSON(json['playlist_library']), + 'events': !exists(json, 'events') ? undefined : CreateUserRequestBodyEventsFromJSON(json['events']), }; } @@ -209,6 +236,8 @@ export function CreateUserRequestBodyToJSON(value?: CreateUserRequestBody | null 'profile_type': value.profileType, 'allow_ai_attribution': value.allowAiAttribution, 'spl_usdc_payout_wallet': value.splUsdcPayoutWallet, + 'playlist_library': CreateUserRequestBodyPlaylistLibraryToJSON(value.playlistLibrary), + 'events': CreateUserRequestBodyEventsToJSON(value.events), }; } diff --git a/packages/sdk/src/sdk/api/generated/default/models/CreateUserRequestBodyEvents.ts b/packages/sdk/src/sdk/api/generated/default/models/CreateUserRequestBodyEvents.ts new file mode 100644 index 00000000000..8a5ddfd732a --- /dev/null +++ b/packages/sdk/src/sdk/api/generated/default/models/CreateUserRequestBodyEvents.ts @@ -0,0 +1,74 @@ +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck +/** + * API + * Audius V1 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'; +/** + * User events for tracking referrals and mobile users + * @export + * @interface CreateUserRequestBodyEvents + */ +export interface CreateUserRequestBodyEvents { + /** + * User ID of the referrer + * @type {number} + * @memberof CreateUserRequestBodyEvents + */ + referrer?: number; + /** + * Whether the user is on mobile + * @type {boolean} + * @memberof CreateUserRequestBodyEvents + */ + isMobileUser?: boolean; +} + +/** + * Check if a given object implements the CreateUserRequestBodyEvents interface. + */ +export function instanceOfCreateUserRequestBodyEvents(value: object): value is CreateUserRequestBodyEvents { + let isInstance = true; + + return isInstance; +} + +export function CreateUserRequestBodyEventsFromJSON(json: any): CreateUserRequestBodyEvents { + return CreateUserRequestBodyEventsFromJSONTyped(json, false); +} + +export function CreateUserRequestBodyEventsFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateUserRequestBodyEvents { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'referrer': !exists(json, 'referrer') ? undefined : json['referrer'], + 'isMobileUser': !exists(json, 'is_mobile_user') ? undefined : json['is_mobile_user'], + }; +} + +export function CreateUserRequestBodyEventsToJSON(value?: CreateUserRequestBodyEvents | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'referrer': value.referrer, + 'is_mobile_user': value.isMobileUser, + }; +} + diff --git a/packages/sdk/src/sdk/api/generated/default/models/CreateUserRequestBodyPlaylistLibrary.ts b/packages/sdk/src/sdk/api/generated/default/models/CreateUserRequestBodyPlaylistLibrary.ts new file mode 100644 index 00000000000..3c9c650152d --- /dev/null +++ b/packages/sdk/src/sdk/api/generated/default/models/CreateUserRequestBodyPlaylistLibrary.ts @@ -0,0 +1,74 @@ +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck +/** + * API + * Audius V1 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 { CreateUserRequestBodyPlaylistLibraryContentsInner } from './CreateUserRequestBodyPlaylistLibraryContentsInner'; +import { + CreateUserRequestBodyPlaylistLibraryContentsInnerFromJSON, + CreateUserRequestBodyPlaylistLibraryContentsInnerFromJSONTyped, + CreateUserRequestBodyPlaylistLibraryContentsInnerToJSON, +} from './CreateUserRequestBodyPlaylistLibraryContentsInner'; + +/** + * User's playlist library with support for folders and playlists + * @export + * @interface CreateUserRequestBodyPlaylistLibrary + */ +export interface CreateUserRequestBodyPlaylistLibrary { + /** + * Array of folders and playlist identifiers + * @type {Array} + * @memberof CreateUserRequestBodyPlaylistLibrary + */ + contents: Array; +} + +/** + * Check if a given object implements the CreateUserRequestBodyPlaylistLibrary interface. + */ +export function instanceOfCreateUserRequestBodyPlaylistLibrary(value: object): value is CreateUserRequestBodyPlaylistLibrary { + let isInstance = true; + isInstance = isInstance && "contents" in value && value["contents"] !== undefined; + + return isInstance; +} + +export function CreateUserRequestBodyPlaylistLibraryFromJSON(json: any): CreateUserRequestBodyPlaylistLibrary { + return CreateUserRequestBodyPlaylistLibraryFromJSONTyped(json, false); +} + +export function CreateUserRequestBodyPlaylistLibraryFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateUserRequestBodyPlaylistLibrary { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'contents': ((json['contents'] as Array).map(CreateUserRequestBodyPlaylistLibraryContentsInnerFromJSON)), + }; +} + +export function CreateUserRequestBodyPlaylistLibraryToJSON(value?: CreateUserRequestBodyPlaylistLibrary | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'contents': ((value.contents as Array).map(CreateUserRequestBodyPlaylistLibraryContentsInnerToJSON)), + }; +} + diff --git a/packages/sdk/src/sdk/api/generated/default/models/CreateUserRequestBodyPlaylistLibraryContentsInner.ts b/packages/sdk/src/sdk/api/generated/default/models/CreateUserRequestBodyPlaylistLibraryContentsInner.ts new file mode 100644 index 00000000000..4ba0e0b53b2 --- /dev/null +++ b/packages/sdk/src/sdk/api/generated/default/models/CreateUserRequestBodyPlaylistLibraryContentsInner.ts @@ -0,0 +1,76 @@ +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck +/** + * API + * Audius V1 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 { + PlaylistLibraryExplorePlaylistIdentifier, + instanceOfPlaylistLibraryExplorePlaylistIdentifier, + PlaylistLibraryExplorePlaylistIdentifierFromJSON, + PlaylistLibraryExplorePlaylistIdentifierFromJSONTyped, + PlaylistLibraryExplorePlaylistIdentifierToJSON, +} from './PlaylistLibraryExplorePlaylistIdentifier'; +import { + PlaylistLibraryFolder, + instanceOfPlaylistLibraryFolder, + PlaylistLibraryFolderFromJSON, + PlaylistLibraryFolderFromJSONTyped, + PlaylistLibraryFolderToJSON, +} from './PlaylistLibraryFolder'; +import { + PlaylistLibraryPlaylistIdentifier, + instanceOfPlaylistLibraryPlaylistIdentifier, + PlaylistLibraryPlaylistIdentifierFromJSON, + PlaylistLibraryPlaylistIdentifierFromJSONTyped, + PlaylistLibraryPlaylistIdentifierToJSON, +} from './PlaylistLibraryPlaylistIdentifier'; + +/** + * @type CreateUserRequestBodyPlaylistLibraryContentsInner + * + * @export + */ +export type CreateUserRequestBodyPlaylistLibraryContentsInner = PlaylistLibraryExplorePlaylistIdentifier | PlaylistLibraryFolder | PlaylistLibraryPlaylistIdentifier; + +export function CreateUserRequestBodyPlaylistLibraryContentsInnerFromJSON(json: any): CreateUserRequestBodyPlaylistLibraryContentsInner { + return CreateUserRequestBodyPlaylistLibraryContentsInnerFromJSONTyped(json, false); +} + +export function CreateUserRequestBodyPlaylistLibraryContentsInnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateUserRequestBodyPlaylistLibraryContentsInner { + if ((json === undefined) || (json === null)) { + return json; + } + return { ...PlaylistLibraryExplorePlaylistIdentifierFromJSONTyped(json, true), ...PlaylistLibraryFolderFromJSONTyped(json, true), ...PlaylistLibraryPlaylistIdentifierFromJSONTyped(json, true) }; +} + +export function CreateUserRequestBodyPlaylistLibraryContentsInnerToJSON(value?: CreateUserRequestBodyPlaylistLibraryContentsInner | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + + if (instanceOfPlaylistLibraryExplorePlaylistIdentifier(value)) { + return PlaylistLibraryExplorePlaylistIdentifierToJSON(value as PlaylistLibraryExplorePlaylistIdentifier); + } + if (instanceOfPlaylistLibraryFolder(value)) { + return PlaylistLibraryFolderToJSON(value as PlaylistLibraryFolder); + } + if (instanceOfPlaylistLibraryPlaylistIdentifier(value)) { + return PlaylistLibraryPlaylistIdentifierToJSON(value as PlaylistLibraryPlaylistIdentifier); + } + + return {}; +} + diff --git a/packages/sdk/src/sdk/api/generated/default/models/PinCommentRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/PinCommentRequestBody.ts index 75e2154e034..27171bf5c0b 100644 --- a/packages/sdk/src/sdk/api/generated/default/models/PinCommentRequestBody.ts +++ b/packages/sdk/src/sdk/api/generated/default/models/PinCommentRequestBody.ts @@ -14,12 +14,25 @@ */ import { exists, mapValues } from '../runtime'; +import type { CommentEntityType } from './CommentEntityType'; +import { + CommentEntityTypeFromJSON, + CommentEntityTypeFromJSONTyped, + CommentEntityTypeToJSON, +} from './CommentEntityType'; + /** * * @export * @interface PinCommentRequestBody */ export interface PinCommentRequestBody { + /** + * + * @type {CommentEntityType} + * @memberof PinCommentRequestBody + */ + entityType: CommentEntityType; /** * ID of the entity (track or playlist) the comment is on * @type {number} @@ -33,6 +46,7 @@ export interface PinCommentRequestBody { */ export function instanceOfPinCommentRequestBody(value: object): value is PinCommentRequestBody { let isInstance = true; + isInstance = isInstance && "entityType" in value && value["entityType"] !== undefined; isInstance = isInstance && "entityId" in value && value["entityId"] !== undefined; return isInstance; @@ -48,6 +62,7 @@ export function PinCommentRequestBodyFromJSONTyped(json: any, ignoreDiscriminato } return { + 'entityType': CommentEntityTypeFromJSON(json['entityType']), 'entityId': json['entityId'], }; } @@ -61,6 +76,7 @@ export function PinCommentRequestBodyToJSON(value?: PinCommentRequestBody | null } return { + 'entityType': CommentEntityTypeToJSON(value.entityType), 'entityId': value.entityId, }; } diff --git a/packages/sdk/src/sdk/api/generated/default/models/PlaylistLibraryExplorePlaylistIdentifier.ts b/packages/sdk/src/sdk/api/generated/default/models/PlaylistLibraryExplorePlaylistIdentifier.ts new file mode 100644 index 00000000000..2cbdd0b12a5 --- /dev/null +++ b/packages/sdk/src/sdk/api/generated/default/models/PlaylistLibraryExplorePlaylistIdentifier.ts @@ -0,0 +1,86 @@ +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck +/** + * API + * Audius V1 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'; +/** + * Reference to an explore playlist + * @export + * @interface PlaylistLibraryExplorePlaylistIdentifier + */ +export interface PlaylistLibraryExplorePlaylistIdentifier { + /** + * + * @type {string} + * @memberof PlaylistLibraryExplorePlaylistIdentifier + */ + type: PlaylistLibraryExplorePlaylistIdentifierTypeEnum; + /** + * Explore playlist identifier + * @type {string} + * @memberof PlaylistLibraryExplorePlaylistIdentifier + */ + playlistId: string; +} + + +/** + * @export + */ +export const PlaylistLibraryExplorePlaylistIdentifierTypeEnum = { + ExplorePlaylist: 'explore_playlist' +} as const; +export type PlaylistLibraryExplorePlaylistIdentifierTypeEnum = typeof PlaylistLibraryExplorePlaylistIdentifierTypeEnum[keyof typeof PlaylistLibraryExplorePlaylistIdentifierTypeEnum]; + + +/** + * Check if a given object implements the PlaylistLibraryExplorePlaylistIdentifier interface. + */ +export function instanceOfPlaylistLibraryExplorePlaylistIdentifier(value: object): value is PlaylistLibraryExplorePlaylistIdentifier { + let isInstance = true; + isInstance = isInstance && "type" in value && value["type"] !== undefined; + isInstance = isInstance && "playlistId" in value && value["playlistId"] !== undefined; + + return isInstance; +} + +export function PlaylistLibraryExplorePlaylistIdentifierFromJSON(json: any): PlaylistLibraryExplorePlaylistIdentifier { + return PlaylistLibraryExplorePlaylistIdentifierFromJSONTyped(json, false); +} + +export function PlaylistLibraryExplorePlaylistIdentifierFromJSONTyped(json: any, ignoreDiscriminator: boolean): PlaylistLibraryExplorePlaylistIdentifier { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'type': json['type'], + 'playlistId': json['playlist_id'], + }; +} + +export function PlaylistLibraryExplorePlaylistIdentifierToJSON(value?: PlaylistLibraryExplorePlaylistIdentifier | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'type': value.type, + 'playlist_id': value.playlistId, + }; +} + diff --git a/packages/sdk/src/sdk/api/generated/default/models/PlaylistLibraryFolder.ts b/packages/sdk/src/sdk/api/generated/default/models/PlaylistLibraryFolder.ts new file mode 100644 index 00000000000..78280c871ab --- /dev/null +++ b/packages/sdk/src/sdk/api/generated/default/models/PlaylistLibraryFolder.ts @@ -0,0 +1,111 @@ +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck +/** + * API + * Audius V1 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 { CreateUserRequestBodyPlaylistLibraryContentsInner } from './CreateUserRequestBodyPlaylistLibraryContentsInner'; +import { + CreateUserRequestBodyPlaylistLibraryContentsInnerFromJSON, + CreateUserRequestBodyPlaylistLibraryContentsInnerFromJSONTyped, + CreateUserRequestBodyPlaylistLibraryContentsInnerToJSON, +} from './CreateUserRequestBodyPlaylistLibraryContentsInner'; + +/** + * Folder containing nested playlists and folders + * @export + * @interface PlaylistLibraryFolder + */ +export interface PlaylistLibraryFolder { + /** + * Unique folder identifier + * @type {string} + * @memberof PlaylistLibraryFolder + */ + id: string; + /** + * + * @type {string} + * @memberof PlaylistLibraryFolder + */ + type: PlaylistLibraryFolderTypeEnum; + /** + * Folder name + * @type {string} + * @memberof PlaylistLibraryFolder + */ + name: string; + /** + * Nested folders and playlist identifiers + * @type {Array} + * @memberof PlaylistLibraryFolder + */ + contents: Array; +} + + +/** + * @export + */ +export const PlaylistLibraryFolderTypeEnum = { + Folder: 'folder' +} as const; +export type PlaylistLibraryFolderTypeEnum = typeof PlaylistLibraryFolderTypeEnum[keyof typeof PlaylistLibraryFolderTypeEnum]; + + +/** + * Check if a given object implements the PlaylistLibraryFolder interface. + */ +export function instanceOfPlaylistLibraryFolder(value: object): value is PlaylistLibraryFolder { + let isInstance = true; + isInstance = isInstance && "id" in value && value["id"] !== undefined; + isInstance = isInstance && "type" in value && value["type"] !== undefined; + isInstance = isInstance && "name" in value && value["name"] !== undefined; + isInstance = isInstance && "contents" in value && value["contents"] !== undefined; + + return isInstance; +} + +export function PlaylistLibraryFolderFromJSON(json: any): PlaylistLibraryFolder { + return PlaylistLibraryFolderFromJSONTyped(json, false); +} + +export function PlaylistLibraryFolderFromJSONTyped(json: any, ignoreDiscriminator: boolean): PlaylistLibraryFolder { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'id': json['id'], + 'type': json['type'], + 'name': json['name'], + 'contents': ((json['contents'] as Array).map(CreateUserRequestBodyPlaylistLibraryContentsInnerFromJSON)), + }; +} + +export function PlaylistLibraryFolderToJSON(value?: PlaylistLibraryFolder | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'id': value.id, + 'type': value.type, + 'name': value.name, + 'contents': ((value.contents as Array).map(CreateUserRequestBodyPlaylistLibraryContentsInnerToJSON)), + }; +} + diff --git a/packages/sdk/src/sdk/api/generated/default/models/PlaylistLibraryPlaylistIdentifier.ts b/packages/sdk/src/sdk/api/generated/default/models/PlaylistLibraryPlaylistIdentifier.ts new file mode 100644 index 00000000000..3711012adb9 --- /dev/null +++ b/packages/sdk/src/sdk/api/generated/default/models/PlaylistLibraryPlaylistIdentifier.ts @@ -0,0 +1,86 @@ +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck +/** + * API + * Audius V1 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'; +/** + * Reference to a playlist + * @export + * @interface PlaylistLibraryPlaylistIdentifier + */ +export interface PlaylistLibraryPlaylistIdentifier { + /** + * + * @type {string} + * @memberof PlaylistLibraryPlaylistIdentifier + */ + type: PlaylistLibraryPlaylistIdentifierTypeEnum; + /** + * Playlist ID + * @type {number} + * @memberof PlaylistLibraryPlaylistIdentifier + */ + playlistId: number; +} + + +/** + * @export + */ +export const PlaylistLibraryPlaylistIdentifierTypeEnum = { + Playlist: 'playlist' +} as const; +export type PlaylistLibraryPlaylistIdentifierTypeEnum = typeof PlaylistLibraryPlaylistIdentifierTypeEnum[keyof typeof PlaylistLibraryPlaylistIdentifierTypeEnum]; + + +/** + * Check if a given object implements the PlaylistLibraryPlaylistIdentifier interface. + */ +export function instanceOfPlaylistLibraryPlaylistIdentifier(value: object): value is PlaylistLibraryPlaylistIdentifier { + let isInstance = true; + isInstance = isInstance && "type" in value && value["type"] !== undefined; + isInstance = isInstance && "playlistId" in value && value["playlistId"] !== undefined; + + return isInstance; +} + +export function PlaylistLibraryPlaylistIdentifierFromJSON(json: any): PlaylistLibraryPlaylistIdentifier { + return PlaylistLibraryPlaylistIdentifierFromJSONTyped(json, false); +} + +export function PlaylistLibraryPlaylistIdentifierFromJSONTyped(json: any, ignoreDiscriminator: boolean): PlaylistLibraryPlaylistIdentifier { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'type': json['type'], + 'playlistId': json['playlist_id'], + }; +} + +export function PlaylistLibraryPlaylistIdentifierToJSON(value?: PlaylistLibraryPlaylistIdentifier | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'type': value.type, + 'playlist_id': value.playlistId, + }; +} + diff --git a/packages/sdk/src/sdk/api/generated/default/models/UpdateUserRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/UpdateUserRequestBody.ts index e82ed821d66..524e27e6489 100644 --- a/packages/sdk/src/sdk/api/generated/default/models/UpdateUserRequestBody.ts +++ b/packages/sdk/src/sdk/api/generated/default/models/UpdateUserRequestBody.ts @@ -14,6 +14,19 @@ */ import { exists, mapValues } from '../runtime'; +import type { CreateUserRequestBodyEvents } from './CreateUserRequestBodyEvents'; +import { + CreateUserRequestBodyEventsFromJSON, + CreateUserRequestBodyEventsFromJSONTyped, + CreateUserRequestBodyEventsToJSON, +} from './CreateUserRequestBodyEvents'; +import type { UpdateUserRequestBodyPlaylistLibrary } from './UpdateUserRequestBodyPlaylistLibrary'; +import { + UpdateUserRequestBodyPlaylistLibraryFromJSON, + UpdateUserRequestBodyPlaylistLibraryFromJSONTyped, + UpdateUserRequestBodyPlaylistLibraryToJSON, +} from './UpdateUserRequestBodyPlaylistLibrary'; + /** * Request body for updating user profile. All fields are optional. * @export @@ -106,10 +119,10 @@ export interface UpdateUserRequestBody { isDeactivated?: boolean; /** * Track ID to feature as artist pick - * @type {string} + * @type {number} * @memberof UpdateUserRequestBody */ - artistPickTrackId?: string; + artistPickTrackId?: number; /** * Whether to allow AI attribution * @type {boolean} @@ -128,6 +141,18 @@ export interface UpdateUserRequestBody { * @memberof UpdateUserRequestBody */ coinFlairMint?: string; + /** + * + * @type {UpdateUserRequestBodyPlaylistLibrary} + * @memberof UpdateUserRequestBody + */ + playlistLibrary?: UpdateUserRequestBodyPlaylistLibrary; + /** + * + * @type {CreateUserRequestBodyEvents} + * @memberof UpdateUserRequestBody + */ + events?: CreateUserRequestBodyEvents; } @@ -177,6 +202,8 @@ export function UpdateUserRequestBodyFromJSONTyped(json: any, ignoreDiscriminato 'allowAiAttribution': !exists(json, 'allow_ai_attribution') ? undefined : json['allow_ai_attribution'], 'splUsdcPayoutWallet': !exists(json, 'spl_usdc_payout_wallet') ? undefined : json['spl_usdc_payout_wallet'], 'coinFlairMint': !exists(json, 'coin_flair_mint') ? undefined : json['coin_flair_mint'], + 'playlistLibrary': !exists(json, 'playlist_library') ? undefined : UpdateUserRequestBodyPlaylistLibraryFromJSON(json['playlist_library']), + 'events': !exists(json, 'events') ? undefined : CreateUserRequestBodyEventsFromJSON(json['events']), }; } @@ -207,6 +234,8 @@ export function UpdateUserRequestBodyToJSON(value?: UpdateUserRequestBody | null 'allow_ai_attribution': value.allowAiAttribution, 'spl_usdc_payout_wallet': value.splUsdcPayoutWallet, 'coin_flair_mint': value.coinFlairMint, + 'playlist_library': UpdateUserRequestBodyPlaylistLibraryToJSON(value.playlistLibrary), + 'events': CreateUserRequestBodyEventsToJSON(value.events), }; } diff --git a/packages/sdk/src/sdk/api/generated/default/models/UpdateUserRequestBodyPlaylistLibrary.ts b/packages/sdk/src/sdk/api/generated/default/models/UpdateUserRequestBodyPlaylistLibrary.ts new file mode 100644 index 00000000000..4cbcdb64750 --- /dev/null +++ b/packages/sdk/src/sdk/api/generated/default/models/UpdateUserRequestBodyPlaylistLibrary.ts @@ -0,0 +1,73 @@ +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck +/** + * API + * Audius V1 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 { CreateUserRequestBodyPlaylistLibraryContentsInner } from './CreateUserRequestBodyPlaylistLibraryContentsInner'; +import { + CreateUserRequestBodyPlaylistLibraryContentsInnerFromJSON, + CreateUserRequestBodyPlaylistLibraryContentsInnerFromJSONTyped, + CreateUserRequestBodyPlaylistLibraryContentsInnerToJSON, +} from './CreateUserRequestBodyPlaylistLibraryContentsInner'; + +/** + * User's playlist library with support for folders and playlists + * @export + * @interface UpdateUserRequestBodyPlaylistLibrary + */ +export interface UpdateUserRequestBodyPlaylistLibrary { + /** + * Array of folders and playlist identifiers + * @type {Array} + * @memberof UpdateUserRequestBodyPlaylistLibrary + */ + contents?: Array; +} + +/** + * Check if a given object implements the UpdateUserRequestBodyPlaylistLibrary interface. + */ +export function instanceOfUpdateUserRequestBodyPlaylistLibrary(value: object): value is UpdateUserRequestBodyPlaylistLibrary { + let isInstance = true; + + return isInstance; +} + +export function UpdateUserRequestBodyPlaylistLibraryFromJSON(json: any): UpdateUserRequestBodyPlaylistLibrary { + return UpdateUserRequestBodyPlaylistLibraryFromJSONTyped(json, false); +} + +export function UpdateUserRequestBodyPlaylistLibraryFromJSONTyped(json: any, ignoreDiscriminator: boolean): UpdateUserRequestBodyPlaylistLibrary { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'contents': !exists(json, 'contents') ? undefined : ((json['contents'] as Array).map(CreateUserRequestBodyPlaylistLibraryContentsInnerFromJSON)), + }; +} + +export function UpdateUserRequestBodyPlaylistLibraryToJSON(value?: UpdateUserRequestBodyPlaylistLibrary | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'contents': value.contents === undefined ? undefined : ((value.contents as Array).map(CreateUserRequestBodyPlaylistLibraryContentsInnerToJSON)), + }; +} + 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 791c42ad9fd..f6560cc3c36 100644 --- a/packages/sdk/src/sdk/api/generated/default/models/index.ts +++ b/packages/sdk/src/sdk/api/generated/default/models/index.ts @@ -63,6 +63,9 @@ export * from './CreateTrackResponse'; export * from './CreateUserDeveloperAppRequestBody'; export * from './CreateUserDeveloperAppResponse'; export * from './CreateUserRequestBody'; +export * from './CreateUserRequestBodyEvents'; +export * from './CreateUserRequestBodyPlaylistLibrary'; +export * from './CreateUserRequestBodyPlaylistLibraryContentsInner'; export * from './CreateUserResponse'; export * from './DashboardWalletUser'; export * from './DashboardWalletUsersResponse'; @@ -102,6 +105,9 @@ export * from './PinCommentRequestBody'; export * from './Playlist'; export * from './PlaylistAddedTimestamp'; export * from './PlaylistArtwork'; +export * from './PlaylistLibraryExplorePlaylistIdentifier'; +export * from './PlaylistLibraryFolder'; +export * from './PlaylistLibraryPlaylistIdentifier'; export * from './PlaylistResponse'; export * from './PlaylistSearchResult'; export * from './PlaylistTracksResponse'; @@ -176,6 +182,7 @@ export * from './UpdateDeveloperAppRequestBody'; export * from './UpdatePlaylistRequestBody'; export * from './UpdateTrackRequestBody'; export * from './UpdateUserRequestBody'; +export * from './UpdateUserRequestBodyPlaylistLibrary'; export * from './User'; export * from './UserCoin'; export * from './UserCoinAccount'; diff --git a/packages/sdk/src/sdk/api/users/UsersApi.ts b/packages/sdk/src/sdk/api/users/UsersApi.ts index bd917f12894..3b52079b1a2 100644 --- a/packages/sdk/src/sdk/api/users/UsersApi.ts +++ b/packages/sdk/src/sdk/api/users/UsersApi.ts @@ -12,7 +12,7 @@ import { import type { LoggerService } from '../../services/Logger' import type { ClaimableTokensClient } from '../../services/Solana/programs/ClaimableTokensClient/ClaimableTokensClient' import type { SolanaClient } from '../../services/Solana/programs/SolanaClient' -import { HashId } from '../../types/HashId' +import { HashId, Id } from '../../types/HashId' import { generateMetadataCidV1 } from '../../utils/cid' import { decodeHashId, encodeHashId } from '../../utils/hashId' import { parseParams } from '../../utils/parseParams' @@ -180,7 +180,13 @@ export class UsersApi extends GeneratedUsersApi { if (this.entityManager) { const { metadata } = params const res = await this.createUserWithEntityManager({ - metadata + metadata: { + ...metadata, + events: { + ...metadata.events, + referrer: Id.parse(metadata.events?.referrer)! + } + } }) return { success: true, diff --git a/packages/web/src/common/store/pages/audio-rewards/sagas.ts b/packages/web/src/common/store/pages/audio-rewards/sagas.ts index e56d2e7a8f7..5d99a9bbcbb 100644 --- a/packages/web/src/common/store/pages/audio-rewards/sagas.ts +++ b/packages/web/src/common/store/pages/audio-rewards/sagas.ts @@ -248,7 +248,7 @@ async function claimRewardsForChallenge({ ) .then(() => sdk.rewards.claimRewards({ - claimRewardsRequest: { + reward: { challengeId, specifier: specifierWithAmount.specifier, userId diff --git a/packages/web/src/pages/oauth-login-page/OAuthSignUpPage.tsx b/packages/web/src/pages/oauth-login-page/OAuthSignUpPage.tsx index 3a977e42af1..f6ee020bbea 100644 --- a/packages/web/src/pages/oauth-login-page/OAuthSignUpPage.tsx +++ b/packages/web/src/pages/oauth-login-page/OAuthSignUpPage.tsx @@ -120,7 +120,7 @@ export const OAuthSignUpPage = () => { const sdk = await audiusSdk() const [wallet] = await sdk.services.audiusWalletClient.getAddresses() - const { blockHash, blockNumber } = await sdk.users.createUser({ + await sdk.users.createUser({ metadata: { handle: data.handle, name: data.displayName.trim(), @@ -128,13 +128,6 @@ export const OAuthSignUpPage = () => { } }) - if (blockHash && blockNumber) { - await sdk.services.entityManager.confirmWrite({ - blockHash, - blockNumber - }) - } - let accountData let retries = 0 const maxRetries = 15