diff --git a/packages/common/src/adapters/accessConditionsFromSDK.ts b/packages/common/src/adapters/accessConditionsFromSDK.ts index 5b9b976416b..1e205eb11db 100644 --- a/packages/common/src/adapters/accessConditionsFromSDK.ts +++ b/packages/common/src/adapters/accessConditionsFromSDK.ts @@ -1,38 +1,20 @@ -import type { AccessGate, full } from '@audius/sdk' +import type { full } from '@audius/sdk' import { - instanceOfExtendedPurchaseGate, instanceOfFollowGate, - instanceOfTokenGate -} from '@audius/sdk' + instanceOfPurchaseGate, + instanceOfTokenGate, + instanceOfNftGate +} from '@audius/sdk/src/sdk/api/generated/full' import { AccessConditions } from '~/models' -/** Accepts default API AccessGate or full API AccessGate (e.g. from playlists). */ export const accessConditionsFromSDK = ( - input: AccessGate | full.AccessGate + input: full.AccessGate ): AccessConditions | null => { if (instanceOfFollowGate(input)) { return { follow_user_id: input.followUserId } - } else if (instanceOfExtendedPurchaseGate(input)) { - const purchase = input.usdcPurchase - const splits = Array.isArray(purchase.splits) - ? purchase.splits.map((s) => ({ - user_id: s.userId, - percentage: s.percentage, - payout_wallet: s.payoutWallet, - amount: s.amount, - ...(s.ethWallet != null && { eth_wallet: s.ethWallet }) - })) - : [] - const albumTrackPrice = (purchase as { albumTrackPrice?: number }) - .albumTrackPrice - return { - usdc_purchase: { - price: purchase.price, - ...(albumTrackPrice != null && { albumTrackPrice }), - splits - } - } + } else if (instanceOfPurchaseGate(input)) { + return { usdc_purchase: input.usdcPurchase } } else if (instanceOfTokenGate(input)) { return { token_gate: { @@ -40,7 +22,7 @@ export const accessConditionsFromSDK = ( token_amount: input.tokenGate.tokenAmount } } - } else if ('nftCollection' in input && input.nftCollection != null) { + } else if (instanceOfNftGate(input)) { return null } else { throw new Error(`Unsupported access gate type: ${JSON.stringify(input)}`) diff --git a/packages/common/src/adapters/accessConditionsToSDK.ts b/packages/common/src/adapters/accessConditionsToSDK.ts index 936001bde3a..0457c5f22b6 100644 --- a/packages/common/src/adapters/accessConditionsToSDK.ts +++ b/packages/common/src/adapters/accessConditionsToSDK.ts @@ -1,46 +1,12 @@ -import type { CreateAlbumMetadata, TrackMetadata } from '@audius/sdk' +import type { TrackMetadata } from '@audius/sdk' import { AccessConditions, isContentFollowGated, isContentTokenGated, - isContentUSDCPurchaseGated, - type PaymentSplit, - type USDCPurchaseConditions + isContentUSDCPurchaseGated } from '~/models' -/** Maps common USDC conditions to SDK format. Use for albums (stream conditions are USDC-only). */ -export const usdcPurchaseConditionsToSDK = ( - input: USDCPurchaseConditions -): NonNullable => { - const splits = input.usdc_purchase.splits ?? [] - return { - usdcPurchase: { - price: input.usdc_purchase.price, - ...(input.usdc_purchase.albumTrackPrice != null && { - albumTrackPrice: input.usdc_purchase.albumTrackPrice - }), - splits: splits.map( - ( - s: PaymentSplit & { - userId?: number - payoutWallet?: string - ethWallet?: string - } - ) => ({ - userId: s.user_id ?? s.userId, - percentage: s.percentage, - payoutWallet: s.payout_wallet ?? s.payoutWallet ?? '', - amount: s.amount, - ...((s.eth_wallet ?? s.ethWallet) != null && { - ethWallet: s.eth_wallet ?? s.ethWallet - }) - }) - ) - } - } -} - export const accessConditionsToSDK = ( input: AccessConditions ): TrackMetadata['downloadConditions'] => { @@ -49,7 +15,9 @@ export const accessConditionsToSDK = ( followUserId: input.follow_user_id } } else if (isContentUSDCPurchaseGated(input)) { - return usdcPurchaseConditionsToSDK(input) + return { + usdcPurchase: input.usdc_purchase + } } else if (isContentTokenGated(input)) { return { tokenGate: { diff --git a/packages/common/src/adapters/collection.ts b/packages/common/src/adapters/collection.ts index 1cec62adea6..2fe6df27b68 100644 --- a/packages/common/src/adapters/collection.ts +++ b/packages/common/src/adapters/collection.ts @@ -1,14 +1,11 @@ import { - type CreateAlbumRequestBody, - type CreatePlaylistRequestBody, + CreateAlbumMetadata, + CreatePlaylistMetadata, full, Id, OptionalHashId, - type Playlist, - type PlaylistAddedTimestamp, UpdateAlbumRequest, - type UpdateAlbumRequestBody, - type UpdatePlaylistRequestBody + UpdatePlaylistRequest } from '@audius/sdk' import dayjs from 'dayjs' import { omit } from 'lodash' @@ -21,11 +18,10 @@ import { UserCollectionMetadata, Variant } from '~/models/Collection' -import { Copyright, isContentUSDCPurchaseGated } from '~/models/Track' +import { Copyright } from '~/models/Track' import type { AlbumValues, PlaylistValues } from '~/schemas' import { accessConditionsFromSDK } from './accessConditionsFromSDK' -import { usdcPurchaseConditionsToSDK } from './accessConditionsToSDK' import { resourceContributorFromSDK } from './attribution' import { favoriteFromSDK } from './favorite' import { coverArtSizesCIDsFromSDK } from './imageSize' @@ -38,13 +34,13 @@ const addedTimestampToPlaylistTrackId = ({ timestamp, trackId, metadataTimestamp -}: PlaylistAddedTimestamp): PlaylistTrackId | null => { +}: full.PlaylistAddedTimestamp): PlaylistTrackId | null => { const decoded = OptionalHashId.parse(trackId) if (decoded) { return { track: decoded, time: timestamp, - metadata_time: metadataTimestamp ?? 0 + metadata_time: metadataTimestamp } } return null @@ -55,14 +51,11 @@ export const userCollectionMetadataFromSDK = ( | full.PlaylistFullWithoutTracks | full.SearchPlaylistFull | full.PlaylistFull - | Playlist ): UserCollectionMetadata | undefined => { try { const decodedPlaylistId = OptionalHashId.parse(input.id) - const decodedOwnerId = OptionalHashId.parse( - 'userId' in input && input.userId != null ? input.userId : input.user.id - ) - const user = userMetadataFromSDK(input.user as unknown as full.UserFull) + const decodedOwnerId = OptionalHashId.parse(input.userId ?? input.user.id) + const user = userMetadataFromSDK(input.user) if (!decodedPlaylistId || !decodedOwnerId || !user) { return undefined } @@ -81,7 +74,7 @@ export const userCollectionMetadataFromSDK = ( '150x150': input.artwork._150x150, '480x480': input.artwork._480x480, '1000x1000': input.artwork._1000x1000, - mirrors: (input.artwork as { mirrors?: string[] }).mirrors ?? [] + mirrors: input.artwork.mirrors } : {}, variant: Variant.USER_GENERATED, @@ -105,11 +98,11 @@ export const userCollectionMetadataFromSDK = ( ? coverArtSizesCIDsFromSDK(input.coverArtCids) : null, followee_reposts: transformAndCleanList( - 'followeeReposts' in input ? (input.followeeReposts ?? []) : [], + input.followeeReposts, repostFromSDK ), followee_saves: transformAndCleanList( - 'followeeFavorites' in input ? (input.followeeFavorites ?? []) : [], + input.followeeFavorites, favoriteFromSDK ), playlist_contents: { @@ -118,30 +111,21 @@ export const userCollectionMetadataFromSDK = ( addedTimestampToPlaylistTrackId ) }, - producer_copyright_line: - 'producerCopyrightLine' in input && input.producerCopyrightLine - ? (snakecaseKeys(input.producerCopyrightLine) as Copyright) - : null, - stream_conditions: - 'streamConditions' in input && input.streamConditions - ? accessConditionsFromSDK(input.streamConditions) - : null, - tracks: transformAndCleanList( - ('tracks' in input ? (input.tracks ?? []) : []) as unknown as ( - | full.TrackFull - | full.SearchTrackFull - )[], - userTrackMetadataFromSDK - ), + producer_copyright_line: input.producerCopyrightLine + ? (snakecaseKeys(input.producerCopyrightLine) as Copyright) + : null, + stream_conditions: input.streamConditions + ? accessConditionsFromSDK(input.streamConditions) + : null, + tracks: transformAndCleanList(input.tracks, userTrackMetadataFromSDK), user, // Retypes / Renames save_count: input.favoriteCount, // Nullable fields - cover_art: 'coverArt' in input ? (input.coverArt ?? null) : null, - cover_art_sizes: - 'coverArtSizes' in input ? (input.coverArtSizes ?? null) : null, + cover_art: input.coverArt ?? null, + cover_art_sizes: input.coverArtSizes ?? null, description: input.description ?? null } @@ -175,7 +159,7 @@ export const accountCollectionFromSDK = ( export const playlistMetadataForCreateWithSDK = ( input: Collection | PlaylistValues -): CreatePlaylistRequestBody => { +): CreatePlaylistMetadata => { return { playlistName: input.playlist_name ?? '', description: input.description ?? '', @@ -187,7 +171,7 @@ export const playlistMetadataForCreateWithSDK = ( artists: input.artists ?? null, copyrightLine: input.copyright_line ?? null, producerCopyrightLine: input.producer_copyright_line ?? null, - parentalWarningType: input.parental_warning_type ?? undefined, + parentalWarningType: input.parental_warning_type ?? null, ...('cover_art_sizes' in input ? { coverArtCid: input.cover_art_sizes ?? '', @@ -199,7 +183,7 @@ export const playlistMetadataForCreateWithSDK = ( export const playlistMetadataForUpdateWithSDK = ( input: Collection -): UpdatePlaylistRequestBody => { +): UpdatePlaylistRequest['metadata'] => { return { ...playlistMetadataForCreateWithSDK(input), playlistContents: input.playlist_contents @@ -218,12 +202,13 @@ export const playlistMetadataForUpdateWithSDK = ( export const albumMetadataForCreateWithSDK = ( input: Collection | AlbumValues -): CreateAlbumRequestBody => { +): CreateAlbumMetadata => { return { streamConditions: - input.stream_conditions != null && - isContentUSDCPurchaseGated(input.stream_conditions) - ? usdcPurchaseConditionsToSDK(input.stream_conditions) + input.stream_conditions && 'usdc_purchase' in input.stream_conditions + ? { + usdcPurchase: input.stream_conditions.usdc_purchase + } : null, isStreamGated: input.is_stream_gated ?? false, isScheduledRelease: input.is_scheduled_release ?? false, @@ -244,7 +229,7 @@ export const albumMetadataForCreateWithSDK = ( export const albumMetadataForUpdateWithSDK = ( input: Collection -): UpdateAlbumRequestBody => { +): UpdateAlbumRequest['metadata'] => { return { ...albumMetadataForCreateWithSDK(input), playlistContents: input.playlist_contents diff --git a/packages/common/src/adapters/track.ts b/packages/common/src/adapters/track.ts index 6cca2f80b0f..ea2b58a84b5 100644 --- a/packages/common/src/adapters/track.ts +++ b/packages/common/src/adapters/track.ts @@ -1,10 +1,9 @@ import { type full, type CrossPlatformFile, - Genre, - Mood, + type Genre, + type Mood, type NativeFile, - type TrackMetadata, HashId, Id, OptionalHashId, @@ -35,27 +34,6 @@ import { repostFromSDK } from './repost' import { userMetadataFromSDK } from './user' import { transformAndCleanList } from './utils' -const VALID_GENRES = new Set(Object.values(Genre)) -const VALID_MOODS = new Set(Object.values(Mood)) - -function toSdkGenre( - value: string | undefined | '' -): (typeof Genre)[keyof typeof Genre] | undefined { - if (value === undefined || value === '') return undefined - return VALID_GENRES.has(value) - ? (value as (typeof Genre)[keyof typeof Genre]) - : undefined -} - -function toSdkMood( - value: string | null | undefined -): (typeof Mood)[keyof typeof Mood] | null | undefined { - if (value === undefined || value === null || value === '') return undefined - return VALID_MOODS.has(value) - ? (value as (typeof Mood)[keyof typeof Mood]) - : undefined -} - export const trackSegmentFromSDK = ({ duration, multihash @@ -256,100 +234,92 @@ export const stemTrackMetadataFromSDK = ( } } -const DEFAULT_GENRE = Genre.Electronic - -export const trackMetadataForUploadToSdk = ( - input: TrackMetadataForUpload -): TrackMetadata => { - const sdkGenre = toSdkGenre(input.genre) - const genre = sdkGenre ?? DEFAULT_GENRE - return { - ...camelcaseKeys( - pick(input, [ - 'license', - 'isrc', - 'iswc', - 'is_unlisted', - 'is_premium', - 'premium_conditions', - 'is_stream_gated', - 'stream_conditions', - 'is_download_gated', - 'is_downloadable', - 'is_original_available', - 'is_scheduled_release', - 'bpm', - 'is_custom_bpm', - 'is_custom_musical_key', - 'comments_disabled', - 'ddex_release_ids', - 'parental_warning_type' - ]) - ), - trackId: OptionalId.parse(input.track_id), - title: input.title, - description: squashNewLines(input.description) ?? undefined, - mood: toSdkMood(input.mood), - tags: input.tags ?? undefined, - genre, - releaseDate: input.release_date ? new Date(input.release_date) : undefined, - previewStartSeconds: input.preview_start_seconds ?? undefined, - previewCid: input.preview_cid ?? '', - ddexApp: input.ddex_app ?? '', - audioUploadId: input.audio_upload_id ?? undefined, - duration: input.duration ?? undefined, - musicalKey: input.musical_key - ? formatMusicalKey(input.musical_key) - : undefined, - trackCid: input.track_cid ?? '', - origFileCid: input.orig_file_cid ?? '', - origFilename: input.orig_filename ?? undefined, - fieldVisibility: input.field_visibility - ? mapValues( - camelcaseKeys(input.field_visibility), - (value: Maybe) => (value === null ? undefined : value) - ) - : undefined, - downloadConditions: input.download_conditions - ? accessConditionsToSDK(input.download_conditions) - : null, - streamConditions: input.stream_conditions - ? accessConditionsToSDK(input.stream_conditions) - : null, - remixOf: input.remix_of - ? { - tracks: input.remix_of.tracks.map((track) => ({ - parentTrackId: Id.parse(track.parent_track_id) - })) - } - : undefined, - stemOf: input.stem_of - ? { - category: input.stem_of.category, - parentTrackId: Id.parse(input.stem_of.parent_track_id) - } - : undefined, - copyrightLine: input.copyright_line - ? camelcaseKeys(input.copyright_line) - : undefined, - producerCopyrightLine: input.producer_copyright_line - ? camelcaseKeys(input.producer_copyright_line) - : undefined, - rightsController: input.rights_controller - ? camelcaseKeys(input.rights_controller) - : undefined, - resourceContributors: input.resource_contributors - ? input.resource_contributors.map((contributor) => - camelcaseKeys(contributor) - ) - : undefined, - indirectResourceContributors: input.indirect_resource_contributors - ? input.indirect_resource_contributors.map((contributor) => - camelcaseKeys(contributor) - ) - : undefined - } as TrackMetadata -} +export const trackMetadataForUploadToSdk = (input: TrackMetadataForUpload) => ({ + ...camelcaseKeys( + pick(input, [ + 'license', + 'isrc', + 'iswc', + 'is_unlisted', + 'is_premium', + 'premium_conditions', + 'is_stream_gated', + 'stream_conditions', + 'is_download_gated', + 'is_downloadable', + 'is_original_available', + 'is_scheduled_release', + 'bpm', + 'is_custom_bpm', + 'is_custom_musical_key', + 'comments_disabled', + 'ddex_release_ids', + 'parental_warning_type' + ]) + ), + trackId: OptionalId.parse(input.track_id), + title: input.title, + description: squashNewLines(input.description) ?? undefined, + mood: input.mood as Mood, + tags: input.tags ?? undefined, + genre: (input.genre as Genre) || undefined, + releaseDate: input.release_date ? new Date(input.release_date) : undefined, + previewStartSeconds: input.preview_start_seconds ?? undefined, + previewCid: input.preview_cid ?? '', + ddexApp: input.ddex_app ?? '', + audioUploadId: input.audio_upload_id ?? undefined, + duration: input.duration ?? undefined, + musicalKey: input.musical_key + ? formatMusicalKey(input.musical_key) + : undefined, + trackCid: input.track_cid ?? '', + origFileCid: input.orig_file_cid ?? '', + origFilename: input.orig_filename ?? undefined, + fieldVisibility: input.field_visibility + ? mapValues( + camelcaseKeys(input.field_visibility), + (value: Maybe) => (value === null ? undefined : value) + ) + : undefined, + downloadConditions: input.download_conditions + ? accessConditionsToSDK(input.download_conditions) + : null, + streamConditions: input.stream_conditions + ? accessConditionsToSDK(input.stream_conditions) + : null, + remixOf: input.remix_of + ? { + tracks: input.remix_of.tracks.map((track) => ({ + parentTrackId: Id.parse(track.parent_track_id) + })) + } + : undefined, + stemOf: input.stem_of + ? { + category: input.stem_of.category, + parentTrackId: Id.parse(input.stem_of.parent_track_id) + } + : undefined, + copyrightLine: input.copyright_line + ? camelcaseKeys(input.copyright_line) + : undefined, + producerCopyrightLine: input.producer_copyright_line + ? camelcaseKeys(input.producer_copyright_line) + : undefined, + rightsController: input.rights_controller + ? camelcaseKeys(input.rights_controller) + : undefined, + resourceContributors: input.resource_contributors + ? input.resource_contributors.map((contributor) => + camelcaseKeys(contributor) + ) + : undefined, + indirectResourceContributors: input.indirect_resource_contributors + ? input.indirect_resource_contributors.map((contributor) => + camelcaseKeys(contributor) + ) + : undefined +}) export const fileToSdk = ( file: Blob | File | NativeFile, diff --git a/packages/common/src/adapters/user.ts b/packages/common/src/adapters/user.ts index 502c1ef9ed7..8cd12de160b 100644 --- a/packages/common/src/adapters/user.ts +++ b/packages/common/src/adapters/user.ts @@ -1,16 +1,14 @@ import { HashId, OptionalHashId, + OptionalId, type full, - type UserPlaylistLibrary, - Id, - type UpdateUserRequestBody + type UpdateProfileRequest } from '@audius/sdk' import camelcaseKeys from 'camelcase-keys' import { omit, pick } from 'lodash' import snakecaseKeys from 'snakecase-keys' -import type { PlaylistLibraryItem } from '~/models' import { AccountUserMetadata, ManagedUserMetadata, @@ -166,33 +164,9 @@ export const accountFromSDK = ( } } -function mapLibraryContentsToSdkFormat( - libraryItems: PlaylistLibraryItem[] -): UserPlaylistLibrary['contents'] { - const items: UserPlaylistLibrary['contents'] = [] - for (const item of libraryItems) { - if (item.type === 'folder') { - const folder = { - id: item.id, - type: 'folder' as const, - name: item.name, - contents: mapLibraryContentsToSdkFormat(item.contents) - } - items.push(folder) - } - if (item.type === 'playlist') { - items.push({ - playlistId: item.playlist_id, - type: 'playlist' as const - }) - } - } - return items -} - export const userMetadataToSdk = ( input: WriteableUserMetadata & Pick -): UpdateUserRequestBody => ({ +): UpdateProfileRequest['metadata'] => ({ ...camelcaseKeys( pick(input, [ 'name', @@ -205,22 +179,14 @@ export const userMetadataToSdk = ( ), bio: input.bio ?? undefined, website: input.website ?? undefined, - artistPickTrackId: input.artist_pick_track_id - ? Id.parse(input.artist_pick_track_id) - : undefined, + artistPickTrackId: OptionalId.parse(input.artist_pick_track_id ?? undefined), events: { - referrer: input.events?.referrer - ? Id.parse(input.events.referrer) - : undefined, + referrer: OptionalId.parse(input.events?.referrer ?? undefined), isMobileUser: input.events?.is_mobile_user ?? undefined }, location: input.location ?? undefined, twitterHandle: input.twitter_handle ?? undefined, instagramHandle: input.instagram_handle ?? undefined, - playlistLibrary: input.playlist_library - ? { - contents: mapLibraryContentsToSdkFormat(input.playlist_library.contents) - } - : undefined, + playlistLibrary: input.playlist_library ?? undefined, tiktokHandle: input.tiktok_handle ?? undefined }) diff --git a/packages/common/src/api/tan-query/coins/useUpdateArtistCoin.ts b/packages/common/src/api/tan-query/coins/useUpdateArtistCoin.ts index 44745c0a0f1..72648c71b86 100644 --- a/packages/common/src/api/tan-query/coins/useUpdateArtistCoin.ts +++ b/packages/common/src/api/tan-query/coins/useUpdateArtistCoin.ts @@ -71,7 +71,7 @@ export const useUpdateArtistCoin = () => { const response = await sdk.coins.updateCoin({ mint, userId: Id.parse(currentUserId), - metadata: { + updateCoinRequest: { description: updateCoinRequest.description, link1: updateCoinRequest.links?.[0] ?? '', link2: updateCoinRequest.links?.[1] ?? '', diff --git a/packages/common/src/api/tan-query/collection/useUpdateCollection.ts b/packages/common/src/api/tan-query/collection/useUpdateCollection.ts index 7470d57ae56..90affce0749 100644 --- a/packages/common/src/api/tan-query/collection/useUpdateCollection.ts +++ b/packages/common/src/api/tan-query/collection/useUpdateCollection.ts @@ -105,13 +105,9 @@ export const useUpdateCollection = () => { collectionUpdate.stream_conditions = { usdc_purchase: { price: priceCents, - splits: [ - { - payout_wallet: userBankStr, - percentage: 100, - amount: priceWei - } - ] + splits: { + [userBankStr]: priceWei + } } } } diff --git a/packages/common/src/api/tan-query/comments/useDeleteComment.ts b/packages/common/src/api/tan-query/comments/useDeleteComment.ts index eaab048aed7..0319d0841f9 100644 --- a/packages/common/src/api/tan-query/comments/useDeleteComment.ts +++ b/packages/common/src/api/tan-query/comments/useDeleteComment.ts @@ -1,4 +1,3 @@ -import { Id } from '@audius/sdk' import { useMutation, useQueryClient } from '@tanstack/react-query' import { cloneDeep } from 'lodash' import { useDispatch } from 'react-redux' @@ -28,10 +27,7 @@ export const useDeleteComment = () => { const dispatch = useDispatch() return useMutation({ mutationFn: async ({ commentId, userId }: DeleteCommentArgs) => { - const commentData = { - userId: Id.parse(userId), - commentId: Id.parse(commentId) - } + const commentData = { userId, entityId: commentId } const sdk = await audiusSdk() return await sdk.comments.deleteComment(commentData) }, diff --git a/packages/common/src/api/tan-query/comments/useEditComment.ts b/packages/common/src/api/tan-query/comments/useEditComment.ts index 3d20f0c1886..492d448a48c 100644 --- a/packages/common/src/api/tan-query/comments/useEditComment.ts +++ b/packages/common/src/api/tan-query/comments/useEditComment.ts @@ -1,4 +1,4 @@ -import { EntityType, CommentMention, Id } from '@audius/sdk' +import { EntityType, CommentMention } from '@audius/sdk' import { useMutation, useQueryClient } from '@tanstack/react-query' import { useDispatch } from 'react-redux' @@ -29,19 +29,19 @@ export const useEditComment = () => { userId, newMessage, trackId, - mentions + mentions, + entityType = EntityType.TRACK }: EditCommentArgs) => { + const commentData = { + body: newMessage, + userId, + entityId: commentId, + trackId, + entityType, + mentions: mentions?.map((mention) => mention.userId) ?? [] + } const sdk = await audiusSdk() - await sdk.comments.updateComment({ - userId: Id.parse(userId)!, - commentId: Id.parse(commentId)!, - metadata: { - body: newMessage, - entityId: trackId, - entityType: 'Track', - mentions: mentions?.map((mention) => mention.userId) ?? [] - } - }) + await sdk.comments.editComment(commentData) }, onMutate: ({ commentId, newMessage, mentions }) => { const prevComment = queryClient.getQueryData( diff --git a/packages/common/src/api/tan-query/comments/usePinComment.ts b/packages/common/src/api/tan-query/comments/usePinComment.ts index b59c8acd111..669605a26a4 100644 --- a/packages/common/src/api/tan-query/comments/usePinComment.ts +++ b/packages/common/src/api/tan-query/comments/usePinComment.ts @@ -1,4 +1,3 @@ -import { Id } from '@audius/sdk' import { useMutation, useQueryClient } from '@tanstack/react-query' import { cloneDeep } from 'lodash' import { useDispatch } from 'react-redux' @@ -30,25 +29,12 @@ export const usePinComment = () => { mutationFn: async (args: PinCommentArgs) => { const { userId, commentId, isPinned, trackId } = args const sdk = await audiusSdk() - if (isPinned) { - return await sdk.comments.pinComment({ - userId: Id.parse(userId)!, - commentId: Id.parse(commentId)!, - metadata: { - entityId: trackId, - entityType: 'Track' - } - }) - } else { - return await sdk.comments.unpinComment({ - userId: Id.parse(userId)!, - commentId: Id.parse(commentId)!, - metadata: { - entityId: trackId, - entityType: 'Track' - } - }) - } + return await sdk.comments.pinComment({ + userId, + entityId: commentId, + trackId, + isPin: isPinned + }) }, onMutate: ({ commentId, isPinned, trackId, currentSort }) => { if (isPinned) { diff --git a/packages/common/src/api/tan-query/comments/usePostComment.ts b/packages/common/src/api/tan-query/comments/usePostComment.ts index f068348d38a..a704b047343 100644 --- a/packages/common/src/api/tan-query/comments/usePostComment.ts +++ b/packages/common/src/api/tan-query/comments/usePostComment.ts @@ -1,4 +1,4 @@ -import { CommentMention, EntityType, Id } from '@audius/sdk' +import { CommentMention, EntityType } from '@audius/sdk' import { useMutation, useQueryClient } from '@tanstack/react-query' import { cloneDeep } from 'lodash' @@ -32,17 +32,11 @@ export const usePostComment = () => { return useMutation({ mutationFn: async (args: PostCommentArgs) => { const sdk = await audiusSdk() - return await sdk.comments.createComment({ - userId: Id.parse(args.userId)!, - metadata: { - commentId: args.newId, - entityId: args.trackId, - entityType: 'Track', - body: args.body, - trackTimestampS: args.trackTimestampS, - mentions: args.mentions?.map((mention) => mention.userId) ?? [], - parentId: args.parentCommentId - } + return await sdk.comments.postComment({ + ...args, + mentions: args.mentions?.map((mention) => mention.userId) ?? [], + entityId: args.trackId, + commentId: args.newId }) }, onMutate: async (args: PostCommentArgs) => { diff --git a/packages/common/src/api/tan-query/comments/useReactToComment.ts b/packages/common/src/api/tan-query/comments/useReactToComment.ts index 92862a5cd1b..8960d383fba 100644 --- a/packages/common/src/api/tan-query/comments/useReactToComment.ts +++ b/packages/common/src/api/tan-query/comments/useReactToComment.ts @@ -1,4 +1,3 @@ -import { Id } from '@audius/sdk' import { useMutation, useQueryClient } from '@tanstack/react-query' import { useDispatch } from 'react-redux' @@ -30,19 +29,7 @@ export const useReactToComment = () => { trackId }: ReactToCommentArgs) => { const sdk = await audiusSdk() - if (isLiked) { - await sdk.comments.reactToComment({ - userId: Id.parse(userId)!, - commentId: Id.parse(commentId)!, - metadata: { entityId: trackId, entityType: 'Track' } - }) - } else { - await sdk.comments.unreactToComment({ - userId: Id.parse(userId)!, - commentId: Id.parse(commentId)!, - metadata: { entityId: trackId, entityType: 'Track' } - }) - } + await sdk.comments.reactComment({ userId, commentId, isLiked, trackId }) }, mutationKey: ['reactToComment'], onMutate: async ({ diff --git a/packages/common/src/api/tan-query/comments/useReportComment.ts b/packages/common/src/api/tan-query/comments/useReportComment.ts index cfe0d94f9d2..8e75b629098 100644 --- a/packages/common/src/api/tan-query/comments/useReportComment.ts +++ b/packages/common/src/api/tan-query/comments/useReportComment.ts @@ -1,4 +1,3 @@ -import { Id } from '@audius/sdk' import { useMutation, useQueryClient } from '@tanstack/react-query' import { cloneDeep } from 'lodash' import { useDispatch } from 'react-redux' @@ -29,10 +28,7 @@ export const useReportComment = () => { return useMutation({ mutationFn: async ({ userId, commentId }: ReportCommentArgs) => { const sdk = await audiusSdk() - await sdk.comments.reportComment({ - userId: Id.parse(userId)!, - commentId: Id.parse(commentId)! - }) + await sdk.comments.reportComment(userId, commentId) }, onMutate: ({ trackId, commentId, currentSort, parentCommentId }) => { // Optimistic update - filter out the comment from either the top list or the parent comment's replies diff --git a/packages/common/src/api/tan-query/developer-apps/useAddDeveloperApp.ts b/packages/common/src/api/tan-query/developer-apps/useAddDeveloperApp.ts index d36b99a16bf..210c7bef9ee 100644 --- a/packages/common/src/api/tan-query/developer-apps/useAddDeveloperApp.ts +++ b/packages/common/src/api/tan-query/developer-apps/useAddDeveloperApp.ts @@ -22,40 +22,25 @@ export const useAddDeveloperApp = () => { const encodedUserId = Id.parse(currentUserId) const sdk = await audiusSdk() - const result = await sdk.developerApps.createDeveloperApp({ - metadata: { - name, - description, - imageUrl - }, + const { apiKey, apiSecret } = await sdk.developerApps.createDeveloperApp({ + name, + description, + imageUrl, userId: encodedUserId }) - const { apiKey, apiSecret } = result - const bearerToken = - 'bearerToken' in result && typeof result.bearerToken === 'string' - ? result.bearerToken - : undefined - - if (!apiKey || !apiSecret) { - throw new Error('Failed to create developer app') - } await sdk.grants.createGrant({ userId: encodedUserId, appApiKey: apiKey }) - return { name, description, imageUrl, apiKey, apiSecret, bearerToken } + return { name, description, imageUrl, apiKey, apiSecret } }, onSuccess: (newApp: DeveloperApp) => { if (!currentUserId) { throw new Error('No current user ID') } - const { - apiSecret: apiSecretIgnored, - bearerToken: bearerTokenIgnored, - ...restNewApp - } = newApp + const { apiSecret: apiSecretIgnored, ...restNewApp } = newApp queryClient.setQueryData( getDeveloperAppsQueryKey(currentUserId), diff --git a/packages/common/src/api/tan-query/developer-apps/useDeleteDeveloperApp.ts b/packages/common/src/api/tan-query/developer-apps/useDeleteDeveloperApp.ts index e82a50fb7b7..5a55c5fc9ee 100644 --- a/packages/common/src/api/tan-query/developer-apps/useDeleteDeveloperApp.ts +++ b/packages/common/src/api/tan-query/developer-apps/useDeleteDeveloperApp.ts @@ -22,7 +22,7 @@ export const useDeleteDeveloperApp = () => { await sdk.developerApps.deleteDeveloperApp({ userId: Id.parse(currentUserId), - address: apiKey + appApiKey: apiKey }) return {} }, diff --git a/packages/common/src/api/tan-query/developer-apps/useDeveloperApps.ts b/packages/common/src/api/tan-query/developer-apps/useDeveloperApps.ts index 55f0994067a..d7454f5b7ac 100644 --- a/packages/common/src/api/tan-query/developer-apps/useDeveloperApps.ts +++ b/packages/common/src/api/tan-query/developer-apps/useDeveloperApps.ts @@ -25,7 +25,7 @@ export const useDeveloperApps = ( queryKey: getDeveloperAppsQueryKey(userId), queryFn: async () => { const sdk = await audiusSdk() - const { data = [] } = await sdk.developerApps.getDeveloperApps({ + const { data = [] } = await sdk.users.getDeveloperApps({ id: Id.parse(userId) }) diff --git a/packages/common/src/api/tan-query/developer-apps/useEditDeveloperApp.ts b/packages/common/src/api/tan-query/developer-apps/useEditDeveloperApp.ts index 623bb9a8cca..fee41094030 100644 --- a/packages/common/src/api/tan-query/developer-apps/useEditDeveloperApp.ts +++ b/packages/common/src/api/tan-query/developer-apps/useEditDeveloperApp.ts @@ -22,12 +22,10 @@ export const useEditDeveloperApp = () => { const sdk = await audiusSdk() await sdk.developerApps.updateDeveloperApp({ - address: apiKey, - metadata: { - name, - description, - imageUrl - }, + appApiKey: apiKey, + name, + description, + imageUrl, userId: Id.parse(currentUserId) }) diff --git a/packages/common/src/api/tan-query/tracks/useUpdateTrack.ts b/packages/common/src/api/tan-query/tracks/useUpdateTrack.ts index 600304081ab..a0dd5669bac 100644 --- a/packages/common/src/api/tan-query/tracks/useUpdateTrack.ts +++ b/packages/common/src/api/tan-query/tracks/useUpdateTrack.ts @@ -1,8 +1,4 @@ -import { - type UpdateTrackRequestBody, - Id, - type CrossPlatformFile -} from '@audius/sdk' +import { Id, type CrossPlatformFile } from '@audius/sdk' import { useMutation, useQueryClient } from '@tanstack/react-query' import { useDispatch, useStore } from 'react-redux' @@ -67,7 +63,7 @@ export const useUpdateTrack = () => { imageFile, trackId: Id.parse(trackId), userId: Id.parse(userId), - metadata: sdkMetadata as UpdateTrackRequestBody, + metadata: sdkMetadata, onProgress: (_, progress) => { if (progress.key === 'audio') { dispatch( diff --git a/packages/common/src/api/tan-query/upload/usePublishCollection.ts b/packages/common/src/api/tan-query/upload/usePublishCollection.ts index a3d63e98ad3..1428b9c2da7 100644 --- a/packages/common/src/api/tan-query/upload/usePublishCollection.ts +++ b/packages/common/src/api/tan-query/upload/usePublishCollection.ts @@ -71,7 +71,7 @@ const getPublishCollectionOptions = (context: PublishCollectionContext) => // albumTrackPrice will be parsed out of the collection metadata, so we keep a copy here albumTrackPrice = params.collectionMetadata.stream_conditions?.usdc_purchase - .albumTrackPrice ?? undefined + .albumTrackPrice params.collectionMetadata.stream_conditions = getUSDCMetadata( userBank.toString(), params.collectionMetadata.stream_conditions @@ -105,30 +105,22 @@ const getPublishCollectionOptions = (context: PublishCollectionContext) => ? fileToSdk(artworkBlob, 'cover_art') : undefined if (params.collectionMetadata.is_album) { - const metadata = albumMetadataForCreateWithSDK( - params.collectionMetadata - ) - metadata.playlistContents = publishedTracks.map((t) => ({ - timestamp: Date.now() / 1000, - trackId: Id.parse(t.trackId) - })) return await sdk.albums.createAlbum({ userId: Id.parse(userId), imageFile: coverArtFile, - metadata + metadata: albumMetadataForCreateWithSDK(params.collectionMetadata), + trackIds: publishedTracks + .filter((t) => t.trackId && !t.error) + .map((t) => t.trackId!) }) } else { - const metadata = playlistMetadataForCreateWithSDK( - params.collectionMetadata - ) - metadata.playlistContents = publishedTracks.map((t) => ({ - timestamp: Date.now() / 1000, - trackId: Id.parse(t.trackId) - })) return await sdk.playlists.createPlaylist({ userId: Id.parse(userId), imageFile: coverArtFile, - metadata + metadata: playlistMetadataForCreateWithSDK(params.collectionMetadata), + trackIds: publishedTracks + .filter((t) => t.trackId && !t.error) + .map((t) => t.trackId!) }) } } @@ -257,14 +249,14 @@ function combineMetadata( metadata.download_conditions = { usdc_purchase: { price: albumTrackPrice, - splits: [] + splits: { 0: 0 } } } // Set up initial stream gating values metadata.is_stream_gated = true metadata.preview_start_seconds = 0 metadata.stream_conditions = { - usdc_purchase: { price: albumTrackPrice, splits: [] } + usdc_purchase: { price: albumTrackPrice, splits: { 0: 0 } } } // Add splits to stream & download conditions addPremiumMetadata(userBank, metadata) diff --git a/packages/common/src/api/tan-query/upload/usePublishStems.ts b/packages/common/src/api/tan-query/upload/usePublishStems.ts index 7437cacad5e..56439c46b4f 100644 --- a/packages/common/src/api/tan-query/upload/usePublishStems.ts +++ b/packages/common/src/api/tan-query/upload/usePublishStems.ts @@ -1,9 +1,13 @@ import { HashId, Id, type UploadResponse } from '@audius/sdk' import { useMutation, useQueryClient } from '@tanstack/react-query' -import { StemCategory, Name, type StemUpload } from '~/models' +import { + StemCategory, + Name, + type StemUpload, + type TrackMetadata +} from '~/models' import { ProgressStatus, uploadActions } from '~/store' -import type { TrackMetadataForUpload } from '~/store/upload/types' import { getStemsQueryKey } from '../tracks/useStems' import { useCurrentUserId } from '../users/account/useCurrentUserId' @@ -23,7 +27,7 @@ type PublishStemsContext = Pick< type PublishStemsParams = { clientId: string parentTrackId: number - parentMetadata: TrackMetadataForUpload + parentMetadata: Omit stems: { metadata: StemUpload audioUploadResponse: UploadResponse diff --git a/packages/common/src/api/tan-query/upload/usePublishTracks.ts b/packages/common/src/api/tan-query/upload/usePublishTracks.ts index 77b1a634e42..0a260dc0774 100644 --- a/packages/common/src/api/tan-query/upload/usePublishTracks.ts +++ b/packages/common/src/api/tan-query/upload/usePublishTracks.ts @@ -81,9 +81,7 @@ export const publishTracks = async ( try { const res = await sdk.tracks.publishTrack({ userId: Id.parse(userId), - metadata: camelMetadata as Parameters< - typeof sdk.tracks.publishTrack - >[0]['metadata'], + metadata: camelMetadata, audioUploadResponse: param.audioUploadResponse, imageUploadResponse: param.imageUploadResponse }) @@ -232,29 +230,25 @@ export const usePublishTracks = ( /* * Given a user's bank and USDC purchase conditions, - * returns updated conditions with price in WEI and splits in the new array format. + * returns updated conditions with price in WEI and splits added. + * + * TODO: Update this to use the new user ID + percentages format. */ export function getUSDCMetadata( userBank: string, stream_conditions: USDCPurchaseConditions -): USDCPurchaseConditions { +) { const priceCents = stream_conditions.usdc_purchase.price const priceWei = Number(USDC(priceCents / 100).value.toString()) - return { + const conditionsWithMetadata: USDCPurchaseConditions = { usdc_purchase: { price: priceCents, - ...(stream_conditions.usdc_purchase.albumTrackPrice != null && { - albumTrackPrice: stream_conditions.usdc_purchase.albumTrackPrice - }), - splits: [ - { - payout_wallet: userBank?.toString() ?? '', - percentage: 100, - amount: priceWei - } - ] + splits: { + [userBank?.toString() ?? '']: priceWei + } } } + return conditionsWithMetadata } /** diff --git a/packages/common/src/api/tan-query/upload/useUpload.ts b/packages/common/src/api/tan-query/upload/useUpload.ts index a05e5ddedc1..6e3927b8126 100644 --- a/packages/common/src/api/tan-query/upload/useUpload.ts +++ b/packages/common/src/api/tan-query/upload/useUpload.ts @@ -200,7 +200,7 @@ export const useUpload = ( ? (t.metadata.artwork.source as 'unsplash' | 'original') : 'original', trackId: t.metadata.track_id!, - genre: t.metadata.genre ?? '', + genre: t.metadata.genre, mood: t.metadata.mood ?? undefined, size: t.file.size ?? -1, fileType: t.file.type ?? '', diff --git a/packages/common/src/api/tan-query/users/useUpdateProfile.ts b/packages/common/src/api/tan-query/users/useUpdateProfile.ts index 29bdee0d88c..df0ebef56c3 100644 --- a/packages/common/src/api/tan-query/users/useUpdateProfile.ts +++ b/packages/common/src/api/tan-query/users/useUpdateProfile.ts @@ -44,14 +44,25 @@ export const useUpdateProfile = () => { } } - await sdk.users.updateUser({ - id: Id.parse(currentUserId), + const { blockHash, blockNumber } = await sdk.users.updateProfile({ userId: Id.parse(currentUserId), profilePictureFile: metadata.updatedProfilePicture?.file, coverArtFile: metadata.updatedCoverPhoto?.file, metadata: userMetadataToSdk(metadata) }) + // Wait for transaction confirmation + const confirmed = await sdk.services.entityManager.confirmWrite({ + blockHash, + blockNumber + }) + + if (!confirmed) { + throw new Error( + `Could not confirm update profile for user id ${currentUserId}` + ) + } + // Fetch updated user data const { data: userData = [] } = await sdk.full.users.getUser({ id: Id.parse(currentUserId), diff --git a/packages/common/src/api/tan-query/users/useUpdateUser.ts b/packages/common/src/api/tan-query/users/useUpdateUser.ts index b66803867e9..b9a7c2bb1e4 100644 --- a/packages/common/src/api/tan-query/users/useUpdateUser.ts +++ b/packages/common/src/api/tan-query/users/useUpdateUser.ts @@ -95,11 +95,10 @@ export async function updateUser( const sdkMetadata = userMetadataToSdk(metadata as UserMetadata) - const response = await sdk.users.updateUser({ + const response = await sdk.users.updateProfile({ coverArtFile, profilePictureFile, userId: encodedUserId, - id: encodedUserId, metadata: sdkMetadata }) diff --git a/packages/common/src/hooks/useTrackMetadata.ts b/packages/common/src/hooks/useTrackMetadata.ts index c96b62d4fd3..78ae4b18cb9 100644 --- a/packages/common/src/hooks/useTrackMetadata.ts +++ b/packages/common/src/hooks/useTrackMetadata.ts @@ -81,13 +81,13 @@ export const useTrackMetadata = ({ { id: TrackMetadataType.GENRE, label: 'Genre', - value: genre ? getCanonicalName(genre) : '', + value: getCanonicalName(genre), url: searchPage({ category: 'tracks', genre: genre as Genre }) }, { id: TrackMetadataType.MOOD, label: 'Mood', - value: mood ?? '', + value: mood, url: searchPage({ category: 'tracks', mood: mood as Mood }) }, { @@ -111,9 +111,9 @@ export const useTrackMetadata = ({ { id: TrackMetadataType.DURATION, label: 'Duration', - value: formatSecondsAsText(duration ?? 0) + value: formatSecondsAsText(duration) } ].filter(({ isHidden, value }) => !isHidden && !!value) - return labels as TrackMetadataInfo[] + return labels } diff --git a/packages/common/src/models/Track.ts b/packages/common/src/models/Track.ts index 069f4fc53cf..efadc43c471 100644 --- a/packages/common/src/models/Track.ts +++ b/packages/common/src/models/Track.ts @@ -64,20 +64,11 @@ export type NftGatedConditions = { } } -/** Single split in USDC purchase conditions (matches API extended_payment_split). */ -export type PaymentSplit = { - user_id?: number - percentage: number - payout_wallet: string - amount: number - eth_wallet?: string -} - export type USDCPurchaseConditions = { usdc_purchase: { price: number - albumTrackPrice?: number | null - splits?: PaymentSplit[] + albumTrackPrice?: number + splits: Record } } diff --git a/packages/common/src/schemas/developerApps.ts b/packages/common/src/schemas/developerApps.ts index b0b045ffc74..6976c8dda46 100644 --- a/packages/common/src/schemas/developerApps.ts +++ b/packages/common/src/schemas/developerApps.ts @@ -15,7 +15,6 @@ export type DeveloperApp = { imageUrl?: string apiKey: string apiSecret?: string - bearerToken?: string } export const developerAppSchema = z.object({ diff --git a/packages/common/src/schemas/sign-on/selectGenresSchema.ts b/packages/common/src/schemas/sign-on/selectGenresSchema.ts index 4bd504d060b..0e0b503def1 100644 --- a/packages/common/src/schemas/sign-on/selectGenresSchema.ts +++ b/packages/common/src/schemas/sign-on/selectGenresSchema.ts @@ -3,12 +3,12 @@ import { z } from 'zod' import { GENRES, Genre, convertGenreLabelToValue } from '~/utils/genres' const excludedGenres = new Set([ - Genre.Comedy, - Genre.Kids, - Genre.Soundtrack, - Genre.Devotional, - Genre.Audiobooks, - Genre.SpokenWord + Genre.COMEDY, + Genre.KIDS, + Genre.SOUNDTRACK, + Genre.DEVOTIONAL, + Genre.AUDIOBOOKS, + Genre.SPOKEN_WORK ]) export const selectableGenres = GENRES.filter( diff --git a/packages/common/src/schemas/upload/uploadFormSchema.ts b/packages/common/src/schemas/upload/uploadFormSchema.ts index 3d52f6cd64d..a6e249cba62 100644 --- a/packages/common/src/schemas/upload/uploadFormSchema.ts +++ b/packages/common/src/schemas/upload/uploadFormSchema.ts @@ -35,21 +35,12 @@ const TokenGatedConditionsSchema = z }) .strict() -/** Same as API extended_payment_split (snake-cased) */ -const PaymentSplitSchema = z.object({ - user_id: z.optional(z.number()), - percentage: z.number().min(0).max(100), - payout_wallet: z.string(), - amount: z.number().nonnegative(), - eth_wallet: z.optional(z.string()) -}) - -/** Same as SDK but snake-cased for USDC purchase conditions */ +/** Same as SDK but snake-cased */ const USDCPurchaseConditionsSchema = z .object({ usdc_purchase: z.object({ price: z.number().positive(), - splits: z.array(PaymentSplitSchema).default([]) + splits: z.any() }) }) .strict() @@ -64,9 +55,8 @@ const GenreSchema = z /** Same as SDK. */ const MoodSchema = z - .enum(Object.values(Mood) as [Mood, ...Mood[]]) + .optional(z.enum(Object.values(Mood) as [Mood, ...Mood[]])) .nullable() - .optional() const DDEXResourceContributor = z .object({ diff --git a/packages/common/src/services/audius-backend/AudiusBackend.ts b/packages/common/src/services/audius-backend/AudiusBackend.ts index 3c018951be4..037a1cd2cd8 100644 --- a/packages/common/src/services/audius-backend/AudiusBackend.ts +++ b/packages/common/src/services/audius-backend/AudiusBackend.ts @@ -195,14 +195,13 @@ export const audiusBackend = ({ try { newMetadata = schemas.newUserMetadata(newMetadata, true) const userId = newMetadata.user_id - await sdk.users.updateUser({ - id: Id.parse(userId), + const { blockHash, blockNumber } = await sdk.users.updateProfile({ userId: Id.parse(userId), profilePictureFile: metadata.updatedProfilePicture?.file, coverArtFile: metadata.updatedCoverPhoto?.file, metadata: userMetadataToSdk(newMetadata) }) - return { userId } + return { blockHash, blockNumber, userId } } catch (err) { console.error(getErrorMessage(err)) throw err diff --git a/packages/common/src/store/pages/trending/reducer.ts b/packages/common/src/store/pages/trending/reducer.ts index 4396e80e4db..2a2b6e831c7 100644 --- a/packages/common/src/store/pages/trending/reducer.ts +++ b/packages/common/src/store/pages/trending/reducer.ts @@ -17,7 +17,7 @@ import { TRENDING_MONTH_PREFIX, TRENDING_ALL_TIME_PREFIX } from '~/store/pages/trending/lineup/actions' -import { parseTrendingGenreFromUrl } from '~/utils/genres' +import { GENRES, Genre } from '~/utils/genres' import { TimeRange, Track } from '../../../models' @@ -94,7 +94,7 @@ const reducer = if (history) { const urlParams = new URLSearchParams(history.location.search) - const genreParam = urlParams.get('genre') + const genre = urlParams.get('genre') as Genre | null const timeRange = urlParams.get('timeRange') as TimeRange | null return { ...initialState, @@ -102,7 +102,8 @@ const reducer = timeRange && Object.values(TimeRange).includes(timeRange) ? timeRange : TimeRange.WEEK, - trendingGenre: parseTrendingGenreFromUrl(genreParam) + trendingGenre: + genre && Object.values(GENRES).includes(genre) ? genre : null } } diff --git a/packages/common/src/store/upload/types.ts b/packages/common/src/store/upload/types.ts index 4fbda8899ad..b73f71d8755 100644 --- a/packages/common/src/store/upload/types.ts +++ b/packages/common/src/store/upload/types.ts @@ -1,4 +1,4 @@ -import { type Genre, type Mood, NativeFile } from '@audius/sdk' +import { NativeFile } from '@audius/sdk' import { CollectionValues } from '~/schemas' @@ -39,14 +39,9 @@ export const isTrackForUpload = ( * Unlike normal Track metadata, TrackMetadataForUpload includes additional * files: artwork and a stems field with StemsForUpload. * This type is used for both Upload and Edit flows. - * Uses SDK Genre/Mood for type safety when passing to SDK. - * mood accepts string so that Track/TQTrack metadata (Nullable) is assignable. */ export interface TrackMetadataForUpload - extends Omit { - /** API tracks use genre: string; form empty state is ''. */ - genre?: Genre | '' | string - mood?: Mood | string | null + extends Omit { artwork?: | Nullable<{ file?: Blob | NativeFile diff --git a/packages/common/src/utils/genres.ts b/packages/common/src/utils/genres.ts index 5e779f12a0a..d55ba9c7b4f 100644 --- a/packages/common/src/utils/genres.ts +++ b/packages/common/src/utils/genres.ts @@ -1,115 +1,132 @@ -import { Genre as SDKGenre } from '@audius/sdk' +export enum Genre { + ALL = 'All Genres', + ELECTRONIC = 'Electronic', + ROCK = 'Rock', + METAL = 'Metal', + ALTERNATIVE = 'Alternative', + HIP_HOP_RAP = 'Hip-Hop/Rap', + EXPERIMENTAL = 'Experimental', + PUNK = 'Punk', + FOLK = 'Folk', + POP = 'Pop', + AMBIENT = 'Ambient', + SOUNDTRACK = 'Soundtrack', + WORLD = 'World', + JAZZ = 'Jazz', + ACOUSTIC = 'Acoustic', + FUNK = 'Funk', + R_AND_B_SOUL = 'R&B/Soul', + DEVOTIONAL = 'Devotional', + CLASSICAL = 'Classical', + REGGAE = 'Reggae', + PODCASTS = 'Podcasts', + COUNTRY = 'Country', + SPOKEN_WORK = 'Spoken Word', + COMEDY = 'Comedy', + BLUES = 'Blues', + KIDS = 'Kids', + AUDIOBOOKS = 'Audiobooks', + LATIN = 'Latin', + LOFI = 'Lo-Fi', + HYPERPOP = 'Hyperpop', + DANCEHALL = 'Dancehall', -/** Re-export SDK Genre as the canonical source for track metadata. */ -export { Genre } from '@audius/sdk' - -/** - * UI-only value for "all genres" filter (e.g. trending page). - * Not part of SDK Genre - use for filter state only. - */ -export const ALL_GENRES = 'All Genres' as const -export type AllGenres = typeof ALL_GENRES + // Electronic Subgenres + TECHNO = 'Techno', + TRAP = 'Trap', + HOUSE = 'House', + TECH_HOUSE = 'Tech House', + DEEP_HOUSE = 'Deep House', + DISCO = 'Disco', + ELECTRO = 'Electro', + JUNGLE = 'Jungle', + PROGRESSIVE_HOUSE = 'Progressive House', + HARDSTYLE = 'Hardstyle', + GLITCH_HOP = 'Glitch Hop', + TRANCE = 'Trance', + FUTURE_BASS = 'Future Bass', + FUTURE_HOUSE = 'Future House', + TROPICAL_HOUSE = 'Tropical House', + DOWNTEMPO = 'Downtempo', + DRUM_AND_BASS = 'Drum & Bass', + DUBSTEP = 'Dubstep', + JERSEY_CLUB = 'Jersey Club', + VAPORWAVE = 'Vaporwave', + MOOMBAHTON = 'Moombahton' +} export const ELECTRONIC_PREFIX = 'Electronic - ' export const ELECTRONIC_SUBGENRES: Partial< - Record + Record > = { - [SDKGenre.Techno]: `${ELECTRONIC_PREFIX}${SDKGenre.Techno}`, - [SDKGenre.Trap]: `${ELECTRONIC_PREFIX}${SDKGenre.Trap}`, - [SDKGenre.House]: `${ELECTRONIC_PREFIX}${SDKGenre.House}`, - [SDKGenre.TechHouse]: `${ELECTRONIC_PREFIX}${SDKGenre.TechHouse}`, - [SDKGenre.DeepHouse]: `${ELECTRONIC_PREFIX}${SDKGenre.DeepHouse}`, - [SDKGenre.Disco]: `${ELECTRONIC_PREFIX}${SDKGenre.Disco}`, - [SDKGenre.Electro]: `${ELECTRONIC_PREFIX}${SDKGenre.Electro}`, - [SDKGenre.Jungle]: `${ELECTRONIC_PREFIX}${SDKGenre.Jungle}`, - [SDKGenre.ProgressiveHouse]: `${ELECTRONIC_PREFIX}${SDKGenre.ProgressiveHouse}`, - [SDKGenre.Hardstyle]: `${ELECTRONIC_PREFIX}${SDKGenre.Hardstyle}`, - [SDKGenre.GlitchHop]: `${ELECTRONIC_PREFIX}${SDKGenre.GlitchHop}`, - [SDKGenre.Trance]: `${ELECTRONIC_PREFIX}${SDKGenre.Trance}`, - [SDKGenre.FutureBass]: `${ELECTRONIC_PREFIX}${SDKGenre.FutureBass}`, - [SDKGenre.FutureHouse]: `${ELECTRONIC_PREFIX}${SDKGenre.FutureHouse}`, - [SDKGenre.TropicalHouse]: `${ELECTRONIC_PREFIX}${SDKGenre.TropicalHouse}`, - [SDKGenre.Downtempo]: `${ELECTRONIC_PREFIX}${SDKGenre.Downtempo}`, - [SDKGenre.DrumBass]: `${ELECTRONIC_PREFIX}${SDKGenre.DrumBass}`, - [SDKGenre.Dubstep]: `${ELECTRONIC_PREFIX}${SDKGenre.Dubstep}`, - [SDKGenre.JerseyClub]: `${ELECTRONIC_PREFIX}${SDKGenre.JerseyClub}`, - [SDKGenre.Vaporwave]: `${ELECTRONIC_PREFIX}${SDKGenre.Vaporwave}`, - [SDKGenre.Moombahton]: `${ELECTRONIC_PREFIX}${SDKGenre.Moombahton}` + [Genre.TECHNO]: `${ELECTRONIC_PREFIX}${Genre.TECHNO}`, + [Genre.TRAP]: `${ELECTRONIC_PREFIX}${Genre.TRAP}`, + [Genre.HOUSE]: `${ELECTRONIC_PREFIX}${Genre.HOUSE}`, + [Genre.TECH_HOUSE]: `${ELECTRONIC_PREFIX}${Genre.TECH_HOUSE}`, + [Genre.DEEP_HOUSE]: `${ELECTRONIC_PREFIX}${Genre.DEEP_HOUSE}`, + [Genre.DISCO]: `${ELECTRONIC_PREFIX}${Genre.DISCO}`, + [Genre.ELECTRO]: `${ELECTRONIC_PREFIX}${Genre.ELECTRO}`, + [Genre.JUNGLE]: `${ELECTRONIC_PREFIX}${Genre.JUNGLE}`, + [Genre.PROGRESSIVE_HOUSE]: `${ELECTRONIC_PREFIX}${Genre.PROGRESSIVE_HOUSE}`, + [Genre.HARDSTYLE]: `${ELECTRONIC_PREFIX}${Genre.HARDSTYLE}`, + [Genre.GLITCH_HOP]: `${ELECTRONIC_PREFIX}${Genre.GLITCH_HOP}`, + [Genre.TRANCE]: `${ELECTRONIC_PREFIX}${Genre.TRANCE}`, + [Genre.FUTURE_BASS]: `${ELECTRONIC_PREFIX}${Genre.FUTURE_BASS}`, + [Genre.FUTURE_HOUSE]: `${ELECTRONIC_PREFIX}${Genre.FUTURE_HOUSE}`, + [Genre.TROPICAL_HOUSE]: `${ELECTRONIC_PREFIX}${Genre.TROPICAL_HOUSE}`, + [Genre.DOWNTEMPO]: `${ELECTRONIC_PREFIX}${Genre.DOWNTEMPO}`, + [Genre.DRUM_AND_BASS]: `${ELECTRONIC_PREFIX}${Genre.DRUM_AND_BASS}`, + [Genre.DUBSTEP]: `${ELECTRONIC_PREFIX}${Genre.DUBSTEP}`, + [Genre.JERSEY_CLUB]: `${ELECTRONIC_PREFIX}${Genre.JERSEY_CLUB}`, + [Genre.VAPORWAVE]: `${ELECTRONIC_PREFIX}${Genre.VAPORWAVE}`, + [Genre.MOOMBAHTON]: `${ELECTRONIC_PREFIX}${Genre.MOOMBAHTON}` } -export const getCanonicalName = (genre: SDKGenre | string) => { - if (genre in ELECTRONIC_SUBGENRES) - return ELECTRONIC_SUBGENRES[genre as SDKGenre] +export const getCanonicalName = (genre: Genre | any) => { + if (genre in ELECTRONIC_SUBGENRES) return ELECTRONIC_SUBGENRES[genre as Genre] return genre } /** User-facing genre labels. Use `convertGenreLabelToValue` to get the correct genre value (to set as the genre in track metadata). */ export const GENRES = [ - SDKGenre.Electronic, - SDKGenre.Rock, - SDKGenre.Metal, - SDKGenre.Alternative, - SDKGenre.HipHopRap, - SDKGenre.Experimental, - SDKGenre.Punk, - SDKGenre.Folk, - SDKGenre.Pop, - SDKGenre.Ambient, - SDKGenre.Soundtrack, - SDKGenre.World, - SDKGenre.Jazz, - SDKGenre.Acoustic, - SDKGenre.Funk, - SDKGenre.RbSoul, - SDKGenre.Devotional, - SDKGenre.Classical, - SDKGenre.Reggae, - SDKGenre.Podcasts, - SDKGenre.Country, - SDKGenre.SpokenWord, - SDKGenre.Comedy, - SDKGenre.Blues, - SDKGenre.Kids, - SDKGenre.Audiobooks, - SDKGenre.Latin, - SDKGenre.LoFi, - SDKGenre.Hyperpop, - SDKGenre.Dancehall, + Genre.ELECTRONIC, + Genre.ROCK, + Genre.METAL, + Genre.ALTERNATIVE, + Genre.HIP_HOP_RAP, + Genre.EXPERIMENTAL, + Genre.PUNK, + Genre.FOLK, + Genre.POP, + Genre.AMBIENT, + Genre.SOUNDTRACK, + Genre.WORLD, + Genre.JAZZ, + Genre.ACOUSTIC, + Genre.FUNK, + Genre.R_AND_B_SOUL, + Genre.DEVOTIONAL, + Genre.CLASSICAL, + Genre.REGGAE, + Genre.PODCASTS, + Genre.COUNTRY, + Genre.SPOKEN_WORK, + Genre.COMEDY, + Genre.BLUES, + Genre.KIDS, + Genre.AUDIOBOOKS, + Genre.LATIN, + Genre.LOFI, + Genre.HYPERPOP, + Genre.DANCEHALL, ...Object.values(ELECTRONIC_SUBGENRES) -] as const - -export type GenreLabel = (typeof GENRES)[number] - -export const convertGenreLabelToValue = (genreLabel: GenreLabel): SDKGenre => { - return genreLabel.replace(ELECTRONIC_PREFIX, '') as SDKGenre -} - -/** - * Converts a string from the trending genre UI (e.g. from URL or genre list) - * into Genre | null for Redux state. Returns null for null, empty, or ALL_GENRES. - */ -export const parseTrendingGenreFromUrl = ( - param: string | null -): SDKGenre | null => { - if (param === null || param === '' || param === ALL_GENRES) return null - const genresList = GENRES as readonly string[] - if (!genresList.includes(param)) return null - const trimmed = param.startsWith(ELECTRONIC_PREFIX) - ? param.slice(ELECTRONIC_PREFIX.length) - : param - return trimmed as SDKGenre -} +] -/** - * Converts a genre string from UI (e.g. from GenreSelectionList) to Genre | null - * for setTrendingGenre. Use when the value is known to come from GENRES. - */ -export const toTrendingGenre = (value: string | null): SDKGenre | null => { - if (value === null || value === '' || value === ALL_GENRES) return null - const genresList = GENRES as readonly string[] - if (!genresList.includes(value)) return null - return convertGenreLabelToValue(value as GenreLabel) +export const convertGenreLabelToValue = ( + genreLabel: (typeof GENRES)[number] +) => { + return genreLabel.replace(ELECTRONIC_PREFIX, '') } const NEWLY_ADDED_GENRES: string[] = [] diff --git a/packages/common/src/utils/isLongFormContent.ts b/packages/common/src/utils/isLongFormContent.ts index 84140d0fe64..5e3764b1049 100644 --- a/packages/common/src/utils/isLongFormContent.ts +++ b/packages/common/src/utils/isLongFormContent.ts @@ -5,4 +5,4 @@ import { Maybe } from './typeUtils' export const isLongFormContent = ( track: Maybe | null> -) => track?.genre === Genre.Podcasts || track?.genre === Genre.Audiobooks +) => track?.genre === Genre.PODCASTS || track?.genre === Genre.AUDIOBOOKS diff --git a/packages/common/src/utils/quickSearch.ts b/packages/common/src/utils/quickSearch.ts index f11c416bcc4..11658d17a63 100644 --- a/packages/common/src/utils/quickSearch.ts +++ b/packages/common/src/utils/quickSearch.ts @@ -35,14 +35,14 @@ export type QuickSearchPreset = { } export const QUICK_SEARCH_PRESETS: QuickSearchPreset[] = [ - { mood: Mood.Fiery, bpm: bpmDescriptions.UPBEAT }, - { genre: Genre.Electronic, mood: Mood.Aggressive }, - { genre: Genre.Alternative, key: 'E Minor' }, - { genre: Genre.HipHopRap, bpm: bpmDescriptions.MEDIUM }, - { genre: Genre.Techno, bpm: bpmDescriptions.UPBEAT }, - { genre: Genre.LoFi, bpm: bpmDescriptions.SLOW }, - { genre: Genre.Dubstep, bpm: bpmDescriptions._140 }, - { genre: Genre.Rock, isVerified: true }, - { genre: Genre.Alternative, mood: Mood.Romantic }, + { mood: Mood.FIERY, bpm: bpmDescriptions.UPBEAT }, + { genre: Genre.ELECTRONIC, mood: Mood.AGGRESSIVE }, + { genre: Genre.ALTERNATIVE, key: 'E Minor' }, + { genre: Genre.HIP_HOP_RAP, bpm: bpmDescriptions.MEDIUM }, + { genre: Genre.TECHNO, bpm: bpmDescriptions.UPBEAT }, + { genre: Genre.LOFI, bpm: bpmDescriptions.SLOW }, + { genre: Genre.DUBSTEP, bpm: bpmDescriptions._140 }, + { genre: Genre.ROCK, isVerified: true }, + { genre: Genre.ALTERNATIVE, mood: Mood.ROMANTIC }, { key: 'A Minor', bpm: bpmDescriptions.SLOW } ] diff --git a/packages/common/src/utils/route.ts b/packages/common/src/utils/route.ts index c2ca6b6bd7f..632ab9dfacd 100644 --- a/packages/common/src/utils/route.ts +++ b/packages/common/src/utils/route.ts @@ -3,7 +3,7 @@ import qs from 'query-string' import { ID, SearchCategory, SearchFilters } from '~/models' import { encodeUrlName, formatTickerForUrl } from './formatUtil' -import { convertGenreLabelToValue, type GenreLabel } from './genres' +import { convertGenreLabelToValue, Genre } from './genres' // External Routes export const PRIVACY_POLICY = '/legal/privacy-policy' @@ -441,9 +441,7 @@ export const searchPage = (searchOptions: SearchOptions) => { const { category, ...searchParams } = searchOptions if (searchParams.genre) { - searchParams.genre = convertGenreLabelToValue( - searchParams.genre as GenreLabel - ) + searchParams.genre = convertGenreLabelToValue(searchParams.genre) as Genre } // Build the search path - category is optional diff --git a/packages/discovery-provider/plugins/pedalboard/apps/relay/src/scripts/sandbox.ts b/packages/discovery-provider/plugins/pedalboard/apps/relay/src/scripts/sandbox.ts index ca481f15bfa..aab871b79d2 100644 --- a/packages/discovery-provider/plugins/pedalboard/apps/relay/src/scripts/sandbox.ts +++ b/packages/discovery-provider/plugins/pedalboard/apps/relay/src/scripts/sandbox.ts @@ -27,8 +27,7 @@ export const main = async () => { handle: 'totallynotalec' }) const userId = data?.id! - const res = await audiusSdk.users.updateUser({ - id: userId, + const res = await audiusSdk.users.updateProfile({ userId, metadata: { bio: `identity has no reigns on me ${new Date().getTime()}` diff --git a/packages/discovery-provider/plugins/pedalboard/apps/trending-challenge-rewards/src/rewards.ts b/packages/discovery-provider/plugins/pedalboard/apps/trending-challenge-rewards/src/rewards.ts index 4075f2db8d4..a18f22404bf 100644 --- a/packages/discovery-provider/plugins/pedalboard/apps/trending-challenge-rewards/src/rewards.ts +++ b/packages/discovery-provider/plugins/pedalboard/apps/trending-challenge-rewards/src/rewards.ts @@ -113,7 +113,7 @@ export const onDisburse = async ( challenge.amount ) res = await sdk.rewards.claimRewards({ - reward: { + claimRewardsRequest: { challengeId, userId: challenge.user_id, specifier: challenge.specifier diff --git a/packages/mobile/src/components/audio/AudioPlayer.tsx b/packages/mobile/src/components/audio/AudioPlayer.tsx index 515c3284b69..cd913ffb736 100644 --- a/packages/mobile/src/components/audio/AudioPlayer.tsx +++ b/packages/mobile/src/components/audio/AudioPlayer.tsx @@ -489,8 +489,8 @@ export const AudioPlayer = () => { }) const isLongFormContent = - track?.genre === Genre.Podcasts || - track?.genre === Genre.Audiobooks + track?.genre === Genre.PODCASTS || + track?.genre === Genre.AUDIOBOOKS const trackPosition = trackPositions?.[track.track_id] if (trackPosition?.status === 'IN_PROGRESS') { dispatch( @@ -513,8 +513,8 @@ export const AudioPlayer = () => { } const isLongFormContent = - queueTracks[playerIndex]?.track?.genre === Genre.Podcasts || - queueTracks[playerIndex]?.track?.genre === Genre.Audiobooks + queueTracks[playerIndex]?.track?.genre === Genre.PODCASTS || + queueTracks[playerIndex]?.track?.genre === Genre.AUDIOBOOKS // Always set the correct playback rate when the active track changes const newRate = isLongFormContent @@ -532,7 +532,7 @@ export const AudioPlayer = () => { if (event?.lastPosition !== undefined && event?.index !== undefined) { const { track } = queueTracks[event.index] ?? {} const isLongFormContent = - track?.genre === Genre.Podcasts || track?.genre === Genre.Audiobooks + track?.genre === Genre.PODCASTS || track?.genre === Genre.AUDIOBOOKS const isAtEndOfTrack = track?.duration && event.lastPosition >= track.duration - TRACK_END_BUFFER diff --git a/packages/mobile/src/components/lineup-tile/TrackTile.tsx b/packages/mobile/src/components/lineup-tile/TrackTile.tsx index 49f66b42ca8..b82251f904f 100644 --- a/packages/mobile/src/components/lineup-tile/TrackTile.tsx +++ b/packages/mobile/src/components/lineup-tile/TrackTile.tsx @@ -194,7 +194,7 @@ const TrackTileComponent = (props: TrackTileProps) => { const handlePressOverflow = useCallback(() => { if (!track) return const isLongFormContent = - track.genre === Genre.Podcasts || track.genre === Genre.Audiobooks + track.genre === Genre.PODCASTS || track.genre === Genre.AUDIOBOOKS const isOwner = currentUserId === track.owner_id const isArtistPick = isOwner && user?.artist_pick_track_id === track.track_id @@ -303,7 +303,7 @@ const TrackTileComponent = (props: TrackTileProps) => { trackId={track.track_id} duration={track.duration} isLongFormContent={ - track.genre === Genre.Podcasts || track.genre === Genre.Audiobooks + track.genre === Genre.PODCASTS || track.genre === Genre.AUDIOBOOKS } isArtistPick={showArtistPick && isArtistPick} /> diff --git a/packages/mobile/src/components/now-playing-drawer/ActionsBar.tsx b/packages/mobile/src/components/now-playing-drawer/ActionsBar.tsx index 1c4ee617937..e0e7901b4c7 100644 --- a/packages/mobile/src/components/now-playing-drawer/ActionsBar.tsx +++ b/packages/mobile/src/components/now-playing-drawer/ActionsBar.tsx @@ -183,7 +183,7 @@ export const ActionsBar = ({ track }: ActionsBarProps) => { const onPressOverflow = useCallback(() => { if (track) { const isLongFormContent = - track.genre === Genre.Podcasts || track.genre === Genre.Audiobooks + track.genre === Genre.PODCASTS || track.genre === Genre.AUDIOBOOKS const overflowActions = [ OverflowAction.VIEW_COMMENTS, OverflowAction.SHARE, diff --git a/packages/mobile/src/components/now-playing-drawer/NowPlayingDrawer.tsx b/packages/mobile/src/components/now-playing-drawer/NowPlayingDrawer.tsx index 0e5e2c83824..d1390303f75 100644 --- a/packages/mobile/src/components/now-playing-drawer/NowPlayingDrawer.tsx +++ b/packages/mobile/src/components/now-playing-drawer/NowPlayingDrawer.tsx @@ -236,7 +236,7 @@ export const NowPlayingDrawer = memo(function NowPlayingDrawer( const onNext = useCallback(async () => { const isLongFormContent = - track?.genre === Genre.Podcasts || track?.genre === Genre.Audiobooks + track?.genre === Genre.PODCASTS || track?.genre === Genre.AUDIOBOOKS if (isLongFormContent) { const { position: currentPosition } = await TrackPlayer.getProgress() const newPosition = currentPosition + SKIP_DURATION_SEC @@ -250,7 +250,7 @@ export const NowPlayingDrawer = memo(function NowPlayingDrawer( const onPrevious = useCallback(async () => { const { position: currentPosition } = await TrackPlayer.getProgress() const isLongFormContent = - track?.genre === Genre.Podcasts || track?.genre === Genre.Audiobooks + track?.genre === Genre.PODCASTS || track?.genre === Genre.AUDIOBOOKS if (isLongFormContent) { const newPosition = currentPosition - SKIP_DURATION_SEC dispatch(seek({ seconds: Math.max(0, newPosition) })) @@ -347,8 +347,8 @@ export const NowPlayingDrawer = memo(function NowPlayingDrawer( onNext={onNext} onPrevious={onPrevious} isLongFormContent={ - track?.genre === Genre.Podcasts || - track?.genre === Genre.Audiobooks + track?.genre === Genre.PODCASTS || + track?.genre === Genre.AUDIOBOOKS } /> diff --git a/packages/mobile/src/components/now-playing-drawer/TrackingBar.tsx b/packages/mobile/src/components/now-playing-drawer/TrackingBar.tsx index 26c21ca3849..6b5a2cb926b 100644 --- a/packages/mobile/src/components/now-playing-drawer/TrackingBar.tsx +++ b/packages/mobile/src/components/now-playing-drawer/TrackingBar.tsx @@ -68,7 +68,7 @@ export const TrackingBar = (props: TrackingBarProps) => { // Calculate the actual playback rate based on track type const isLongFormContent = - trackGenre === Genre.Podcasts || trackGenre === Genre.Audiobooks + trackGenre === Genre.PODCASTS || trackGenre === Genre.AUDIOBOOKS const actualPlaybackRate = isLongFormContent ? playbackRateValueMap[playbackRate] : 1.0 diff --git a/packages/mobile/src/components/scrubber/Slider.tsx b/packages/mobile/src/components/scrubber/Slider.tsx index a5a52537a1e..b5bde348c10 100644 --- a/packages/mobile/src/components/scrubber/Slider.tsx +++ b/packages/mobile/src/components/scrubber/Slider.tsx @@ -161,7 +161,7 @@ export const Slider = memo(function Slider(props: SliderProps) { // Calculate the actual playback rate based on track type const isLongFormContent = - trackGenre === Genre.Podcasts || trackGenre === Genre.Audiobooks + trackGenre === Genre.PODCASTS || trackGenre === Genre.AUDIOBOOKS const actualPlaybackRate = isLongFormContent ? playbackRateValueMap[playbackRate] : 1.0 diff --git a/packages/mobile/src/components/scrubber/usePosition.ts b/packages/mobile/src/components/scrubber/usePosition.ts index 2f30a67db3b..5f3f5ccffb2 100644 --- a/packages/mobile/src/components/scrubber/usePosition.ts +++ b/packages/mobile/src/components/scrubber/usePosition.ts @@ -41,7 +41,7 @@ export const usePosition = ( // Calculate the actual playback rate based on track type const isLongFormContent = - trackGenre === Genre.Podcasts || trackGenre === Genre.Audiobooks + trackGenre === Genre.PODCASTS || trackGenre === Genre.AUDIOBOOKS const actualPlaybackRate = isLongFormContent ? playbackRateValueMap[playbackRate] : 1.0 diff --git a/packages/mobile/src/components/track-list/TrackListItem.tsx b/packages/mobile/src/components/track-list/TrackListItem.tsx index 5d906f08462..be048eb0766 100644 --- a/packages/mobile/src/components/track-list/TrackListItem.tsx +++ b/packages/mobile/src/components/track-list/TrackListItem.tsx @@ -261,7 +261,7 @@ const TrackListItemComponent = (props: TrackListItemComponentProps) => { currentUserId && contextPlaylist?.playlist_owner_id === currentUserId const isLongFormContent = - track?.genre === Genre.Podcasts || track?.genre === Genre.Audiobooks + track?.genre === Genre.PODCASTS || track?.genre === Genre.AUDIOBOOKS const playbackPositionInfo = useSelector((state) => getTrackPosition(state, { trackId: track_id, userId: currentUserId }) ) diff --git a/packages/mobile/src/screens/sign-on-screen/screens/SelectArtistScreen/SelectedGenresTabBar.tsx b/packages/mobile/src/screens/sign-on-screen/screens/SelectArtistScreen/SelectedGenresTabBar.tsx index 058136db714..5e37a9798b5 100644 --- a/packages/mobile/src/screens/sign-on-screen/screens/SelectArtistScreen/SelectedGenresTabBar.tsx +++ b/packages/mobile/src/screens/sign-on-screen/screens/SelectArtistScreen/SelectedGenresTabBar.tsx @@ -1,6 +1,6 @@ import { useCallback } from 'react' -import type { GenreLabel } from '@audius/common/utils' +import type { Genre } from '@audius/common/utils' import { convertGenreLabelToValue } from '@audius/common/utils' import { css } from '@emotion/native' import { ScrollView } from 'react-native' @@ -50,7 +50,7 @@ export const SelectedGenresTabBar = (props: SelectedGenresTabBarProps) => { { const { spacing } = useTheme() const { data: artists } = useGetTopArtists( - convertGenreLabelToValue(genre as GenreLabel), + convertGenreLabelToValue(genre as Genre), { enabled: isFocused } diff --git a/packages/mobile/src/screens/sign-on-screen/screens/SelectGenresScreen.tsx b/packages/mobile/src/screens/sign-on-screen/screens/SelectGenresScreen.tsx index 2d1c517f7f5..0f9e051b68b 100644 --- a/packages/mobile/src/screens/sign-on-screen/screens/SelectGenresScreen.tsx +++ b/packages/mobile/src/screens/sign-on-screen/screens/SelectGenresScreen.tsx @@ -23,11 +23,9 @@ import type { SignOnScreenParamList } from '../types' import { useTrackScreen } from '../utils/useTrackScreen' type Genre = (typeof GENRES)[number] -type SelectGenresValue = { genres: Genre[] } +type SelectGenresValue = { genres: typeof GENRES } -const initialValues: SelectGenresValue = { - genres: [] as Genre[] -} +const initialValues: SelectGenresValue = { genres: [] } /* Memoized SelectablePill to fix a performance issue. * The code below is arranged so that the pills don't need to re-render, diff --git a/packages/mobile/src/screens/track-screen/TrackScreenDetailsTile.tsx b/packages/mobile/src/screens/track-screen/TrackScreenDetailsTile.tsx index 0cae222ae8b..e433d4baf84 100644 --- a/packages/mobile/src/screens/track-screen/TrackScreenDetailsTile.tsx +++ b/packages/mobile/src/screens/track-screen/TrackScreenDetailsTile.tsx @@ -227,7 +227,7 @@ export const TrackScreenDetailsTile = ({ const { open: openCommentDrawer } = useCommentDrawer() const isLongFormContent = - track?.genre === Genre.Podcasts || track?.genre === Genre.Audiobooks + track?.genre === Genre.PODCASTS || track?.genre === Genre.AUDIOBOOKS const isUSDCPurchaseGated = isContentUSDCPurchaseGated(streamConditions) const { data: remixContest } = useRemixContest(trackId) const isRemixContest = !!remixContest @@ -433,7 +433,7 @@ export const TrackScreenDetailsTile = ({ const handlePressOverflow = () => { const isLongFormContent = - genre === Genre.Podcasts || genre === Genre.Audiobooks + genre === Genre.PODCASTS || genre === Genre.AUDIOBOOKS const addToAlbumAction = isOwner && !ddexApp ? OverflowAction.ADD_TO_ALBUM : null const overflowActions = [ diff --git a/packages/mobile/src/screens/trending-screen/TrendingFilterButton.tsx b/packages/mobile/src/screens/trending-screen/TrendingFilterButton.tsx index 891b3be7c74..367127f680b 100644 --- a/packages/mobile/src/screens/trending-screen/TrendingFilterButton.tsx +++ b/packages/mobile/src/screens/trending-screen/TrendingFilterButton.tsx @@ -1,7 +1,7 @@ import { useCallback } from 'react' import { modalsActions, trendingPageSelectors } from '@audius/common/store' -import { ALL_GENRES } from '@audius/common/utils' +import { Genre } from '@audius/common/utils' import { useDispatch, useSelector } from 'react-redux' import { FilterButton } from '@audius/harmony-native' @@ -13,7 +13,7 @@ const { setVisibility } = modalsActions export const TrendingFilterButton = () => { const dispatch = useDispatch() - const trendingGenre = useSelector(getTrendingGenre) ?? ALL_GENRES + const trendingGenre = useSelector(getTrendingGenre) ?? Genre.ALL const handlePress = useCallback(() => { dispatch(setVisibility({ modal: MODAL_NAME, visible: true })) diff --git a/packages/mobile/src/screens/trending-screen/TrendingFilterDrawer.tsx b/packages/mobile/src/screens/trending-screen/TrendingFilterDrawer.tsx index bb76501e1a5..47a5072e53f 100644 --- a/packages/mobile/src/screens/trending-screen/TrendingFilterDrawer.tsx +++ b/packages/mobile/src/screens/trending-screen/TrendingFilterDrawer.tsx @@ -6,11 +6,10 @@ import { trendingPageSelectors } from '@audius/common/store' import { - type Genre, + Genre, ELECTRONIC_PREFIX, ELECTRONIC_SUBGENRES, - GENRES, - ALL_GENRES + GENRES } from '@audius/common/utils' import { FlatList, Keyboard, View } from 'react-native' import { useDispatch, useSelector } from 'react-redux' @@ -32,7 +31,7 @@ const messages = { searchPlaceholder: 'Search Genres' } -const trendingGenres = [ALL_GENRES, ...GENRES] +const trendingGenres = [Genre.ALL, ...GENRES] const useStyles = makeStyles(({ spacing }) => ({ root: { @@ -50,7 +49,7 @@ const useStyles = makeStyles(({ spacing }) => ({ export const TrendingFilterDrawer = () => { const styles = useStyles() const [searchValue, setSearchValue] = useState('') - const trendingGenre = useSelector(getTrendingGenre) ?? ALL_GENRES + const trendingGenre = useSelector(getTrendingGenre) ?? Genre.ALL const { onClose } = useDrawerState(MODAL_NAME) const dispatch = useDispatch() @@ -64,7 +63,7 @@ export const TrendingFilterDrawer = () => { const handleSelect = useCallback( (genre: string) => { const trimmedGenre = - genre === ALL_GENRES + genre === Genre.ALL ? null : (genre.replace(ELECTRONIC_PREFIX, '') as Genre) diff --git a/packages/mobile/src/screens/trending-screen/TrendingGenrePill.tsx b/packages/mobile/src/screens/trending-screen/TrendingGenrePill.tsx index ed078cc2aa3..424c455ebd1 100644 --- a/packages/mobile/src/screens/trending-screen/TrendingGenrePill.tsx +++ b/packages/mobile/src/screens/trending-screen/TrendingGenrePill.tsx @@ -6,7 +6,7 @@ import { trendingPageLineupActions, trendingPageSelectors } from '@audius/common/store' -import { ALL_GENRES } from '@audius/common/utils' +import { Genre } from '@audius/common/utils' import { useDispatch, useSelector } from 'react-redux' import { IconCloseAlt, SelectablePill } from '@audius/harmony-native' @@ -21,12 +21,12 @@ const { trendingWeekActions, trendingMonthActions, trendingAllTimeActions } = export const TrendingGenrePill = () => { const dispatch = useDispatch() - const genre = useSelector(getTrendingGenre) ?? ALL_GENRES + const genre = useSelector(getTrendingGenre) ?? Genre.ALL - const isSelected = genre !== ALL_GENRES + const isSelected = genre !== Genre.ALL const handlePress = useCallback(() => { - if (genre === ALL_GENRES) { + if (genre === Genre.ALL) { dispatch(setVisibility({ modal: MODAL_NAME, visible: true })) } }, [dispatch, genre]) diff --git a/packages/sdk/src/sdk/api/albums/AlbumsApi.test.ts b/packages/sdk/src/sdk/api/albums/AlbumsApi.test.ts index 502f2dd3d51..3b5d376831b 100644 --- a/packages/sdk/src/sdk/api/albums/AlbumsApi.test.ts +++ b/packages/sdk/src/sdk/api/albums/AlbumsApi.test.ts @@ -20,7 +20,9 @@ import { import { SolanaClient } from '../../services/Solana/programs/SolanaClient' import { Storage } from '../../services/Storage' import { StorageNodeSelector } from '../../services/StorageNodeSelector' -import { Configuration, Genre, Mood } from '../generated/default' +import { Genre } from '../../types/Genre' +import { Mood } from '../../types/Mood' +import { Configuration } from '../generated/default' import { PlaylistsApi as GeneratedPlaylistsApi } from '../generated/default/apis/PlaylistsApi' import { TrackUploadHelper } from '../tracks/TrackUploadHelper' @@ -169,9 +171,9 @@ describe('AlbumsApi', () => { name: 'coverArt' }, metadata: { - genre: Genre.Acoustic, + genre: Genre.ACOUSTIC, albumName: 'My Album', - mood: Mood.Tender + mood: Mood.TENDER }, trackMetadatas: [ { @@ -228,9 +230,9 @@ describe('AlbumsApi', () => { name: 'coverArt' }, metadata: { - genre: Genre.Acoustic, + genre: Genre.ACOUSTIC, albumName: 'My Album edited', - mood: Mood.Tender + mood: Mood.TENDER } }) @@ -250,7 +252,7 @@ describe('AlbumsApi', () => { name: 'coverArt' }, metadata: { - mod: Mood.Tender + mod: Mood.TENDER } as any }) }).rejects.toThrow() diff --git a/packages/sdk/src/sdk/api/albums/AlbumsApi.ts b/packages/sdk/src/sdk/api/albums/AlbumsApi.ts index bd0ea6d697c..a9d7d7b2768 100644 --- a/packages/sdk/src/sdk/api/albums/AlbumsApi.ts +++ b/packages/sdk/src/sdk/api/albums/AlbumsApi.ts @@ -7,7 +7,10 @@ import type { SolanaRelayService, StorageService } from '../../services' -import type { EntityManagerService } from '../../services/EntityManager/types' +import type { + EntityManagerService, + AdvancedOptions +} from '../../services/EntityManager/types' import type { LoggerService } from '../../services/Logger' import type { SolanaClient } from '../../services/Solana/programs/SolanaClient' import { parseParams } from '../../utils/parseParams' @@ -18,9 +21,13 @@ import { type Configuration } from '../generated/default' import { PlaylistsApi } from '../playlists/PlaylistsApi' -import type { UploadPlaylistRequest } from '../playlists/types' +import { PlaylistMetadata } from '../playlists/types' import { + DeleteAlbumRequest, + DeleteAlbumSchema, + FavoriteAlbumRequest, + FavoriteAlbumSchema, getAlbumRequest, getAlbumsRequest, getAlbumTracksRequest, @@ -28,16 +35,18 @@ import { GetPurchaseAlbumInstructionsSchema, PurchaseAlbumRequest, PurchaseAlbumSchema, - UploadAlbumRequest, - UploadAlbumSchema, - CreateAlbumRequestWithFiles, - UpdateAlbumRequest, - DeleteAlbumRequest, - FavoriteAlbumRequest, - UnfavoriteAlbumRequest, RepostAlbumRequest, + RepostAlbumSchema, + UnfavoriteAlbumRequest, + UnfavoriteAlbumSchema, UnrepostAlbumRequest, - UpdateAlbumSchema + UnrepostAlbumSchema, + UpdateAlbumRequest, + UpdateAlbumSchema, + UploadAlbumRequest, + UploadAlbumSchema, + CreateAlbumRequest, + CreateAlbumSchema } from './types' export class AlbumsApi { @@ -82,92 +91,139 @@ export class AlbumsApi { * Create an album from existing tracks */ async createAlbum( - params: CreateAlbumRequestWithFiles, - requestInit?: RequestInit + params: CreateAlbumRequest, + advancedOptions?: AdvancedOptions ) { - const { metadata, ...rest } = params + // Parse inputs + const { metadata, ...parsedParameters } = await parseParams( + 'createAlbum', + CreateAlbumSchema + )(params) + const { albumName, ...playlistMetadata } = metadata - // Transform album request to playlist request - const playlistParams = { - ...rest, - metadata: { - ...playlistMetadata, - playlistName: albumName, - isAlbum: true - } - } - const response = await this.playlistsApi.createPlaylist( - playlistParams, - requestInit + // Call createPlaylistInternal with parsed inputs + const response = await this.playlistsApi.createPlaylistInternal< + PlaylistMetadata & { isAlbum: boolean } + >( + { + ...parsedParameters, + playlistId: parsedParameters.albumId, + metadata: { + ...playlistMetadata, + playlistName: albumName, + isAlbum: true + } + }, + advancedOptions ) - return response + return { + ...response, + albumId: response.playlistId + } } /** @hidden * Upload an album * Uploads the specified tracks and combines them into an album */ - async uploadAlbum(params: UploadAlbumRequest) { - await parseParams('uploadAlbum', UploadAlbumSchema)(params) + async uploadAlbum( + params: UploadAlbumRequest, + advancedOptions?: AdvancedOptions + ) { + const { metadata, ...parsedParameters } = await parseParams( + 'uploadAlbum', + UploadAlbumSchema + )(params) - const { albumName, ...playlistMetadata } = params.metadata + const { albumName, ...playlistMetadata } = metadata - const playlistParams: UploadPlaylistRequest = { - ...params, - metadata: { - ...playlistMetadata, - playlistName: albumName, - isAlbum: true - } - } + // Call uploadPlaylistInternal with parsed inputs + const response = await this.playlistsApi.uploadPlaylistInternal( + { + ...parsedParameters, + metadata: { + ...playlistMetadata, + playlistName: albumName, + isAlbum: true + } + }, + advancedOptions + ) - return await this.playlistsApi.uploadPlaylist(playlistParams) + return { + blockHash: response.blockHash, + blockNumber: response.blockNumber, + albumId: response.playlistId + } } /** @hidden * Update an album */ - async updateAlbum(params: UpdateAlbumRequest, requestInit?: RequestInit) { - await parseParams('updateAlbum', UpdateAlbumSchema)(params) + async updateAlbum( + params: UpdateAlbumRequest, + advancedOptions?: AdvancedOptions + ) { + const { albumId, metadata, ...parsedParameters } = await parseParams( + 'updateAlbum', + UpdateAlbumSchema + )(params) - const { metadata, albumId, ...rest } = params const { albumName, ...playlistMetadata } = metadata - // Transform album request to playlist request - const playlistParams = { - ...rest, - playlistId: albumId, - metadata: { - ...playlistMetadata, - ...(albumName && { playlistName: albumName }) - } - } - return await this.playlistsApi.updatePlaylist(playlistParams, requestInit) + // Call updatePlaylistInternal with parsed inputs + return await this.playlistsApi.updatePlaylistInternal( + { + ...parsedParameters, + playlistId: albumId, + metadata: { + ...playlistMetadata, + playlistName: albumName + } + }, + advancedOptions + ) } /** @hidden * Delete an album */ - async deleteAlbum(params: DeleteAlbumRequest, requestInit?: RequestInit) { - const playlistParams = { - userId: params.userId, - playlistId: params.albumId - } - return await this.playlistsApi.deletePlaylist(playlistParams, requestInit) + async deleteAlbum( + params: DeleteAlbumRequest, + advancedOptions?: AdvancedOptions + ) { + await parseParams('deleteAlbum', DeleteAlbumSchema)(params) + + return await this.playlistsApi.deletePlaylist( + { + userId: params.userId, + playlistId: params.albumId + }, + advancedOptions + ) } /** @hidden * Favorite an album */ - async favoriteAlbum(params: FavoriteAlbumRequest, requestInit?: RequestInit) { - const playlistParams = { - userId: params.userId, - playlistId: params.albumId, - metadata: params.metadata - } - return await this.playlistsApi.favoritePlaylist(playlistParams, requestInit) + async favoriteAlbum( + params: FavoriteAlbumRequest, + advancedOptions?: AdvancedOptions + ) { + const { metadata } = await parseParams( + 'favoriteAlbum', + FavoriteAlbumSchema + )(params) + return await this.playlistsApi.favoritePlaylist( + { + userId: params.userId, + playlistId: params.albumId, + metadata + }, + advancedOptions + ) } /** @hidden @@ -175,39 +231,55 @@ export class AlbumsApi { */ async unfavoriteAlbum( params: UnfavoriteAlbumRequest, - requestInit?: RequestInit + advancedOptions?: AdvancedOptions ) { - const playlistParams = { - userId: params.userId, - playlistId: params.albumId - } + await parseParams('unfavoriteAlbum', UnfavoriteAlbumSchema)(params) return await this.playlistsApi.unfavoritePlaylist( - playlistParams, - requestInit + { + userId: params.userId, + playlistId: params.albumId + }, + advancedOptions ) } /** @hidden * Repost an album */ - async repostAlbum(params: RepostAlbumRequest, requestInit?: RequestInit) { - const playlistParams = { - userId: params.userId, - playlistId: params.albumId, - repostRequestBody: params.metadata - } - return await this.playlistsApi.repostPlaylist(playlistParams, requestInit) + async repostAlbum( + params: RepostAlbumRequest, + advancedOptions?: AdvancedOptions + ) { + const { metadata } = await parseParams( + 'repostAlbum', + RepostAlbumSchema + )(params) + + return await this.playlistsApi.repostPlaylist( + { + userId: params.userId, + playlistId: params.albumId, + metadata + }, + advancedOptions + ) } /** @hidden * Unrepost an album */ - async unrepostAlbum(params: UnrepostAlbumRequest, requestInit?: RequestInit) { - const playlistParams = { - userId: params.userId, - playlistId: params.albumId - } - return await this.playlistsApi.unrepostPlaylist(playlistParams, requestInit) + async unrepostAlbum( + params: UnrepostAlbumRequest, + advancedOptions?: AdvancedOptions + ) { + await parseParams('unrepostAlbum', UnrepostAlbumSchema)(params) + return await this.playlistsApi.unrepostPlaylist( + { + userId: params.userId, + playlistId: params.albumId + }, + advancedOptions + ) } /** diff --git a/packages/sdk/src/sdk/api/albums/types.ts b/packages/sdk/src/sdk/api/albums/types.ts index cd442373e44..6e376fae974 100644 --- a/packages/sdk/src/sdk/api/albums/types.ts +++ b/packages/sdk/src/sdk/api/albums/types.ts @@ -4,84 +4,14 @@ import { z } from 'zod' import { PublicKeySchema } from '../../services/Solana' import { DDEXResourceContributor, DDEXCopyright } from '../../types/DDEX' import { AudioFile, ImageFile } from '../../types/File' +import { Genre } from '../../types/Genre' import { HashId } from '../../types/HashId' -import { Mood, Genre } from '../generated/default' -import type { - CreatePlaylistRequestBody, - UpdatePlaylistRequestBody -} from '../generated/default' -import type { UploadPlaylistProgressHandler } from '../playlists/types' +import { Mood } from '../../types/Mood' import { UploadTrackMetadataSchema, USDCPurchaseConditions } from '../tracks/types' -// Album request body types that wrap playlist types but use album field names -export type CreateAlbumRequestBody = Omit< - CreatePlaylistRequestBody, - 'playlistName' -> & { - albumName: string -} - -export type UpdateAlbumRequestBody = Omit< - UpdatePlaylistRequestBody, - 'playlistName' -> & { - albumName?: string -} - -// Album request types that wrap playlist request types -export type CreateAlbumRequest = { - userId: string - albumId?: string - metadata: CreateAlbumRequestBody -} - -export type CreateAlbumRequestWithFiles = CreateAlbumRequest & { - imageFile?: z.input - onProgress?: UploadPlaylistProgressHandler -} - -export type UpdateAlbumRequest = { - userId: string - albumId: string - metadata: UpdateAlbumRequestBody - imageFile?: z.input - onProgress?: UploadPlaylistProgressHandler -} - -export type DeleteAlbumRequest = { - userId: string - albumId: string -} - -export type FavoriteAlbumRequest = { - userId: string - albumId: string - metadata?: { - isSaveOfRepost?: boolean - } -} - -export type UnfavoriteAlbumRequest = { - userId: string - albumId: string -} - -export type RepostAlbumRequest = { - userId: string - albumId: string - metadata?: { - isRepostOfRepost?: boolean - } -} - -export type UnrepostAlbumRequest = { - userId: string - albumId: string -} - export const getAlbumSchema = z.object({ userId: HashId.optional(), albumId: HashId @@ -137,7 +67,7 @@ export const CreateAlbumSchema = z }) .strict() -export type EntityManagerCreateAlbumRequest = z.input +export type CreateAlbumRequest = z.input export const UploadAlbumMetadataSchema = CreateAlbumMetadataSchema.extend({ genre: z.enum(Object.values(Genre) as [Genre, ...Genre[]]), @@ -199,7 +129,7 @@ export const UpdateAlbumSchema = z }) .strict() -export type EntityManagerUpdateAlbumRequest = z.input +export type UpdateAlbumRequest = z.input export const DeleteAlbumSchema = z .object({ @@ -208,7 +138,7 @@ export const DeleteAlbumSchema = z }) .strict() -export type EntityManagerDeleteAlbumRequest = z.input +export type DeleteAlbumRequest = z.input export const FavoriteAlbumSchema = z .object({ @@ -220,15 +150,13 @@ export const FavoriteAlbumSchema = z * Is this a save of a repost? Used to dispatch notifications * when a user favorites another user's repost */ - isSaveOfRepost: z.optional(z.boolean()) + isSaveOfRepost: z.boolean() }) ) }) .strict() -export type EntityManagerFavoriteAlbumRequest = z.input< - typeof FavoriteAlbumSchema -> +export type FavoriteAlbumRequest = z.input export const UnfavoriteAlbumSchema = z .object({ @@ -237,9 +165,7 @@ export const UnfavoriteAlbumSchema = z }) .strict() -export type EntityManagerUnfavoriteAlbumRequest = z.input< - typeof UnfavoriteAlbumSchema -> +export type UnfavoriteAlbumRequest = z.input export const RepostAlbumSchema = z .object({ @@ -249,15 +175,15 @@ export const RepostAlbumSchema = z z.object({ /** * Is this a repost of a repost? Used to dispatch notifications - * when a user reposts content that someone they follow has already reposted + * when a user favorites another user's repost */ - isRepostOfRepost: z.optional(z.boolean()) + isRepostOfRepost: z.boolean() }) ) }) .strict() -export type EntityManagerRepostAlbumRequest = z.input +export type RepostAlbumRequest = z.input export const UnrepostAlbumSchema = z .object({ @@ -266,9 +192,7 @@ export const UnrepostAlbumSchema = z }) .strict() -export type EntityManagerUnrepostAlbumRequest = z.input< - typeof UnrepostAlbumSchema -> +export type UnrepostAlbumRequest = z.input const PurchaseAlbumSchemaBase = z.object({ /** The ID of the user purchasing the album. */ diff --git a/packages/sdk/src/sdk/api/comments/CommentsAPI.ts b/packages/sdk/src/sdk/api/comments/CommentsAPI.ts index 3c58fba3d1d..3909311123c 100644 --- a/packages/sdk/src/sdk/api/comments/CommentsAPI.ts +++ b/packages/sdk/src/sdk/api/comments/CommentsAPI.ts @@ -1,40 +1,43 @@ import snakecaseKeys from 'snakecase-keys' +import { OverrideProperties } from 'type-fest' import { LoggerService } from '../../services' import { Action, EntityManagerService, - EntityType + EntityType, + ManageEntityOptions } from '../../services/EntityManager/types' import { decodeHashId, encodeHashId } from '../../utils/hashId' -import { parseParams } from '../../utils/parseParams' import { Configuration, - CommentsApi as GeneratedCommentsApi, - type CreateCommentRequest, - type UpdateCommentRequest, - type DeleteCommentRequest, - type PinCommentRequest, - type UnpinCommentRequest, - type ReactToCommentRequest, - type UnreactToCommentRequest, - type ReportCommentRequest + CommentsApi as GeneratedCommentsApi } from '../generated/default' -import { - CreateCommentSchema, - UpdateCommentSchema, - DeleteCommentSchema, - PinCommentSchema, - ReactCommentSchema, - ReportCommentSchema, - EntityManagerCreateCommentRequest, - EntityManagerUpdateCommentRequest, - EntityManagerDeleteCommentRequest, - EntityManagerPinCommentRequest, - EntityManagerReactCommentRequest, - EntityManagerReportCommentRequest -} from './types' +import { CommentMetadata } from './types' + +type EditCommentMetadata = CommentMetadata & { + trackId: number +} + +type PinCommentMetadata = { + userId: number + entityId: number + trackId: number + isPin: boolean +} + +type ReactCommentMetadata = { + userId: number + commentId: number + isLiked: boolean + trackId: number +} + +type CommentNotificationOptions = OverrideProperties< + Omit, + { action: Action.MUTE | Action.UNMUTE } +> export class CommentsApi extends GeneratedCommentsApi { constructor( @@ -54,16 +57,7 @@ export class CommentsApi extends GeneratedCommentsApi { return decodeHashId(unclaimedId)! } - /** @hidden - * Create a comment using entity manager - */ - async createCommentWithEntityManager( - params: EntityManagerCreateCommentRequest - ) { - const metadata = await parseParams( - 'createComment', - CreateCommentSchema - )(params) + async postComment(metadata: CommentMetadata) { const { userId, entityType = EntityType.TRACK, commentId } = metadata const newCommentId = commentId ?? (await this.generateCommentId()) await this.entityManager.manageEntity({ @@ -80,41 +74,8 @@ export class CommentsApi extends GeneratedCommentsApi { return encodeHashId(newCommentId) } - override async createComment( - params: CreateCommentRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - const { metadata, userId } = params - const commentId = await this.createCommentWithEntityManager({ - userId, - entityId: encodeHashId(metadata.entityId) ?? '', - entityType: metadata.entityType, - body: metadata.body, - commentId: metadata.commentId, - parentCommentId: metadata.parentId, - trackTimestampS: metadata.trackTimestampS, - mentions: metadata.mentions - }) - return { - success: true, - commentId: commentId ?? undefined - } - } - return super.createComment(params, requestInit) - } - - /** @hidden - * Update a comment using entity manager - */ - async updateCommentWithEntityManager( - params: EntityManagerUpdateCommentRequest - ) { - const metadata = await parseParams( - 'updateComment', - UpdateCommentSchema - )(params) - const { userId, entityId, trackId, body } = metadata + async editComment(metadata: EditCommentMetadata) { + const { userId, entityId, trackId } = metadata const response = await this.entityManager.manageEntity({ userId, entityType: EntityType.COMMENT, @@ -122,41 +83,13 @@ export class CommentsApi extends GeneratedCommentsApi { action: Action.UPDATE, metadata: JSON.stringify({ cid: '', - data: snakecaseKeys({ body, entityId: trackId }) + data: snakecaseKeys({ ...metadata, entityId: trackId }) }) }) return response } - override async updateComment( - params: UpdateCommentRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - const { metadata, userId, commentId } = params - await this.updateCommentWithEntityManager({ - userId, - entityId: commentId, - trackId: encodeHashId(metadata.entityId) ?? '', - body: metadata.body - }) - return { - success: true - } - } - return super.updateComment(params, requestInit) - } - - /** @hidden - * Delete a comment using entity manager - */ - async deleteCommentWithEntityManager( - params: EntityManagerDeleteCommentRequest - ) { - const metadata = await parseParams( - 'deleteComment', - DeleteCommentSchema - )(params) + async deleteComment(metadata: CommentMetadata) { const { userId, entityId } = metadata const response = await this.entityManager.manageEntity({ userId, @@ -168,33 +101,7 @@ export class CommentsApi extends GeneratedCommentsApi { return response } - override async deleteComment( - params: DeleteCommentRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - const metadata: EntityManagerDeleteCommentRequest = { - userId: params.userId, - entityId: params.commentId - } - await this.deleteCommentWithEntityManager(metadata) - return { - success: true - } - } - return super.deleteComment(params, requestInit) - } - - /** @hidden - * React to a comment using entity manager - */ - async reactToCommentWithEntityManager( - params: EntityManagerReactCommentRequest - ) { - const metadata = await parseParams( - 'reactComment', - ReactCommentSchema - )(params) + async reactComment(metadata: ReactCommentMetadata) { const { userId, commentId, isLiked, trackId } = metadata const response = await this.entityManager.manageEntity({ userId, @@ -209,49 +116,7 @@ export class CommentsApi extends GeneratedCommentsApi { return response } - override async reactToComment( - params: ReactToCommentRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - const metadata: EntityManagerReactCommentRequest = { - userId: params.userId, - commentId: params.commentId, - isLiked: true, - trackId: params.commentId // trackId represents the entity being commented on - } - await this.reactToCommentWithEntityManager(metadata) - return { - success: true - } - } - return super.reactToComment(params, requestInit) - } - - override async unreactToComment( - params: UnreactToCommentRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - const metadata: EntityManagerReactCommentRequest = { - userId: params.userId, - commentId: params.commentId, - isLiked: false, - trackId: params.commentId - } - await this.reactToCommentWithEntityManager(metadata) - return { - success: true - } - } - return super.unreactToComment(params, requestInit) - } - - /** @hidden - * Pin a comment using entity manager - */ - async pinCommentWithEntityManager(params: EntityManagerPinCommentRequest) { - const metadata = await parseParams('pinComment', PinCommentSchema)(params) + async pinComment(metadata: PinCommentMetadata) { const { userId, entityId, trackId, isPin } = metadata const response = await this.entityManager.manageEntity({ userId, @@ -266,55 +131,7 @@ export class CommentsApi extends GeneratedCommentsApi { return response } - override async pinComment( - params: PinCommentRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - const metadata: EntityManagerPinCommentRequest = { - userId: params.userId, - entityId: params.commentId, - trackId: params.commentId, // trackId represents the entity being commented on - isPin: true - } - await this.pinCommentWithEntityManager(metadata) - return { - success: true - } - } - return super.pinComment(params, requestInit) - } - - override async unpinComment( - params: UnpinCommentRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - const metadata: EntityManagerPinCommentRequest = { - userId: params.userId, - entityId: params.commentId, - trackId: params.commentId, - isPin: false - } - await this.pinCommentWithEntityManager(metadata) - return { - success: true - } - } - return super.unpinComment(params, requestInit) - } - - /** @hidden - * Report a comment using entity manager - */ - async reportCommentWithEntityManager( - params: EntityManagerReportCommentRequest - ) { - const metadata = await parseParams( - 'reportComment', - ReportCommentSchema - )(params) - const { userId, entityId } = metadata + async reportComment(userId: number, entityId: number) { const response = await this.entityManager.manageEntity({ userId, entityType: EntityType.COMMENT, @@ -325,26 +142,6 @@ export class CommentsApi extends GeneratedCommentsApi { return response } - override async reportComment( - params: ReportCommentRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - const metadata: EntityManagerReportCommentRequest = { - userId: params.userId, - entityId: params.commentId - } - await this.reportCommentWithEntityManager(metadata) - return { - success: true - } - } - return super.reportComment(params, requestInit) - } - - /** @hidden - * Mute/unmute a user (entity manager only) - */ async muteUser(userId: number, mutedUserId: number, isMuted: boolean) { const response = await this.entityManager.manageEntity({ userId, @@ -356,15 +153,7 @@ export class CommentsApi extends GeneratedCommentsApi { return response } - /** @hidden - * Update comment notification settings (entity manager only) - */ - async updateCommentNotificationSetting(config: { - userId: number - entityType: EntityType - entityId: number - action: Action.MUTE | Action.UNMUTE - }) { + async updateCommentNotificationSetting(config: CommentNotificationOptions) { const response = await this.entityManager.manageEntity({ ...config, metadata: '' diff --git a/packages/sdk/src/sdk/api/comments/types.ts b/packages/sdk/src/sdk/api/comments/types.ts index 680e24e5e1f..4db8f953926 100644 --- a/packages/sdk/src/sdk/api/comments/types.ts +++ b/packages/sdk/src/sdk/api/comments/types.ts @@ -1,92 +1,12 @@ -import { z } from 'zod' - -import { HashId } from '../../types/HashId' -import type { CommentEntityType } from '../generated/default' +import { EntityType } from '../../services/EntityManager/types' export type CommentMetadata = { body?: string commentId?: number userId: number entityId: number - entityType?: CommentEntityType // For now just tracks are supported, but we left the door open for more + entityType?: EntityType // For now just tracks are supported, but we left the door open for more parentCommentId?: number trackTimestampS?: number mentions?: number[] } - -// Zod schemas for dual-auth support -export const CreateCommentSchema = z - .object({ - userId: HashId, - entityId: HashId, - entityType: z.optional(z.string()), - body: z.optional(z.string()), - commentId: z.optional(z.number()), - parentCommentId: z.optional(z.number()), - trackTimestampS: z.optional(z.number()), - mentions: z.optional(z.array(z.number())) - }) - .strict() - -export type EntityManagerCreateCommentRequest = z.input< - typeof CreateCommentSchema -> - -export const UpdateCommentSchema = z - .object({ - userId: HashId, - entityId: HashId, - trackId: HashId, - body: z.string() - }) - .strict() - -export type EntityManagerUpdateCommentRequest = z.input< - typeof UpdateCommentSchema -> - -export const DeleteCommentSchema = z - .object({ - userId: HashId, - entityId: HashId - }) - .strict() - -export type EntityManagerDeleteCommentRequest = z.input< - typeof DeleteCommentSchema -> - -export const PinCommentSchema = z - .object({ - userId: HashId, - entityId: HashId, - trackId: HashId, - isPin: z.boolean() - }) - .strict() - -export type EntityManagerPinCommentRequest = z.input - -export const ReactCommentSchema = z - .object({ - userId: HashId, - commentId: HashId, - isLiked: z.boolean(), - trackId: HashId - }) - .strict() - -export type EntityManagerReactCommentRequest = z.input< - typeof ReactCommentSchema -> - -export const ReportCommentSchema = z - .object({ - userId: HashId, - entityId: HashId - }) - .strict() - -export type EntityManagerReportCommentRequest = z.input< - typeof ReportCommentSchema -> diff --git a/packages/sdk/src/sdk/api/developer-apps/DeveloperAppsApi.ts b/packages/sdk/src/sdk/api/developer-apps/DeveloperAppsApi.ts index e9acd907913..dfbcb7052df 100644 --- a/packages/sdk/src/sdk/api/developer-apps/DeveloperAppsApi.ts +++ b/packages/sdk/src/sdk/api/developer-apps/DeveloperAppsApi.ts @@ -12,18 +12,15 @@ import { import { parseParams } from '../../utils/parseParams' import { Configuration, - DeveloperAppsApi as GeneratedDeveloperAppsApi, - type CreateDeveloperAppRequest, - type DeleteDeveloperAppRequest, - type UpdateDeveloperAppRequest + DeveloperAppsApi as GeneratedDeveloperAppsApi } from '../generated/default' import { - EntityManagerCreateDeveloperAppRequest, + CreateDeveloperAppRequest, CreateDeveloperAppSchema, - EntityManagerUpdateDeveloperAppRequest, + UpdateDeveloperAppRequest, UpdateDeveloperAppSchema, - EntityManagerDeleteDeveloperAppRequest, + DeleteDeveloperAppRequest, DeleteDeveloperAppSchema } from './types' @@ -38,8 +35,8 @@ export class DeveloperAppsApi extends GeneratedDeveloperAppsApi { /** * Create a developer app */ - async createDeveloperAppWithEntityManager( - params: EntityManagerCreateDeveloperAppRequest, + async createDeveloperApp( + params: CreateDeveloperAppRequest, advancedOptions?: AdvancedOptions ) { const { name, userId, description, imageUrl } = await parseParams( @@ -84,25 +81,11 @@ export class DeveloperAppsApi extends GeneratedDeveloperAppsApi { } } - override async createDeveloperApp( - params: CreateDeveloperAppRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - return await this.createDeveloperAppWithEntityManager({ - ...params.metadata, - userId: params.userId - }) - } else { - return await super.createDeveloperApp(params, requestInit) - } - } - /** * Update a developer app */ - async updateDeveloperAppWithEntityManager( - params: EntityManagerUpdateDeveloperAppRequest, + async updateDeveloperApp( + params: UpdateDeveloperAppRequest, advancedOptions?: AdvancedOptions ) { const { appApiKey, name, userId, description, imageUrl } = @@ -127,27 +110,10 @@ export class DeveloperAppsApi extends GeneratedDeveloperAppsApi { } } - override async updateDeveloperApp( - params: UpdateDeveloperAppRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - return await this.updateDeveloperAppWithEntityManager({ - ...params.metadata, - userId: params.userId, - appApiKey: params.address - }) - } else { - return await super.updateDeveloperApp(params, requestInit) - } - } - /** * Delete a developer app */ - async deleteDeveloperAppWithEntityManager( - params: EntityManagerDeleteDeveloperAppRequest - ) { + async deleteDeveloperApp(params: DeleteDeveloperAppRequest) { const { userId, appApiKey } = await parseParams( 'deleteDeveloperApp', DeleteDeveloperAppSchema @@ -163,18 +129,4 @@ export class DeveloperAppsApi extends GeneratedDeveloperAppsApi { }) }) } - - override async deleteDeveloperApp( - params: DeleteDeveloperAppRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - return await this.deleteDeveloperAppWithEntityManager({ - userId: params.userId, - appApiKey: params.address - }) - } else { - return await super.deleteDeveloperApp(params, requestInit) - } - } } diff --git a/packages/sdk/src/sdk/api/developer-apps/types.ts b/packages/sdk/src/sdk/api/developer-apps/types.ts index 7887ee2269e..cf957fa2046 100644 --- a/packages/sdk/src/sdk/api/developer-apps/types.ts +++ b/packages/sdk/src/sdk/api/developer-apps/types.ts @@ -21,9 +21,7 @@ export const CreateDeveloperAppSchema = z.object({ userId: HashId }) -export type EntityManagerCreateDeveloperAppRequest = z.input< - typeof CreateDeveloperAppSchema -> +export type CreateDeveloperAppRequest = z.input export const UpdateDeveloperAppSchema = z.object({ appApiKey: z.custom((data: unknown) => { @@ -42,9 +40,7 @@ export const UpdateDeveloperAppSchema = z.object({ userId: HashId }) -export type EntityManagerUpdateDeveloperAppRequest = z.input< - typeof UpdateDeveloperAppSchema -> +export type UpdateDeveloperAppRequest = z.input export const DeleteDeveloperAppSchema = z.object({ userId: HashId, @@ -53,6 +49,4 @@ export const DeleteDeveloperAppSchema = z.object({ }) }) -export type EntityManagerDeleteDeveloperAppRequest = z.input< - typeof DeleteDeveloperAppSchema -> +export type DeleteDeveloperAppRequest = z.input 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 134ac6d39eb..03c4b835dc7 100644 --- a/packages/sdk/src/sdk/api/generated/default/.openapi-generator/FILES +++ b/packages/sdk/src/sdk/api/generated/default/.openapi-generator/FILES @@ -17,13 +17,10 @@ apis/WalletApi.ts apis/index.ts index.ts models/Access.ts -models/AccessGate.ts models/AccessInfoResponse.ts models/Activity.ts -models/AddManagerRequestBody.ts models/AlbumBacklink.ts models/AlbumsResponse.ts -models/ApproveGrantRequestBody.ts models/AuthorizedApp.ts models/AuthorizedApps.ts models/BalanceHistoryDataPoint.ts @@ -32,7 +29,7 @@ models/BestSellingItem.ts models/BestSellingResponse.ts models/BlobInfo.ts models/ChallengeResponse.ts -models/ClaimRewardsRequestBody.ts +models/ClaimRewardsRequest.ts models/ClaimRewardsResponse.ts models/ClaimRewardsResponseDataInner.ts models/ClaimedPrize.ts @@ -56,7 +53,6 @@ models/Collectibles.ts models/CollectiblesResponse.ts models/CollectionActivity.ts models/Comment.ts -models/CommentEntityType.ts models/CommentMention.ts models/CommentNotificationSetting.ts models/CommentRepliesResponse.ts @@ -64,38 +60,17 @@ models/CommentResponse.ts models/ConnectedWallets.ts models/ConnectedWalletsResponse.ts models/CoverPhoto.ts -models/CreateAccessKeyResponse.ts -models/CreateCoinRequestBody.ts +models/CreateCoinRequest.ts models/CreateCoinResponse.ts models/CreateCoinResponseData.ts -models/CreateCommentRequestBody.ts -models/CreateCommentResponse.ts -models/CreateDeveloperAppRequestBody.ts -models/CreateDeveloperAppResponse.ts -models/CreateGrantRequestBody.ts -models/CreatePlaylistRequestBody.ts -models/CreatePlaylistRequestBodyCopyrightLine.ts -models/CreatePlaylistRequestBodyProducerCopyrightLine.ts -models/CreatePlaylistResponse.ts -models/CreateRewardCodeRequestBody.ts +models/CreateRewardCodeRequest.ts models/CreateRewardCodeResponse.ts -models/CreateTrackRequestBody.ts -models/CreateTrackResponse.ts -models/CreateUserDeveloperAppRequestBody.ts -models/CreateUserDeveloperAppResponse.ts -models/CreateUserRequestBody.ts -models/CreateUserRequestBodyEvents.ts -models/CreateUserResponse.ts models/DashboardWalletUser.ts models/DashboardWalletUsersResponse.ts -models/DdexCopyright.ts -models/DdexResourceContributor.ts -models/DeactivateAccessKeyRequestBody.ts -models/DeactivateAccessKeyResponse.ts models/DecodedUserToken.ts models/DeveloperApp.ts models/DeveloperAppResponse.ts -models/DeveloperAppsResponse.ts +models/DeveloperApps.ts models/EmailAccess.ts models/EmailAccessResponse.ts models/Event.ts @@ -106,52 +81,39 @@ models/ExtendedPurchaseGate.ts models/ExtendedTokenGate.ts models/ExtendedUsdcGate.ts models/Favorite.ts -models/FavoriteRequestBody.ts models/FavoritesResponse.ts -models/FieldVisibility.ts models/FollowGate.ts models/FollowersResponse.ts models/FollowingResponse.ts -models/Genre.ts models/GetChallenges.ts models/GetSupportedUsers.ts models/GetSupporters.ts models/GetTipsResponse.ts models/HistoryResponse.ts models/ListenCount.ts -models/MediaLink.ts models/MonthlyAggregatePlay.ts -models/Mood.ts models/MutualFollowersResponse.ts -models/PinCommentRequestBody.ts +models/NftCollection.ts +models/NftGate.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 models/PlaylistsResponse.ts -models/PrizeClaimRequestBody.ts +models/PrizeClaimRequest.ts models/PrizeClaimResponse.ts models/PrizePublic.ts models/PrizesResponse.ts models/ProfilePicture.ts models/PurchasersResponse.ts -models/ReactCommentRequestBody.ts models/RedeemAmountResponse.ts models/RelatedArtistResponse.ts models/RemixParent.ts -models/RemixParentWrite.ts models/RemixedTrackAggregate.ts models/RemixersResponse.ts -models/RemixesResponse.ts -models/RemixingResponse.ts models/ReplyComment.ts -models/Repost.ts -models/RepostRequestBody.ts models/Reposts.ts models/RewardCodeErrorResponse.ts models/RewardCodeResponse.ts @@ -161,8 +123,6 @@ models/SalesAggregateResponse.ts models/SalesJsonContent.ts models/SalesJsonResponse.ts models/Stem.ts -models/StemCategory.ts -models/StemParent.ts models/StemsResponse.ts models/StreamUrlResponse.ts models/SubscribersResponse.ts @@ -180,31 +140,18 @@ models/TrackArtwork.ts models/TrackCommentCountResponse.ts models/TrackCommentNotificationResponse.ts models/TrackCommentsResponse.ts -models/TrackDownloadRequestBody.ts models/TrackElement.ts -models/TrackElementWrite.ts -models/TrackFavoritesResponse.ts -models/TrackId.ts models/TrackInspect.ts models/TrackInspectList.ts -models/TrackRepostsResponse.ts models/TrackResponse.ts models/TrackSearch.ts -models/TracksCountResponse.ts models/TracksResponse.ts -models/TrendingIdsResponse.ts models/TrendingPlaylistsResponse.ts -models/TrendingTimesIds.ts models/UnclaimedIdResponse.ts models/UndisbursedChallenge.ts models/UndisbursedChallenges.ts -models/UpdateCoinRequestBody.ts +models/UpdateCoinRequest.ts models/UpdateCoinResponse.ts -models/UpdateCommentRequestBody.ts -models/UpdateDeveloperAppRequestBody.ts -models/UpdatePlaylistRequestBody.ts -models/UpdateTrackRequestBody.ts -models/UpdateUserRequestBody.ts models/User.ts models/UserCoin.ts models/UserCoinAccount.ts @@ -214,14 +161,11 @@ models/UserCoinsResponse.ts models/UserCommentsResponse.ts models/UserIdAddress.ts models/UserIdsAddressesResponse.ts -models/UserPlaylistLibrary.ts -models/UserPlaylistLibraryContentsInner.ts models/UserResponse.ts models/UserSearch.ts models/UserTrackListenCountsResponse.ts models/UserTracksRemixedResponse.ts models/UsersResponse.ts models/VerifyToken.ts -models/WriteResponse.ts models/index.ts runtime.ts diff --git a/packages/sdk/src/sdk/api/generated/default/apis/CoinsApi.ts b/packages/sdk/src/sdk/api/generated/default/apis/CoinsApi.ts index fb26e551c03..af966b2c1cd 100644 --- a/packages/sdk/src/sdk/api/generated/default/apis/CoinsApi.ts +++ b/packages/sdk/src/sdk/api/generated/default/apis/CoinsApi.ts @@ -23,12 +23,12 @@ import type { CoinResponse, CoinsResponse, CoinsVolumeLeadersResponse, - CreateCoinRequestBody, + CreateCoinRequest, CreateCoinResponse, RedeemAmountResponse, RewardCodeErrorResponse, RewardCodeResponse, - UpdateCoinRequestBody, + UpdateCoinRequest, UpdateCoinResponse, } from '../models'; import { @@ -46,8 +46,8 @@ import { CoinsResponseToJSON, CoinsVolumeLeadersResponseFromJSON, CoinsVolumeLeadersResponseToJSON, - CreateCoinRequestBodyFromJSON, - CreateCoinRequestBodyToJSON, + CreateCoinRequestFromJSON, + CreateCoinRequestToJSON, CreateCoinResponseFromJSON, CreateCoinResponseToJSON, RedeemAmountResponseFromJSON, @@ -56,8 +56,8 @@ import { RewardCodeErrorResponseToJSON, RewardCodeResponseFromJSON, RewardCodeResponseToJSON, - UpdateCoinRequestBodyFromJSON, - UpdateCoinRequestBodyToJSON, + UpdateCoinRequestFromJSON, + UpdateCoinRequestToJSON, UpdateCoinResponseFromJSON, UpdateCoinResponseToJSON, } from '../models'; @@ -73,9 +73,9 @@ export interface ClaimCoinRewardCodeRequest { userId: string; } -export interface CreateCoinRequest { +export interface CreateCoinOperationRequest { userId: string; - metadata: CreateCoinRequestBody; + createCoinRequest: CreateCoinRequest; } export interface GetCoinRequest { @@ -128,10 +128,10 @@ export interface GetVolumeLeadersRequest { limit?: number; } -export interface UpdateCoinRequest { +export interface UpdateCoinOperationRequest { mint: string; userId: string; - metadata: UpdateCoinRequestBody; + updateCoinRequest: UpdateCoinRequest; } /** @@ -225,13 +225,13 @@ export class CoinsApi extends runtime.BaseAPI { * @hidden * Creates a new artist coin */ - async createCoinRaw(params: CreateCoinRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createCoinRaw(params: CreateCoinOperationRequest, 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 createCoin.'); } - if (params.metadata === null || params.metadata === undefined) { - throw new runtime.RequiredError('metadata','Required parameter params.metadata was null or undefined when calling createCoin.'); + if (params.createCoinRequest === null || params.createCoinRequest === undefined) { + throw new runtime.RequiredError('createCoinRequest','Required parameter params.createCoinRequest was null or undefined when calling createCoin.'); } const queryParameters: any = {}; @@ -249,7 +249,7 @@ export class CoinsApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: CreateCoinRequestBodyToJSON(params.metadata), + body: CreateCoinRequestToJSON(params.createCoinRequest), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => CreateCoinResponseFromJSON(jsonValue)); @@ -258,7 +258,7 @@ export class CoinsApi extends runtime.BaseAPI { /** * Creates a new artist coin */ - async createCoin(params: CreateCoinRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + async createCoin(params: CreateCoinOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.createCoinRaw(params, initOverrides); return await response.value(); } @@ -602,7 +602,7 @@ export class CoinsApi extends runtime.BaseAPI { * @hidden * Updates information about a specific coin by its mint address */ - async updateCoinRaw(params: UpdateCoinRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async updateCoinRaw(params: UpdateCoinOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (params.mint === null || params.mint === undefined) { throw new runtime.RequiredError('mint','Required parameter params.mint was null or undefined when calling updateCoin.'); } @@ -611,8 +611,8 @@ export class CoinsApi extends runtime.BaseAPI { throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling updateCoin.'); } - if (params.metadata === null || params.metadata === undefined) { - throw new runtime.RequiredError('metadata','Required parameter params.metadata was null or undefined when calling updateCoin.'); + if (params.updateCoinRequest === null || params.updateCoinRequest === undefined) { + throw new runtime.RequiredError('updateCoinRequest','Required parameter params.updateCoinRequest was null or undefined when calling updateCoin.'); } const queryParameters: any = {}; @@ -630,7 +630,7 @@ export class CoinsApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: UpdateCoinRequestBodyToJSON(params.metadata), + body: UpdateCoinRequestToJSON(params.updateCoinRequest), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => UpdateCoinResponseFromJSON(jsonValue)); @@ -639,7 +639,7 @@ export class CoinsApi extends runtime.BaseAPI { /** * Updates information about a specific coin by its mint address */ - async updateCoin(params: UpdateCoinRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + async updateCoin(params: UpdateCoinOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.updateCoinRaw(params, initOverrides); return await response.value(); } 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 7c3d8a785e6..1bf63a31e2d 100644 --- a/packages/sdk/src/sdk/api/generated/default/apis/CommentsApi.ts +++ b/packages/sdk/src/sdk/api/generated/default/apis/CommentsApi.ts @@ -18,45 +18,17 @@ import * as runtime from '../runtime'; import type { CommentRepliesResponse, CommentResponse, - CreateCommentRequestBody, - CreateCommentResponse, - PinCommentRequestBody, - ReactCommentRequestBody, UnclaimedIdResponse, - UpdateCommentRequestBody, - WriteResponse, } from '../models'; import { CommentRepliesResponseFromJSON, CommentRepliesResponseToJSON, CommentResponseFromJSON, CommentResponseToJSON, - CreateCommentRequestBodyFromJSON, - CreateCommentRequestBodyToJSON, - CreateCommentResponseFromJSON, - CreateCommentResponseToJSON, - PinCommentRequestBodyFromJSON, - PinCommentRequestBodyToJSON, - ReactCommentRequestBodyFromJSON, - ReactCommentRequestBodyToJSON, UnclaimedIdResponseFromJSON, UnclaimedIdResponseToJSON, - UpdateCommentRequestBodyFromJSON, - UpdateCommentRequestBodyToJSON, - WriteResponseFromJSON, - WriteResponseToJSON, } from '../models'; -export interface CreateCommentRequest { - userId: string; - metadata: CreateCommentRequestBody; -} - -export interface DeleteCommentRequest { - commentId: string; - userId: string; -} - export interface GetCommentRequest { commentId: string; } @@ -68,149 +40,11 @@ export interface GetCommentRepliesRequest { userId?: string; } -export interface PinCommentRequest { - commentId: string; - userId: string; - metadata: PinCommentRequestBody; -} - -export interface ReactToCommentRequest { - commentId: string; - userId: string; - metadata: ReactCommentRequestBody; -} - -export interface ReportCommentRequest { - commentId: string; - userId: string; -} - -export interface UnpinCommentRequest { - commentId: string; - userId: string; - metadata: PinCommentRequestBody; -} - -export interface UnreactToCommentRequest { - commentId: string; - userId: string; - metadata: ReactCommentRequestBody; -} - -export interface UpdateCommentRequest { - commentId: string; - userId: string; - metadata: UpdateCommentRequestBody; -} - /** * */ export class CommentsApi extends runtime.BaseAPI { - /** - * @hidden - * Creates a new comment - */ - async createCommentRaw(params: CreateCommentRequest, 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 createComment.'); - } - - if (params.metadata === null || params.metadata === undefined) { - throw new runtime.RequiredError('metadata','Required parameter params.metadata was null or undefined when calling createComment.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/comments`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: CreateCommentRequestBodyToJSON(params.metadata), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => CreateCommentResponseFromJSON(jsonValue)); - } - - /** - * Creates a new comment - */ - async createComment(params: CreateCommentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.createCommentRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Deletes a comment - */ - async deleteCommentRaw(params: DeleteCommentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (params.commentId === null || params.commentId === undefined) { - throw new runtime.RequiredError('commentId','Required parameter params.commentId was null or undefined when calling deleteComment.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling deleteComment.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/comments/{comment_id}`.replace(`{${"comment_id"}}`, encodeURIComponent(String(params.commentId))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Deletes a comment - */ - async deleteComment(params: DeleteCommentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deleteCommentRaw(params, initOverrides); - return await response.value(); - } - /** * @hidden * Gets a comment by ID @@ -312,339 +146,4 @@ export class CommentsApi extends runtime.BaseAPI { return await response.value(); } - /** - * @hidden - * Pin a comment - */ - async pinCommentRaw(params: PinCommentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (params.commentId === null || params.commentId === undefined) { - throw new runtime.RequiredError('commentId','Required parameter params.commentId was null or undefined when calling pinComment.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling pinComment.'); - } - - if (params.metadata === null || params.metadata === undefined) { - throw new runtime.RequiredError('metadata','Required parameter params.metadata was null or undefined when calling pinComment.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/comments/{comment_id}/pin`.replace(`{${"comment_id"}}`, encodeURIComponent(String(params.commentId))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: PinCommentRequestBodyToJSON(params.metadata), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Pin a comment - */ - async pinComment(params: PinCommentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.pinCommentRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * React to a comment - */ - async reactToCommentRaw(params: ReactToCommentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (params.commentId === null || params.commentId === undefined) { - throw new runtime.RequiredError('commentId','Required parameter params.commentId was null or undefined when calling reactToComment.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling reactToComment.'); - } - - if (params.metadata === null || params.metadata === undefined) { - throw new runtime.RequiredError('metadata','Required parameter params.metadata was null or undefined when calling reactToComment.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/comments/{comment_id}/react`.replace(`{${"comment_id"}}`, encodeURIComponent(String(params.commentId))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: ReactCommentRequestBodyToJSON(params.metadata), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * React to a comment - */ - async reactToComment(params: ReactToCommentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.reactToCommentRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Report a comment - */ - async reportCommentRaw(params: ReportCommentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (params.commentId === null || params.commentId === undefined) { - throw new runtime.RequiredError('commentId','Required parameter params.commentId was null or undefined when calling reportComment.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling reportComment.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/comments/{comment_id}/report`.replace(`{${"comment_id"}}`, encodeURIComponent(String(params.commentId))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Report a comment - */ - async reportComment(params: ReportCommentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.reportCommentRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Unpin a comment - */ - async unpinCommentRaw(params: UnpinCommentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (params.commentId === null || params.commentId === undefined) { - throw new runtime.RequiredError('commentId','Required parameter params.commentId was null or undefined when calling unpinComment.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling unpinComment.'); - } - - if (params.metadata === null || params.metadata === undefined) { - throw new runtime.RequiredError('metadata','Required parameter params.metadata was null or undefined when calling unpinComment.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/comments/{comment_id}/pin`.replace(`{${"comment_id"}}`, encodeURIComponent(String(params.commentId))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - body: PinCommentRequestBodyToJSON(params.metadata), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Unpin a comment - */ - async unpinComment(params: UnpinCommentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.unpinCommentRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Unreact to a comment - */ - async unreactToCommentRaw(params: UnreactToCommentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (params.commentId === null || params.commentId === undefined) { - throw new runtime.RequiredError('commentId','Required parameter params.commentId was null or undefined when calling unreactToComment.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling unreactToComment.'); - } - - if (params.metadata === null || params.metadata === undefined) { - throw new runtime.RequiredError('metadata','Required parameter params.metadata was null or undefined when calling unreactToComment.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/comments/{comment_id}/react`.replace(`{${"comment_id"}}`, encodeURIComponent(String(params.commentId))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - body: ReactCommentRequestBodyToJSON(params.metadata), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Unreact to a comment - */ - async unreactToComment(params: UnreactToCommentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.unreactToCommentRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Updates a comment - */ - async updateCommentRaw(params: UpdateCommentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (params.commentId === null || params.commentId === undefined) { - throw new runtime.RequiredError('commentId','Required parameter params.commentId was null or undefined when calling updateComment.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling updateComment.'); - } - - if (params.metadata === null || params.metadata === undefined) { - throw new runtime.RequiredError('metadata','Required parameter params.metadata was null or undefined when calling updateComment.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/comments/{comment_id}`.replace(`{${"comment_id"}}`, encodeURIComponent(String(params.commentId))), - method: 'PUT', - headers: headerParameters, - query: queryParameters, - body: UpdateCommentRequestBodyToJSON(params.metadata), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Updates a comment - */ - async updateComment(params: UpdateCommentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.updateCommentRaw(params, initOverrides); - return await response.value(); - } - } 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 55c1b45ea4f..30a0d4bae89 100644 --- a/packages/sdk/src/sdk/api/generated/default/apis/DeveloperAppsApi.ts +++ b/packages/sdk/src/sdk/api/generated/default/apis/DeveloperAppsApi.ts @@ -16,244 +16,22 @@ import * as runtime from '../runtime'; import type { - CreateAccessKeyResponse, - CreateDeveloperAppRequestBody, - CreateDeveloperAppResponse, - DeactivateAccessKeyRequestBody, - DeactivateAccessKeyResponse, DeveloperAppResponse, - DeveloperAppsResponse, - UpdateDeveloperAppRequestBody, - WriteResponse, } from '../models'; import { - CreateAccessKeyResponseFromJSON, - CreateAccessKeyResponseToJSON, - CreateDeveloperAppRequestBodyFromJSON, - CreateDeveloperAppRequestBodyToJSON, - CreateDeveloperAppResponseFromJSON, - CreateDeveloperAppResponseToJSON, - DeactivateAccessKeyRequestBodyFromJSON, - DeactivateAccessKeyRequestBodyToJSON, - DeactivateAccessKeyResponseFromJSON, - DeactivateAccessKeyResponseToJSON, DeveloperAppResponseFromJSON, DeveloperAppResponseToJSON, - DeveloperAppsResponseFromJSON, - DeveloperAppsResponseToJSON, - UpdateDeveloperAppRequestBodyFromJSON, - UpdateDeveloperAppRequestBodyToJSON, - WriteResponseFromJSON, - WriteResponseToJSON, } from '../models'; -export interface CreateDeveloperAppRequest { - userId: string; - metadata: CreateDeveloperAppRequestBody; -} - -export interface CreateDeveloperAppAccessKeyRequest { - userId: string; - address: string; -} - -export interface DeactivateDeveloperAppAccessKeyRequest { - userId: string; - address: string; - metadata: DeactivateAccessKeyRequestBody; -} - -export interface DeleteDeveloperAppRequest { - userId: string; - address: string; -} - export interface GetDeveloperAppRequest { address: string; } -export interface GetDeveloperAppsRequest { - id: string; - include?: GetDeveloperAppsIncludeEnum; -} - -export interface UpdateDeveloperAppRequest { - userId: string; - address: string; - metadata: UpdateDeveloperAppRequestBody; -} - /** * */ export class DeveloperAppsApi extends runtime.BaseAPI { - /** - * @hidden - * Create a new developer app. Indexer validates grants. - */ - async createDeveloperAppRaw(params: CreateDeveloperAppRequest, 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 createDeveloperApp.'); - } - - if (params.metadata === null || params.metadata === undefined) { - throw new runtime.RequiredError('metadata','Required parameter params.metadata was null or undefined when calling createDeveloperApp.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - const response = await this.request({ - path: `/developer-apps`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: CreateDeveloperAppRequestBodyToJSON(params.metadata), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => CreateDeveloperAppResponseFromJSON(jsonValue)); - } - - /** - * Create a new developer app. Indexer validates grants. - */ - async createDeveloperApp(params: CreateDeveloperAppRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.createDeveloperAppRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Create a new bearer token (API access key) for a developer app. Indexer validates grants. - */ - async createDeveloperAppAccessKeyRaw(params: CreateDeveloperAppAccessKeyRequest, 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 createDeveloperAppAccessKey.'); - } - - if (params.address === null || params.address === undefined) { - throw new runtime.RequiredError('address','Required parameter params.address was null or undefined when calling createDeveloperAppAccessKey.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - const response = await this.request({ - path: `/developer-apps/{address}/access-keys`.replace(`{${"address"}}`, encodeURIComponent(String(params.address))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => CreateAccessKeyResponseFromJSON(jsonValue)); - } - - /** - * Create a new bearer token (API access key) for a developer app. Indexer validates grants. - */ - async createDeveloperAppAccessKey(params: CreateDeveloperAppAccessKeyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.createDeveloperAppAccessKeyRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Deactivate a bearer token (API access key) for a developer app. Indexer validates grants. - */ - async deactivateDeveloperAppAccessKeyRaw(params: DeactivateDeveloperAppAccessKeyRequest, 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 deactivateDeveloperAppAccessKey.'); - } - - if (params.address === null || params.address === undefined) { - throw new runtime.RequiredError('address','Required parameter params.address was null or undefined when calling deactivateDeveloperAppAccessKey.'); - } - - if (params.metadata === null || params.metadata === undefined) { - throw new runtime.RequiredError('metadata','Required parameter params.metadata was null or undefined when calling deactivateDeveloperAppAccessKey.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - const response = await this.request({ - path: `/developer-apps/{address}/access-keys/deactivate`.replace(`{${"address"}}`, encodeURIComponent(String(params.address))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: DeactivateAccessKeyRequestBodyToJSON(params.metadata), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => DeactivateAccessKeyResponseFromJSON(jsonValue)); - } - - /** - * Deactivate a bearer token (API access key) for a developer app. Indexer validates grants. - */ - async deactivateDeveloperAppAccessKey(params: DeactivateDeveloperAppAccessKeyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deactivateDeveloperAppAccessKeyRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Deletes a developer app. Indexer validates grants. - */ - async deleteDeveloperAppRaw(params: DeleteDeveloperAppRequest, 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 deleteDeveloperApp.'); - } - - if (params.address === null || params.address === undefined) { - throw new runtime.RequiredError('address','Required parameter params.address was null or undefined when calling deleteDeveloperApp.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - const response = await this.request({ - path: `/developer-apps/{address}`.replace(`{${"address"}}`, encodeURIComponent(String(params.address))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Deletes a developer app. Indexer validates grants. - */ - async deleteDeveloperApp(params: DeleteDeveloperAppRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deleteDeveloperAppRaw(params, initOverrides); - return await response.value(); - } - /** * @hidden * Gets developer app matching given address (API key) @@ -268,7 +46,7 @@ export class DeveloperAppsApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/developer-apps/{address}`.replace(`{${"address"}}`, encodeURIComponent(String(params.address))), + path: `/developer_apps/{address}`.replace(`{${"address"}}`, encodeURIComponent(String(params.address))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -285,93 +63,4 @@ export class DeveloperAppsApi extends runtime.BaseAPI { return await response.value(); } - /** - * @hidden - * Get developer apps for the user. - */ - async getDeveloperAppsRaw(params: GetDeveloperAppsRequest, 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 getDeveloperApps.'); - } - - const queryParameters: any = {}; - - if (params.include !== undefined) { - queryParameters['include'] = params.include; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - const response = await this.request({ - path: `/users/{id}/developer-apps`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => DeveloperAppsResponseFromJSON(jsonValue)); - } - - /** - * Get developer apps for the user. - */ - async getDeveloperApps(params: GetDeveloperAppsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getDeveloperAppsRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Updates a developer app. Indexer validates grants. - */ - async updateDeveloperAppRaw(params: UpdateDeveloperAppRequest, 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 updateDeveloperApp.'); - } - - if (params.address === null || params.address === undefined) { - throw new runtime.RequiredError('address','Required parameter params.address was null or undefined when calling updateDeveloperApp.'); - } - - if (params.metadata === null || params.metadata === undefined) { - throw new runtime.RequiredError('metadata','Required parameter params.metadata was null or undefined when calling updateDeveloperApp.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - const response = await this.request({ - path: `/developer-apps/{address}`.replace(`{${"address"}}`, encodeURIComponent(String(params.address))), - method: 'PUT', - headers: headerParameters, - query: queryParameters, - body: UpdateDeveloperAppRequestBodyToJSON(params.metadata), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Updates a developer app. Indexer validates grants. - */ - async updateDeveloperApp(params: UpdateDeveloperAppRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.updateDeveloperAppRaw(params, initOverrides); - return await response.value(); - } - } - -/** - * @export - */ -export const GetDeveloperAppsIncludeEnum = { - Metrics: 'metrics' -} as const; -export type GetDeveloperAppsIncludeEnum = typeof GetDeveloperAppsIncludeEnum[keyof typeof GetDeveloperAppsIncludeEnum]; 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 b1cfe4d0c37..bfa99560fc0 100644 --- a/packages/sdk/src/sdk/api/generated/default/apis/PlaylistsApi.ts +++ b/packages/sdk/src/sdk/api/generated/default/apis/PlaylistsApi.ts @@ -17,58 +17,24 @@ import * as runtime from '../runtime'; import type { AccessInfoResponse, - CreatePlaylistRequestBody, - CreatePlaylistResponse, - FavoriteRequestBody, PlaylistResponse, PlaylistSearchResult, PlaylistTracksResponse, - RepostRequestBody, TrendingPlaylistsResponse, - UpdatePlaylistRequestBody, - WriteResponse, } from '../models'; import { AccessInfoResponseFromJSON, AccessInfoResponseToJSON, - CreatePlaylistRequestBodyFromJSON, - CreatePlaylistRequestBodyToJSON, - CreatePlaylistResponseFromJSON, - CreatePlaylistResponseToJSON, - FavoriteRequestBodyFromJSON, - FavoriteRequestBodyToJSON, PlaylistResponseFromJSON, PlaylistResponseToJSON, PlaylistSearchResultFromJSON, PlaylistSearchResultToJSON, PlaylistTracksResponseFromJSON, PlaylistTracksResponseToJSON, - RepostRequestBodyFromJSON, - RepostRequestBodyToJSON, TrendingPlaylistsResponseFromJSON, TrendingPlaylistsResponseToJSON, - UpdatePlaylistRequestBodyFromJSON, - UpdatePlaylistRequestBodyToJSON, - WriteResponseFromJSON, - WriteResponseToJSON, } from '../models'; -export interface CreatePlaylistRequest { - userId: string; - metadata: CreatePlaylistRequestBody; -} - -export interface DeletePlaylistRequest { - playlistId: string; - userId: string; -} - -export interface FavoritePlaylistRequest { - playlistId: string; - userId: string; - metadata?: FavoriteRequestBody; -} - export interface GetBulkPlaylistsRequest { userId?: string; id?: Array; @@ -98,18 +64,11 @@ export interface GetPlaylistTracksRequest { export interface GetTrendingPlaylistsRequest { offset?: number; limit?: number; - userId?: string; time?: GetTrendingPlaylistsTimeEnum; type?: GetTrendingPlaylistsTypeEnum; omitTracks?: boolean; } -export interface RepostPlaylistRequest { - playlistId: string; - userId: string; - repostRequestBody?: RepostRequestBody; -} - export interface SearchPlaylistsRequest { offset?: number; limit?: number; @@ -121,188 +80,11 @@ export interface SearchPlaylistsRequest { hasDownloads?: string; } -export interface SharePlaylistRequest { - playlistId: string; - userId: string; -} - -export interface UnfavoritePlaylistRequest { - playlistId: string; - userId: string; -} - -export interface UnrepostPlaylistRequest { - playlistId: string; - userId: string; -} - -export interface UpdatePlaylistRequest { - playlistId: string; - userId: string; - metadata: UpdatePlaylistRequestBody; -} - /** * */ export class PlaylistsApi extends runtime.BaseAPI { - /** - * @hidden - * Creates a new playlist or album - */ - async createPlaylistRaw(params: CreatePlaylistRequest, 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 createPlaylist.'); - } - - if (params.metadata === null || params.metadata === undefined) { - throw new runtime.RequiredError('metadata','Required parameter params.metadata was null or undefined when calling createPlaylist.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/playlists`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: CreatePlaylistRequestBodyToJSON(params.metadata), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => CreatePlaylistResponseFromJSON(jsonValue)); - } - - /** - * Creates a new playlist or album - */ - async createPlaylist(params: CreatePlaylistRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.createPlaylistRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Deletes a playlist or album - */ - async deletePlaylistRaw(params: DeletePlaylistRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (params.playlistId === null || params.playlistId === undefined) { - throw new runtime.RequiredError('playlistId','Required parameter params.playlistId was null or undefined when calling deletePlaylist.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling deletePlaylist.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/playlists/{playlist_id}`.replace(`{${"playlist_id"}}`, encodeURIComponent(String(params.playlistId))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Deletes a playlist or album - */ - async deletePlaylist(params: DeletePlaylistRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deletePlaylistRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Favorite a playlist - */ - async favoritePlaylistRaw(params: FavoritePlaylistRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (params.playlistId === null || params.playlistId === undefined) { - throw new runtime.RequiredError('playlistId','Required parameter params.playlistId was null or undefined when calling favoritePlaylist.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling favoritePlaylist.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/playlists/{playlist_id}/favorites`.replace(`{${"playlist_id"}}`, encodeURIComponent(String(params.playlistId))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: FavoriteRequestBodyToJSON(params.metadata), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Favorite a playlist - */ - async favoritePlaylist(params: FavoritePlaylistRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.favoritePlaylistRaw(params, initOverrides); - return await response.value(); - } - /** * @hidden * Gets a list of playlists by ID @@ -497,10 +279,6 @@ export class PlaylistsApi extends runtime.BaseAPI { queryParameters['limit'] = params.limit; } - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - if (params.time !== undefined) { queryParameters['time'] = params.time; } @@ -533,59 +311,6 @@ export class PlaylistsApi extends runtime.BaseAPI { return await response.value(); } - /** - * @hidden - * Repost a playlist - */ - async repostPlaylistRaw(params: RepostPlaylistRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (params.playlistId === null || params.playlistId === undefined) { - throw new runtime.RequiredError('playlistId','Required parameter params.playlistId was null or undefined when calling repostPlaylist.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling repostPlaylist.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/playlists/{playlist_id}/reposts`.replace(`{${"playlist_id"}}`, encodeURIComponent(String(params.playlistId))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: RepostRequestBodyToJSON(params.repostRequestBody), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Repost a playlist - */ - async repostPlaylist(params: RepostPlaylistRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.repostPlaylistRaw(params, initOverrides); - return await response.value(); - } - /** * @hidden * Search for a playlist @@ -645,213 +370,6 @@ export class PlaylistsApi extends runtime.BaseAPI { return await response.value(); } - /** - * @hidden - * Record a playlist share event - */ - async sharePlaylistRaw(params: SharePlaylistRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (params.playlistId === null || params.playlistId === undefined) { - throw new runtime.RequiredError('playlistId','Required parameter params.playlistId was null or undefined when calling sharePlaylist.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling sharePlaylist.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/playlists/{playlist_id}/shares`.replace(`{${"playlist_id"}}`, encodeURIComponent(String(params.playlistId))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Record a playlist share event - */ - async sharePlaylist(params: SharePlaylistRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.sharePlaylistRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Unfavorite a playlist - */ - async unfavoritePlaylistRaw(params: UnfavoritePlaylistRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (params.playlistId === null || params.playlistId === undefined) { - throw new runtime.RequiredError('playlistId','Required parameter params.playlistId was null or undefined when calling unfavoritePlaylist.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling unfavoritePlaylist.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/playlists/{playlist_id}/favorites`.replace(`{${"playlist_id"}}`, encodeURIComponent(String(params.playlistId))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Unfavorite a playlist - */ - async unfavoritePlaylist(params: UnfavoritePlaylistRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.unfavoritePlaylistRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Unrepost a playlist - */ - async unrepostPlaylistRaw(params: UnrepostPlaylistRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (params.playlistId === null || params.playlistId === undefined) { - throw new runtime.RequiredError('playlistId','Required parameter params.playlistId was null or undefined when calling unrepostPlaylist.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling unrepostPlaylist.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/playlists/{playlist_id}/reposts`.replace(`{${"playlist_id"}}`, encodeURIComponent(String(params.playlistId))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Unrepost a playlist - */ - async unrepostPlaylist(params: UnrepostPlaylistRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.unrepostPlaylistRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Updates an existing playlist or album - */ - async updatePlaylistRaw(params: UpdatePlaylistRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (params.playlistId === null || params.playlistId === undefined) { - throw new runtime.RequiredError('playlistId','Required parameter params.playlistId was null or undefined when calling updatePlaylist.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling updatePlaylist.'); - } - - if (params.metadata === null || params.metadata === undefined) { - throw new runtime.RequiredError('metadata','Required parameter params.metadata was null or undefined when calling updatePlaylist.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/playlists/{playlist_id}`.replace(`{${"playlist_id"}}`, encodeURIComponent(String(params.playlistId))), - method: 'PUT', - headers: headerParameters, - query: queryParameters, - body: UpdatePlaylistRequestBodyToJSON(params.metadata), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Updates an existing playlist or album - */ - async updatePlaylist(params: UpdatePlaylistRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.updatePlaylistRaw(params, initOverrides); - return await response.value(); - } - } /** diff --git a/packages/sdk/src/sdk/api/generated/default/apis/PrizesApi.ts b/packages/sdk/src/sdk/api/generated/default/apis/PrizesApi.ts index 10f1d0a8941..d547104adef 100644 --- a/packages/sdk/src/sdk/api/generated/default/apis/PrizesApi.ts +++ b/packages/sdk/src/sdk/api/generated/default/apis/PrizesApi.ts @@ -17,15 +17,15 @@ import * as runtime from '../runtime'; import type { ClaimedPrizesResponse, - PrizeClaimRequestBody, + PrizeClaimRequest, PrizeClaimResponse, PrizesResponse, } from '../models'; import { ClaimedPrizesResponseFromJSON, ClaimedPrizesResponseToJSON, - PrizeClaimRequestBodyFromJSON, - PrizeClaimRequestBodyToJSON, + PrizeClaimRequestFromJSON, + PrizeClaimRequestToJSON, PrizeClaimResponseFromJSON, PrizeClaimResponseToJSON, PrizesResponseFromJSON, @@ -33,7 +33,7 @@ import { } from '../models'; export interface ClaimPrizeRequest { - claim: PrizeClaimRequestBody; + prizeClaimRequest: PrizeClaimRequest; } export interface GetWalletPrizesRequest { @@ -50,8 +50,8 @@ export class PrizesApi extends runtime.BaseAPI { * Claims a prize by verifying a Solana transaction. User must send exactly 2 YAK to the prize receiver address. Returns the prize won and any redeem codes/URLs. */ async claimPrizeRaw(params: ClaimPrizeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (params.claim === null || params.claim === undefined) { - throw new runtime.RequiredError('claim','Required parameter params.claim was null or undefined when calling claimPrize.'); + if (params.prizeClaimRequest === null || params.prizeClaimRequest === undefined) { + throw new runtime.RequiredError('prizeClaimRequest','Required parameter params.prizeClaimRequest was null or undefined when calling claimPrize.'); } const queryParameters: any = {}; @@ -65,7 +65,7 @@ export class PrizesApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: PrizeClaimRequestBodyToJSON(params.claim), + body: PrizeClaimRequestToJSON(params.prizeClaimRequest), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => PrizeClaimResponseFromJSON(jsonValue)); diff --git a/packages/sdk/src/sdk/api/generated/default/apis/RewardsApi.ts b/packages/sdk/src/sdk/api/generated/default/apis/RewardsApi.ts index 8b421c67625..000d31d8cfa 100644 --- a/packages/sdk/src/sdk/api/generated/default/apis/RewardsApi.ts +++ b/packages/sdk/src/sdk/api/generated/default/apis/RewardsApi.ts @@ -16,28 +16,28 @@ import * as runtime from '../runtime'; import type { - ClaimRewardsRequestBody, + ClaimRewardsRequest, ClaimRewardsResponse, - CreateRewardCodeRequestBody, + CreateRewardCodeRequest, CreateRewardCodeResponse, } from '../models'; import { - ClaimRewardsRequestBodyFromJSON, - ClaimRewardsRequestBodyToJSON, + ClaimRewardsRequestFromJSON, + ClaimRewardsRequestToJSON, ClaimRewardsResponseFromJSON, ClaimRewardsResponseToJSON, - CreateRewardCodeRequestBodyFromJSON, - CreateRewardCodeRequestBodyToJSON, + CreateRewardCodeRequestFromJSON, + CreateRewardCodeRequestToJSON, CreateRewardCodeResponseFromJSON, CreateRewardCodeResponseToJSON, } from '../models'; -export interface ClaimRewardsRequest { - reward: ClaimRewardsRequestBody; +export interface ClaimRewardsOperationRequest { + claimRewardsRequest: ClaimRewardsRequest; } -export interface CreateRewardCodeRequest { - body?: CreateRewardCodeRequestBody; +export interface CreateRewardCodeOperationRequest { + createRewardCodeRequest: CreateRewardCodeRequest; } /** @@ -49,9 +49,9 @@ export class RewardsApi extends runtime.BaseAPI { * @hidden * Claims all the filtered undisbursed rewards for a user */ - async claimRewardsRaw(params: ClaimRewardsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (params.reward === null || params.reward === undefined) { - throw new runtime.RequiredError('reward','Required parameter params.reward was null or undefined when calling claimRewards.'); + async claimRewardsRaw(params: ClaimRewardsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (params.claimRewardsRequest === null || params.claimRewardsRequest === undefined) { + throw new runtime.RequiredError('claimRewardsRequest','Required parameter params.claimRewardsRequest was null or undefined when calling claimRewards.'); } const queryParameters: any = {}; @@ -65,7 +65,7 @@ export class RewardsApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: ClaimRewardsRequestBodyToJSON(params.reward), + body: ClaimRewardsRequestToJSON(params.claimRewardsRequest), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ClaimRewardsResponseFromJSON(jsonValue)); @@ -74,7 +74,7 @@ export class RewardsApi extends runtime.BaseAPI { /** * Claims all the filtered undisbursed rewards for a user */ - async claimRewards(params: ClaimRewardsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + async claimRewards(params: ClaimRewardsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.claimRewardsRaw(params, initOverrides); return await response.value(); } @@ -83,7 +83,11 @@ export class RewardsApi extends runtime.BaseAPI { * @hidden * Creates a new reward code with Solana signature verification */ - async createRewardCodeRaw(params: CreateRewardCodeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createRewardCodeRaw(params: CreateRewardCodeOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (params.createRewardCodeRequest === null || params.createRewardCodeRequest === undefined) { + throw new runtime.RequiredError('createRewardCodeRequest','Required parameter params.createRewardCodeRequest was null or undefined when calling createRewardCode.'); + } + const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -95,7 +99,7 @@ export class RewardsApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: CreateRewardCodeRequestBodyToJSON(params.body), + body: CreateRewardCodeRequestToJSON(params.createRewardCodeRequest), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => CreateRewardCodeResponseFromJSON(jsonValue)); @@ -104,7 +108,7 @@ export class RewardsApi extends runtime.BaseAPI { /** * Creates a new reward code with Solana signature verification */ - async createRewardCode(params: CreateRewardCodeRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + async createRewardCode(params: CreateRewardCodeOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.createRewardCodeRaw(params, 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 d7f6d92dfd8..ef1c7417336 100644 --- a/packages/sdk/src/sdk/api/generated/default/apis/TracksApi.ts +++ b/packages/sdk/src/sdk/api/generated/default/apis/TracksApi.ts @@ -17,45 +17,21 @@ import * as runtime from '../runtime'; import type { AccessInfoResponse, - CreateTrackRequestBody, - CreateTrackResponse, - FavoriteRequestBody, - RemixesResponse, - RemixingResponse, - RepostRequestBody, StemsResponse, StreamUrlResponse, TopListener, TrackCommentCountResponse, TrackCommentNotificationResponse, TrackCommentsResponse, - TrackDownloadRequestBody, - TrackFavoritesResponse, TrackInspect, TrackInspectList, - TrackRepostsResponse, TrackResponse, TrackSearch, TracksResponse, - TrendingIdsResponse, - UpdateTrackRequestBody, - WriteResponse, } from '../models'; import { AccessInfoResponseFromJSON, AccessInfoResponseToJSON, - CreateTrackRequestBodyFromJSON, - CreateTrackRequestBodyToJSON, - CreateTrackResponseFromJSON, - CreateTrackResponseToJSON, - FavoriteRequestBodyFromJSON, - FavoriteRequestBodyToJSON, - RemixesResponseFromJSON, - RemixesResponseToJSON, - RemixingResponseFromJSON, - RemixingResponseToJSON, - RepostRequestBodyFromJSON, - RepostRequestBodyToJSON, StemsResponseFromJSON, StemsResponseToJSON, StreamUrlResponseFromJSON, @@ -68,40 +44,18 @@ import { TrackCommentNotificationResponseToJSON, TrackCommentsResponseFromJSON, TrackCommentsResponseToJSON, - TrackDownloadRequestBodyFromJSON, - TrackDownloadRequestBodyToJSON, - TrackFavoritesResponseFromJSON, - TrackFavoritesResponseToJSON, TrackInspectFromJSON, TrackInspectToJSON, TrackInspectListFromJSON, TrackInspectListToJSON, - TrackRepostsResponseFromJSON, - TrackRepostsResponseToJSON, TrackResponseFromJSON, TrackResponseToJSON, TrackSearchFromJSON, TrackSearchToJSON, TracksResponseFromJSON, TracksResponseToJSON, - TrendingIdsResponseFromJSON, - TrendingIdsResponseToJSON, - UpdateTrackRequestBodyFromJSON, - UpdateTrackRequestBodyToJSON, - WriteResponseFromJSON, - WriteResponseToJSON, } from '../models'; -export interface CreateTrackRequest { - userId: string; - metadata: CreateTrackRequestBody; -} - -export interface DeleteTrackRequest { - trackId: string; - userId: string; -} - export interface DownloadTrackRequest { trackId: string; userId?: string; @@ -111,23 +65,15 @@ export interface DownloadTrackRequest { filename?: string; } -export interface FavoriteTrackRequest { - trackId: string; - userId: string; - metadata?: FavoriteRequestBody; -} - export interface GetBulkTracksRequest { permalink?: Array; id?: Array; isrc?: Array; - userId?: string; } export interface GetFeelingLuckyTracksRequest { userId?: string; limit?: number; - withUsers?: boolean; minFollowers?: number; } @@ -144,26 +90,8 @@ export interface GetRecentPremiumTracksRequest { userId?: string; } -export interface GetRecommendedTracksRequest { - limit?: number; - genre?: string; - time?: GetRecommendedTracksTimeEnum; - exclusionList?: Array; - userId?: string; -} - -export interface GetRecommendedTracksWithVersionRequest { - version: string; - limit?: number; - genre?: string; - time?: GetRecommendedTracksWithVersionTimeEnum; - exclusionList?: Array; - userId?: string; -} - export interface GetTrackRequest { trackId: string; - userId?: string; } export interface GetTrackAccessInfoRequest { @@ -189,23 +117,6 @@ export interface GetTrackCommentsRequest { sortMethod?: GetTrackCommentsSortMethodEnum; } -export interface GetTrackRemixParentsRequest { - trackId: string; - offset?: number; - limit?: number; - userId?: string; -} - -export interface GetTrackRemixesRequest { - trackId: string; - offset?: number; - limit?: number; - userId?: string; - sortMethod?: GetTrackRemixesSortMethodEnum; - onlyCosigns?: boolean; - onlyContestEntries?: boolean; -} - export interface GetTrackStemsRequest { trackId: string; } @@ -223,88 +134,16 @@ export interface GetTracksWithRecentCommentsRequest { offset?: number; } -export interface GetTrendingTrackIDsRequest { - offset?: number; - limit?: number; - genre?: string; -} - export interface GetTrendingTracksRequest { offset?: number; limit?: number; genre?: string; time?: GetTrendingTracksTimeEnum; - userId?: string; -} - -export interface GetTrendingTracksIDsWithVersionRequest { - version: string; - offset?: number; - limit?: number; - genre?: string; -} - -export interface GetTrendingTracksWithVersionRequest { - version: string; - offset?: number; - limit?: number; - userId?: string; - genre?: string; - time?: GetTrendingTracksWithVersionTimeEnum; -} - -export interface GetTrendingUSDCPurchaseTracksRequest { - offset?: number; - limit?: number; - userId?: string; - genre?: string; - time?: GetTrendingUSDCPurchaseTracksTimeEnum; -} - -export interface GetTrendingUSDCPurchaseTracksWithVersionRequest { - version: string; - offset?: number; - limit?: number; - userId?: string; - genre?: string; - time?: GetTrendingUSDCPurchaseTracksWithVersionTimeEnum; -} - -export interface GetTrendingUndergroundWinnersRequest { - week?: Date; - userId?: string; -} - -export interface GetTrendingWinnersRequest { - week?: Date; - userId?: string; } export interface GetUndergroundTrendingTracksRequest { offset?: number; limit?: number; - userId?: string; -} - -export interface GetUndergroundTrendingTracksWithVersionRequest { - version: string; - offset?: number; - limit?: number; - userId?: string; -} - -export interface GetUsersFromFavoritesRequest { - trackId: string; - offset?: number; - limit?: number; - userId?: string; -} - -export interface GetUsersFromRepostsRequest { - trackId: string; - offset?: number; - limit?: number; - userId?: string; } export interface InspectTrackRequest { @@ -317,18 +156,6 @@ export interface InspectTracksRequest { original?: boolean; } -export interface RecordTrackDownloadRequest { - trackId: string; - userId?: string; - location?: TrackDownloadRequestBody; -} - -export interface RepostTrackRequest { - trackId: string; - userId: string; - repostRequestBody?: RepostRequestBody; -} - export interface SearchTracksRequest { offset?: number; limit?: number; @@ -345,11 +172,6 @@ export interface SearchTracksRequest { bpmMax?: string; } -export interface ShareTrackRequest { - trackId: string; - userId: string; -} - export interface StreamTrackRequest { trackId: string; userId?: string; @@ -363,130 +185,11 @@ export interface StreamTrackRequest { noRedirect?: boolean; } -export interface UnfavoriteTrackRequest { - trackId: string; - userId: string; -} - -export interface UnrepostTrackRequest { - trackId: string; - userId: string; -} - -export interface UpdateTrackRequest { - trackId: string; - userId: string; - metadata: UpdateTrackRequestBody; -} - /** * */ export class TracksApi extends runtime.BaseAPI { - /** - * @hidden - * Creates a new track - */ - async createTrackRaw(params: CreateTrackRequest, 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 createTrack.'); - } - - if (params.metadata === null || params.metadata === undefined) { - throw new runtime.RequiredError('metadata','Required parameter params.metadata was null or undefined when calling createTrack.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/tracks`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: CreateTrackRequestBodyToJSON(params.metadata), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => CreateTrackResponseFromJSON(jsonValue)); - } - - /** - * Creates a new track - */ - async createTrack(params: CreateTrackRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.createTrackRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Deletes a track - */ - async deleteTrackRaw(params: DeleteTrackRequest, 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 deleteTrack.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling deleteTrack.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/tracks/{track_id}`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Deletes a track - */ - async deleteTrack(params: DeleteTrackRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deleteTrackRaw(params, initOverrides); - return await response.value(); - } - /** * @hidden * Download an original or mp3 track @@ -539,59 +242,6 @@ export class TracksApi extends runtime.BaseAPI { await this.downloadTrackRaw(params, initOverrides); } - /** - * @hidden - * Favorite a track - */ - async favoriteTrackRaw(params: FavoriteTrackRequest, 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 favoriteTrack.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling favoriteTrack.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/tracks/{track_id}/favorites`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: FavoriteRequestBodyToJSON(params.metadata), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Favorite a track - */ - async favoriteTrack(params: FavoriteTrackRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.favoriteTrackRaw(params, initOverrides); - return await response.value(); - } - /** * @hidden * Gets a list of tracks using their IDs or permalinks @@ -611,10 +261,6 @@ export class TracksApi extends runtime.BaseAPI { queryParameters['isrc'] = params.isrc; } - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ @@ -650,10 +296,6 @@ export class TracksApi extends runtime.BaseAPI { queryParameters['limit'] = params.limit; } - if (params.withUsers !== undefined) { - queryParameters['with_users'] = params.withUsers; - } - if (params.minFollowers !== undefined) { queryParameters['min_followers'] = params.minFollowers; } @@ -762,78 +404,46 @@ export class TracksApi extends runtime.BaseAPI { /** * @hidden - * Get recommended tracks + * Gets a track by ID */ - async getRecommendedTracksRaw(params: GetRecommendedTracksRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - if (params.limit !== undefined) { - queryParameters['limit'] = params.limit; - } - - if (params.genre !== undefined) { - queryParameters['genre'] = params.genre; - } - - if (params.time !== undefined) { - queryParameters['time'] = params.time; - } - - if (params.exclusionList) { - queryParameters['exclusion_list'] = params.exclusionList; + async getTrackRaw(params: GetTrackRequest, 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 getTrack.'); } - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } + const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/tracks/recommended`, + path: `/tracks/{track_id}`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); - return new runtime.JSONApiResponse(response, (jsonValue) => TracksResponseFromJSON(jsonValue)); + return new runtime.JSONApiResponse(response, (jsonValue) => TrackResponseFromJSON(jsonValue)); } /** - * Get recommended tracks + * Gets a track by ID */ - async getRecommendedTracks(params: GetRecommendedTracksRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getRecommendedTracksRaw(params, initOverrides); + async getTrack(params: GetTrackRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getTrackRaw(params, initOverrides); return await response.value(); } /** * @hidden - * Get recommended tracks using the given trending strategy version + * Gets the information necessary to access the track and what access the given user has. */ - async getRecommendedTracksWithVersionRaw(params: GetRecommendedTracksWithVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (params.version === null || params.version === undefined) { - throw new runtime.RequiredError('version','Required parameter params.version was null or undefined when calling getRecommendedTracksWithVersion.'); + async getTrackAccessInfoRaw(params: GetTrackAccessInfoRequest, 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 getTrackAccessInfo.'); } const queryParameters: any = {}; - if (params.limit !== undefined) { - queryParameters['limit'] = params.limit; - } - - if (params.genre !== undefined) { - queryParameters['genre'] = params.genre; - } - - if (params.time !== undefined) { - queryParameters['time'] = params.time; - } - - if (params.exclusionList) { - queryParameters['exclusion_list'] = params.exclusionList; - } - if (params.userId !== undefined) { queryParameters['user_id'] = params.userId; } @@ -841,87 +451,17 @@ export class TracksApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/tracks/recommended/{version}`.replace(`{${"version"}}`, encodeURIComponent(String(params.version))), + path: `/tracks/{track_id}/access-info`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); - return new runtime.JSONApiResponse(response, (jsonValue) => TracksResponseFromJSON(jsonValue)); + return new runtime.JSONApiResponse(response, (jsonValue) => AccessInfoResponseFromJSON(jsonValue)); } /** - * Get recommended tracks using the given trending strategy version - */ - async getRecommendedTracksWithVersion(params: GetRecommendedTracksWithVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getRecommendedTracksWithVersionRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Gets a track by ID - */ - async getTrackRaw(params: GetTrackRequest, 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 getTrack.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - const response = await this.request({ - path: `/tracks/{track_id}`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => TrackResponseFromJSON(jsonValue)); - } - - /** - * Gets a track by ID - */ - async getTrack(params: GetTrackRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getTrackRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Gets the information necessary to access the track and what access the given user has. - */ - async getTrackAccessInfoRaw(params: GetTrackAccessInfoRequest, 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 getTrackAccessInfo.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - const response = await this.request({ - path: `/tracks/{track_id}/access-info`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => AccessInfoResponseFromJSON(jsonValue)); - } - - /** - * Gets the information necessary to access the track and what access the given user has. + * Gets the information necessary to access the track and what access the given user has. */ async getTrackAccessInfo(params: GetTrackAccessInfoRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getTrackAccessInfoRaw(params, initOverrides); @@ -1045,104 +585,6 @@ export class TracksApi extends runtime.BaseAPI { return await response.value(); } - /** - * @hidden - * Gets all the tracks that the given track remixes - */ - async getTrackRemixParentsRaw(params: GetTrackRemixParentsRequest, 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 getTrackRemixParents.'); - } - - const queryParameters: any = {}; - - if (params.offset !== undefined) { - queryParameters['offset'] = params.offset; - } - - if (params.limit !== undefined) { - queryParameters['limit'] = params.limit; - } - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - const response = await this.request({ - path: `/tracks/{track_id}/remixing`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => RemixingResponseFromJSON(jsonValue)); - } - - /** - * Gets all the tracks that the given track remixes - */ - async getTrackRemixParents(params: GetTrackRemixParentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getTrackRemixParentsRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Get all tracks that remix the given track - */ - async getTrackRemixesRaw(params: GetTrackRemixesRequest, 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 getTrackRemixes.'); - } - - const queryParameters: any = {}; - - if (params.offset !== undefined) { - queryParameters['offset'] = params.offset; - } - - if (params.limit !== undefined) { - queryParameters['limit'] = params.limit; - } - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - if (params.sortMethod !== undefined) { - queryParameters['sort_method'] = params.sortMethod; - } - - if (params.onlyCosigns !== undefined) { - queryParameters['only_cosigns'] = params.onlyCosigns; - } - - if (params.onlyContestEntries !== undefined) { - queryParameters['only_contest_entries'] = params.onlyContestEntries; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - const response = await this.request({ - path: `/tracks/{track_id}/remixes`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => RemixesResponseFromJSON(jsonValue)); - } - - /** - * Get all tracks that remix the given track - */ - async getTrackRemixes(params: GetTrackRemixesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getTrackRemixesRaw(params, initOverrides); - return await response.value(); - } - /** * @hidden * Get the remixable stems of a track @@ -1258,9 +700,9 @@ export class TracksApi extends runtime.BaseAPI { /** * @hidden - * Gets the track IDs of the top trending tracks on Audius + * Gets the top 100 trending (most popular) tracks on Audius */ - async getTrendingTrackIDsRaw(params: GetTrendingTrackIDsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getTrendingTracksRaw(params: GetTrendingTracksRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; if (params.offset !== undefined) { @@ -1275,31 +717,35 @@ export class TracksApi extends runtime.BaseAPI { queryParameters['genre'] = params.genre; } + if (params.time !== undefined) { + queryParameters['time'] = params.time; + } + const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/tracks/trending/ids`, + path: `/tracks/trending`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); - return new runtime.JSONApiResponse(response, (jsonValue) => TrendingIdsResponseFromJSON(jsonValue)); + return new runtime.JSONApiResponse(response, (jsonValue) => TracksResponseFromJSON(jsonValue)); } /** - * Gets the track IDs of the top trending tracks on Audius + * Gets the top 100 trending (most popular) tracks on Audius */ - async getTrendingTrackIDs(params: GetTrendingTrackIDsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getTrendingTrackIDsRaw(params, initOverrides); + async getTrendingTracks(params: GetTrendingTracksRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getTrendingTracksRaw(params, initOverrides); return await response.value(); } /** * @hidden - * Gets the top 100 trending (most popular) tracks on Audius + * Gets the top 100 trending underground tracks on Audius */ - async getTrendingTracksRaw(params: GetTrendingTracksRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getUndergroundTrendingTracksRaw(params: GetUndergroundTrendingTracksRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; if (params.offset !== undefined) { @@ -1310,22 +756,10 @@ export class TracksApi extends runtime.BaseAPI { queryParameters['limit'] = params.limit; } - if (params.genre !== undefined) { - queryParameters['genre'] = params.genre; - } - - if (params.time !== undefined) { - queryParameters['time'] = params.time; - } - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/tracks/trending`, + path: `/tracks/trending/underground`, method: 'GET', headers: headerParameters, query: queryParameters, @@ -1335,112 +769,96 @@ export class TracksApi extends runtime.BaseAPI { } /** - * Gets the top 100 trending (most popular) tracks on Audius + * Gets the top 100 trending underground tracks on Audius */ - async getTrendingTracks(params: GetTrendingTracksRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getTrendingTracksRaw(params, initOverrides); + async getUndergroundTrendingTracks(params: GetUndergroundTrendingTracksRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getUndergroundTrendingTracksRaw(params, initOverrides); return await response.value(); } /** * @hidden - * Gets the track IDs of the top trending tracks on Audius based on the given trending strategy version + * Inspect a track + * Inspects the details of the file for a track */ - async getTrendingTracksIDsWithVersionRaw(params: GetTrendingTracksIDsWithVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (params.version === null || params.version === undefined) { - throw new runtime.RequiredError('version','Required parameter params.version was null or undefined when calling getTrendingTracksIDsWithVersion.'); + async inspectTrackRaw(params: InspectTrackRequest, 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 inspectTrack.'); } const queryParameters: any = {}; - if (params.offset !== undefined) { - queryParameters['offset'] = params.offset; - } - - if (params.limit !== undefined) { - queryParameters['limit'] = params.limit; - } - - if (params.genre !== undefined) { - queryParameters['genre'] = params.genre; + if (params.original !== undefined) { + queryParameters['original'] = params.original; } const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/tracks/trending/ids/{version}`.replace(`{${"version"}}`, encodeURIComponent(String(params.version))), + path: `/tracks/{track_id}/inspect`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); - return new runtime.JSONApiResponse(response, (jsonValue) => TrendingIdsResponseFromJSON(jsonValue)); + return new runtime.JSONApiResponse(response, (jsonValue) => TrackInspectFromJSON(jsonValue)); } /** - * Gets the track IDs of the top trending tracks on Audius based on the given trending strategy version + * Inspect a track + * Inspects the details of the file for a track */ - async getTrendingTracksIDsWithVersion(params: GetTrendingTracksIDsWithVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getTrendingTracksIDsWithVersionRaw(params, initOverrides); + async inspectTrack(params: InspectTrackRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.inspectTrackRaw(params, initOverrides); return await response.value(); } /** * @hidden - * Gets the top 100 trending (most popular) tracks on Audius using a given trending strategy version + * Inspect multiple tracks + * Inspects the details of the files for multiple tracks */ - async getTrendingTracksWithVersionRaw(params: GetTrendingTracksWithVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (params.version === null || params.version === undefined) { - throw new runtime.RequiredError('version','Required parameter params.version was null or undefined when calling getTrendingTracksWithVersion.'); + async inspectTracksRaw(params: InspectTracksRequest, 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 inspectTracks.'); } const queryParameters: any = {}; - if (params.offset !== undefined) { - queryParameters['offset'] = params.offset; - } - - if (params.limit !== undefined) { - queryParameters['limit'] = params.limit; - } - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - if (params.genre !== undefined) { - queryParameters['genre'] = params.genre; + if (params.id) { + queryParameters['id'] = params.id; } - if (params.time !== undefined) { - queryParameters['time'] = params.time; + if (params.original !== undefined) { + queryParameters['original'] = params.original; } const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/tracks/trending/{version}`.replace(`{${"version"}}`, encodeURIComponent(String(params.version))), + path: `/tracks/inspect`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); - return new runtime.JSONApiResponse(response, (jsonValue) => TracksResponseFromJSON(jsonValue)); + return new runtime.JSONApiResponse(response, (jsonValue) => TrackInspectListFromJSON(jsonValue)); } /** - * Gets the top 100 trending (most popular) tracks on Audius using a given trending strategy version + * Inspect multiple tracks + * Inspects the details of the files for multiple tracks */ - async getTrendingTracksWithVersion(params: GetTrendingTracksWithVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getTrendingTracksWithVersionRaw(params, initOverrides); + async inspectTracks(params: InspectTracksRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.inspectTracksRaw(params, initOverrides); return await response.value(); } /** * @hidden - * Gets the top trending (most popular) USDC purchase tracks on Audius + * Search for a track or tracks */ - async getTrendingUSDCPurchaseTracksRaw(params: GetTrendingUSDCPurchaseTracksRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async searchTracksRaw(params: SearchTracksRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; if (params.offset !== undefined) { @@ -1451,537 +869,21 @@ export class TracksApi extends runtime.BaseAPI { queryParameters['limit'] = params.limit; } - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; + if (params.query !== undefined) { + queryParameters['query'] = params.query; } - if (params.genre !== undefined) { + if (params.genre) { queryParameters['genre'] = params.genre; } - if (params.time !== undefined) { - queryParameters['time'] = params.time; + if (params.sortMethod !== undefined) { + queryParameters['sort_method'] = params.sortMethod; } - const headerParameters: runtime.HTTPHeaders = {}; - - const response = await this.request({ - path: `/tracks/usdc-purchase`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => TracksResponseFromJSON(jsonValue)); - } - - /** - * Gets the top trending (most popular) USDC purchase tracks on Audius - */ - async getTrendingUSDCPurchaseTracks(params: GetTrendingUSDCPurchaseTracksRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getTrendingUSDCPurchaseTracksRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Gets the top trending (most popular) USDC purchase tracks on Audius using a given trending strategy version - */ - async getTrendingUSDCPurchaseTracksWithVersionRaw(params: GetTrendingUSDCPurchaseTracksWithVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (params.version === null || params.version === undefined) { - throw new runtime.RequiredError('version','Required parameter params.version was null or undefined when calling getTrendingUSDCPurchaseTracksWithVersion.'); - } - - const queryParameters: any = {}; - - if (params.offset !== undefined) { - queryParameters['offset'] = params.offset; - } - - if (params.limit !== undefined) { - queryParameters['limit'] = params.limit; - } - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - if (params.genre !== undefined) { - queryParameters['genre'] = params.genre; - } - - if (params.time !== undefined) { - queryParameters['time'] = params.time; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - const response = await this.request({ - path: `/tracks/usdc-purchase/{version}`.replace(`{${"version"}}`, encodeURIComponent(String(params.version))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => TracksResponseFromJSON(jsonValue)); - } - - /** - * Gets the top trending (most popular) USDC purchase tracks on Audius using a given trending strategy version - */ - async getTrendingUSDCPurchaseTracksWithVersion(params: GetTrendingUSDCPurchaseTracksWithVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getTrendingUSDCPurchaseTracksWithVersionRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * 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. - */ - async getTrendingUndergroundWinnersRaw(params: GetTrendingUndergroundWinnersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - if (params.week !== undefined) { - queryParameters['week'] = (params.week as any).toISOString().substr(0,10); - } - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - const response = await this.request({ - path: `/tracks/trending/underground/winners`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => TracksResponseFromJSON(jsonValue)); - } - - /** - * 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. - */ - async getTrendingUndergroundWinners(params: GetTrendingUndergroundWinnersRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getTrendingUndergroundWinnersRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * 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. - */ - async getTrendingWinnersRaw(params: GetTrendingWinnersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - if (params.week !== undefined) { - queryParameters['week'] = (params.week as any).toISOString().substr(0,10); - } - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - const response = await this.request({ - path: `/tracks/trending/winners`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => TracksResponseFromJSON(jsonValue)); - } - - /** - * 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. - */ - async getTrendingWinners(params: GetTrendingWinnersRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getTrendingWinnersRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Gets the top 100 trending underground tracks on Audius - */ - async getUndergroundTrendingTracksRaw(params: GetUndergroundTrendingTracksRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - if (params.offset !== undefined) { - queryParameters['offset'] = params.offset; - } - - if (params.limit !== undefined) { - queryParameters['limit'] = params.limit; - } - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - const response = await this.request({ - path: `/tracks/trending/underground`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => TracksResponseFromJSON(jsonValue)); - } - - /** - * Gets the top 100 trending underground tracks on Audius - */ - async getUndergroundTrendingTracks(params: GetUndergroundTrendingTracksRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getUndergroundTrendingTracksRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Gets the top 100 trending underground tracks on Audius using a given trending strategy version - */ - async getUndergroundTrendingTracksWithVersionRaw(params: GetUndergroundTrendingTracksWithVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (params.version === null || params.version === undefined) { - throw new runtime.RequiredError('version','Required parameter params.version was null or undefined when calling getUndergroundTrendingTracksWithVersion.'); - } - - const queryParameters: any = {}; - - if (params.offset !== undefined) { - queryParameters['offset'] = params.offset; - } - - if (params.limit !== undefined) { - queryParameters['limit'] = params.limit; - } - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - const response = await this.request({ - path: `/tracks/trending/underground/{version}`.replace(`{${"version"}}`, encodeURIComponent(String(params.version))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => TracksResponseFromJSON(jsonValue)); - } - - /** - * Gets the top 100 trending underground tracks on Audius using a given trending strategy version - */ - async getUndergroundTrendingTracksWithVersion(params: GetUndergroundTrendingTracksWithVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getUndergroundTrendingTracksWithVersionRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Get users that favorited a track - */ - async getUsersFromFavoritesRaw(params: GetUsersFromFavoritesRequest, 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 getUsersFromFavorites.'); - } - - const queryParameters: any = {}; - - if (params.offset !== undefined) { - queryParameters['offset'] = params.offset; - } - - if (params.limit !== undefined) { - queryParameters['limit'] = params.limit; - } - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - const response = await this.request({ - path: `/tracks/{track_id}/favorites`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => TrackFavoritesResponseFromJSON(jsonValue)); - } - - /** - * Get users that favorited a track - */ - async getUsersFromFavorites(params: GetUsersFromFavoritesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getUsersFromFavoritesRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Get the users that reposted a track - */ - async getUsersFromRepostsRaw(params: GetUsersFromRepostsRequest, 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 getUsersFromReposts.'); - } - - const queryParameters: any = {}; - - if (params.offset !== undefined) { - queryParameters['offset'] = params.offset; - } - - if (params.limit !== undefined) { - queryParameters['limit'] = params.limit; - } - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - const response = await this.request({ - path: `/tracks/{track_id}/reposts`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => TrackRepostsResponseFromJSON(jsonValue)); - } - - /** - * Get the users that reposted a track - */ - async getUsersFromReposts(params: GetUsersFromRepostsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getUsersFromRepostsRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Inspect a track - * Inspects the details of the file for a track - */ - async inspectTrackRaw(params: InspectTrackRequest, 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 inspectTrack.'); - } - - const queryParameters: any = {}; - - if (params.original !== undefined) { - queryParameters['original'] = params.original; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - const response = await this.request({ - path: `/tracks/{track_id}/inspect`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => TrackInspectFromJSON(jsonValue)); - } - - /** - * Inspect a track - * Inspects the details of the file for a track - */ - async inspectTrack(params: InspectTrackRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.inspectTrackRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Inspect multiple tracks - * Inspects the details of the files for multiple tracks - */ - async inspectTracksRaw(params: InspectTracksRequest, 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 inspectTracks.'); - } - - const queryParameters: any = {}; - - if (params.id) { - queryParameters['id'] = params.id; - } - - if (params.original !== undefined) { - queryParameters['original'] = params.original; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - const response = await this.request({ - path: `/tracks/inspect`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => TrackInspectListFromJSON(jsonValue)); - } - - /** - * Inspect multiple tracks - * Inspects the details of the files for multiple tracks - */ - async inspectTracks(params: InspectTracksRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.inspectTracksRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Record a track download event - */ - async recordTrackDownloadRaw(params: RecordTrackDownloadRequest, 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 recordTrackDownload.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/tracks/{track_id}/downloads`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: TrackDownloadRequestBodyToJSON(params.location), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Record a track download event - */ - async recordTrackDownload(params: RecordTrackDownloadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.recordTrackDownloadRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Repost a track - */ - async repostTrackRaw(params: RepostTrackRequest, 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 repostTrack.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling repostTrack.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/tracks/{track_id}/reposts`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: RepostRequestBodyToJSON(params.repostRequestBody), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Repost a track - */ - async repostTrack(params: RepostTrackRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.repostTrackRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Search for a track or tracks - */ - async searchTracksRaw(params: SearchTracksRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - if (params.offset !== undefined) { - queryParameters['offset'] = params.offset; - } - - if (params.limit !== undefined) { - queryParameters['limit'] = params.limit; - } - - if (params.query !== undefined) { - queryParameters['query'] = params.query; - } - - if (params.genre) { - queryParameters['genre'] = params.genre; - } - - if (params.sortMethod !== undefined) { - queryParameters['sort_method'] = params.sortMethod; - } - - if (params.mood) { - queryParameters['mood'] = params.mood; - } + if (params.mood) { + queryParameters['mood'] = params.mood; + } if (params.onlyDownloadable !== undefined) { queryParameters['only_downloadable'] = params.onlyDownloadable; @@ -2031,56 +933,6 @@ export class TracksApi extends runtime.BaseAPI { return await response.value(); } - /** - * @hidden - * Record a track share event - */ - async shareTrackRaw(params: ShareTrackRequest, 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 shareTrack.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling shareTrack.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/tracks/{track_id}/shares`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Record a track share event - */ - async shareTrack(params: ShareTrackRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.shareTrackRaw(params, initOverrides); - return await response.value(); - } - /** * @hidden * Stream an mp3 track This endpoint accepts the Range header for streaming. https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests @@ -2150,163 +1002,6 @@ export class TracksApi extends runtime.BaseAPI { return await response.value(); } - /** - * @hidden - * Unfavorite a track - */ - async unfavoriteTrackRaw(params: UnfavoriteTrackRequest, 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 unfavoriteTrack.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling unfavoriteTrack.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/tracks/{track_id}/favorites`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Unfavorite a track - */ - async unfavoriteTrack(params: UnfavoriteTrackRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.unfavoriteTrackRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Unrepost a track - */ - async unrepostTrackRaw(params: UnrepostTrackRequest, 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 unrepostTrack.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling unrepostTrack.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/tracks/{track_id}/reposts`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Unrepost a track - */ - async unrepostTrack(params: UnrepostTrackRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.unrepostTrackRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Updates an existing track - */ - async updateTrackRaw(params: UpdateTrackRequest, 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 updateTrack.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling updateTrack.'); - } - - if (params.metadata === null || params.metadata === undefined) { - throw new runtime.RequiredError('metadata','Required parameter params.metadata was null or undefined when calling updateTrack.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/tracks/{track_id}`.replace(`{${"track_id"}}`, encodeURIComponent(String(params.trackId))), - method: 'PUT', - headers: headerParameters, - query: queryParameters, - body: UpdateTrackRequestBodyToJSON(params.metadata), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Updates an existing track - */ - async updateTrack(params: UpdateTrackRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.updateTrackRaw(params, initOverrides); - return await response.value(); - } - } /** @@ -2318,26 +1013,6 @@ export const GetMostSharedTracksTimeRangeEnum = { AllTime: 'allTime' } as const; export type GetMostSharedTracksTimeRangeEnum = typeof GetMostSharedTracksTimeRangeEnum[keyof typeof GetMostSharedTracksTimeRangeEnum]; -/** - * @export - */ -export const GetRecommendedTracksTimeEnum = { - Week: 'week', - Month: 'month', - Year: 'year', - AllTime: 'allTime' -} as const; -export type GetRecommendedTracksTimeEnum = typeof GetRecommendedTracksTimeEnum[keyof typeof GetRecommendedTracksTimeEnum]; -/** - * @export - */ -export const GetRecommendedTracksWithVersionTimeEnum = { - Week: 'week', - Month: 'month', - Year: 'year', - AllTime: 'allTime' -} as const; -export type GetRecommendedTracksWithVersionTimeEnum = typeof GetRecommendedTracksWithVersionTimeEnum[keyof typeof GetRecommendedTracksWithVersionTimeEnum]; /** * @export */ @@ -2347,15 +1022,6 @@ export const GetTrackCommentsSortMethodEnum = { Timestamp: 'timestamp' } as const; export type GetTrackCommentsSortMethodEnum = typeof GetTrackCommentsSortMethodEnum[keyof typeof GetTrackCommentsSortMethodEnum]; -/** - * @export - */ -export const GetTrackRemixesSortMethodEnum = { - Likes: 'likes', - Plays: 'plays', - Recent: 'recent' -} as const; -export type GetTrackRemixesSortMethodEnum = typeof GetTrackRemixesSortMethodEnum[keyof typeof GetTrackRemixesSortMethodEnum]; /** * @export */ @@ -2366,36 +1032,6 @@ export const GetTrendingTracksTimeEnum = { AllTime: 'allTime' } as const; export type GetTrendingTracksTimeEnum = typeof GetTrendingTracksTimeEnum[keyof typeof GetTrendingTracksTimeEnum]; -/** - * @export - */ -export const GetTrendingTracksWithVersionTimeEnum = { - Week: 'week', - Month: 'month', - Year: 'year', - AllTime: 'allTime' -} as const; -export type GetTrendingTracksWithVersionTimeEnum = typeof GetTrendingTracksWithVersionTimeEnum[keyof typeof GetTrendingTracksWithVersionTimeEnum]; -/** - * @export - */ -export const GetTrendingUSDCPurchaseTracksTimeEnum = { - Week: 'week', - Month: 'month', - Year: 'year', - AllTime: 'allTime' -} as const; -export type GetTrendingUSDCPurchaseTracksTimeEnum = typeof GetTrendingUSDCPurchaseTracksTimeEnum[keyof typeof GetTrendingUSDCPurchaseTracksTimeEnum]; -/** - * @export - */ -export const GetTrendingUSDCPurchaseTracksWithVersionTimeEnum = { - Week: 'week', - Month: 'month', - Year: 'year', - AllTime: 'allTime' -} as const; -export type GetTrendingUSDCPurchaseTracksWithVersionTimeEnum = typeof GetTrendingUSDCPurchaseTracksWithVersionTimeEnum[keyof typeof GetTrendingUSDCPurchaseTracksWithVersionTimeEnum]; /** * @export */ 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 9b1e8507c79..15cfed14f00 100644 --- a/packages/sdk/src/sdk/api/generated/default/apis/UsersApi.ts +++ b/packages/sdk/src/sdk/api/generated/default/apis/UsersApi.ts @@ -16,16 +16,12 @@ import * as runtime from '../runtime'; import type { - AddManagerRequestBody, AlbumsResponse, - ApproveGrantRequestBody, AuthorizedApps, BalanceHistoryResponse, CollectiblesResponse, ConnectedWalletsResponse, - CreateGrantRequestBody, - CreateUserRequestBody, - CreateUserResponse, + DeveloperApps, EmailAccessResponse, FavoritesResponse, FollowersResponse, @@ -44,9 +40,7 @@ import type { SalesJsonResponse, SubscribersResponse, TagsResponse, - TracksCountResponse, TracksResponse, - UpdateUserRequestBody, UserCoinResponse, UserCoinsResponse, UserCommentsResponse, @@ -57,15 +51,10 @@ import type { UserTracksRemixedResponse, UsersResponse, VerifyToken, - WriteResponse, } from '../models'; import { - AddManagerRequestBodyFromJSON, - AddManagerRequestBodyToJSON, AlbumsResponseFromJSON, AlbumsResponseToJSON, - ApproveGrantRequestBodyFromJSON, - ApproveGrantRequestBodyToJSON, AuthorizedAppsFromJSON, AuthorizedAppsToJSON, BalanceHistoryResponseFromJSON, @@ -74,12 +63,8 @@ import { CollectiblesResponseToJSON, ConnectedWalletsResponseFromJSON, ConnectedWalletsResponseToJSON, - CreateGrantRequestBodyFromJSON, - CreateGrantRequestBodyToJSON, - CreateUserRequestBodyFromJSON, - CreateUserRequestBodyToJSON, - CreateUserResponseFromJSON, - CreateUserResponseToJSON, + DeveloperAppsFromJSON, + DeveloperAppsToJSON, EmailAccessResponseFromJSON, EmailAccessResponseToJSON, FavoritesResponseFromJSON, @@ -116,12 +101,8 @@ import { SubscribersResponseToJSON, TagsResponseFromJSON, TagsResponseToJSON, - TracksCountResponseFromJSON, - TracksCountResponseToJSON, TracksResponseFromJSON, TracksResponseToJSON, - UpdateUserRequestBodyFromJSON, - UpdateUserRequestBodyToJSON, UserCoinResponseFromJSON, UserCoinResponseToJSON, UserCoinsResponseFromJSON, @@ -142,29 +123,8 @@ import { UsersResponseToJSON, VerifyTokenFromJSON, VerifyTokenToJSON, - WriteResponseFromJSON, - WriteResponseToJSON, } from '../models'; -export interface AddManagerRequest { - id: string; - addManagerRequestBody: AddManagerRequestBody; -} - -export interface ApproveGrantRequest { - id: string; - approveGrantRequestBody: ApproveGrantRequestBody; -} - -export interface CreateGrantRequest { - id: string; - createGrantRequestBody: CreateGrantRequestBody; -} - -export interface CreateUserRequest { - metadata: CreateUserRequestBody; -} - export interface DownloadPurchasesAsCSVRequest { id: string; userId?: string; @@ -194,11 +154,6 @@ export interface DownloadUSDCWithdrawalsAsCSVRequest { encodedDataSignature?: string; } -export interface FollowUserRequest { - id: string; - userId: string; -} - export interface GetAIAttributedTracksByUserHandleRequest { handle: string; offset?: number; @@ -237,6 +192,10 @@ export interface GetConnectedWalletsRequest { id: string; } +export interface GetDeveloperAppsRequest { + id: string; +} + export interface GetFavoritesRequest { id: string; } @@ -331,14 +290,12 @@ export interface GetSupportedUsersRequest { id: string; offset?: number; limit?: number; - userId?: string; } export interface GetSupportersRequest { id: string; offset?: number; limit?: number; - userId?: string; } export interface GetTopTrackTagsRequest { @@ -362,32 +319,8 @@ export interface GetTracksByUserRequest { encodedDataSignature?: string; } -export interface GetTracksByUserHandleRequest { - handle: string; - offset?: number; - limit?: number; - userId?: string; - sort?: GetTracksByUserHandleSortEnum; - query?: string; - sortMethod?: GetTracksByUserHandleSortMethodEnum; - sortDirection?: GetTracksByUserHandleSortDirectionEnum; - filterTracks?: GetTracksByUserHandleFilterTracksEnum; - encodedDataMessage?: string; - encodedDataSignature?: string; -} - -export interface GetTracksCountByUserRequest { - id: string; - userId?: string; - filterTracks?: GetTracksCountByUserFilterTracksEnum; - gateCondition?: Array; - encodedDataMessage?: string; - encodedDataSignature?: string; -} - export interface GetUserRequest { id: string; - userId?: string; } export interface GetUserBalanceHistoryRequest { @@ -474,21 +407,6 @@ export interface GetUsersTrackHistoryRequest { encodedDataSignature?: string; } -export interface MuteUserRequest { - id: string; - userId: string; -} - -export interface RemoveManagerRequest { - id: string; - managerUserId: string; -} - -export interface RevokeGrantRequest { - id: string; - address: string; -} - export interface SearchUsersRequest { offset?: number; limit?: number; @@ -498,32 +416,6 @@ export interface SearchUsersRequest { isVerified?: string; } -export interface SubscribeToUserRequest { - id: string; - userId: string; -} - -export interface UnfollowUserRequest { - id: string; - userId: string; -} - -export interface UnmuteUserRequest { - id: string; - userId: string; -} - -export interface UnsubscribeFromUserRequest { - id: string; - userId: string; -} - -export interface UpdateUserRequest { - id: string; - userId: string; - metadata: UpdateUserRequestBody; -} - export interface VerifyIDTokenRequest { token: string; } @@ -533,198 +425,6 @@ export interface VerifyIDTokenRequest { */ export class UsersApi extends runtime.BaseAPI { - /** - * @hidden - * Add a manager (authorize another user to act on your behalf) - */ - async addManagerRaw(params: AddManagerRequest, 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 addManager.'); - } - - if (params.addManagerRequestBody === null || params.addManagerRequestBody === undefined) { - throw new runtime.RequiredError('addManagerRequestBody','Required parameter params.addManagerRequestBody was null or undefined when calling addManager.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/users/{id}/managers`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: AddManagerRequestBodyToJSON(params.addManagerRequestBody), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Add a manager (authorize another user to act on your behalf) - */ - async addManager(params: AddManagerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.addManagerRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Approve a manager request (manager approves being added by the child user) - */ - async approveGrantRaw(params: ApproveGrantRequest, 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 approveGrant.'); - } - - if (params.approveGrantRequestBody === null || params.approveGrantRequestBody === undefined) { - throw new runtime.RequiredError('approveGrantRequestBody','Required parameter params.approveGrantRequestBody was null or undefined when calling approveGrant.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/users/{id}/grants/approve`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: ApproveGrantRequestBodyToJSON(params.approveGrantRequestBody), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Approve a manager request (manager approves being added by the child user) - */ - async approveGrant(params: ApproveGrantRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.approveGrantRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Create a grant (authorize an app to act on the user\'s behalf) - */ - async createGrantRaw(params: CreateGrantRequest, 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 createGrant.'); - } - - if (params.createGrantRequestBody === null || params.createGrantRequestBody === undefined) { - throw new runtime.RequiredError('createGrantRequestBody','Required parameter params.createGrantRequestBody was null or undefined when calling createGrant.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/users/{id}/grants`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: CreateGrantRequestBodyToJSON(params.createGrantRequestBody), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Create a grant (authorize an app to act on the user\'s behalf) - */ - async createGrant(params: CreateGrantRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.createGrantRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Creates a new user - */ - async createUserRaw(params: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - 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 = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/users`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: CreateUserRequestBodyToJSON(params.metadata), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => CreateUserResponseFromJSON(jsonValue)); - } - - /** - * Creates a new user - */ - async createUser(params: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.createUserRaw(params, initOverrides); - return await response.value(); - } - /** * @hidden * Downloads the purchases the user has made as a CSV file @@ -898,56 +598,6 @@ export class UsersApi extends runtime.BaseAPI { await this.downloadUSDCWithdrawalsAsCSVRaw(params, initOverrides); } - /** - * @hidden - * Follow a user - */ - async followUserRaw(params: FollowUserRequest, 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 followUser.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling followUser.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/users/{id}/follow`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Follow a user - */ - async followUser(params: FollowUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.followUserRaw(params, initOverrides); - return await response.value(); - } - /** * @hidden * Gets the AI generated tracks attributed to a user using the user\'s handle @@ -1175,6 +825,37 @@ export class UsersApi extends runtime.BaseAPI { return await response.value(); } + /** + * @hidden + * Gets the developer apps that the user owns + */ + async getDeveloperAppsRaw(params: GetDeveloperAppsRequest, 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 getDeveloperApps.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ + path: `/users/{id}/developer_apps`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => DeveloperAppsFromJSON(jsonValue)); + } + + /** + * Gets the developer apps that the user owns + */ + async getDeveloperApps(params: GetDeveloperAppsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getDeveloperAppsRaw(params, initOverrides); + return await response.value(); + } + /** * @hidden * Gets a user\'s favorite tracks @@ -1734,10 +1415,6 @@ export class UsersApi extends runtime.BaseAPI { queryParameters['limit'] = params.limit; } - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ @@ -1777,10 +1454,6 @@ export class UsersApi extends runtime.BaseAPI { queryParameters['limit'] = params.limit; } - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ @@ -1919,152 +1592,26 @@ export class UsersApi extends runtime.BaseAPI { /** * @hidden - * Gets the tracks created by a user using the user\'s handle + * Gets a single user by their user ID */ - async getTracksByUserHandleRaw(params: GetTracksByUserHandleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (params.handle === null || params.handle === undefined) { - throw new runtime.RequiredError('handle','Required parameter params.handle was null or undefined when calling getTracksByUserHandle.'); + async getUserRaw(params: GetUserRequest, 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 getUser.'); } const queryParameters: any = {}; - if (params.offset !== undefined) { - queryParameters['offset'] = params.offset; - } + const headerParameters: runtime.HTTPHeaders = {}; - if (params.limit !== undefined) { - queryParameters['limit'] = params.limit; - } + const response = await this.request({ + path: `/users/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - if (params.sort !== undefined) { - queryParameters['sort'] = params.sort; - } - - if (params.query !== undefined) { - queryParameters['query'] = params.query; - } - - if (params.sortMethod !== undefined) { - queryParameters['sort_method'] = params.sortMethod; - } - - if (params.sortDirection !== undefined) { - queryParameters['sort_direction'] = params.sortDirection; - } - - if (params.filterTracks !== undefined) { - queryParameters['filter_tracks'] = params.filterTracks; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (params.encodedDataMessage !== undefined && params.encodedDataMessage !== null) { - headerParameters['Encoded-Data-Message'] = String(params.encodedDataMessage); - } - - if (params.encodedDataSignature !== undefined && params.encodedDataSignature !== null) { - headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); - } - - const response = await this.request({ - path: `/users/handle/{handle}/tracks`.replace(`{${"handle"}}`, encodeURIComponent(String(params.handle))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => TracksResponseFromJSON(jsonValue)); - } - - /** - * Gets the tracks created by a user using the user\'s handle - */ - async getTracksByUserHandle(params: GetTracksByUserHandleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getTracksByUserHandleRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Gets the count of tracks created by a user - */ - async getTracksCountByUserRaw(params: GetTracksCountByUserRequest, 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 getTracksCountByUser.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - if (params.filterTracks !== undefined) { - queryParameters['filter_tracks'] = params.filterTracks; - } - - if (params.gateCondition) { - queryParameters['gate_condition'] = params.gateCondition; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (params.encodedDataMessage !== undefined && params.encodedDataMessage !== null) { - headerParameters['Encoded-Data-Message'] = String(params.encodedDataMessage); - } - - if (params.encodedDataSignature !== undefined && params.encodedDataSignature !== null) { - headerParameters['Encoded-Data-Signature'] = String(params.encodedDataSignature); - } - - const response = await this.request({ - path: `/users/{id}/tracks/count`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => TracksCountResponseFromJSON(jsonValue)); - } - - /** - * Gets the count of tracks created by a user - */ - async getTracksCountByUser(params: GetTracksCountByUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getTracksCountByUserRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Gets a single user by their user ID - */ - async getUserRaw(params: GetUserRequest, 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 getUser.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - const response = await this.request({ - path: `/users/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => UserResponseFromJSON(jsonValue)); - } + return new runtime.JSONApiResponse(response, (jsonValue) => UserResponseFromJSON(jsonValue)); + } /** * Gets a single user by their user ID @@ -2617,148 +2164,6 @@ export class UsersApi extends runtime.BaseAPI { return await response.value(); } - /** - * @hidden - * Mute a user - */ - async muteUserRaw(params: MuteUserRequest, 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 muteUser.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling muteUser.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/users/{id}/muted`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Mute a user - */ - async muteUser(params: MuteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.muteUserRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Remove a manager (revoke user-to-user grant). Can be called by the child user or the manager. - */ - async removeManagerRaw(params: RemoveManagerRequest, 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 removeManager.'); - } - - if (params.managerUserId === null || params.managerUserId === undefined) { - throw new runtime.RequiredError('managerUserId','Required parameter params.managerUserId was null or undefined when calling removeManager.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/users/{id}/managers/{managerUserId}`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))).replace(`{${"managerUserId"}}`, encodeURIComponent(String(params.managerUserId))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Remove a manager (revoke user-to-user grant). Can be called by the child user or the manager. - */ - async removeManager(params: RemoveManagerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.removeManagerRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Revoke a grant (remove app authorization) - */ - async revokeGrantRaw(params: RevokeGrantRequest, 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 revokeGrant.'); - } - - if (params.address === null || params.address === undefined) { - throw new runtime.RequiredError('address','Required parameter params.address was null or undefined when calling revokeGrant.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/users/{id}/grants/{address}`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))).replace(`{${"address"}}`, encodeURIComponent(String(params.address))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Revoke a grant (remove app authorization) - */ - async revokeGrant(params: RevokeGrantRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.revokeGrantRaw(params, initOverrides); - return await response.value(); - } - /** * @hidden * Search for users that match the given query @@ -2810,255 +2215,6 @@ export class UsersApi extends runtime.BaseAPI { return await response.value(); } - /** - * @hidden - * Subscribe to a user - */ - async subscribeToUserRaw(params: SubscribeToUserRequest, 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 subscribeToUser.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling subscribeToUser.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/users/{id}/subscribers`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Subscribe to a user - */ - async subscribeToUser(params: SubscribeToUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.subscribeToUserRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Unfollow a user - */ - async unfollowUserRaw(params: UnfollowUserRequest, 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 unfollowUser.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling unfollowUser.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/users/{id}/follow`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Unfollow a user - */ - async unfollowUser(params: UnfollowUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.unfollowUserRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Unmute a user - */ - async unmuteUserRaw(params: UnmuteUserRequest, 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 unmuteUser.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling unmuteUser.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/users/{id}/muted`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Unmute a user - */ - async unmuteUser(params: UnmuteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.unmuteUserRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Unsubscribe from a user - */ - async unsubscribeFromUserRaw(params: UnsubscribeFromUserRequest, 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 unsubscribeFromUser.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling unsubscribeFromUser.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - if (this.configuration && this.configuration.accessToken) { - const token = this.configuration.accessToken; - const tokenString = await token("BearerAuth", []); - - if (tokenString) { - headerParameters["Authorization"] = `Bearer ${tokenString}`; - } - } - const response = await this.request({ - path: `/users/{id}/subscribers`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Unsubscribe from a user - */ - async unsubscribeFromUser(params: UnsubscribeFromUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.unsubscribeFromUserRaw(params, initOverrides); - return await response.value(); - } - - /** - * @hidden - * Updates an existing user profile - */ - async updateUserRaw(params: UpdateUserRequest, 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 updateUser.'); - } - - if (params.userId === null || params.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter params.userId was null or undefined when calling updateUser.'); - } - - if (params.metadata === null || params.metadata === undefined) { - throw new runtime.RequiredError('metadata','Required parameter params.metadata was null or undefined when calling updateUser.'); - } - - const queryParameters: any = {}; - - if (params.userId !== undefined) { - queryParameters['user_id'] = params.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/users/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(params.id))), - method: 'PUT', - headers: headerParameters, - query: queryParameters, - body: UpdateUserRequestBodyToJSON(params.metadata), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); - } - - /** - * Updates an existing user profile - */ - async updateUser(params: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.updateUserRaw(params, initOverrides); - return await response.value(); - } - /** * @hidden * Verify if the given jwt ID token was signed by the subject (user) in the payload @@ -3202,65 +2358,6 @@ export const GetTracksByUserGateConditionEnum = { Token: 'token' } as const; export type GetTracksByUserGateConditionEnum = typeof GetTracksByUserGateConditionEnum[keyof typeof GetTracksByUserGateConditionEnum]; -/** - * @export - */ -export const GetTracksByUserHandleSortEnum = { - Date: 'date', - Plays: 'plays' -} as const; -export type GetTracksByUserHandleSortEnum = typeof GetTracksByUserHandleSortEnum[keyof typeof GetTracksByUserHandleSortEnum]; -/** - * @export - */ -export const GetTracksByUserHandleSortMethodEnum = { - Title: 'title', - ArtistName: 'artist_name', - ReleaseDate: 'release_date', - LastListenDate: 'last_listen_date', - AddedDate: 'added_date', - Plays: 'plays', - Reposts: 'reposts', - Saves: 'saves', - MostListensByUser: 'most_listens_by_user' -} as const; -export type GetTracksByUserHandleSortMethodEnum = typeof GetTracksByUserHandleSortMethodEnum[keyof typeof GetTracksByUserHandleSortMethodEnum]; -/** - * @export - */ -export const GetTracksByUserHandleSortDirectionEnum = { - Asc: 'asc', - Desc: 'desc' -} as const; -export type GetTracksByUserHandleSortDirectionEnum = typeof GetTracksByUserHandleSortDirectionEnum[keyof typeof GetTracksByUserHandleSortDirectionEnum]; -/** - * @export - */ -export const GetTracksByUserHandleFilterTracksEnum = { - All: 'all', - Public: 'public' -} as const; -export type GetTracksByUserHandleFilterTracksEnum = typeof GetTracksByUserHandleFilterTracksEnum[keyof typeof GetTracksByUserHandleFilterTracksEnum]; -/** - * @export - */ -export const GetTracksCountByUserFilterTracksEnum = { - All: 'all', - Public: 'public' -} as const; -export type GetTracksCountByUserFilterTracksEnum = typeof GetTracksCountByUserFilterTracksEnum[keyof typeof GetTracksCountByUserFilterTracksEnum]; -/** - * @export - */ -export const GetTracksCountByUserGateConditionEnum = { - Ungated: 'ungated', - UsdcPurchase: 'usdc_purchase', - Follow: 'follow', - Tip: 'tip', - Nft: 'nft', - Token: 'token' -} as const; -export type GetTracksCountByUserGateConditionEnum = typeof GetTracksCountByUserGateConditionEnum[keyof typeof GetTracksCountByUserGateConditionEnum]; /** * @export */ diff --git a/packages/sdk/src/sdk/api/generated/default/models/AccessGate.ts b/packages/sdk/src/sdk/api/generated/default/models/AccessGate.ts deleted file mode 100644 index 283722cfa35..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/AccessGate.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 { - ExtendedPurchaseGate, - instanceOfExtendedPurchaseGate, - ExtendedPurchaseGateFromJSON, - ExtendedPurchaseGateFromJSONTyped, - ExtendedPurchaseGateToJSON, -} from './ExtendedPurchaseGate'; -import { - FollowGate, - instanceOfFollowGate, - FollowGateFromJSON, - FollowGateFromJSONTyped, - FollowGateToJSON, -} from './FollowGate'; -import { - TipGate, - instanceOfTipGate, - TipGateFromJSON, - TipGateFromJSONTyped, - TipGateToJSON, -} from './TipGate'; -import { - TokenGate, - instanceOfTokenGate, - TokenGateFromJSON, - TokenGateFromJSONTyped, - TokenGateToJSON, -} from './TokenGate'; - -/** - * @type AccessGate - * - * @export - */ -export type AccessGate = ExtendedPurchaseGate | FollowGate | TipGate | TokenGate; - -export function AccessGateFromJSON(json: any): AccessGate { - return AccessGateFromJSONTyped(json, false); -} - -export function AccessGateFromJSONTyped(json: any, ignoreDiscriminator: boolean): AccessGate { - if ((json === undefined) || (json === null)) { - return json; - } - return { ...ExtendedPurchaseGateFromJSONTyped(json, true), ...FollowGateFromJSONTyped(json, true), ...TipGateFromJSONTyped(json, true), ...TokenGateFromJSONTyped(json, true) }; -} - -export function AccessGateToJSON(value?: AccessGate | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - - if (instanceOfExtendedPurchaseGate(value)) { - return ExtendedPurchaseGateToJSON(value as ExtendedPurchaseGate); - } - if (instanceOfFollowGate(value)) { - return FollowGateToJSON(value as FollowGate); - } - if (instanceOfTipGate(value)) { - return TipGateToJSON(value as TipGate); - } - if (instanceOfTokenGate(value)) { - return TokenGateToJSON(value as TokenGate); - } - - return {}; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/AddManagerRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/AddManagerRequestBody.ts deleted file mode 100644 index 203822af092..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/AddManagerRequestBody.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface AddManagerRequestBody - */ -export interface AddManagerRequestBody { - /** - * The user ID of the user to add as manager - * @type {string} - * @memberof AddManagerRequestBody - */ - managerUserId: string; -} - -/** - * Check if a given object implements the AddManagerRequestBody interface. - */ -export function instanceOfAddManagerRequestBody(value: object): value is AddManagerRequestBody { - let isInstance = true; - isInstance = isInstance && "managerUserId" in value && value["managerUserId"] !== undefined; - - return isInstance; -} - -export function AddManagerRequestBodyFromJSON(json: any): AddManagerRequestBody { - return AddManagerRequestBodyFromJSONTyped(json, false); -} - -export function AddManagerRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): AddManagerRequestBody { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'managerUserId': json['manager_user_id'], - }; -} - -export function AddManagerRequestBodyToJSON(value?: AddManagerRequestBody | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'manager_user_id': value.managerUserId, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/ApproveGrantRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/ApproveGrantRequestBody.ts deleted file mode 100644 index 5e67bd3ade6..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/ApproveGrantRequestBody.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface ApproveGrantRequestBody - */ -export interface ApproveGrantRequestBody { - /** - * The user ID of the child user who proposed the manager (grantor) - * @type {string} - * @memberof ApproveGrantRequestBody - */ - grantorUserId: string; -} - -/** - * Check if a given object implements the ApproveGrantRequestBody interface. - */ -export function instanceOfApproveGrantRequestBody(value: object): value is ApproveGrantRequestBody { - let isInstance = true; - isInstance = isInstance && "grantorUserId" in value && value["grantorUserId"] !== undefined; - - return isInstance; -} - -export function ApproveGrantRequestBodyFromJSON(json: any): ApproveGrantRequestBody { - return ApproveGrantRequestBodyFromJSONTyped(json, false); -} - -export function ApproveGrantRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): ApproveGrantRequestBody { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'grantorUserId': json['grantor_user_id'], - }; -} - -export function ApproveGrantRequestBodyToJSON(value?: ApproveGrantRequestBody | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'grantor_user_id': value.grantorUserId, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/ClaimRewardsRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/ClaimRewardsRequest.ts similarity index 65% rename from packages/sdk/src/sdk/api/generated/default/models/ClaimRewardsRequestBody.ts rename to packages/sdk/src/sdk/api/generated/default/models/ClaimRewardsRequest.ts index 203c1c6d5fa..ec62104bfff 100644 --- a/packages/sdk/src/sdk/api/generated/default/models/ClaimRewardsRequestBody.ts +++ b/packages/sdk/src/sdk/api/generated/default/models/ClaimRewardsRequest.ts @@ -17,44 +17,44 @@ import { exists, mapValues } from '../runtime'; /** * * @export - * @interface ClaimRewardsRequestBody + * @interface ClaimRewardsRequest */ -export interface ClaimRewardsRequestBody { +export interface ClaimRewardsRequest { /** * The challenge ID to filter rewards (optional) * @type {string} - * @memberof ClaimRewardsRequestBody + * @memberof ClaimRewardsRequest */ challengeId?: string; /** * The specifier to filter rewards (optional) * @type {string} - * @memberof ClaimRewardsRequestBody + * @memberof ClaimRewardsRequest */ specifier?: string; /** * The user ID to claim rewards for * @type {string} - * @memberof ClaimRewardsRequestBody + * @memberof ClaimRewardsRequest */ userId: string; } /** - * Check if a given object implements the ClaimRewardsRequestBody interface. + * Check if a given object implements the ClaimRewardsRequest interface. */ -export function instanceOfClaimRewardsRequestBody(value: object): value is ClaimRewardsRequestBody { +export function instanceOfClaimRewardsRequest(value: object): value is ClaimRewardsRequest { let isInstance = true; isInstance = isInstance && "userId" in value && value["userId"] !== undefined; return isInstance; } -export function ClaimRewardsRequestBodyFromJSON(json: any): ClaimRewardsRequestBody { - return ClaimRewardsRequestBodyFromJSONTyped(json, false); +export function ClaimRewardsRequestFromJSON(json: any): ClaimRewardsRequest { + return ClaimRewardsRequestFromJSONTyped(json, false); } -export function ClaimRewardsRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): ClaimRewardsRequestBody { +export function ClaimRewardsRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): ClaimRewardsRequest { if ((json === undefined) || (json === null)) { return json; } @@ -66,7 +66,7 @@ export function ClaimRewardsRequestBodyFromJSONTyped(json: any, ignoreDiscrimina }; } -export function ClaimRewardsRequestBodyToJSON(value?: ClaimRewardsRequestBody | null): any { +export function ClaimRewardsRequestToJSON(value?: ClaimRewardsRequest | null): any { if (value === undefined) { return undefined; } diff --git a/packages/sdk/src/sdk/api/generated/default/models/Comment.ts b/packages/sdk/src/sdk/api/generated/default/models/Comment.ts index bb2296d91ca..d8d97d2748e 100644 --- a/packages/sdk/src/sdk/api/generated/default/models/Comment.ts +++ b/packages/sdk/src/sdk/api/generated/default/models/Comment.ts @@ -14,12 +14,6 @@ */ import { exists, mapValues } from '../runtime'; -import type { CommentEntityType } from './CommentEntityType'; -import { - CommentEntityTypeFromJSON, - CommentEntityTypeFromJSONTyped, - CommentEntityTypeToJSON, -} from './CommentEntityType'; import type { CommentMention } from './CommentMention'; import { CommentMentionFromJSON, @@ -53,10 +47,10 @@ export interface Comment { entityId: string; /** * - * @type {CommentEntityType} + * @type {string} * @memberof Comment */ - entityType: CommentEntityType; + entityType: string; /** * * @type {string} @@ -178,7 +172,7 @@ export function CommentFromJSONTyped(json: any, ignoreDiscriminator: boolean): C 'id': json['id'], 'entityId': json['entity_id'], - 'entityType': CommentEntityTypeFromJSON(json['entity_type']), + 'entityType': json['entity_type'], 'userId': !exists(json, 'user_id') ? undefined : json['user_id'], 'message': json['message'], 'mentions': !exists(json, 'mentions') ? undefined : ((json['mentions'] as Array).map(CommentMentionFromJSON)), @@ -208,7 +202,7 @@ export function CommentToJSON(value?: Comment | null): any { 'id': value.id, 'entity_id': value.entityId, - 'entity_type': CommentEntityTypeToJSON(value.entityType), + 'entity_type': value.entityType, 'user_id': value.userId, 'message': value.message, 'mentions': value.mentions === undefined ? undefined : ((value.mentions as Array).map(CommentMentionToJSON)), diff --git a/packages/sdk/src/sdk/api/generated/default/models/CommentEntityType.ts b/packages/sdk/src/sdk/api/generated/default/models/CommentEntityType.ts deleted file mode 100644 index 02a05fabdf1..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/CommentEntityType.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* 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. - */ - - -/** - * - * @export - */ -export const CommentEntityType = { - Track: 'Track' -} as const; -export type CommentEntityType = typeof CommentEntityType[keyof typeof CommentEntityType]; - - -export function CommentEntityTypeFromJSON(json: any): CommentEntityType { - return CommentEntityTypeFromJSONTyped(json, false); -} - -export function CommentEntityTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): CommentEntityType { - return json as CommentEntityType; -} - -export function CommentEntityTypeToJSON(value?: CommentEntityType | null): any { - return value as any; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/CreateAccessKeyResponse.ts b/packages/sdk/src/sdk/api/generated/default/models/CreateAccessKeyResponse.ts deleted file mode 100644 index 3d7cf28e3aa..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/CreateAccessKeyResponse.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface CreateAccessKeyResponse - */ -export interface CreateAccessKeyResponse { - /** - * The newly created bearer token (API access key) - * @type {string} - * @memberof CreateAccessKeyResponse - */ - apiAccessKey: string; -} - -/** - * Check if a given object implements the CreateAccessKeyResponse interface. - */ -export function instanceOfCreateAccessKeyResponse(value: object): value is CreateAccessKeyResponse { - let isInstance = true; - isInstance = isInstance && "apiAccessKey" in value && value["apiAccessKey"] !== undefined; - - return isInstance; -} - -export function CreateAccessKeyResponseFromJSON(json: any): CreateAccessKeyResponse { - return CreateAccessKeyResponseFromJSONTyped(json, false); -} - -export function CreateAccessKeyResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateAccessKeyResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'apiAccessKey': json['api_access_key'], - }; -} - -export function CreateAccessKeyResponseToJSON(value?: CreateAccessKeyResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'api_access_key': value.apiAccessKey, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/CreateCoinRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/CreateCoinRequest.ts similarity index 75% rename from packages/sdk/src/sdk/api/generated/default/models/CreateCoinRequestBody.ts rename to packages/sdk/src/sdk/api/generated/default/models/CreateCoinRequest.ts index 53e70836f09..39817b101dd 100644 --- a/packages/sdk/src/sdk/api/generated/default/models/CreateCoinRequestBody.ts +++ b/packages/sdk/src/sdk/api/generated/default/models/CreateCoinRequest.ts @@ -17,81 +17,81 @@ import { exists, mapValues } from '../runtime'; /** * * @export - * @interface CreateCoinRequestBody + * @interface CreateCoinRequest */ -export interface CreateCoinRequestBody { +export interface CreateCoinRequest { /** * The mint address of the coin * @type {string} - * @memberof CreateCoinRequestBody + * @memberof CreateCoinRequest */ mint: string; /** * The coin symbol/ticker * @type {string} - * @memberof CreateCoinRequestBody + * @memberof CreateCoinRequest */ ticker: string; /** * The number of decimals for the coin (0-18) * @type {number} - * @memberof CreateCoinRequestBody + * @memberof CreateCoinRequest */ decimals: number; /** * The coin name * @type {string} - * @memberof CreateCoinRequestBody + * @memberof CreateCoinRequest */ name: string; /** * The URI for the coin's logo image * @type {string} - * @memberof CreateCoinRequestBody + * @memberof CreateCoinRequest */ logoUri?: string; /** * The URI for the coin's banner image * @type {string} - * @memberof CreateCoinRequestBody + * @memberof CreateCoinRequest */ bannerImageUrl?: string; /** * The description of the coin * @type {string} - * @memberof CreateCoinRequestBody + * @memberof CreateCoinRequest */ description?: string; /** * Generic link URL for the coin * @type {string} - * @memberof CreateCoinRequestBody + * @memberof CreateCoinRequest */ link1?: string; /** * Generic link URL for the coin * @type {string} - * @memberof CreateCoinRequestBody + * @memberof CreateCoinRequest */ link2?: string; /** * Generic link URL for the coin * @type {string} - * @memberof CreateCoinRequestBody + * @memberof CreateCoinRequest */ link3?: string; /** * Generic link URL for the coin * @type {string} - * @memberof CreateCoinRequestBody + * @memberof CreateCoinRequest */ link4?: string; } /** - * Check if a given object implements the CreateCoinRequestBody interface. + * Check if a given object implements the CreateCoinRequest interface. */ -export function instanceOfCreateCoinRequestBody(value: object): value is CreateCoinRequestBody { +export function instanceOfCreateCoinRequest(value: object): value is CreateCoinRequest { let isInstance = true; isInstance = isInstance && "mint" in value && value["mint"] !== undefined; isInstance = isInstance && "ticker" in value && value["ticker"] !== undefined; @@ -101,11 +101,11 @@ export function instanceOfCreateCoinRequestBody(value: object): value is CreateC return isInstance; } -export function CreateCoinRequestBodyFromJSON(json: any): CreateCoinRequestBody { - return CreateCoinRequestBodyFromJSONTyped(json, false); +export function CreateCoinRequestFromJSON(json: any): CreateCoinRequest { + return CreateCoinRequestFromJSONTyped(json, false); } -export function CreateCoinRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateCoinRequestBody { +export function CreateCoinRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateCoinRequest { if ((json === undefined) || (json === null)) { return json; } @@ -125,7 +125,7 @@ export function CreateCoinRequestBodyFromJSONTyped(json: any, ignoreDiscriminato }; } -export function CreateCoinRequestBodyToJSON(value?: CreateCoinRequestBody | null): any { +export function CreateCoinRequestToJSON(value?: CreateCoinRequest | null): any { if (value === undefined) { return undefined; } diff --git a/packages/sdk/src/sdk/api/generated/default/models/CreateCommentRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/CreateCommentRequestBody.ts deleted file mode 100644 index 604fa946cca..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/CreateCommentRequestBody.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* 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 { CommentEntityType } from './CommentEntityType'; -import { - CommentEntityTypeFromJSON, - CommentEntityTypeFromJSONTyped, - CommentEntityTypeToJSON, -} from './CommentEntityType'; - -/** - * - * @export - * @interface CreateCommentRequestBody - */ -export interface CreateCommentRequestBody { - /** - * - * @type {CommentEntityType} - * @memberof CreateCommentRequestBody - */ - entityType: CommentEntityType; - /** - * ID of the entity being commented on - * @type {number} - * @memberof CreateCommentRequestBody - */ - entityId: number; - /** - * Comment text - * @type {string} - * @memberof CreateCommentRequestBody - */ - body: string; - /** - * Optional ID for the comment (will be generated if not provided) - * @type {number} - * @memberof CreateCommentRequestBody - */ - commentId?: number; - /** - * Parent comment ID if this is a reply - * @type {number} - * @memberof CreateCommentRequestBody - */ - parentId?: number; - /** - * Timestamp in the track where the comment was made (in seconds) - * @type {number} - * @memberof CreateCommentRequestBody - */ - trackTimestampS?: number; - /** - * Array of user IDs mentioned in the comment (max 10) - * @type {Array} - * @memberof CreateCommentRequestBody - */ - mentions?: Array; -} - -/** - * Check if a given object implements the CreateCommentRequestBody interface. - */ -export function instanceOfCreateCommentRequestBody(value: object): value is CreateCommentRequestBody { - let isInstance = true; - isInstance = isInstance && "entityType" in value && value["entityType"] !== undefined; - isInstance = isInstance && "entityId" in value && value["entityId"] !== undefined; - isInstance = isInstance && "body" in value && value["body"] !== undefined; - - return isInstance; -} - -export function CreateCommentRequestBodyFromJSON(json: any): CreateCommentRequestBody { - return CreateCommentRequestBodyFromJSONTyped(json, false); -} - -export function CreateCommentRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateCommentRequestBody { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'entityType': CommentEntityTypeFromJSON(json['entityType']), - 'entityId': json['entityId'], - 'body': json['body'], - 'commentId': !exists(json, 'commentId') ? undefined : json['commentId'], - 'parentId': !exists(json, 'parentId') ? undefined : json['parentId'], - 'trackTimestampS': !exists(json, 'trackTimestampS') ? undefined : json['trackTimestampS'], - 'mentions': !exists(json, 'mentions') ? undefined : json['mentions'], - }; -} - -export function CreateCommentRequestBodyToJSON(value?: CreateCommentRequestBody | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'entityType': CommentEntityTypeToJSON(value.entityType), - 'entityId': value.entityId, - 'body': value.body, - 'commentId': value.commentId, - 'parentId': value.parentId, - 'trackTimestampS': value.trackTimestampS, - 'mentions': value.mentions, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/CreateCommentResponse.ts b/packages/sdk/src/sdk/api/generated/default/models/CreateCommentResponse.ts deleted file mode 100644 index fe10f559a84..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/CreateCommentResponse.ts +++ /dev/null @@ -1,82 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface CreateCommentResponse - */ -export interface CreateCommentResponse { - /** - * Whether the comment was created successfully - * @type {boolean} - * @memberof CreateCommentResponse - */ - success?: boolean; - /** - * The blockchain transaction hash - * @type {string} - * @memberof CreateCommentResponse - */ - transactionHash?: string; - /** - * The ID of the created comment - * @type {string} - * @memberof CreateCommentResponse - */ - commentId?: string; -} - -/** - * Check if a given object implements the CreateCommentResponse interface. - */ -export function instanceOfCreateCommentResponse(value: object): value is CreateCommentResponse { - let isInstance = true; - - return isInstance; -} - -export function CreateCommentResponseFromJSON(json: any): CreateCommentResponse { - return CreateCommentResponseFromJSONTyped(json, false); -} - -export function CreateCommentResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateCommentResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'success': !exists(json, 'success') ? undefined : json['success'], - 'transactionHash': !exists(json, 'transaction_hash') ? undefined : json['transaction_hash'], - 'commentId': !exists(json, 'comment_id') ? undefined : json['comment_id'], - }; -} - -export function CreateCommentResponseToJSON(value?: CreateCommentResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'success': value.success, - 'transaction_hash': value.transactionHash, - 'comment_id': value.commentId, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/CreateDeveloperAppRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/CreateDeveloperAppRequestBody.ts deleted file mode 100644 index 404d87c473c..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/CreateDeveloperAppRequestBody.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface CreateDeveloperAppRequestBody - */ -export interface CreateDeveloperAppRequestBody { - /** - * Developer app name - * @type {string} - * @memberof CreateDeveloperAppRequestBody - */ - name: string; - /** - * App description - * @type {string} - * @memberof CreateDeveloperAppRequestBody - */ - description?: string; - /** - * App logo/image URL - * @type {string} - * @memberof CreateDeveloperAppRequestBody - */ - imageUrl?: string; -} - -/** - * Check if a given object implements the CreateDeveloperAppRequestBody interface. - */ -export function instanceOfCreateDeveloperAppRequestBody(value: object): value is CreateDeveloperAppRequestBody { - let isInstance = true; - isInstance = isInstance && "name" in value && value["name"] !== undefined; - - return isInstance; -} - -export function CreateDeveloperAppRequestBodyFromJSON(json: any): CreateDeveloperAppRequestBody { - return CreateDeveloperAppRequestBodyFromJSONTyped(json, false); -} - -export function CreateDeveloperAppRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateDeveloperAppRequestBody { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'name': json['name'], - 'description': !exists(json, 'description') ? undefined : json['description'], - 'imageUrl': !exists(json, 'imageUrl') ? undefined : json['imageUrl'], - }; -} - -export function CreateDeveloperAppRequestBodyToJSON(value?: CreateDeveloperAppRequestBody | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'name': value.name, - 'description': value.description, - 'imageUrl': value.imageUrl, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/CreateDeveloperAppResponse.ts b/packages/sdk/src/sdk/api/generated/default/models/CreateDeveloperAppResponse.ts deleted file mode 100644 index f9e25a2e9bb..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/CreateDeveloperAppResponse.ts +++ /dev/null @@ -1,90 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface CreateDeveloperAppResponse - */ -export interface CreateDeveloperAppResponse { - /** - * The API key (address) for the developer app - * @type {string} - * @memberof CreateDeveloperAppResponse - */ - apiKey?: string; - /** - * The private key for the developer app (for signing) - * @type {string} - * @memberof CreateDeveloperAppResponse - */ - apiSecret?: string; - /** - * The bearer token for API authentication (use in Authorization header) - * @type {string} - * @memberof CreateDeveloperAppResponse - */ - bearerToken?: string; - /** - * Transaction hash of the creation - * @type {string} - * @memberof CreateDeveloperAppResponse - */ - transactionHash?: string; -} - -/** - * Check if a given object implements the CreateDeveloperAppResponse interface. - */ -export function instanceOfCreateDeveloperAppResponse(value: object): value is CreateDeveloperAppResponse { - let isInstance = true; - - return isInstance; -} - -export function CreateDeveloperAppResponseFromJSON(json: any): CreateDeveloperAppResponse { - return CreateDeveloperAppResponseFromJSONTyped(json, false); -} - -export function CreateDeveloperAppResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateDeveloperAppResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'apiKey': !exists(json, 'api_key') ? undefined : json['api_key'], - 'apiSecret': !exists(json, 'api_secret') ? undefined : json['api_secret'], - 'bearerToken': !exists(json, 'bearer_token') ? undefined : json['bearer_token'], - 'transactionHash': !exists(json, 'transaction_hash') ? undefined : json['transaction_hash'], - }; -} - -export function CreateDeveloperAppResponseToJSON(value?: CreateDeveloperAppResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'api_key': value.apiKey, - 'api_secret': value.apiSecret, - 'bearer_token': value.bearerToken, - 'transaction_hash': value.transactionHash, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/CreateGrantRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/CreateGrantRequestBody.ts deleted file mode 100644 index 8921acfa70a..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/CreateGrantRequestBody.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface CreateGrantRequestBody - */ -export interface CreateGrantRequestBody { - /** - * The developer app address (API key) to grant authorization to - * @type {string} - * @memberof CreateGrantRequestBody - */ - appApiKey: string; -} - -/** - * Check if a given object implements the CreateGrantRequestBody interface. - */ -export function instanceOfCreateGrantRequestBody(value: object): value is CreateGrantRequestBody { - let isInstance = true; - isInstance = isInstance && "appApiKey" in value && value["appApiKey"] !== undefined; - - return isInstance; -} - -export function CreateGrantRequestBodyFromJSON(json: any): CreateGrantRequestBody { - return CreateGrantRequestBodyFromJSONTyped(json, false); -} - -export function CreateGrantRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateGrantRequestBody { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'appApiKey': json['app_api_key'], - }; -} - -export function CreateGrantRequestBodyToJSON(value?: CreateGrantRequestBody | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'app_api_key': value.appApiKey, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/CreatePlaylistRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/CreatePlaylistRequestBody.ts deleted file mode 100644 index c613727e1a1..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/CreatePlaylistRequestBody.ts +++ /dev/null @@ -1,286 +0,0 @@ -/* 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 { AccessGate } from './AccessGate'; -import { - AccessGateFromJSON, - AccessGateFromJSONTyped, - AccessGateToJSON, -} from './AccessGate'; -import type { CreatePlaylistRequestBodyCopyrightLine } from './CreatePlaylistRequestBodyCopyrightLine'; -import { - CreatePlaylistRequestBodyCopyrightLineFromJSON, - CreatePlaylistRequestBodyCopyrightLineFromJSONTyped, - CreatePlaylistRequestBodyCopyrightLineToJSON, -} from './CreatePlaylistRequestBodyCopyrightLine'; -import type { CreatePlaylistRequestBodyProducerCopyrightLine } from './CreatePlaylistRequestBodyProducerCopyrightLine'; -import { - CreatePlaylistRequestBodyProducerCopyrightLineFromJSON, - CreatePlaylistRequestBodyProducerCopyrightLineFromJSONTyped, - CreatePlaylistRequestBodyProducerCopyrightLineToJSON, -} from './CreatePlaylistRequestBodyProducerCopyrightLine'; -import type { DdexResourceContributor } from './DdexResourceContributor'; -import { - DdexResourceContributorFromJSON, - DdexResourceContributorFromJSONTyped, - DdexResourceContributorToJSON, -} from './DdexResourceContributor'; -import type { Genre } from './Genre'; -import { - GenreFromJSON, - GenreFromJSONTyped, - GenreToJSON, -} from './Genre'; -import type { Mood } from './Mood'; -import { - MoodFromJSON, - MoodFromJSONTyped, - MoodToJSON, -} from './Mood'; -import type { PlaylistAddedTimestamp } from './PlaylistAddedTimestamp'; -import { - PlaylistAddedTimestampFromJSON, - PlaylistAddedTimestampFromJSONTyped, - PlaylistAddedTimestampToJSON, -} from './PlaylistAddedTimestamp'; - -/** - * - * @export - * @interface CreatePlaylistRequestBody - */ -export interface CreatePlaylistRequestBody { - /** - * Optional playlist ID (will be generated if not provided) - * @type {string} - * @memberof CreatePlaylistRequestBody - */ - playlistId?: string; - /** - * Playlist or album name - * @type {string} - * @memberof CreatePlaylistRequestBody - */ - playlistName: string; - /** - * Playlist description - * @type {string} - * @memberof CreatePlaylistRequestBody - */ - description?: string; - /** - * Whether the playlist is private - * @type {boolean} - * @memberof CreatePlaylistRequestBody - */ - isPrivate?: boolean; - /** - * Whether this is an album - * @type {boolean} - * @memberof CreatePlaylistRequestBody - */ - isAlbum?: boolean; - /** - * - * @type {Genre} - * @memberof CreatePlaylistRequestBody - */ - genre?: Genre; - /** - * - * @type {Mood} - * @memberof CreatePlaylistRequestBody - */ - mood?: Mood; - /** - * Comma-separated tags - * @type {string} - * @memberof CreatePlaylistRequestBody - */ - tags?: string; - /** - * License type - * @type {string} - * @memberof CreatePlaylistRequestBody - */ - license?: string; - /** - * Universal Product Code (for albums) - * @type {string} - * @memberof CreatePlaylistRequestBody - */ - upc?: string; - /** - * Release date - * @type {Date} - * @memberof CreatePlaylistRequestBody - */ - releaseDate?: Date; - /** - * IPFS CID for cover art - * @type {string} - * @memberof CreatePlaylistRequestBody - */ - coverArtCid?: string; - /** - * Array of tracks in the playlist - * @type {Array} - * @memberof CreatePlaylistRequestBody - */ - playlistContents?: Array; - /** - * Whether streaming is restricted behind an access gate - * @type {boolean} - * @memberof CreatePlaylistRequestBody - */ - isStreamGated?: boolean | null; - /** - * Whether the playlist/album is a scheduled release - * @type {boolean} - * @memberof CreatePlaylistRequestBody - */ - isScheduledRelease?: boolean | null; - /** - * - * @type {AccessGate} - * @memberof CreatePlaylistRequestBody - */ - streamConditions?: AccessGate | null; - /** - * DDEX application identifier - * @type {string} - * @memberof CreatePlaylistRequestBody - */ - ddexApp?: string; - /** - * DDEX release identifiers - * @type {{ [key: string]: string; }} - * @memberof CreatePlaylistRequestBody - */ - ddexReleaseIds?: { [key: string]: string; } | null; - /** - * DDEX resource contributors / artists - * @type {Array} - * @memberof CreatePlaylistRequestBody - */ - artists?: Array | null; - /** - * - * @type {CreatePlaylistRequestBodyCopyrightLine} - * @memberof CreatePlaylistRequestBody - */ - copyrightLine?: CreatePlaylistRequestBodyCopyrightLine | null; - /** - * - * @type {CreatePlaylistRequestBodyProducerCopyrightLine} - * @memberof CreatePlaylistRequestBody - */ - producerCopyrightLine?: CreatePlaylistRequestBodyProducerCopyrightLine | null; - /** - * Parental warning type - * @type {string} - * @memberof CreatePlaylistRequestBody - */ - parentalWarningType?: string | null; - /** - * Whether the image is autogenerated - * @type {boolean} - * @memberof CreatePlaylistRequestBody - */ - isImageAutogenerated?: boolean | null; -} - -/** - * Check if a given object implements the CreatePlaylistRequestBody interface. - */ -export function instanceOfCreatePlaylistRequestBody(value: object): value is CreatePlaylistRequestBody { - let isInstance = true; - isInstance = isInstance && "playlistName" in value && value["playlistName"] !== undefined; - - return isInstance; -} - -export function CreatePlaylistRequestBodyFromJSON(json: any): CreatePlaylistRequestBody { - return CreatePlaylistRequestBodyFromJSONTyped(json, false); -} - -export function CreatePlaylistRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreatePlaylistRequestBody { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'playlistId': !exists(json, 'playlist_id') ? undefined : json['playlist_id'], - 'playlistName': json['playlist_name'], - 'description': !exists(json, 'description') ? undefined : json['description'], - 'isPrivate': !exists(json, 'is_private') ? undefined : json['is_private'], - 'isAlbum': !exists(json, 'is_album') ? undefined : json['is_album'], - 'genre': !exists(json, 'genre') ? undefined : GenreFromJSON(json['genre']), - 'mood': !exists(json, 'mood') ? undefined : MoodFromJSON(json['mood']), - 'tags': !exists(json, 'tags') ? undefined : json['tags'], - 'license': !exists(json, 'license') ? undefined : json['license'], - 'upc': !exists(json, 'upc') ? undefined : json['upc'], - 'releaseDate': !exists(json, 'release_date') ? undefined : (new Date(json['release_date'])), - 'coverArtCid': !exists(json, 'cover_art_cid') ? undefined : json['cover_art_cid'], - 'playlistContents': !exists(json, 'playlist_contents') ? undefined : ((json['playlist_contents'] as Array).map(PlaylistAddedTimestampFromJSON)), - 'isStreamGated': !exists(json, 'is_stream_gated') ? undefined : json['is_stream_gated'], - 'isScheduledRelease': !exists(json, 'is_scheduled_release') ? undefined : json['is_scheduled_release'], - 'streamConditions': !exists(json, 'stream_conditions') ? undefined : AccessGateFromJSON(json['stream_conditions']), - 'ddexApp': !exists(json, 'ddex_app') ? undefined : json['ddex_app'], - 'ddexReleaseIds': !exists(json, 'ddex_release_ids') ? undefined : json['ddex_release_ids'], - 'artists': !exists(json, 'artists') ? undefined : (json['artists'] === null ? null : (json['artists'] as Array).map(DdexResourceContributorFromJSON)), - 'copyrightLine': !exists(json, 'copyright_line') ? undefined : CreatePlaylistRequestBodyCopyrightLineFromJSON(json['copyright_line']), - 'producerCopyrightLine': !exists(json, 'producer_copyright_line') ? undefined : CreatePlaylistRequestBodyProducerCopyrightLineFromJSON(json['producer_copyright_line']), - 'parentalWarningType': !exists(json, 'parental_warning_type') ? undefined : json['parental_warning_type'], - 'isImageAutogenerated': !exists(json, 'is_image_autogenerated') ? undefined : json['is_image_autogenerated'], - }; -} - -export function CreatePlaylistRequestBodyToJSON(value?: CreatePlaylistRequestBody | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'playlist_id': value.playlistId, - 'playlist_name': value.playlistName, - 'description': value.description, - 'is_private': value.isPrivate, - 'is_album': value.isAlbum, - 'genre': GenreToJSON(value.genre), - 'mood': MoodToJSON(value.mood), - 'tags': value.tags, - 'license': value.license, - 'upc': value.upc, - 'release_date': value.releaseDate === undefined ? undefined : (value.releaseDate.toISOString().substr(0,10)), - 'cover_art_cid': value.coverArtCid, - 'playlist_contents': value.playlistContents === undefined ? undefined : ((value.playlistContents as Array).map(PlaylistAddedTimestampToJSON)), - 'is_stream_gated': value.isStreamGated, - 'is_scheduled_release': value.isScheduledRelease, - 'stream_conditions': AccessGateToJSON(value.streamConditions), - 'ddex_app': value.ddexApp, - 'ddex_release_ids': value.ddexReleaseIds, - 'artists': value.artists === undefined ? undefined : (value.artists === null ? null : (value.artists as Array).map(DdexResourceContributorToJSON)), - 'copyright_line': CreatePlaylistRequestBodyCopyrightLineToJSON(value.copyrightLine), - 'producer_copyright_line': CreatePlaylistRequestBodyProducerCopyrightLineToJSON(value.producerCopyrightLine), - 'parental_warning_type': value.parentalWarningType, - 'is_image_autogenerated': value.isImageAutogenerated, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/CreatePlaylistRequestBodyCopyrightLine.ts b/packages/sdk/src/sdk/api/generated/default/models/CreatePlaylistRequestBodyCopyrightLine.ts deleted file mode 100644 index 0b12a95deeb..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/CreatePlaylistRequestBodyCopyrightLine.ts +++ /dev/null @@ -1,76 +0,0 @@ -/* 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'; -/** - * DDEX copyright line - * @export - * @interface CreatePlaylistRequestBodyCopyrightLine - */ -export interface CreatePlaylistRequestBodyCopyrightLine { - /** - * Copyright year (4 characters) - * @type {string} - * @memberof CreatePlaylistRequestBodyCopyrightLine - */ - year: string; - /** - * Copyright text - * @type {string} - * @memberof CreatePlaylistRequestBodyCopyrightLine - */ - text: string; -} - -/** - * Check if a given object implements the CreatePlaylistRequestBodyCopyrightLine interface. - */ -export function instanceOfCreatePlaylistRequestBodyCopyrightLine(value: object): value is CreatePlaylistRequestBodyCopyrightLine { - let isInstance = true; - isInstance = isInstance && "year" in value && value["year"] !== undefined; - isInstance = isInstance && "text" in value && value["text"] !== undefined; - - return isInstance; -} - -export function CreatePlaylistRequestBodyCopyrightLineFromJSON(json: any): CreatePlaylistRequestBodyCopyrightLine { - return CreatePlaylistRequestBodyCopyrightLineFromJSONTyped(json, false); -} - -export function CreatePlaylistRequestBodyCopyrightLineFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreatePlaylistRequestBodyCopyrightLine { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'year': json['year'], - 'text': json['text'], - }; -} - -export function CreatePlaylistRequestBodyCopyrightLineToJSON(value?: CreatePlaylistRequestBodyCopyrightLine | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'year': value.year, - 'text': value.text, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/CreatePlaylistRequestBodyProducerCopyrightLine.ts b/packages/sdk/src/sdk/api/generated/default/models/CreatePlaylistRequestBodyProducerCopyrightLine.ts deleted file mode 100644 index 9cdc90e6517..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/CreatePlaylistRequestBodyProducerCopyrightLine.ts +++ /dev/null @@ -1,76 +0,0 @@ -/* 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'; -/** - * DDEX producer copyright line - * @export - * @interface CreatePlaylistRequestBodyProducerCopyrightLine - */ -export interface CreatePlaylistRequestBodyProducerCopyrightLine { - /** - * Copyright year (4 characters) - * @type {string} - * @memberof CreatePlaylistRequestBodyProducerCopyrightLine - */ - year: string; - /** - * Copyright text - * @type {string} - * @memberof CreatePlaylistRequestBodyProducerCopyrightLine - */ - text: string; -} - -/** - * Check if a given object implements the CreatePlaylistRequestBodyProducerCopyrightLine interface. - */ -export function instanceOfCreatePlaylistRequestBodyProducerCopyrightLine(value: object): value is CreatePlaylistRequestBodyProducerCopyrightLine { - let isInstance = true; - isInstance = isInstance && "year" in value && value["year"] !== undefined; - isInstance = isInstance && "text" in value && value["text"] !== undefined; - - return isInstance; -} - -export function CreatePlaylistRequestBodyProducerCopyrightLineFromJSON(json: any): CreatePlaylistRequestBodyProducerCopyrightLine { - return CreatePlaylistRequestBodyProducerCopyrightLineFromJSONTyped(json, false); -} - -export function CreatePlaylistRequestBodyProducerCopyrightLineFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreatePlaylistRequestBodyProducerCopyrightLine { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'year': json['year'], - 'text': json['text'], - }; -} - -export function CreatePlaylistRequestBodyProducerCopyrightLineToJSON(value?: CreatePlaylistRequestBodyProducerCopyrightLine | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'year': value.year, - 'text': value.text, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/CreatePlaylistResponse.ts b/packages/sdk/src/sdk/api/generated/default/models/CreatePlaylistResponse.ts deleted file mode 100644 index e755c8cf65d..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/CreatePlaylistResponse.ts +++ /dev/null @@ -1,82 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface CreatePlaylistResponse - */ -export interface CreatePlaylistResponse { - /** - * Whether the playlist was created successfully - * @type {boolean} - * @memberof CreatePlaylistResponse - */ - success?: boolean; - /** - * The blockchain transaction hash - * @type {string} - * @memberof CreatePlaylistResponse - */ - transactionHash?: string; - /** - * The ID of the created playlist - * @type {string} - * @memberof CreatePlaylistResponse - */ - playlistId?: string; -} - -/** - * Check if a given object implements the CreatePlaylistResponse interface. - */ -export function instanceOfCreatePlaylistResponse(value: object): value is CreatePlaylistResponse { - let isInstance = true; - - return isInstance; -} - -export function CreatePlaylistResponseFromJSON(json: any): CreatePlaylistResponse { - return CreatePlaylistResponseFromJSONTyped(json, false); -} - -export function CreatePlaylistResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreatePlaylistResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'success': !exists(json, 'success') ? undefined : json['success'], - 'transactionHash': !exists(json, 'transaction_hash') ? undefined : json['transaction_hash'], - 'playlistId': !exists(json, 'playlist_id') ? undefined : json['playlist_id'], - }; -} - -export function CreatePlaylistResponseToJSON(value?: CreatePlaylistResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'success': value.success, - 'transaction_hash': value.transactionHash, - 'playlist_id': value.playlistId, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/CreateRewardCodeRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/CreateRewardCodeRequest.ts similarity index 67% rename from packages/sdk/src/sdk/api/generated/default/models/CreateRewardCodeRequestBody.ts rename to packages/sdk/src/sdk/api/generated/default/models/CreateRewardCodeRequest.ts index 9712e227d91..44bbad4a730 100644 --- a/packages/sdk/src/sdk/api/generated/default/models/CreateRewardCodeRequestBody.ts +++ b/packages/sdk/src/sdk/api/generated/default/models/CreateRewardCodeRequest.ts @@ -17,33 +17,33 @@ import { exists, mapValues } from '../runtime'; /** * * @export - * @interface CreateRewardCodeRequestBody + * @interface CreateRewardCodeRequest */ -export interface CreateRewardCodeRequestBody { +export interface CreateRewardCodeRequest { /** * Base64-encoded Solana Ed25519 signature of the string "code" * @type {string} - * @memberof CreateRewardCodeRequestBody + * @memberof CreateRewardCodeRequest */ signature: string; /** * The coin mint address * @type {string} - * @memberof CreateRewardCodeRequestBody + * @memberof CreateRewardCodeRequest */ mint: string; /** * The reward amount (must be greater than 0) * @type {number} - * @memberof CreateRewardCodeRequestBody + * @memberof CreateRewardCodeRequest */ amount: number; } /** - * Check if a given object implements the CreateRewardCodeRequestBody interface. + * Check if a given object implements the CreateRewardCodeRequest interface. */ -export function instanceOfCreateRewardCodeRequestBody(value: object): value is CreateRewardCodeRequestBody { +export function instanceOfCreateRewardCodeRequest(value: object): value is CreateRewardCodeRequest { let isInstance = true; isInstance = isInstance && "signature" in value && value["signature"] !== undefined; isInstance = isInstance && "mint" in value && value["mint"] !== undefined; @@ -52,11 +52,11 @@ export function instanceOfCreateRewardCodeRequestBody(value: object): value is C return isInstance; } -export function CreateRewardCodeRequestBodyFromJSON(json: any): CreateRewardCodeRequestBody { - return CreateRewardCodeRequestBodyFromJSONTyped(json, false); +export function CreateRewardCodeRequestFromJSON(json: any): CreateRewardCodeRequest { + return CreateRewardCodeRequestFromJSONTyped(json, false); } -export function CreateRewardCodeRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateRewardCodeRequestBody { +export function CreateRewardCodeRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateRewardCodeRequest { if ((json === undefined) || (json === null)) { return json; } @@ -68,7 +68,7 @@ export function CreateRewardCodeRequestBodyFromJSONTyped(json: any, ignoreDiscri }; } -export function CreateRewardCodeRequestBodyToJSON(value?: CreateRewardCodeRequestBody | null): any { +export function CreateRewardCodeRequestToJSON(value?: CreateRewardCodeRequest | null): any { if (value === undefined) { return undefined; } diff --git a/packages/sdk/src/sdk/api/generated/default/models/CreateTrackRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/CreateTrackRequestBody.ts deleted file mode 100644 index 33945056b88..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/CreateTrackRequestBody.ts +++ /dev/null @@ -1,442 +0,0 @@ -/* 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 { AccessGate } from './AccessGate'; -import { - AccessGateFromJSON, - AccessGateFromJSONTyped, - AccessGateToJSON, -} from './AccessGate'; -import type { FieldVisibility } from './FieldVisibility'; -import { - FieldVisibilityFromJSON, - FieldVisibilityFromJSONTyped, - FieldVisibilityToJSON, -} from './FieldVisibility'; -import type { Genre } from './Genre'; -import { - GenreFromJSON, - GenreFromJSONTyped, - GenreToJSON, -} from './Genre'; -import type { Mood } from './Mood'; -import { - MoodFromJSON, - MoodFromJSONTyped, - MoodToJSON, -} from './Mood'; -import type { RemixParentWrite } from './RemixParentWrite'; -import { - RemixParentWriteFromJSON, - RemixParentWriteFromJSONTyped, - RemixParentWriteToJSON, -} from './RemixParentWrite'; -import type { StemParent } from './StemParent'; -import { - StemParentFromJSON, - StemParentFromJSONTyped, - StemParentToJSON, -} from './StemParent'; - -/** - * - * @export - * @interface CreateTrackRequestBody - */ -export interface CreateTrackRequestBody { - /** - * Optional track ID (will be generated if not provided) - * @type {string} - * @memberof CreateTrackRequestBody - */ - trackId?: string; - /** - * Track title - * @type {string} - * @memberof CreateTrackRequestBody - */ - title: string; - /** - * - * @type {Genre} - * @memberof CreateTrackRequestBody - */ - genre: Genre; - /** - * Track description - * @type {string} - * @memberof CreateTrackRequestBody - */ - description?: string | null; - /** - * - * @type {Mood} - * @memberof CreateTrackRequestBody - */ - mood?: Mood | null; - /** - * Beats per minute (tempo) - * @type {number} - * @memberof CreateTrackRequestBody - */ - bpm?: number | null; - /** - * Musical key of the track - * @type {string} - * @memberof CreateTrackRequestBody - */ - musicalKey?: string | null; - /** - * Comma-separated tags - * @type {string} - * @memberof CreateTrackRequestBody - */ - tags?: string | null; - /** - * License type - * @type {string} - * @memberof CreateTrackRequestBody - */ - license?: string | null; - /** - * International Standard Recording Code - * @type {string} - * @memberof CreateTrackRequestBody - */ - isrc?: string | null; - /** - * International Standard Musical Work Code - * @type {string} - * @memberof CreateTrackRequestBody - */ - iswc?: string | null; - /** - * Release date - * @type {Date} - * @memberof CreateTrackRequestBody - */ - releaseDate?: Date; - /** - * IPFS CID for the track audio file (required) - * @type {string} - * @memberof CreateTrackRequestBody - */ - trackCid: string; - /** - * IPFS CID for the original track file - * @type {string} - * @memberof CreateTrackRequestBody - */ - origFileCid?: string; - /** - * Original filename of the track - * @type {string} - * @memberof CreateTrackRequestBody - */ - origFilename?: string; - /** - * IPFS CID for cover art - * @type {string} - * @memberof CreateTrackRequestBody - */ - coverArtCid?: string; - /** - * Cover art sizes metadata - * @type {string} - * @memberof CreateTrackRequestBody - */ - coverArtSizes?: string; - /** - * IPFS CID for the track preview - * @type {string} - * @memberof CreateTrackRequestBody - */ - previewCid?: string; - /** - * Preview start time in seconds - * @type {number} - * @memberof CreateTrackRequestBody - */ - previewStartSeconds?: number; - /** - * Track duration in seconds - * @type {number} - * @memberof CreateTrackRequestBody - */ - duration?: number; - /** - * Whether the track is downloadable - * @type {boolean} - * @memberof CreateTrackRequestBody - */ - isDownloadable?: boolean; - /** - * Whether the track is unlisted - * @type {boolean} - * @memberof CreateTrackRequestBody - */ - isUnlisted?: boolean; - /** - * Whether streaming is restricted behind an access gate - * @type {boolean} - * @memberof CreateTrackRequestBody - */ - isStreamGated?: boolean | null; - /** - * - * @type {AccessGate} - * @memberof CreateTrackRequestBody - */ - streamConditions?: AccessGate | null; - /** - * - * @type {AccessGate} - * @memberof CreateTrackRequestBody - */ - downloadConditions?: AccessGate | null; - /** - * - * @type {FieldVisibility} - * @memberof CreateTrackRequestBody - */ - fieldVisibility?: FieldVisibility; - /** - * Placement hosts for the track - * @type {string} - * @memberof CreateTrackRequestBody - */ - placementHosts?: string; - /** - * - * @type {StemParent} - * @memberof CreateTrackRequestBody - */ - stemOf?: StemParent; - /** - * - * @type {RemixParentWrite} - * @memberof CreateTrackRequestBody - */ - remixOf?: RemixParentWrite; - /** - * DDEX application identifier - * @type {string} - * @memberof CreateTrackRequestBody - */ - ddexApp?: string | null; - /** - * DDEX release identifiers - * @type {object} - * @memberof CreateTrackRequestBody - */ - ddexReleaseIds?: object | null; - /** - * DDEX resource contributors / artists - * @type {Array} - * @memberof CreateTrackRequestBody - */ - artists?: Array | null; - /** - * DDEX resource contributors - * @type {Array} - * @memberof CreateTrackRequestBody - */ - resourceContributors?: Array | null; - /** - * DDEX indirect resource contributors - * @type {Array} - * @memberof CreateTrackRequestBody - */ - indirectResourceContributors?: Array | null; - /** - * DDEX rights controller - * @type {object} - * @memberof CreateTrackRequestBody - */ - rightsController?: object | null; - /** - * DDEX copyright line - * @type {object} - * @memberof CreateTrackRequestBody - */ - copyrightLine?: object | null; - /** - * DDEX producer copyright line - * @type {object} - * @memberof CreateTrackRequestBody - */ - producerCopyrightLine?: object | null; - /** - * Parental warning type - * @type {string} - * @memberof CreateTrackRequestBody - */ - parentalWarningType?: string | null; - /** - * Original song title for cover tracks - * @type {string} - * @memberof CreateTrackRequestBody - */ - coverOriginalSongTitle?: string | null; - /** - * Original artist for cover tracks - * @type {string} - * @memberof CreateTrackRequestBody - */ - coverOriginalArtist?: string | null; - /** - * Whether the track is owned by the user - * @type {boolean} - * @memberof CreateTrackRequestBody - */ - isOwnedByUser?: boolean; - /** - * Territory codes for distribution - * @type {Array} - * @memberof CreateTrackRequestBody - */ - territoryCodes?: Array | null; - /** - * Whether AI use is prohibited - * @type {boolean} - * @memberof CreateTrackRequestBody - */ - noAiUse?: boolean; -} - -/** - * Check if a given object implements the CreateTrackRequestBody interface. - */ -export function instanceOfCreateTrackRequestBody(value: object): value is CreateTrackRequestBody { - let isInstance = true; - isInstance = isInstance && "title" in value && value["title"] !== undefined; - isInstance = isInstance && "genre" in value && value["genre"] !== undefined; - isInstance = isInstance && "trackCid" in value && value["trackCid"] !== undefined; - - return isInstance; -} - -export function CreateTrackRequestBodyFromJSON(json: any): CreateTrackRequestBody { - return CreateTrackRequestBodyFromJSONTyped(json, false); -} - -export function CreateTrackRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateTrackRequestBody { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'trackId': !exists(json, 'track_id') ? undefined : json['track_id'], - 'title': json['title'], - 'genre': GenreFromJSON(json['genre']), - 'description': !exists(json, 'description') ? undefined : json['description'], - 'mood': !exists(json, 'mood') ? undefined : MoodFromJSON(json['mood']), - 'bpm': !exists(json, 'bpm') ? undefined : json['bpm'], - 'musicalKey': !exists(json, 'musical_key') ? undefined : json['musical_key'], - 'tags': !exists(json, 'tags') ? undefined : json['tags'], - 'license': !exists(json, 'license') ? undefined : json['license'], - 'isrc': !exists(json, 'isrc') ? undefined : json['isrc'], - 'iswc': !exists(json, 'iswc') ? undefined : json['iswc'], - 'releaseDate': !exists(json, 'release_date') ? undefined : (new Date(json['release_date'])), - 'trackCid': json['track_cid'], - 'origFileCid': !exists(json, 'orig_file_cid') ? undefined : json['orig_file_cid'], - 'origFilename': !exists(json, 'orig_filename') ? undefined : json['orig_filename'], - 'coverArtCid': !exists(json, 'cover_art_cid') ? undefined : json['cover_art_cid'], - 'coverArtSizes': !exists(json, 'cover_art_sizes') ? undefined : json['cover_art_sizes'], - 'previewCid': !exists(json, 'preview_cid') ? undefined : json['preview_cid'], - 'previewStartSeconds': !exists(json, 'preview_start_seconds') ? undefined : json['preview_start_seconds'], - 'duration': !exists(json, 'duration') ? undefined : json['duration'], - 'isDownloadable': !exists(json, 'is_downloadable') ? undefined : json['is_downloadable'], - 'isUnlisted': !exists(json, 'is_unlisted') ? undefined : json['is_unlisted'], - 'isStreamGated': !exists(json, 'is_stream_gated') ? undefined : json['is_stream_gated'], - 'streamConditions': !exists(json, 'stream_conditions') ? undefined : AccessGateFromJSON(json['stream_conditions']), - 'downloadConditions': !exists(json, 'download_conditions') ? undefined : AccessGateFromJSON(json['download_conditions']), - 'fieldVisibility': !exists(json, 'field_visibility') ? undefined : FieldVisibilityFromJSON(json['field_visibility']), - 'placementHosts': !exists(json, 'placement_hosts') ? undefined : json['placement_hosts'], - 'stemOf': !exists(json, 'stem_of') ? undefined : StemParentFromJSON(json['stem_of']), - 'remixOf': !exists(json, 'remix_of') ? undefined : RemixParentWriteFromJSON(json['remix_of']), - 'ddexApp': !exists(json, 'ddex_app') ? undefined : json['ddex_app'], - 'ddexReleaseIds': !exists(json, 'ddex_release_ids') ? undefined : json['ddex_release_ids'], - 'artists': !exists(json, 'artists') ? undefined : json['artists'], - 'resourceContributors': !exists(json, 'resource_contributors') ? undefined : json['resource_contributors'], - 'indirectResourceContributors': !exists(json, 'indirect_resource_contributors') ? undefined : json['indirect_resource_contributors'], - 'rightsController': !exists(json, 'rights_controller') ? undefined : json['rights_controller'], - 'copyrightLine': !exists(json, 'copyright_line') ? undefined : json['copyright_line'], - 'producerCopyrightLine': !exists(json, 'producer_copyright_line') ? undefined : json['producer_copyright_line'], - 'parentalWarningType': !exists(json, 'parental_warning_type') ? undefined : json['parental_warning_type'], - 'coverOriginalSongTitle': !exists(json, 'cover_original_song_title') ? undefined : json['cover_original_song_title'], - 'coverOriginalArtist': !exists(json, 'cover_original_artist') ? undefined : json['cover_original_artist'], - 'isOwnedByUser': !exists(json, 'is_owned_by_user') ? undefined : json['is_owned_by_user'], - 'territoryCodes': !exists(json, 'territory_codes') ? undefined : json['territory_codes'], - 'noAiUse': !exists(json, 'no_ai_use') ? undefined : json['no_ai_use'], - }; -} - -export function CreateTrackRequestBodyToJSON(value?: CreateTrackRequestBody | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'track_id': value.trackId, - 'title': value.title, - 'genre': GenreToJSON(value.genre), - 'description': value.description, - 'mood': MoodToJSON(value.mood), - 'bpm': value.bpm, - 'musical_key': value.musicalKey, - 'tags': value.tags, - 'license': value.license, - 'isrc': value.isrc, - 'iswc': value.iswc, - 'release_date': value.releaseDate === undefined ? undefined : (value.releaseDate.toISOString().substr(0,10)), - 'track_cid': value.trackCid, - 'orig_file_cid': value.origFileCid, - 'orig_filename': value.origFilename, - 'cover_art_cid': value.coverArtCid, - 'cover_art_sizes': value.coverArtSizes, - 'preview_cid': value.previewCid, - 'preview_start_seconds': value.previewStartSeconds, - 'duration': value.duration, - 'is_downloadable': value.isDownloadable, - 'is_unlisted': value.isUnlisted, - 'is_stream_gated': value.isStreamGated, - 'stream_conditions': AccessGateToJSON(value.streamConditions), - 'download_conditions': AccessGateToJSON(value.downloadConditions), - 'field_visibility': FieldVisibilityToJSON(value.fieldVisibility), - 'placement_hosts': value.placementHosts, - 'stem_of': StemParentToJSON(value.stemOf), - 'remix_of': RemixParentWriteToJSON(value.remixOf), - 'ddex_app': value.ddexApp, - 'ddex_release_ids': value.ddexReleaseIds, - 'artists': value.artists, - 'resource_contributors': value.resourceContributors, - 'indirect_resource_contributors': value.indirectResourceContributors, - 'rights_controller': value.rightsController, - 'copyright_line': value.copyrightLine, - 'producer_copyright_line': value.producerCopyrightLine, - 'parental_warning_type': value.parentalWarningType, - 'cover_original_song_title': value.coverOriginalSongTitle, - 'cover_original_artist': value.coverOriginalArtist, - 'is_owned_by_user': value.isOwnedByUser, - 'territory_codes': value.territoryCodes, - 'no_ai_use': value.noAiUse, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/CreateTrackResponse.ts b/packages/sdk/src/sdk/api/generated/default/models/CreateTrackResponse.ts deleted file mode 100644 index e9588e8cef1..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/CreateTrackResponse.ts +++ /dev/null @@ -1,82 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface CreateTrackResponse - */ -export interface CreateTrackResponse { - /** - * Whether the track was created successfully - * @type {boolean} - * @memberof CreateTrackResponse - */ - success?: boolean; - /** - * The blockchain transaction hash - * @type {string} - * @memberof CreateTrackResponse - */ - transactionHash?: string; - /** - * The ID of the created track - * @type {string} - * @memberof CreateTrackResponse - */ - trackId?: string; -} - -/** - * Check if a given object implements the CreateTrackResponse interface. - */ -export function instanceOfCreateTrackResponse(value: object): value is CreateTrackResponse { - let isInstance = true; - - return isInstance; -} - -export function CreateTrackResponseFromJSON(json: any): CreateTrackResponse { - return CreateTrackResponseFromJSONTyped(json, false); -} - -export function CreateTrackResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateTrackResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'success': !exists(json, 'success') ? undefined : json['success'], - 'transactionHash': !exists(json, 'transaction_hash') ? undefined : json['transaction_hash'], - 'trackId': !exists(json, 'track_id') ? undefined : json['track_id'], - }; -} - -export function CreateTrackResponseToJSON(value?: CreateTrackResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'success': value.success, - 'transaction_hash': value.transactionHash, - 'track_id': value.trackId, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/CreateUserDeveloperAppRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/CreateUserDeveloperAppRequestBody.ts deleted file mode 100644 index 34d42929d73..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/CreateUserDeveloperAppRequestBody.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface CreateUserDeveloperAppRequestBody - */ -export interface CreateUserDeveloperAppRequestBody { - /** - * Developer app name - * @type {string} - * @memberof CreateUserDeveloperAppRequestBody - */ - name: string; -} - -/** - * Check if a given object implements the CreateUserDeveloperAppRequestBody interface. - */ -export function instanceOfCreateUserDeveloperAppRequestBody(value: object): value is CreateUserDeveloperAppRequestBody { - let isInstance = true; - isInstance = isInstance && "name" in value && value["name"] !== undefined; - - return isInstance; -} - -export function CreateUserDeveloperAppRequestBodyFromJSON(json: any): CreateUserDeveloperAppRequestBody { - return CreateUserDeveloperAppRequestBodyFromJSONTyped(json, false); -} - -export function CreateUserDeveloperAppRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateUserDeveloperAppRequestBody { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'name': json['name'], - }; -} - -export function CreateUserDeveloperAppRequestBodyToJSON(value?: CreateUserDeveloperAppRequestBody | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'name': value.name, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/CreateUserDeveloperAppResponse.ts b/packages/sdk/src/sdk/api/generated/default/models/CreateUserDeveloperAppResponse.ts deleted file mode 100644 index c4b6427309c..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/CreateUserDeveloperAppResponse.ts +++ /dev/null @@ -1,90 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface CreateUserDeveloperAppResponse - */ -export interface CreateUserDeveloperAppResponse { - /** - * The API key (address) for the developer app - * @type {string} - * @memberof CreateUserDeveloperAppResponse - */ - apiKey?: string; - /** - * The private key for the developer app (for signing) - * @type {string} - * @memberof CreateUserDeveloperAppResponse - */ - apiSecret?: string; - /** - * The bearer token for API authentication (use in Authorization header) - * @type {string} - * @memberof CreateUserDeveloperAppResponse - */ - bearerToken?: string; - /** - * Transaction hash of the creation - * @type {string} - * @memberof CreateUserDeveloperAppResponse - */ - transactionHash?: string; -} - -/** - * Check if a given object implements the CreateUserDeveloperAppResponse interface. - */ -export function instanceOfCreateUserDeveloperAppResponse(value: object): value is CreateUserDeveloperAppResponse { - let isInstance = true; - - return isInstance; -} - -export function CreateUserDeveloperAppResponseFromJSON(json: any): CreateUserDeveloperAppResponse { - return CreateUserDeveloperAppResponseFromJSONTyped(json, false); -} - -export function CreateUserDeveloperAppResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateUserDeveloperAppResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'apiKey': !exists(json, 'api_key') ? undefined : json['api_key'], - 'apiSecret': !exists(json, 'api_secret') ? undefined : json['api_secret'], - 'bearerToken': !exists(json, 'bearer_token') ? undefined : json['bearer_token'], - 'transactionHash': !exists(json, 'transaction_hash') ? undefined : json['transaction_hash'], - }; -} - -export function CreateUserDeveloperAppResponseToJSON(value?: CreateUserDeveloperAppResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'api_key': value.apiKey, - 'api_secret': value.apiSecret, - 'bearer_token': value.bearerToken, - 'transaction_hash': value.transactionHash, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/CreateUserRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/CreateUserRequestBody.ts deleted file mode 100644 index 33a1febb2bb..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/CreateUserRequestBody.ts +++ /dev/null @@ -1,243 +0,0 @@ -/* 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 { CreateUserRequestBodyEvents } from './CreateUserRequestBodyEvents'; -import { - CreateUserRequestBodyEventsFromJSON, - CreateUserRequestBodyEventsFromJSONTyped, - CreateUserRequestBodyEventsToJSON, -} from './CreateUserRequestBodyEvents'; -import type { UserPlaylistLibrary } from './UserPlaylistLibrary'; -import { - UserPlaylistLibraryFromJSON, - UserPlaylistLibraryFromJSONTyped, - UserPlaylistLibraryToJSON, -} from './UserPlaylistLibrary'; - -/** - * - * @export - * @interface CreateUserRequestBody - */ -export interface CreateUserRequestBody { - /** - * Optional user hash ID (will be generated if not provided) - * @type {string} - * @memberof CreateUserRequestBody - */ - userId?: string; - /** - * User handle (unique username) - * @type {string} - * @memberof CreateUserRequestBody - */ - handle: string; - /** - * Wallet address (required) - * @type {string} - * @memberof CreateUserRequestBody - */ - wallet: string; - /** - * Display name - * @type {string} - * @memberof CreateUserRequestBody - */ - name?: string; - /** - * User bio - * @type {string} - * @memberof CreateUserRequestBody - */ - bio?: string; - /** - * User location - * @type {string} - * @memberof CreateUserRequestBody - */ - location?: string; - /** - * Website URL - * @type {string} - * @memberof CreateUserRequestBody - */ - website?: string; - /** - * Donation link - * @type {string} - * @memberof CreateUserRequestBody - */ - donation?: string; - /** - * Twitter handle (without @) - * @type {string} - * @memberof CreateUserRequestBody - */ - twitterHandle?: string; - /** - * Instagram handle (without @) - * @type {string} - * @memberof CreateUserRequestBody - */ - instagramHandle?: string; - /** - * TikTok handle (without @) - * @type {string} - * @memberof CreateUserRequestBody - */ - tiktokHandle?: string; - /** - * Profile picture CID or URL - * @type {string} - * @memberof CreateUserRequestBody - */ - profilePicture?: string; - /** - * Profile picture sizes metadata - * @type {string} - * @memberof CreateUserRequestBody - */ - profilePictureSizes?: string; - /** - * Cover photo CID or URL - * @type {string} - * @memberof CreateUserRequestBody - */ - coverPhoto?: string; - /** - * Cover photo sizes metadata - * @type {string} - * @memberof CreateUserRequestBody - */ - coverPhotoSizes?: string; - /** - * Type of profile (e.g., 'label' for record labels) - * @type {string} - * @memberof CreateUserRequestBody - */ - profileType?: CreateUserRequestBodyProfileTypeEnum; - /** - * Whether to allow AI attribution - * @type {boolean} - * @memberof CreateUserRequestBody - */ - allowAiAttribution?: boolean; - /** - * Solana USDC payout wallet address - * @type {string} - * @memberof CreateUserRequestBody - */ - splUsdcPayoutWallet?: string; - /** - * - * @type {UserPlaylistLibrary} - * @memberof CreateUserRequestBody - */ - playlistLibrary?: UserPlaylistLibrary; - /** - * - * @type {CreateUserRequestBodyEvents} - * @memberof CreateUserRequestBody - */ - events?: CreateUserRequestBodyEvents; -} - - -/** - * @export - */ -export const CreateUserRequestBodyProfileTypeEnum = { - Label: 'label' -} as const; -export type CreateUserRequestBodyProfileTypeEnum = typeof CreateUserRequestBodyProfileTypeEnum[keyof typeof CreateUserRequestBodyProfileTypeEnum]; - - -/** - * Check if a given object implements the CreateUserRequestBody interface. - */ -export function instanceOfCreateUserRequestBody(value: object): value is CreateUserRequestBody { - let isInstance = true; - isInstance = isInstance && "handle" in value && value["handle"] !== undefined; - isInstance = isInstance && "wallet" in value && value["wallet"] !== undefined; - - return isInstance; -} - -export function CreateUserRequestBodyFromJSON(json: any): CreateUserRequestBody { - return CreateUserRequestBodyFromJSONTyped(json, false); -} - -export function CreateUserRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateUserRequestBody { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'userId': !exists(json, 'user_id') ? undefined : json['user_id'], - 'handle': json['handle'], - 'wallet': json['wallet'], - 'name': !exists(json, 'name') ? undefined : json['name'], - 'bio': !exists(json, 'bio') ? undefined : json['bio'], - 'location': !exists(json, 'location') ? undefined : json['location'], - 'website': !exists(json, 'website') ? undefined : json['website'], - 'donation': !exists(json, 'donation') ? undefined : json['donation'], - 'twitterHandle': !exists(json, 'twitter_handle') ? undefined : json['twitter_handle'], - 'instagramHandle': !exists(json, 'instagram_handle') ? undefined : json['instagram_handle'], - 'tiktokHandle': !exists(json, 'tiktok_handle') ? undefined : json['tiktok_handle'], - 'profilePicture': !exists(json, 'profile_picture') ? undefined : json['profile_picture'], - 'profilePictureSizes': !exists(json, 'profile_picture_sizes') ? undefined : json['profile_picture_sizes'], - 'coverPhoto': !exists(json, 'cover_photo') ? undefined : json['cover_photo'], - 'coverPhotoSizes': !exists(json, 'cover_photo_sizes') ? undefined : json['cover_photo_sizes'], - '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 : UserPlaylistLibraryFromJSON(json['playlist_library']), - 'events': !exists(json, 'events') ? undefined : CreateUserRequestBodyEventsFromJSON(json['events']), - }; -} - -export function CreateUserRequestBodyToJSON(value?: CreateUserRequestBody | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'user_id': value.userId, - 'handle': value.handle, - 'wallet': value.wallet, - 'name': value.name, - 'bio': value.bio, - 'location': value.location, - 'website': value.website, - 'donation': value.donation, - 'twitter_handle': value.twitterHandle, - 'instagram_handle': value.instagramHandle, - 'tiktok_handle': value.tiktokHandle, - 'profile_picture': value.profilePicture, - 'profile_picture_sizes': value.profilePictureSizes, - 'cover_photo': value.coverPhoto, - 'cover_photo_sizes': value.coverPhotoSizes, - 'profile_type': value.profileType, - 'allow_ai_attribution': value.allowAiAttribution, - 'spl_usdc_payout_wallet': value.splUsdcPayoutWallet, - 'playlist_library': UserPlaylistLibraryToJSON(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 deleted file mode 100644 index 88a8c3a5a64..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/CreateUserRequestBodyEvents.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* 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 { - /** - * Hash ID of the user who referred this user - * @type {string} - * @memberof CreateUserRequestBodyEvents - */ - referrer?: string; - /** - * 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/CreateUserResponse.ts b/packages/sdk/src/sdk/api/generated/default/models/CreateUserResponse.ts deleted file mode 100644 index fd7dacd1101..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/CreateUserResponse.ts +++ /dev/null @@ -1,82 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface CreateUserResponse - */ -export interface CreateUserResponse { - /** - * Whether the user was created successfully - * @type {boolean} - * @memberof CreateUserResponse - */ - success?: boolean; - /** - * The blockchain transaction hash - * @type {string} - * @memberof CreateUserResponse - */ - transactionHash?: string; - /** - * The ID of the created user - * @type {string} - * @memberof CreateUserResponse - */ - userId?: string; -} - -/** - * Check if a given object implements the CreateUserResponse interface. - */ -export function instanceOfCreateUserResponse(value: object): value is CreateUserResponse { - let isInstance = true; - - return isInstance; -} - -export function CreateUserResponseFromJSON(json: any): CreateUserResponse { - return CreateUserResponseFromJSONTyped(json, false); -} - -export function CreateUserResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateUserResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'success': !exists(json, 'success') ? undefined : json['success'], - 'transactionHash': !exists(json, 'transaction_hash') ? undefined : json['transaction_hash'], - 'userId': !exists(json, 'user_id') ? undefined : json['user_id'], - }; -} - -export function CreateUserResponseToJSON(value?: CreateUserResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'success': value.success, - 'transaction_hash': value.transactionHash, - 'user_id': value.userId, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/DdexCopyright.ts b/packages/sdk/src/sdk/api/generated/default/models/DdexCopyright.ts deleted file mode 100644 index 2cb755e92de..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/DdexCopyright.ts +++ /dev/null @@ -1,76 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface DdexCopyright - */ -export interface DdexCopyright { - /** - * Copyright year (4 characters) - * @type {string} - * @memberof DdexCopyright - */ - year: string; - /** - * Copyright text - * @type {string} - * @memberof DdexCopyright - */ - text: string; -} - -/** - * Check if a given object implements the DdexCopyright interface. - */ -export function instanceOfDdexCopyright(value: object): value is DdexCopyright { - let isInstance = true; - isInstance = isInstance && "year" in value && value["year"] !== undefined; - isInstance = isInstance && "text" in value && value["text"] !== undefined; - - return isInstance; -} - -export function DdexCopyrightFromJSON(json: any): DdexCopyright { - return DdexCopyrightFromJSONTyped(json, false); -} - -export function DdexCopyrightFromJSONTyped(json: any, ignoreDiscriminator: boolean): DdexCopyright { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'year': json['year'], - 'text': json['text'], - }; -} - -export function DdexCopyrightToJSON(value?: DdexCopyright | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'year': value.year, - 'text': value.text, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/DdexResourceContributor.ts b/packages/sdk/src/sdk/api/generated/default/models/DdexResourceContributor.ts deleted file mode 100644 index fa056f790c9..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/DdexResourceContributor.ts +++ /dev/null @@ -1,84 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface DdexResourceContributor - */ -export interface DdexResourceContributor { - /** - * Contributor name - * @type {string} - * @memberof DdexResourceContributor - */ - name: string; - /** - * Contributor roles - * @type {Array} - * @memberof DdexResourceContributor - */ - roles: Array; - /** - * Sequence number for ordering - * @type {number} - * @memberof DdexResourceContributor - */ - sequenceNumber?: number; -} - -/** - * Check if a given object implements the DdexResourceContributor interface. - */ -export function instanceOfDdexResourceContributor(value: object): value is DdexResourceContributor { - let isInstance = true; - isInstance = isInstance && "name" in value && value["name"] !== undefined; - isInstance = isInstance && "roles" in value && value["roles"] !== undefined; - - return isInstance; -} - -export function DdexResourceContributorFromJSON(json: any): DdexResourceContributor { - return DdexResourceContributorFromJSONTyped(json, false); -} - -export function DdexResourceContributorFromJSONTyped(json: any, ignoreDiscriminator: boolean): DdexResourceContributor { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'name': json['name'], - 'roles': json['roles'], - 'sequenceNumber': !exists(json, 'sequence_number') ? undefined : json['sequence_number'], - }; -} - -export function DdexResourceContributorToJSON(value?: DdexResourceContributor | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'name': value.name, - 'roles': value.roles, - 'sequence_number': value.sequenceNumber, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/DeactivateAccessKeyRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/DeactivateAccessKeyRequestBody.ts deleted file mode 100644 index f17f20a9e3c..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/DeactivateAccessKeyRequestBody.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface DeactivateAccessKeyRequestBody - */ -export interface DeactivateAccessKeyRequestBody { - /** - * The bearer token (API access key) to deactivate - * @type {string} - * @memberof DeactivateAccessKeyRequestBody - */ - apiAccessKey: string; -} - -/** - * Check if a given object implements the DeactivateAccessKeyRequestBody interface. - */ -export function instanceOfDeactivateAccessKeyRequestBody(value: object): value is DeactivateAccessKeyRequestBody { - let isInstance = true; - isInstance = isInstance && "apiAccessKey" in value && value["apiAccessKey"] !== undefined; - - return isInstance; -} - -export function DeactivateAccessKeyRequestBodyFromJSON(json: any): DeactivateAccessKeyRequestBody { - return DeactivateAccessKeyRequestBodyFromJSONTyped(json, false); -} - -export function DeactivateAccessKeyRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): DeactivateAccessKeyRequestBody { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'apiAccessKey': json['api_access_key'], - }; -} - -export function DeactivateAccessKeyRequestBodyToJSON(value?: DeactivateAccessKeyRequestBody | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'api_access_key': value.apiAccessKey, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/DeactivateAccessKeyResponse.ts b/packages/sdk/src/sdk/api/generated/default/models/DeactivateAccessKeyResponse.ts deleted file mode 100644 index f84110ccc4f..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/DeactivateAccessKeyResponse.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface DeactivateAccessKeyResponse - */ -export interface DeactivateAccessKeyResponse { - /** - * Whether the deactivation was successful - * @type {boolean} - * @memberof DeactivateAccessKeyResponse - */ - success?: boolean; -} - -/** - * Check if a given object implements the DeactivateAccessKeyResponse interface. - */ -export function instanceOfDeactivateAccessKeyResponse(value: object): value is DeactivateAccessKeyResponse { - let isInstance = true; - - return isInstance; -} - -export function DeactivateAccessKeyResponseFromJSON(json: any): DeactivateAccessKeyResponse { - return DeactivateAccessKeyResponseFromJSONTyped(json, false); -} - -export function DeactivateAccessKeyResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): DeactivateAccessKeyResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'success': !exists(json, 'success') ? undefined : json['success'], - }; -} - -export function DeactivateAccessKeyResponseToJSON(value?: DeactivateAccessKeyResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'success': value.success, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/DeveloperAppsResponse.ts b/packages/sdk/src/sdk/api/generated/default/models/DeveloperApps.ts similarity index 64% rename from packages/sdk/src/sdk/api/generated/default/models/DeveloperAppsResponse.ts rename to packages/sdk/src/sdk/api/generated/default/models/DeveloperApps.ts index efd7e305ef5..7a9b32cae80 100644 --- a/packages/sdk/src/sdk/api/generated/default/models/DeveloperAppsResponse.ts +++ b/packages/sdk/src/sdk/api/generated/default/models/DeveloperApps.ts @@ -24,31 +24,31 @@ import { /** * * @export - * @interface DeveloperAppsResponse + * @interface DeveloperApps */ -export interface DeveloperAppsResponse { +export interface DeveloperApps { /** * * @type {Array} - * @memberof DeveloperAppsResponse + * @memberof DeveloperApps */ data?: Array; } /** - * Check if a given object implements the DeveloperAppsResponse interface. + * Check if a given object implements the DeveloperApps interface. */ -export function instanceOfDeveloperAppsResponse(value: object): value is DeveloperAppsResponse { +export function instanceOfDeveloperApps(value: object): value is DeveloperApps { let isInstance = true; return isInstance; } -export function DeveloperAppsResponseFromJSON(json: any): DeveloperAppsResponse { - return DeveloperAppsResponseFromJSONTyped(json, false); +export function DeveloperAppsFromJSON(json: any): DeveloperApps { + return DeveloperAppsFromJSONTyped(json, false); } -export function DeveloperAppsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): DeveloperAppsResponse { +export function DeveloperAppsFromJSONTyped(json: any, ignoreDiscriminator: boolean): DeveloperApps { if ((json === undefined) || (json === null)) { return json; } @@ -58,7 +58,7 @@ export function DeveloperAppsResponseFromJSONTyped(json: any, ignoreDiscriminato }; } -export function DeveloperAppsResponseToJSON(value?: DeveloperAppsResponse | null): any { +export function DeveloperAppsToJSON(value?: DeveloperApps | null): any { if (value === undefined) { return undefined; } diff --git a/packages/sdk/src/sdk/api/generated/default/models/ExtendedAccessGate.ts b/packages/sdk/src/sdk/api/generated/default/models/ExtendedAccessGate.ts index 81efdc83724..a8797915fa3 100644 --- a/packages/sdk/src/sdk/api/generated/default/models/ExtendedAccessGate.ts +++ b/packages/sdk/src/sdk/api/generated/default/models/ExtendedAccessGate.ts @@ -27,6 +27,13 @@ import { FollowGateFromJSONTyped, FollowGateToJSON, } from './FollowGate'; +import { + NftGate, + instanceOfNftGate, + NftGateFromJSON, + NftGateFromJSONTyped, + NftGateToJSON, +} from './NftGate'; import { TipGate, instanceOfTipGate, @@ -47,7 +54,7 @@ import { * * @export */ -export type ExtendedAccessGate = ExtendedPurchaseGate | FollowGate | TipGate | TokenGate; +export type ExtendedAccessGate = ExtendedPurchaseGate | FollowGate | NftGate | TipGate | TokenGate; export function ExtendedAccessGateFromJSON(json: any): ExtendedAccessGate { return ExtendedAccessGateFromJSONTyped(json, false); @@ -57,7 +64,7 @@ export function ExtendedAccessGateFromJSONTyped(json: any, ignoreDiscriminator: if ((json === undefined) || (json === null)) { return json; } - return { ...ExtendedPurchaseGateFromJSONTyped(json, true), ...FollowGateFromJSONTyped(json, true), ...TipGateFromJSONTyped(json, true), ...TokenGateFromJSONTyped(json, true) }; + return { ...ExtendedPurchaseGateFromJSONTyped(json, true), ...FollowGateFromJSONTyped(json, true), ...NftGateFromJSONTyped(json, true), ...TipGateFromJSONTyped(json, true), ...TokenGateFromJSONTyped(json, true) }; } export function ExtendedAccessGateToJSON(value?: ExtendedAccessGate | null): any { @@ -74,6 +81,9 @@ export function ExtendedAccessGateToJSON(value?: ExtendedAccessGate | null): any if (instanceOfFollowGate(value)) { return FollowGateToJSON(value as FollowGate); } + if (instanceOfNftGate(value)) { + return NftGateToJSON(value as NftGate); + } if (instanceOfTipGate(value)) { return TipGateToJSON(value as TipGate); } diff --git a/packages/sdk/src/sdk/api/generated/default/models/FavoriteRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/FavoriteRequestBody.ts deleted file mode 100644 index 2f94a62f6c9..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/FavoriteRequestBody.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* 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'; -/** - * Optional metadata for favorite/save operations - * @export - * @interface FavoriteRequestBody - */ -export interface FavoriteRequestBody { - /** - * Set to true when favoriting a reposted item (used for notifications) - * @type {boolean} - * @memberof FavoriteRequestBody - */ - isSaveOfRepost?: boolean; -} - -/** - * Check if a given object implements the FavoriteRequestBody interface. - */ -export function instanceOfFavoriteRequestBody(value: object): value is FavoriteRequestBody { - let isInstance = true; - - return isInstance; -} - -export function FavoriteRequestBodyFromJSON(json: any): FavoriteRequestBody { - return FavoriteRequestBodyFromJSONTyped(json, false); -} - -export function FavoriteRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): FavoriteRequestBody { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'isSaveOfRepost': !exists(json, 'is_save_of_repost') ? undefined : json['is_save_of_repost'], - }; -} - -export function FavoriteRequestBodyToJSON(value?: FavoriteRequestBody | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'is_save_of_repost': value.isSaveOfRepost, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/FieldVisibility.ts b/packages/sdk/src/sdk/api/generated/default/models/FieldVisibility.ts deleted file mode 100644 index 2802b489b9f..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/FieldVisibility.ts +++ /dev/null @@ -1,106 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface FieldVisibility - */ -export interface FieldVisibility { - /** - * - * @type {boolean} - * @memberof FieldVisibility - */ - mood?: boolean; - /** - * - * @type {boolean} - * @memberof FieldVisibility - */ - tags?: boolean; - /** - * - * @type {boolean} - * @memberof FieldVisibility - */ - genre?: boolean; - /** - * - * @type {boolean} - * @memberof FieldVisibility - */ - share?: boolean; - /** - * - * @type {boolean} - * @memberof FieldVisibility - */ - playCount?: boolean; - /** - * - * @type {boolean} - * @memberof FieldVisibility - */ - remixes?: boolean; -} - -/** - * Check if a given object implements the FieldVisibility interface. - */ -export function instanceOfFieldVisibility(value: object): value is FieldVisibility { - let isInstance = true; - - return isInstance; -} - -export function FieldVisibilityFromJSON(json: any): FieldVisibility { - return FieldVisibilityFromJSONTyped(json, false); -} - -export function FieldVisibilityFromJSONTyped(json: any, ignoreDiscriminator: boolean): FieldVisibility { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'mood': !exists(json, 'mood') ? undefined : json['mood'], - 'tags': !exists(json, 'tags') ? undefined : json['tags'], - 'genre': !exists(json, 'genre') ? undefined : json['genre'], - 'share': !exists(json, 'share') ? undefined : json['share'], - 'playCount': !exists(json, 'play_count') ? undefined : json['play_count'], - 'remixes': !exists(json, 'remixes') ? undefined : json['remixes'], - }; -} - -export function FieldVisibilityToJSON(value?: FieldVisibility | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'mood': value.mood, - 'tags': value.tags, - 'genre': value.genre, - 'share': value.share, - 'play_count': value.playCount, - 'remixes': value.remixes, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/Genre.ts b/packages/sdk/src/sdk/api/generated/default/models/Genre.ts deleted file mode 100644 index fd4414aa682..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/Genre.ts +++ /dev/null @@ -1,88 +0,0 @@ -/* 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. - */ - - -/** - * Music genre - * @export - */ -export const Genre = { - Electronic: 'Electronic', - Rock: 'Rock', - Metal: 'Metal', - Alternative: 'Alternative', - HipHopRap: 'Hip-Hop/Rap', - Experimental: 'Experimental', - Punk: 'Punk', - Folk: 'Folk', - Pop: 'Pop', - Ambient: 'Ambient', - Soundtrack: 'Soundtrack', - World: 'World', - Jazz: 'Jazz', - Acoustic: 'Acoustic', - Funk: 'Funk', - RbSoul: 'R&B/Soul', - Devotional: 'Devotional', - Classical: 'Classical', - Reggae: 'Reggae', - Podcasts: 'Podcasts', - Country: 'Country', - SpokenWord: 'Spoken Word', - Comedy: 'Comedy', - Blues: 'Blues', - Kids: 'Kids', - Audiobooks: 'Audiobooks', - Latin: 'Latin', - LoFi: 'Lo-Fi', - Hyperpop: 'Hyperpop', - Dancehall: 'Dancehall', - Techno: 'Techno', - Trap: 'Trap', - House: 'House', - TechHouse: 'Tech House', - DeepHouse: 'Deep House', - Disco: 'Disco', - Electro: 'Electro', - Jungle: 'Jungle', - ProgressiveHouse: 'Progressive House', - Hardstyle: 'Hardstyle', - GlitchHop: 'Glitch Hop', - Trance: 'Trance', - FutureBass: 'Future Bass', - FutureHouse: 'Future House', - TropicalHouse: 'Tropical House', - Downtempo: 'Downtempo', - DrumBass: 'Drum & Bass', - Dubstep: 'Dubstep', - JerseyClub: 'Jersey Club', - Vaporwave: 'Vaporwave', - Moombahton: 'Moombahton' -} as const; -export type Genre = typeof Genre[keyof typeof Genre]; - - -export function GenreFromJSON(json: any): Genre { - return GenreFromJSONTyped(json, false); -} - -export function GenreFromJSONTyped(json: any, ignoreDiscriminator: boolean): Genre { - return json as Genre; -} - -export function GenreToJSON(value?: Genre | null): any { - return value as any; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/MediaLink.ts b/packages/sdk/src/sdk/api/generated/default/models/MediaLink.ts deleted file mode 100644 index 7f5b4eed8b3..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/MediaLink.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface MediaLink - */ -export interface MediaLink { - /** - * - * @type {string} - * @memberof MediaLink - */ - url?: string; - /** - * - * @type {Array} - * @memberof MediaLink - */ - mirrors?: Array; -} - -/** - * Check if a given object implements the MediaLink interface. - */ -export function instanceOfMediaLink(value: object): value is MediaLink { - let isInstance = true; - - return isInstance; -} - -export function MediaLinkFromJSON(json: any): MediaLink { - return MediaLinkFromJSONTyped(json, false); -} - -export function MediaLinkFromJSONTyped(json: any, ignoreDiscriminator: boolean): MediaLink { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'url': !exists(json, 'url') ? undefined : json['url'], - 'mirrors': !exists(json, 'mirrors') ? undefined : json['mirrors'], - }; -} - -export function MediaLinkToJSON(value?: MediaLink | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'url': value.url, - 'mirrors': value.mirrors, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/Mood.ts b/packages/sdk/src/sdk/api/generated/default/models/Mood.ts deleted file mode 100644 index 0fe36c425d0..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/Mood.ts +++ /dev/null @@ -1,60 +0,0 @@ -/* 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. - */ - - -/** - * Music mood - * @export - */ -export const Mood = { - Peaceful: 'Peaceful', - Romantic: 'Romantic', - Sentimental: 'Sentimental', - Tender: 'Tender', - Easygoing: 'Easygoing', - Yearning: 'Yearning', - Sophisticated: 'Sophisticated', - Sensual: 'Sensual', - Cool: 'Cool', - Gritty: 'Gritty', - Melancholy: 'Melancholy', - Serious: 'Serious', - Brooding: 'Brooding', - Fiery: 'Fiery', - Defiant: 'Defiant', - Aggressive: 'Aggressive', - Rowdy: 'Rowdy', - Excited: 'Excited', - Energizing: 'Energizing', - Empowering: 'Empowering', - Stirring: 'Stirring', - Upbeat: 'Upbeat', - Other: 'Other' -} as const; -export type Mood = typeof Mood[keyof typeof Mood]; - - -export function MoodFromJSON(json: any): Mood { - return MoodFromJSONTyped(json, false); -} - -export function MoodFromJSONTyped(json: any, ignoreDiscriminator: boolean): Mood { - return json as Mood; -} - -export function MoodToJSON(value?: Mood | null): any { - return value as any; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/NftCollection.ts b/packages/sdk/src/sdk/api/generated/default/models/NftCollection.ts new file mode 100644 index 00000000000..9a275dcfbb0 --- /dev/null +++ b/packages/sdk/src/sdk/api/generated/default/models/NftCollection.ts @@ -0,0 +1,129 @@ +/* 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'; +/** + * + * @export + * @interface NftCollection + */ +export interface NftCollection { + /** + * + * @type {string} + * @memberof NftCollection + */ + chain: NftCollectionChainEnum; + /** + * + * @type {string} + * @memberof NftCollection + */ + standard?: NftCollectionStandardEnum; + /** + * + * @type {string} + * @memberof NftCollection + */ + address: string; + /** + * + * @type {string} + * @memberof NftCollection + */ + name: string; + /** + * + * @type {string} + * @memberof NftCollection + */ + imageUrl?: string; + /** + * + * @type {string} + * @memberof NftCollection + */ + externalLink?: string; +} + + +/** + * @export + */ +export const NftCollectionChainEnum = { + Eth: 'eth', + Sol: 'sol' +} as const; +export type NftCollectionChainEnum = typeof NftCollectionChainEnum[keyof typeof NftCollectionChainEnum]; + +/** + * @export + */ +export const NftCollectionStandardEnum = { + Erc721: 'ERC721', + Erc1155: 'ERC1155' +} as const; +export type NftCollectionStandardEnum = typeof NftCollectionStandardEnum[keyof typeof NftCollectionStandardEnum]; + + +/** + * Check if a given object implements the NftCollection interface. + */ +export function instanceOfNftCollection(value: object): value is NftCollection { + let isInstance = true; + isInstance = isInstance && "chain" in value && value["chain"] !== undefined; + isInstance = isInstance && "address" in value && value["address"] !== undefined; + isInstance = isInstance && "name" in value && value["name"] !== undefined; + + return isInstance; +} + +export function NftCollectionFromJSON(json: any): NftCollection { + return NftCollectionFromJSONTyped(json, false); +} + +export function NftCollectionFromJSONTyped(json: any, ignoreDiscriminator: boolean): NftCollection { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'chain': json['chain'], + 'standard': !exists(json, 'standard') ? undefined : json['standard'], + 'address': json['address'], + 'name': json['name'], + 'imageUrl': !exists(json, 'imageUrl') ? undefined : json['imageUrl'], + 'externalLink': !exists(json, 'externalLink') ? undefined : json['externalLink'], + }; +} + +export function NftCollectionToJSON(value?: NftCollection | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'chain': value.chain, + 'standard': value.standard, + 'address': value.address, + 'name': value.name, + 'imageUrl': value.imageUrl, + 'externalLink': value.externalLink, + }; +} + diff --git a/packages/sdk/src/sdk/api/generated/default/models/NftGate.ts b/packages/sdk/src/sdk/api/generated/default/models/NftGate.ts new file mode 100644 index 00000000000..fc60b56daad --- /dev/null +++ b/packages/sdk/src/sdk/api/generated/default/models/NftGate.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 { NftCollection } from './NftCollection'; +import { + NftCollectionFromJSON, + NftCollectionFromJSONTyped, + NftCollectionToJSON, +} from './NftCollection'; + +/** + * + * @export + * @interface NftGate + */ +export interface NftGate { + /** + * Must hold an NFT of the given collection to unlock + * @type {NftCollection} + * @memberof NftGate + */ + nftCollection: NftCollection; +} + +/** + * Check if a given object implements the NftGate interface. + */ +export function instanceOfNftGate(value: object): value is NftGate { + let isInstance = true; + isInstance = isInstance && "nftCollection" in value && value["nftCollection"] !== undefined; + + return isInstance; +} + +export function NftGateFromJSON(json: any): NftGate { + return NftGateFromJSONTyped(json, false); +} + +export function NftGateFromJSONTyped(json: any, ignoreDiscriminator: boolean): NftGate { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'nftCollection': NftCollectionFromJSON(json['nft_collection']), + }; +} + +export function NftGateToJSON(value?: NftGate | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'nft_collection': NftCollectionToJSON(value.nftCollection), + }; +} + diff --git a/packages/sdk/src/sdk/api/generated/default/models/PinCommentRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/PinCommentRequestBody.ts deleted file mode 100644 index ef43a072a64..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/PinCommentRequestBody.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* 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 { 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) the comment is on - * @type {number} - * @memberof PinCommentRequestBody - */ - entityId: number; -} - -/** - * Check if a given object implements the PinCommentRequestBody interface. - */ -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; -} - -export function PinCommentRequestBodyFromJSON(json: any): PinCommentRequestBody { - return PinCommentRequestBodyFromJSONTyped(json, false); -} - -export function PinCommentRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): PinCommentRequestBody { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'entityType': CommentEntityTypeFromJSON(json['entityType']), - 'entityId': json['entityId'], - }; -} - -export function PinCommentRequestBodyToJSON(value?: PinCommentRequestBody | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'entityType': CommentEntityTypeToJSON(value.entityType), - 'entityId': value.entityId, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/Playlist.ts b/packages/sdk/src/sdk/api/generated/default/models/Playlist.ts index 8ea5a93faab..9ae67a5bbd4 100644 --- a/packages/sdk/src/sdk/api/generated/default/models/Playlist.ts +++ b/packages/sdk/src/sdk/api/generated/default/models/Playlist.ts @@ -20,18 +20,6 @@ import { AccessFromJSONTyped, AccessToJSON, } from './Access'; -import type { AccessGate } from './AccessGate'; -import { - AccessGateFromJSON, - AccessGateFromJSONTyped, - AccessGateToJSON, -} from './AccessGate'; -import type { Favorite } from './Favorite'; -import { - FavoriteFromJSON, - FavoriteFromJSONTyped, - FavoriteToJSON, -} from './Favorite'; import type { PlaylistAddedTimestamp } from './PlaylistAddedTimestamp'; import { PlaylistAddedTimestampFromJSON, @@ -44,18 +32,6 @@ import { PlaylistArtworkFromJSONTyped, PlaylistArtworkToJSON, } from './PlaylistArtwork'; -import type { Repost } from './Repost'; -import { - RepostFromJSON, - RepostFromJSONTyped, - RepostToJSON, -} from './Repost'; -import type { Track } from './Track'; -import { - TrackFromJSON, - TrackFromJSONTyped, - TrackToJSON, -} from './Track'; import type { User } from './User'; import { UserFromJSON, @@ -165,150 +141,6 @@ export interface Playlist { * @memberof Playlist */ trackCount: number; - /** - * - * @type {number} - * @memberof Playlist - */ - blocknumber: number; - /** - * - * @type {string} - * @memberof Playlist - */ - createdAt: string; - /** - * - * @type {Array} - * @memberof Playlist - */ - followeeReposts: Array; - /** - * - * @type {Array} - * @memberof Playlist - */ - followeeFavorites: Array; - /** - * - * @type {boolean} - * @memberof Playlist - */ - hasCurrentUserReposted: boolean; - /** - * - * @type {boolean} - * @memberof Playlist - */ - hasCurrentUserSaved: boolean; - /** - * - * @type {boolean} - * @memberof Playlist - */ - isDelete: boolean; - /** - * - * @type {boolean} - * @memberof Playlist - */ - isPrivate: boolean; - /** - * - * @type {string} - * @memberof Playlist - */ - updatedAt: string; - /** - * DEPRECATED. Use playlist_contents instead. - * @type {Array} - * @memberof Playlist - */ - addedTimestamps: Array; - /** - * - * @type {string} - * @memberof Playlist - */ - userId: string; - /** - * - * @type {Array} - * @memberof Playlist - */ - tracks?: Array; - /** - * - * @type {string} - * @memberof Playlist - */ - coverArt?: string; - /** - * - * @type {string} - * @memberof Playlist - */ - coverArtSizes?: string; - /** - * - * @type {PlaylistArtwork} - * @memberof Playlist - */ - coverArtCids?: PlaylistArtwork; - /** - * - * @type {boolean} - * @memberof Playlist - */ - isStreamGated: boolean; - /** - * How to unlock stream access to the track - * @type {AccessGate} - * @memberof Playlist - */ - streamConditions?: AccessGate; - /** - * - * @type {boolean} - * @memberof Playlist - */ - isScheduledRelease: boolean; - /** - * - * @type {Date} - * @memberof Playlist - */ - releaseDate?: Date; - /** - * - * @type {object} - * @memberof Playlist - */ - ddexReleaseIds?: object; - /** - * - * @type {Array} - * @memberof Playlist - */ - artists?: Array; - /** - * - * @type {object} - * @memberof Playlist - */ - copyrightLine?: object; - /** - * - * @type {object} - * @memberof Playlist - */ - producerCopyrightLine?: object; - /** - * - * @type {string} - * @memberof Playlist - */ - parentalWarningType?: string | null; } /** @@ -328,19 +160,6 @@ export function instanceOfPlaylist(value: object): value is Playlist { isInstance = isInstance && "user" in value && value["user"] !== undefined; isInstance = isInstance && "access" in value && value["access"] !== undefined; isInstance = isInstance && "trackCount" in value && value["trackCount"] !== undefined; - isInstance = isInstance && "blocknumber" in value && value["blocknumber"] !== undefined; - isInstance = isInstance && "createdAt" in value && value["createdAt"] !== undefined; - isInstance = isInstance && "followeeReposts" in value && value["followeeReposts"] !== undefined; - isInstance = isInstance && "followeeFavorites" in value && value["followeeFavorites"] !== undefined; - isInstance = isInstance && "hasCurrentUserReposted" in value && value["hasCurrentUserReposted"] !== undefined; - isInstance = isInstance && "hasCurrentUserSaved" in value && value["hasCurrentUserSaved"] !== undefined; - isInstance = isInstance && "isDelete" in value && value["isDelete"] !== undefined; - isInstance = isInstance && "isPrivate" in value && value["isPrivate"] !== undefined; - isInstance = isInstance && "updatedAt" in value && value["updatedAt"] !== undefined; - isInstance = isInstance && "addedTimestamps" in value && value["addedTimestamps"] !== undefined; - isInstance = isInstance && "userId" in value && value["userId"] !== undefined; - isInstance = isInstance && "isStreamGated" in value && value["isStreamGated"] !== undefined; - isInstance = isInstance && "isScheduledRelease" in value && value["isScheduledRelease"] !== undefined; return isInstance; } @@ -371,30 +190,6 @@ export function PlaylistFromJSONTyped(json: any, ignoreDiscriminator: boolean): 'access': AccessFromJSON(json['access']), 'upc': !exists(json, 'upc') ? undefined : json['upc'], 'trackCount': json['track_count'], - 'blocknumber': json['blocknumber'], - 'createdAt': json['created_at'], - 'followeeReposts': ((json['followee_reposts'] as Array).map(RepostFromJSON)), - 'followeeFavorites': ((json['followee_favorites'] as Array).map(FavoriteFromJSON)), - 'hasCurrentUserReposted': json['has_current_user_reposted'], - 'hasCurrentUserSaved': json['has_current_user_saved'], - 'isDelete': json['is_delete'], - 'isPrivate': json['is_private'], - 'updatedAt': json['updated_at'], - 'addedTimestamps': ((json['added_timestamps'] as Array).map(PlaylistAddedTimestampFromJSON)), - 'userId': json['user_id'], - 'tracks': !exists(json, 'tracks') ? undefined : ((json['tracks'] as Array).map(TrackFromJSON)), - 'coverArt': !exists(json, 'cover_art') ? undefined : json['cover_art'], - 'coverArtSizes': !exists(json, 'cover_art_sizes') ? undefined : json['cover_art_sizes'], - 'coverArtCids': !exists(json, 'cover_art_cids') ? undefined : PlaylistArtworkFromJSON(json['cover_art_cids']), - 'isStreamGated': json['is_stream_gated'], - 'streamConditions': !exists(json, 'stream_conditions') ? undefined : AccessGateFromJSON(json['stream_conditions']), - 'isScheduledRelease': json['is_scheduled_release'], - 'releaseDate': !exists(json, 'release_date') ? undefined : (new Date(json['release_date'])), - 'ddexReleaseIds': !exists(json, 'ddex_release_ids') ? undefined : json['ddex_release_ids'], - 'artists': !exists(json, 'artists') ? undefined : json['artists'], - 'copyrightLine': !exists(json, 'copyright_line') ? undefined : json['copyright_line'], - 'producerCopyrightLine': !exists(json, 'producer_copyright_line') ? undefined : json['producer_copyright_line'], - 'parentalWarningType': !exists(json, 'parental_warning_type') ? undefined : json['parental_warning_type'], }; } @@ -423,30 +218,6 @@ export function PlaylistToJSON(value?: Playlist | null): any { 'access': AccessToJSON(value.access), 'upc': value.upc, 'track_count': value.trackCount, - 'blocknumber': value.blocknumber, - 'created_at': value.createdAt, - 'followee_reposts': ((value.followeeReposts as Array).map(RepostToJSON)), - 'followee_favorites': ((value.followeeFavorites as Array).map(FavoriteToJSON)), - 'has_current_user_reposted': value.hasCurrentUserReposted, - 'has_current_user_saved': value.hasCurrentUserSaved, - 'is_delete': value.isDelete, - 'is_private': value.isPrivate, - 'updated_at': value.updatedAt, - 'added_timestamps': ((value.addedTimestamps as Array).map(PlaylistAddedTimestampToJSON)), - 'user_id': value.userId, - 'tracks': value.tracks === undefined ? undefined : ((value.tracks as Array).map(TrackToJSON)), - 'cover_art': value.coverArt, - 'cover_art_sizes': value.coverArtSizes, - 'cover_art_cids': PlaylistArtworkToJSON(value.coverArtCids), - 'is_stream_gated': value.isStreamGated, - 'stream_conditions': AccessGateToJSON(value.streamConditions), - 'is_scheduled_release': value.isScheduledRelease, - 'release_date': value.releaseDate === undefined ? undefined : (value.releaseDate.toISOString().substr(0,10)), - 'ddex_release_ids': value.ddexReleaseIds, - 'artists': value.artists, - 'copyright_line': value.copyrightLine, - 'producer_copyright_line': value.producerCopyrightLine, - 'parental_warning_type': value.parentalWarningType, }; } diff --git a/packages/sdk/src/sdk/api/generated/default/models/PlaylistAddedTimestamp.ts b/packages/sdk/src/sdk/api/generated/default/models/PlaylistAddedTimestamp.ts index 702afac2f9f..6a7c21f2856 100644 --- a/packages/sdk/src/sdk/api/generated/default/models/PlaylistAddedTimestamp.ts +++ b/packages/sdk/src/sdk/api/generated/default/models/PlaylistAddedTimestamp.ts @@ -21,23 +21,23 @@ import { exists, mapValues } from '../runtime'; */ export interface PlaylistAddedTimestamp { /** - * Track ID - * @type {string} + * + * @type {number} * @memberof PlaylistAddedTimestamp */ - trackId: string; + metadataTimestamp: number; /** - * Unix timestamp when track was added + * * @type {number} * @memberof PlaylistAddedTimestamp */ timestamp: number; /** - * Metadata timestamp - * @type {number} + * + * @type {string} * @memberof PlaylistAddedTimestamp */ - metadataTimestamp?: number; + trackId: string; } /** @@ -45,8 +45,9 @@ export interface PlaylistAddedTimestamp { */ export function instanceOfPlaylistAddedTimestamp(value: object): value is PlaylistAddedTimestamp { let isInstance = true; - isInstance = isInstance && "trackId" in value && value["trackId"] !== undefined; + isInstance = isInstance && "metadataTimestamp" in value && value["metadataTimestamp"] !== undefined; isInstance = isInstance && "timestamp" in value && value["timestamp"] !== undefined; + isInstance = isInstance && "trackId" in value && value["trackId"] !== undefined; return isInstance; } @@ -61,9 +62,9 @@ export function PlaylistAddedTimestampFromJSONTyped(json: any, ignoreDiscriminat } return { - 'trackId': json['track_id'], + 'metadataTimestamp': json['metadata_timestamp'], 'timestamp': json['timestamp'], - 'metadataTimestamp': !exists(json, 'metadata_timestamp') ? undefined : json['metadata_timestamp'], + 'trackId': json['track_id'], }; } @@ -76,9 +77,9 @@ export function PlaylistAddedTimestampToJSON(value?: PlaylistAddedTimestamp | nu } return { - 'track_id': value.trackId, - 'timestamp': value.timestamp, 'metadata_timestamp': value.metadataTimestamp, + 'timestamp': value.timestamp, + 'track_id': value.trackId, }; } diff --git a/packages/sdk/src/sdk/api/generated/default/models/PlaylistLibraryExplorePlaylistIdentifier.ts b/packages/sdk/src/sdk/api/generated/default/models/PlaylistLibraryExplorePlaylistIdentifier.ts deleted file mode 100644 index 2cbdd0b12a5..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/PlaylistLibraryExplorePlaylistIdentifier.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 deleted file mode 100644 index 82176824092..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/PlaylistLibraryFolder.ts +++ /dev/null @@ -1,111 +0,0 @@ -/* 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 { UserPlaylistLibraryContentsInner } from './UserPlaylistLibraryContentsInner'; -import { - UserPlaylistLibraryContentsInnerFromJSON, - UserPlaylistLibraryContentsInnerFromJSONTyped, - UserPlaylistLibraryContentsInnerToJSON, -} from './UserPlaylistLibraryContentsInner'; - -/** - * 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(UserPlaylistLibraryContentsInnerFromJSON)), - }; -} - -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(UserPlaylistLibraryContentsInnerToJSON)), - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/PlaylistLibraryPlaylistIdentifier.ts b/packages/sdk/src/sdk/api/generated/default/models/PlaylistLibraryPlaylistIdentifier.ts deleted file mode 100644 index 3711012adb9..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/PlaylistLibraryPlaylistIdentifier.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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/PrizeClaimRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/PrizeClaimRequest.ts similarity index 64% rename from packages/sdk/src/sdk/api/generated/default/models/PrizeClaimRequestBody.ts rename to packages/sdk/src/sdk/api/generated/default/models/PrizeClaimRequest.ts index 9e4fad05bdb..eba5cc35546 100644 --- a/packages/sdk/src/sdk/api/generated/default/models/PrizeClaimRequestBody.ts +++ b/packages/sdk/src/sdk/api/generated/default/models/PrizeClaimRequest.ts @@ -17,27 +17,27 @@ import { exists, mapValues } from '../runtime'; /** * * @export - * @interface PrizeClaimRequestBody + * @interface PrizeClaimRequest */ -export interface PrizeClaimRequestBody { +export interface PrizeClaimRequest { /** * The Solana transaction signature for the 2 YAK payment * @type {string} - * @memberof PrizeClaimRequestBody + * @memberof PrizeClaimRequest */ signature: string; /** * The wallet address that sent the transaction * @type {string} - * @memberof PrizeClaimRequestBody + * @memberof PrizeClaimRequest */ wallet: string; } /** - * Check if a given object implements the PrizeClaimRequestBody interface. + * Check if a given object implements the PrizeClaimRequest interface. */ -export function instanceOfPrizeClaimRequestBody(value: object): value is PrizeClaimRequestBody { +export function instanceOfPrizeClaimRequest(value: object): value is PrizeClaimRequest { let isInstance = true; isInstance = isInstance && "signature" in value && value["signature"] !== undefined; isInstance = isInstance && "wallet" in value && value["wallet"] !== undefined; @@ -45,11 +45,11 @@ export function instanceOfPrizeClaimRequestBody(value: object): value is PrizeCl return isInstance; } -export function PrizeClaimRequestBodyFromJSON(json: any): PrizeClaimRequestBody { - return PrizeClaimRequestBodyFromJSONTyped(json, false); +export function PrizeClaimRequestFromJSON(json: any): PrizeClaimRequest { + return PrizeClaimRequestFromJSONTyped(json, false); } -export function PrizeClaimRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): PrizeClaimRequestBody { +export function PrizeClaimRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): PrizeClaimRequest { if ((json === undefined) || (json === null)) { return json; } @@ -60,7 +60,7 @@ export function PrizeClaimRequestBodyFromJSONTyped(json: any, ignoreDiscriminato }; } -export function PrizeClaimRequestBodyToJSON(value?: PrizeClaimRequestBody | null): any { +export function PrizeClaimRequestToJSON(value?: PrizeClaimRequest | null): any { if (value === undefined) { return undefined; } diff --git a/packages/sdk/src/sdk/api/generated/default/models/ReactCommentRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/ReactCommentRequestBody.ts deleted file mode 100644 index 21400696514..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/ReactCommentRequestBody.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* 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 { CommentEntityType } from './CommentEntityType'; -import { - CommentEntityTypeFromJSON, - CommentEntityTypeFromJSONTyped, - CommentEntityTypeToJSON, -} from './CommentEntityType'; - -/** - * - * @export - * @interface ReactCommentRequestBody - */ -export interface ReactCommentRequestBody { - /** - * - * @type {CommentEntityType} - * @memberof ReactCommentRequestBody - */ - entityType: CommentEntityType; - /** - * ID of the entity (track) being commented on - * @type {number} - * @memberof ReactCommentRequestBody - */ - entityId: number; -} - -/** - * Check if a given object implements the ReactCommentRequestBody interface. - */ -export function instanceOfReactCommentRequestBody(value: object): value is ReactCommentRequestBody { - let isInstance = true; - isInstance = isInstance && "entityType" in value && value["entityType"] !== undefined; - isInstance = isInstance && "entityId" in value && value["entityId"] !== undefined; - - return isInstance; -} - -export function ReactCommentRequestBodyFromJSON(json: any): ReactCommentRequestBody { - return ReactCommentRequestBodyFromJSONTyped(json, false); -} - -export function ReactCommentRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): ReactCommentRequestBody { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'entityType': CommentEntityTypeFromJSON(json['entityType']), - 'entityId': json['entityId'], - }; -} - -export function ReactCommentRequestBodyToJSON(value?: ReactCommentRequestBody | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'entityType': CommentEntityTypeToJSON(value.entityType), - 'entityId': value.entityId, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/RemixParentWrite.ts b/packages/sdk/src/sdk/api/generated/default/models/RemixParentWrite.ts deleted file mode 100644 index 0942b855c60..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/RemixParentWrite.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* 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 { TrackElementWrite } from './TrackElementWrite'; -import { - TrackElementWriteFromJSON, - TrackElementWriteFromJSONTyped, - TrackElementWriteToJSON, -} from './TrackElementWrite'; - -/** - * - * @export - * @interface RemixParentWrite - */ -export interface RemixParentWrite { - /** - * - * @type {Array} - * @memberof RemixParentWrite - */ - tracks: Array; -} - -/** - * Check if a given object implements the RemixParentWrite interface. - */ -export function instanceOfRemixParentWrite(value: object): value is RemixParentWrite { - let isInstance = true; - isInstance = isInstance && "tracks" in value && value["tracks"] !== undefined; - - return isInstance; -} - -export function RemixParentWriteFromJSON(json: any): RemixParentWrite { - return RemixParentWriteFromJSONTyped(json, false); -} - -export function RemixParentWriteFromJSONTyped(json: any, ignoreDiscriminator: boolean): RemixParentWrite { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'tracks': ((json['tracks'] as Array).map(TrackElementWriteFromJSON)), - }; -} - -export function RemixParentWriteToJSON(value?: RemixParentWrite | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'tracks': ((value.tracks as Array).map(TrackElementWriteToJSON)), - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/RemixesResponse.ts b/packages/sdk/src/sdk/api/generated/default/models/RemixesResponse.ts deleted file mode 100644 index 7f0e20e298e..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/RemixesResponse.ts +++ /dev/null @@ -1,82 +0,0 @@ -/* 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 { Track } from './Track'; -import { - TrackFromJSON, - TrackFromJSONTyped, - TrackToJSON, -} from './Track'; - -/** - * - * @export - * @interface RemixesResponse - */ -export interface RemixesResponse { - /** - * - * @type {number} - * @memberof RemixesResponse - */ - count: number; - /** - * - * @type {Array} - * @memberof RemixesResponse - */ - tracks?: Array; -} - -/** - * Check if a given object implements the RemixesResponse interface. - */ -export function instanceOfRemixesResponse(value: object): value is RemixesResponse { - let isInstance = true; - isInstance = isInstance && "count" in value && value["count"] !== undefined; - - return isInstance; -} - -export function RemixesResponseFromJSON(json: any): RemixesResponse { - return RemixesResponseFromJSONTyped(json, false); -} - -export function RemixesResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): RemixesResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'count': json['count'], - 'tracks': !exists(json, 'tracks') ? undefined : ((json['tracks'] as Array).map(TrackFromJSON)), - }; -} - -export function RemixesResponseToJSON(value?: RemixesResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'count': value.count, - 'tracks': value.tracks === undefined ? undefined : ((value.tracks as Array).map(TrackToJSON)), - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/RemixingResponse.ts b/packages/sdk/src/sdk/api/generated/default/models/RemixingResponse.ts deleted file mode 100644 index 42abb4c51cc..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/RemixingResponse.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* 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 { Track } from './Track'; -import { - TrackFromJSON, - TrackFromJSONTyped, - TrackToJSON, -} from './Track'; - -/** - * - * @export - * @interface RemixingResponse - */ -export interface RemixingResponse { - /** - * - * @type {Array} - * @memberof RemixingResponse - */ - data?: Array; -} - -/** - * Check if a given object implements the RemixingResponse interface. - */ -export function instanceOfRemixingResponse(value: object): value is RemixingResponse { - let isInstance = true; - - return isInstance; -} - -export function RemixingResponseFromJSON(json: any): RemixingResponse { - return RemixingResponseFromJSONTyped(json, false); -} - -export function RemixingResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): RemixingResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'data': !exists(json, 'data') ? undefined : ((json['data'] as Array).map(TrackFromJSON)), - }; -} - -export function RemixingResponseToJSON(value?: RemixingResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'data': value.data === undefined ? undefined : ((value.data as Array).map(TrackToJSON)), - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/ReplyComment.ts b/packages/sdk/src/sdk/api/generated/default/models/ReplyComment.ts index b4fb76173c4..972e094a0c2 100644 --- a/packages/sdk/src/sdk/api/generated/default/models/ReplyComment.ts +++ b/packages/sdk/src/sdk/api/generated/default/models/ReplyComment.ts @@ -14,12 +14,6 @@ */ import { exists, mapValues } from '../runtime'; -import type { CommentEntityType } from './CommentEntityType'; -import { - CommentEntityTypeFromJSON, - CommentEntityTypeFromJSONTyped, - CommentEntityTypeToJSON, -} from './CommentEntityType'; import type { CommentMention } from './CommentMention'; import { CommentMentionFromJSON, @@ -47,10 +41,10 @@ export interface ReplyComment { entityId: string; /** * - * @type {CommentEntityType} + * @type {string} * @memberof ReplyComment */ - entityType: CommentEntityType; + entityType: string; /** * * @type {string} @@ -148,7 +142,7 @@ export function ReplyCommentFromJSONTyped(json: any, ignoreDiscriminator: boolea 'id': json['id'], 'entityId': json['entity_id'], - 'entityType': CommentEntityTypeFromJSON(json['entity_type']), + 'entityType': json['entity_type'], 'userId': json['user_id'], 'message': json['message'], 'mentions': !exists(json, 'mentions') ? undefined : ((json['mentions'] as Array).map(CommentMentionFromJSON)), @@ -174,7 +168,7 @@ export function ReplyCommentToJSON(value?: ReplyComment | null): any { 'id': value.id, 'entity_id': value.entityId, - 'entity_type': CommentEntityTypeToJSON(value.entityType), + 'entity_type': value.entityType, 'user_id': value.userId, 'message': value.message, 'mentions': value.mentions === undefined ? undefined : ((value.mentions as Array).map(CommentMentionToJSON)), diff --git a/packages/sdk/src/sdk/api/generated/default/models/Repost.ts b/packages/sdk/src/sdk/api/generated/default/models/Repost.ts deleted file mode 100644 index 2b842bb5616..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/Repost.ts +++ /dev/null @@ -1,85 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface Repost - */ -export interface Repost { - /** - * - * @type {string} - * @memberof Repost - */ - repostItemId: string; - /** - * - * @type {string} - * @memberof Repost - */ - repostType: string; - /** - * - * @type {string} - * @memberof Repost - */ - userId: string; -} - -/** - * Check if a given object implements the Repost interface. - */ -export function instanceOfRepost(value: object): value is Repost { - let isInstance = true; - isInstance = isInstance && "repostItemId" in value && value["repostItemId"] !== undefined; - isInstance = isInstance && "repostType" in value && value["repostType"] !== undefined; - isInstance = isInstance && "userId" in value && value["userId"] !== undefined; - - return isInstance; -} - -export function RepostFromJSON(json: any): Repost { - return RepostFromJSONTyped(json, false); -} - -export function RepostFromJSONTyped(json: any, ignoreDiscriminator: boolean): Repost { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'repostItemId': json['repost_item_id'], - 'repostType': json['repost_type'], - 'userId': json['user_id'], - }; -} - -export function RepostToJSON(value?: Repost | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'repost_item_id': value.repostItemId, - 'repost_type': value.repostType, - 'user_id': value.userId, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/RepostRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/RepostRequestBody.ts deleted file mode 100644 index 0543d1cdc07..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/RepostRequestBody.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* 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'; -/** - * Optional metadata for repost operations - * @export - * @interface RepostRequestBody - */ -export interface RepostRequestBody { - /** - * Set to true when reposting an item that was reposted (used for notifications) - * @type {boolean} - * @memberof RepostRequestBody - */ - isRepostOfRepost?: boolean; -} - -/** - * Check if a given object implements the RepostRequestBody interface. - */ -export function instanceOfRepostRequestBody(value: object): value is RepostRequestBody { - let isInstance = true; - - return isInstance; -} - -export function RepostRequestBodyFromJSON(json: any): RepostRequestBody { - return RepostRequestBodyFromJSONTyped(json, false); -} - -export function RepostRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): RepostRequestBody { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'isRepostOfRepost': !exists(json, 'is_repost_of_repost') ? undefined : json['is_repost_of_repost'], - }; -} - -export function RepostRequestBodyToJSON(value?: RepostRequestBody | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'is_repost_of_repost': value.isRepostOfRepost, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/StemCategory.ts b/packages/sdk/src/sdk/api/generated/default/models/StemCategory.ts deleted file mode 100644 index 22c02baf21a..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/StemCategory.ts +++ /dev/null @@ -1,49 +0,0 @@ -/* 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. - */ - - -/** - * - * @export - */ -export const StemCategory = { - Instrumental: 'INSTRUMENTAL', - LeadVocals: 'LEAD_VOCALS', - MelodicLead: 'MELODIC_LEAD', - Pad: 'PAD', - Snare: 'SNARE', - Kick: 'KICK', - Hihat: 'HIHAT', - Percussion: 'PERCUSSION', - Sample: 'SAMPLE', - BackingVox: 'BACKING_VOX', - Bass: 'BASS', - Other: 'OTHER' -} as const; -export type StemCategory = typeof StemCategory[keyof typeof StemCategory]; - - -export function StemCategoryFromJSON(json: any): StemCategory { - return StemCategoryFromJSONTyped(json, false); -} - -export function StemCategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): StemCategory { - return json as StemCategory; -} - -export function StemCategoryToJSON(value?: StemCategory | null): any { - return value as any; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/StemParent.ts b/packages/sdk/src/sdk/api/generated/default/models/StemParent.ts deleted file mode 100644 index 7a27fca93f6..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/StemParent.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* 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 { StemCategory } from './StemCategory'; -import { - StemCategoryFromJSON, - StemCategoryFromJSONTyped, - StemCategoryToJSON, -} from './StemCategory'; - -/** - * - * @export - * @interface StemParent - */ -export interface StemParent { - /** - * - * @type {StemCategory} - * @memberof StemParent - */ - category: StemCategory; - /** - * - * @type {string} - * @memberof StemParent - */ - parentTrackId: string; -} - -/** - * Check if a given object implements the StemParent interface. - */ -export function instanceOfStemParent(value: object): value is StemParent { - let isInstance = true; - isInstance = isInstance && "category" in value && value["category"] !== undefined; - isInstance = isInstance && "parentTrackId" in value && value["parentTrackId"] !== undefined; - - return isInstance; -} - -export function StemParentFromJSON(json: any): StemParent { - return StemParentFromJSONTyped(json, false); -} - -export function StemParentFromJSONTyped(json: any, ignoreDiscriminator: boolean): StemParent { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'category': StemCategoryFromJSON(json['category']), - 'parentTrackId': json['parent_track_id'], - }; -} - -export function StemParentToJSON(value?: StemParent | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'category': StemCategoryToJSON(value.category), - 'parent_track_id': value.parentTrackId, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/Track.ts b/packages/sdk/src/sdk/api/generated/default/models/Track.ts index 4181f9359eb..b31f12889aa 100644 --- a/packages/sdk/src/sdk/api/generated/default/models/Track.ts +++ b/packages/sdk/src/sdk/api/generated/default/models/Track.ts @@ -14,36 +14,18 @@ */ import { exists, mapValues } from '../runtime'; -import type { AccessGate } from './AccessGate'; -import { - AccessGateFromJSON, - AccessGateFromJSONTyped, - AccessGateToJSON, -} from './AccessGate'; import type { AlbumBacklink } from './AlbumBacklink'; import { AlbumBacklinkFromJSON, AlbumBacklinkFromJSONTyped, AlbumBacklinkToJSON, } from './AlbumBacklink'; -import type { MediaLink } from './MediaLink'; -import { - MediaLinkFromJSON, - MediaLinkFromJSONTyped, - MediaLinkToJSON, -} from './MediaLink'; import type { RemixParent } from './RemixParent'; import { RemixParentFromJSON, RemixParentFromJSONTyped, RemixParentToJSON, } from './RemixParent'; -import type { TrackAccessInfo } from './TrackAccessInfo'; -import { - TrackAccessInfoFromJSON, - TrackAccessInfoFromJSONTyped, - TrackAccessInfoToJSON, -} from './TrackAccessInfo'; import type { TrackArtwork } from './TrackArtwork'; import { TrackArtworkFromJSON, @@ -125,10 +107,10 @@ export interface Track { mood?: string; /** * - * @type {Date} + * @type {string} * @memberof Track */ - releaseDate?: Date; + releaseDate?: string; /** * * @type {string} @@ -231,318 +213,6 @@ export interface Track { * @memberof Track */ albumBacklink?: AlbumBacklink; - /** - * - * @type {TrackAccessInfo} - * @memberof Track - */ - access?: TrackAccessInfo; - /** - * - * @type {string} - * @memberof Track - */ - aiAttributionUserId?: string; - /** - * - * @type {Array} - * @memberof Track - */ - allowedApiKeys?: Array; - /** - * - * @type {object} - * @memberof Track - */ - artists?: object; - /** - * - * @type {number} - * @memberof Track - */ - audioAnalysisErrorCount?: number; - /** - * - * @type {string} - * @memberof Track - */ - audioUploadId?: string; - /** - * - * @type {number} - * @memberof Track - */ - blocknumber?: number; - /** - * - * @type {number} - * @memberof Track - */ - bpm?: number; - /** - * - * @type {boolean} - * @memberof Track - */ - commentsDisabled?: boolean; - /** - * - * @type {object} - * @memberof Track - */ - copyrightLine?: object; - /** - * - * @type {string} - * @memberof Track - */ - coverArt?: string; - /** - * - * @type {string} - * @memberof Track - */ - coverArtSizes?: string; - /** - * - * @type {string} - * @memberof Track - */ - coverOriginalArtist?: string; - /** - * - * @type {string} - * @memberof Track - */ - coverOriginalSongTitle?: string; - /** - * - * @type {string} - * @memberof Track - */ - createDate?: string; - /** - * - * @type {Date} - * @memberof Track - */ - createdAt?: Date; - /** - * - * @type {string} - * @memberof Track - */ - creditsSplits?: string; - /** - * - * @type {object} - * @memberof Track - */ - ddexReleaseIds?: object; - /** - * - * @type {MediaLink} - * @memberof Track - */ - download?: MediaLink; - /** - * - * @type {AccessGate} - * @memberof Track - */ - downloadConditions?: AccessGate; - /** - * - * @type {object} - * @memberof Track - */ - fieldVisibility?: object; - /** - * - * @type {Array} - * @memberof Track - */ - followeeFavorites?: Array; - /** - * - * @type {Array} - * @memberof Track - */ - followeeReposts?: Array; - /** - * - * @type {boolean} - * @memberof Track - */ - hasCurrentUserReposted?: boolean; - /** - * - * @type {boolean} - * @memberof Track - */ - hasCurrentUserSaved?: boolean; - /** - * - * @type {object} - * @memberof Track - */ - indirectResourceContributors?: object; - /** - * - * @type {boolean} - * @memberof Track - */ - isAvailable?: boolean; - /** - * - * @type {boolean} - * @memberof Track - */ - isCustomBpm?: boolean; - /** - * - * @type {boolean} - * @memberof Track - */ - isCustomMusicalKey?: boolean; - /** - * - * @type {boolean} - * @memberof Track - */ - isDelete?: boolean; - /** - * - * @type {boolean} - * @memberof Track - */ - isDownloadGated?: boolean; - /** - * - * @type {boolean} - * @memberof Track - */ - isOwnedByUser?: boolean; - /** - * - * @type {boolean} - * @memberof Track - */ - isScheduledRelease?: boolean; - /** - * - * @type {boolean} - * @memberof Track - */ - isStreamGated?: boolean; - /** - * - * @type {boolean} - * @memberof Track - */ - isUnlisted?: boolean; - /** - * - * @type {string} - * @memberof Track - */ - iswc?: string; - /** - * - * @type {string} - * @memberof Track - */ - license?: string; - /** - * - * @type {string} - * @memberof Track - */ - musicalKey?: string; - /** - * - * @type {string} - * @memberof Track - */ - parentalWarningType?: string | null; - /** - * - * @type {object} - * @memberof Track - */ - playlistsPreviouslyContainingTrack?: object; - /** - * - * @type {MediaLink} - * @memberof Track - */ - preview?: MediaLink; - /** - * - * @type {number} - * @memberof Track - */ - previewStartSeconds?: number; - /** - * - * @type {object} - * @memberof Track - */ - producerCopyrightLine?: object; - /** - * - * @type {object} - * @memberof Track - */ - resourceContributors?: object; - /** - * - * @type {object} - * @memberof Track - */ - rightsController?: object; - /** - * - * @type {string} - * @memberof Track - */ - slug?: string; - /** - * - * @type {Array} - * @memberof Track - */ - stemOf?: Array; - /** - * - * @type {MediaLink} - * @memberof Track - */ - stream?: MediaLink; - /** - * - * @type {AccessGate} - * @memberof Track - */ - streamConditions?: AccessGate; - /** - * - * @type {number} - * @memberof Track - */ - trackId?: number; - /** - * - * @type {object} - * @memberof Track - */ - trackSegments?: object; - /** - * - * @type {Date} - * @memberof Track - */ - updatedAt?: Date; } /** @@ -587,7 +257,7 @@ export function TrackFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tra 'origFilename': !exists(json, 'orig_filename') ? undefined : json['orig_filename'], 'isOriginalAvailable': json['is_original_available'], 'mood': !exists(json, 'mood') ? undefined : json['mood'], - 'releaseDate': !exists(json, 'release_date') ? undefined : (new Date(json['release_date'])), + 'releaseDate': !exists(json, 'release_date') ? undefined : json['release_date'], 'isrc': !exists(json, 'isrc') ? undefined : json['isrc'], 'remixOf': !exists(json, 'remix_of') ? undefined : RemixParentFromJSON(json['remix_of']), 'repostCount': json['repost_count'], @@ -605,58 +275,6 @@ export function TrackFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tra 'playlistsContainingTrack': !exists(json, 'playlists_containing_track') ? undefined : json['playlists_containing_track'], 'pinnedCommentId': !exists(json, 'pinned_comment_id') ? undefined : json['pinned_comment_id'], 'albumBacklink': !exists(json, 'album_backlink') ? undefined : AlbumBacklinkFromJSON(json['album_backlink']), - 'access': !exists(json, 'access') ? undefined : TrackAccessInfoFromJSON(json['access']), - 'aiAttributionUserId': !exists(json, 'ai_attribution_user_id') ? undefined : json['ai_attribution_user_id'], - 'allowedApiKeys': !exists(json, 'allowed_api_keys') ? undefined : json['allowed_api_keys'], - 'artists': !exists(json, 'artists') ? undefined : json['artists'], - 'audioAnalysisErrorCount': !exists(json, 'audio_analysis_error_count') ? undefined : json['audio_analysis_error_count'], - 'audioUploadId': !exists(json, 'audio_upload_id') ? undefined : json['audio_upload_id'], - 'blocknumber': !exists(json, 'blocknumber') ? undefined : json['blocknumber'], - 'bpm': !exists(json, 'bpm') ? undefined : json['bpm'], - 'commentsDisabled': !exists(json, 'comments_disabled') ? undefined : json['comments_disabled'], - 'copyrightLine': !exists(json, 'copyright_line') ? undefined : json['copyright_line'], - 'coverArt': !exists(json, 'cover_art') ? undefined : json['cover_art'], - 'coverArtSizes': !exists(json, 'cover_art_sizes') ? undefined : json['cover_art_sizes'], - 'coverOriginalArtist': !exists(json, 'cover_original_artist') ? undefined : json['cover_original_artist'], - 'coverOriginalSongTitle': !exists(json, 'cover_original_song_title') ? undefined : json['cover_original_song_title'], - 'createDate': !exists(json, 'create_date') ? undefined : json['create_date'], - 'createdAt': !exists(json, 'created_at') ? undefined : (new Date(json['created_at'])), - 'creditsSplits': !exists(json, 'credits_splits') ? undefined : json['credits_splits'], - 'ddexReleaseIds': !exists(json, 'ddex_release_ids') ? undefined : json['ddex_release_ids'], - 'download': !exists(json, 'download') ? undefined : MediaLinkFromJSON(json['download']), - 'downloadConditions': !exists(json, 'download_conditions') ? undefined : AccessGateFromJSON(json['download_conditions']), - 'fieldVisibility': !exists(json, 'field_visibility') ? undefined : json['field_visibility'], - 'followeeFavorites': !exists(json, 'followee_favorites') ? undefined : json['followee_favorites'], - 'followeeReposts': !exists(json, 'followee_reposts') ? undefined : json['followee_reposts'], - 'hasCurrentUserReposted': !exists(json, 'has_current_user_reposted') ? undefined : json['has_current_user_reposted'], - 'hasCurrentUserSaved': !exists(json, 'has_current_user_saved') ? undefined : json['has_current_user_saved'], - 'indirectResourceContributors': !exists(json, 'indirect_resource_contributors') ? undefined : json['indirect_resource_contributors'], - 'isAvailable': !exists(json, 'is_available') ? undefined : json['is_available'], - 'isCustomBpm': !exists(json, 'is_custom_bpm') ? undefined : json['is_custom_bpm'], - 'isCustomMusicalKey': !exists(json, 'is_custom_musical_key') ? undefined : json['is_custom_musical_key'], - 'isDelete': !exists(json, 'is_delete') ? undefined : json['is_delete'], - 'isDownloadGated': !exists(json, 'is_download_gated') ? undefined : json['is_download_gated'], - 'isOwnedByUser': !exists(json, 'is_owned_by_user') ? undefined : json['is_owned_by_user'], - 'isScheduledRelease': !exists(json, 'is_scheduled_release') ? undefined : json['is_scheduled_release'], - 'isStreamGated': !exists(json, 'is_stream_gated') ? undefined : json['is_stream_gated'], - 'isUnlisted': !exists(json, 'is_unlisted') ? undefined : json['is_unlisted'], - 'iswc': !exists(json, 'iswc') ? undefined : json['iswc'], - 'license': !exists(json, 'license') ? undefined : json['license'], - 'musicalKey': !exists(json, 'musical_key') ? undefined : json['musical_key'], - 'parentalWarningType': !exists(json, 'parental_warning_type') ? undefined : json['parental_warning_type'], - 'playlistsPreviouslyContainingTrack': !exists(json, 'playlists_previously_containing_track') ? undefined : json['playlists_previously_containing_track'], - 'preview': !exists(json, 'preview') ? undefined : MediaLinkFromJSON(json['preview']), - 'previewStartSeconds': !exists(json, 'preview_start_seconds') ? undefined : json['preview_start_seconds'], - 'producerCopyrightLine': !exists(json, 'producer_copyright_line') ? undefined : json['producer_copyright_line'], - 'resourceContributors': !exists(json, 'resource_contributors') ? undefined : json['resource_contributors'], - 'rightsController': !exists(json, 'rights_controller') ? undefined : json['rights_controller'], - 'slug': !exists(json, 'slug') ? undefined : json['slug'], - 'stemOf': !exists(json, 'stem_of') ? undefined : json['stem_of'], - 'stream': !exists(json, 'stream') ? undefined : MediaLinkFromJSON(json['stream']), - 'streamConditions': !exists(json, 'stream_conditions') ? undefined : AccessGateFromJSON(json['stream_conditions']), - 'trackId': !exists(json, 'track_id') ? undefined : json['track_id'], - 'trackSegments': !exists(json, 'track_segments') ? undefined : json['track_segments'], - 'updatedAt': !exists(json, 'updated_at') ? undefined : (new Date(json['updated_at'])), }; } @@ -679,7 +297,7 @@ export function TrackToJSON(value?: Track | null): any { 'orig_filename': value.origFilename, 'is_original_available': value.isOriginalAvailable, 'mood': value.mood, - 'release_date': value.releaseDate === undefined ? undefined : (value.releaseDate.toISOString().substr(0,10)), + 'release_date': value.releaseDate, 'isrc': value.isrc, 'remix_of': RemixParentToJSON(value.remixOf), 'repost_count': value.repostCount, @@ -697,58 +315,6 @@ export function TrackToJSON(value?: Track | null): any { 'playlists_containing_track': value.playlistsContainingTrack, 'pinned_comment_id': value.pinnedCommentId, 'album_backlink': AlbumBacklinkToJSON(value.albumBacklink), - 'access': TrackAccessInfoToJSON(value.access), - 'ai_attribution_user_id': value.aiAttributionUserId, - 'allowed_api_keys': value.allowedApiKeys, - 'artists': value.artists, - 'audio_analysis_error_count': value.audioAnalysisErrorCount, - 'audio_upload_id': value.audioUploadId, - 'blocknumber': value.blocknumber, - 'bpm': value.bpm, - 'comments_disabled': value.commentsDisabled, - 'copyright_line': value.copyrightLine, - 'cover_art': value.coverArt, - 'cover_art_sizes': value.coverArtSizes, - 'cover_original_artist': value.coverOriginalArtist, - 'cover_original_song_title': value.coverOriginalSongTitle, - 'create_date': value.createDate, - 'created_at': value.createdAt === undefined ? undefined : (value.createdAt.toISOString()), - 'credits_splits': value.creditsSplits, - 'ddex_release_ids': value.ddexReleaseIds, - 'download': MediaLinkToJSON(value.download), - 'download_conditions': AccessGateToJSON(value.downloadConditions), - 'field_visibility': value.fieldVisibility, - 'followee_favorites': value.followeeFavorites, - 'followee_reposts': value.followeeReposts, - 'has_current_user_reposted': value.hasCurrentUserReposted, - 'has_current_user_saved': value.hasCurrentUserSaved, - 'indirect_resource_contributors': value.indirectResourceContributors, - 'is_available': value.isAvailable, - 'is_custom_bpm': value.isCustomBpm, - 'is_custom_musical_key': value.isCustomMusicalKey, - 'is_delete': value.isDelete, - 'is_download_gated': value.isDownloadGated, - 'is_owned_by_user': value.isOwnedByUser, - 'is_scheduled_release': value.isScheduledRelease, - 'is_stream_gated': value.isStreamGated, - 'is_unlisted': value.isUnlisted, - 'iswc': value.iswc, - 'license': value.license, - 'musical_key': value.musicalKey, - 'parental_warning_type': value.parentalWarningType, - 'playlists_previously_containing_track': value.playlistsPreviouslyContainingTrack, - 'preview': MediaLinkToJSON(value.preview), - 'preview_start_seconds': value.previewStartSeconds, - 'producer_copyright_line': value.producerCopyrightLine, - 'resource_contributors': value.resourceContributors, - 'rights_controller': value.rightsController, - 'slug': value.slug, - 'stem_of': value.stemOf, - 'stream': MediaLinkToJSON(value.stream), - 'stream_conditions': AccessGateToJSON(value.streamConditions), - 'track_id': value.trackId, - 'track_segments': value.trackSegments, - 'updated_at': value.updatedAt === undefined ? undefined : (value.updatedAt.toISOString()), }; } diff --git a/packages/sdk/src/sdk/api/generated/default/models/TrackDownloadRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/TrackDownloadRequestBody.ts deleted file mode 100644 index c770d331547..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/TrackDownloadRequestBody.ts +++ /dev/null @@ -1,82 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface TrackDownloadRequestBody - */ -export interface TrackDownloadRequestBody { - /** - * City where the download occurred - * @type {string} - * @memberof TrackDownloadRequestBody - */ - city?: string; - /** - * Region where the download occurred - * @type {string} - * @memberof TrackDownloadRequestBody - */ - region?: string; - /** - * Country where the download occurred - * @type {string} - * @memberof TrackDownloadRequestBody - */ - country?: string; -} - -/** - * Check if a given object implements the TrackDownloadRequestBody interface. - */ -export function instanceOfTrackDownloadRequestBody(value: object): value is TrackDownloadRequestBody { - let isInstance = true; - - return isInstance; -} - -export function TrackDownloadRequestBodyFromJSON(json: any): TrackDownloadRequestBody { - return TrackDownloadRequestBodyFromJSONTyped(json, false); -} - -export function TrackDownloadRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): TrackDownloadRequestBody { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'city': !exists(json, 'city') ? undefined : json['city'], - 'region': !exists(json, 'region') ? undefined : json['region'], - 'country': !exists(json, 'country') ? undefined : json['country'], - }; -} - -export function TrackDownloadRequestBodyToJSON(value?: TrackDownloadRequestBody | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'city': value.city, - 'region': value.region, - 'country': value.country, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/TrackElementWrite.ts b/packages/sdk/src/sdk/api/generated/default/models/TrackElementWrite.ts deleted file mode 100644 index d7d2d8b9c21..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/TrackElementWrite.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface TrackElementWrite - */ -export interface TrackElementWrite { - /** - * - * @type {string} - * @memberof TrackElementWrite - */ - parentTrackId: string; -} - -/** - * Check if a given object implements the TrackElementWrite interface. - */ -export function instanceOfTrackElementWrite(value: object): value is TrackElementWrite { - let isInstance = true; - isInstance = isInstance && "parentTrackId" in value && value["parentTrackId"] !== undefined; - - return isInstance; -} - -export function TrackElementWriteFromJSON(json: any): TrackElementWrite { - return TrackElementWriteFromJSONTyped(json, false); -} - -export function TrackElementWriteFromJSONTyped(json: any, ignoreDiscriminator: boolean): TrackElementWrite { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'parentTrackId': json['parent_track_id'], - }; -} - -export function TrackElementWriteToJSON(value?: TrackElementWrite | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'parent_track_id': value.parentTrackId, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/TrackFavoritesResponse.ts b/packages/sdk/src/sdk/api/generated/default/models/TrackFavoritesResponse.ts deleted file mode 100644 index b8d17ae3c2f..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/TrackFavoritesResponse.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* 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 { User } from './User'; -import { - UserFromJSON, - UserFromJSONTyped, - UserToJSON, -} from './User'; - -/** - * - * @export - * @interface TrackFavoritesResponse - */ -export interface TrackFavoritesResponse { - /** - * - * @type {Array} - * @memberof TrackFavoritesResponse - */ - data?: Array; -} - -/** - * Check if a given object implements the TrackFavoritesResponse interface. - */ -export function instanceOfTrackFavoritesResponse(value: object): value is TrackFavoritesResponse { - let isInstance = true; - - return isInstance; -} - -export function TrackFavoritesResponseFromJSON(json: any): TrackFavoritesResponse { - return TrackFavoritesResponseFromJSONTyped(json, false); -} - -export function TrackFavoritesResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): TrackFavoritesResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'data': !exists(json, 'data') ? undefined : ((json['data'] as Array).map(UserFromJSON)), - }; -} - -export function TrackFavoritesResponseToJSON(value?: TrackFavoritesResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'data': value.data === undefined ? undefined : ((value.data as Array).map(UserToJSON)), - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/TrackId.ts b/packages/sdk/src/sdk/api/generated/default/models/TrackId.ts deleted file mode 100644 index 5556dd0cac7..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/TrackId.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface TrackId - */ -export interface TrackId { - /** - * - * @type {string} - * @memberof TrackId - */ - id: string; -} - -/** - * Check if a given object implements the TrackId interface. - */ -export function instanceOfTrackId(value: object): value is TrackId { - let isInstance = true; - isInstance = isInstance && "id" in value && value["id"] !== undefined; - - return isInstance; -} - -export function TrackIdFromJSON(json: any): TrackId { - return TrackIdFromJSONTyped(json, false); -} - -export function TrackIdFromJSONTyped(json: any, ignoreDiscriminator: boolean): TrackId { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'id': json['id'], - }; -} - -export function TrackIdToJSON(value?: TrackId | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'id': value.id, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/TrackRepostsResponse.ts b/packages/sdk/src/sdk/api/generated/default/models/TrackRepostsResponse.ts deleted file mode 100644 index 1af78ef92ec..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/TrackRepostsResponse.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* 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 { User } from './User'; -import { - UserFromJSON, - UserFromJSONTyped, - UserToJSON, -} from './User'; - -/** - * - * @export - * @interface TrackRepostsResponse - */ -export interface TrackRepostsResponse { - /** - * - * @type {Array} - * @memberof TrackRepostsResponse - */ - data?: Array; -} - -/** - * Check if a given object implements the TrackRepostsResponse interface. - */ -export function instanceOfTrackRepostsResponse(value: object): value is TrackRepostsResponse { - let isInstance = true; - - return isInstance; -} - -export function TrackRepostsResponseFromJSON(json: any): TrackRepostsResponse { - return TrackRepostsResponseFromJSONTyped(json, false); -} - -export function TrackRepostsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): TrackRepostsResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'data': !exists(json, 'data') ? undefined : ((json['data'] as Array).map(UserFromJSON)), - }; -} - -export function TrackRepostsResponseToJSON(value?: TrackRepostsResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'data': value.data === undefined ? undefined : ((value.data as Array).map(UserToJSON)), - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/TracksCountResponse.ts b/packages/sdk/src/sdk/api/generated/default/models/TracksCountResponse.ts deleted file mode 100644 index f69ebd0a498..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/TracksCountResponse.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface TracksCountResponse - */ -export interface TracksCountResponse { - /** - * - * @type {number} - * @memberof TracksCountResponse - */ - data?: number; -} - -/** - * Check if a given object implements the TracksCountResponse interface. - */ -export function instanceOfTracksCountResponse(value: object): value is TracksCountResponse { - let isInstance = true; - - return isInstance; -} - -export function TracksCountResponseFromJSON(json: any): TracksCountResponse { - return TracksCountResponseFromJSONTyped(json, false); -} - -export function TracksCountResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): TracksCountResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'data': !exists(json, 'data') ? undefined : json['data'], - }; -} - -export function TracksCountResponseToJSON(value?: TracksCountResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'data': value.data, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/TrendingIdsResponse.ts b/packages/sdk/src/sdk/api/generated/default/models/TrendingIdsResponse.ts deleted file mode 100644 index 6b26c0b56a3..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/TrendingIdsResponse.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* 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 { TrendingTimesIds } from './TrendingTimesIds'; -import { - TrendingTimesIdsFromJSON, - TrendingTimesIdsFromJSONTyped, - TrendingTimesIdsToJSON, -} from './TrendingTimesIds'; - -/** - * - * @export - * @interface TrendingIdsResponse - */ -export interface TrendingIdsResponse { - /** - * - * @type {TrendingTimesIds} - * @memberof TrendingIdsResponse - */ - data?: TrendingTimesIds; -} - -/** - * Check if a given object implements the TrendingIdsResponse interface. - */ -export function instanceOfTrendingIdsResponse(value: object): value is TrendingIdsResponse { - let isInstance = true; - - return isInstance; -} - -export function TrendingIdsResponseFromJSON(json: any): TrendingIdsResponse { - return TrendingIdsResponseFromJSONTyped(json, false); -} - -export function TrendingIdsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): TrendingIdsResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'data': !exists(json, 'data') ? undefined : TrendingTimesIdsFromJSON(json['data']), - }; -} - -export function TrendingIdsResponseToJSON(value?: TrendingIdsResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'data': TrendingTimesIdsToJSON(value.data), - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/TrendingTimesIds.ts b/packages/sdk/src/sdk/api/generated/default/models/TrendingTimesIds.ts deleted file mode 100644 index c90a28244c1..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/TrendingTimesIds.ts +++ /dev/null @@ -1,89 +0,0 @@ -/* 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 { TrackId } from './TrackId'; -import { - TrackIdFromJSON, - TrackIdFromJSONTyped, - TrackIdToJSON, -} from './TrackId'; - -/** - * - * @export - * @interface TrendingTimesIds - */ -export interface TrendingTimesIds { - /** - * - * @type {Array} - * @memberof TrendingTimesIds - */ - week?: Array; - /** - * - * @type {Array} - * @memberof TrendingTimesIds - */ - month?: Array; - /** - * - * @type {Array} - * @memberof TrendingTimesIds - */ - year?: Array; -} - -/** - * Check if a given object implements the TrendingTimesIds interface. - */ -export function instanceOfTrendingTimesIds(value: object): value is TrendingTimesIds { - let isInstance = true; - - return isInstance; -} - -export function TrendingTimesIdsFromJSON(json: any): TrendingTimesIds { - return TrendingTimesIdsFromJSONTyped(json, false); -} - -export function TrendingTimesIdsFromJSONTyped(json: any, ignoreDiscriminator: boolean): TrendingTimesIds { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'week': !exists(json, 'week') ? undefined : ((json['week'] as Array).map(TrackIdFromJSON)), - 'month': !exists(json, 'month') ? undefined : ((json['month'] as Array).map(TrackIdFromJSON)), - 'year': !exists(json, 'year') ? undefined : ((json['year'] as Array).map(TrackIdFromJSON)), - }; -} - -export function TrendingTimesIdsToJSON(value?: TrendingTimesIds | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'week': value.week === undefined ? undefined : ((value.week as Array).map(TrackIdToJSON)), - 'month': value.month === undefined ? undefined : ((value.month as Array).map(TrackIdToJSON)), - 'year': value.year === undefined ? undefined : ((value.year as Array).map(TrackIdToJSON)), - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/UpdateCoinRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/UpdateCoinRequest.ts similarity index 71% rename from packages/sdk/src/sdk/api/generated/default/models/UpdateCoinRequestBody.ts rename to packages/sdk/src/sdk/api/generated/default/models/UpdateCoinRequest.ts index b7e984def5c..8da77b0d2e5 100644 --- a/packages/sdk/src/sdk/api/generated/default/models/UpdateCoinRequestBody.ts +++ b/packages/sdk/src/sdk/api/generated/default/models/UpdateCoinRequest.ts @@ -17,61 +17,61 @@ import { exists, mapValues } from '../runtime'; /** * Request body for updating coin information * @export - * @interface UpdateCoinRequestBody + * @interface UpdateCoinRequest */ -export interface UpdateCoinRequestBody { +export interface UpdateCoinRequest { /** * The description of the coin (max 2500 characters) * @type {string} - * @memberof UpdateCoinRequestBody + * @memberof UpdateCoinRequest */ description?: string; /** * URL for the coin's banner image * @type {string} - * @memberof UpdateCoinRequestBody + * @memberof UpdateCoinRequest */ bannerImageUrl?: string; /** * Generic link URL for the coin * @type {string} - * @memberof UpdateCoinRequestBody + * @memberof UpdateCoinRequest */ link1?: string; /** * Generic link URL for the coin * @type {string} - * @memberof UpdateCoinRequestBody + * @memberof UpdateCoinRequest */ link2?: string; /** * Generic link URL for the coin * @type {string} - * @memberof UpdateCoinRequestBody + * @memberof UpdateCoinRequest */ link3?: string; /** * Generic link URL for the coin * @type {string} - * @memberof UpdateCoinRequestBody + * @memberof UpdateCoinRequest */ link4?: string; } /** - * Check if a given object implements the UpdateCoinRequestBody interface. + * Check if a given object implements the UpdateCoinRequest interface. */ -export function instanceOfUpdateCoinRequestBody(value: object): value is UpdateCoinRequestBody { +export function instanceOfUpdateCoinRequest(value: object): value is UpdateCoinRequest { let isInstance = true; return isInstance; } -export function UpdateCoinRequestBodyFromJSON(json: any): UpdateCoinRequestBody { - return UpdateCoinRequestBodyFromJSONTyped(json, false); +export function UpdateCoinRequestFromJSON(json: any): UpdateCoinRequest { + return UpdateCoinRequestFromJSONTyped(json, false); } -export function UpdateCoinRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): UpdateCoinRequestBody { +export function UpdateCoinRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): UpdateCoinRequest { if ((json === undefined) || (json === null)) { return json; } @@ -86,7 +86,7 @@ export function UpdateCoinRequestBodyFromJSONTyped(json: any, ignoreDiscriminato }; } -export function UpdateCoinRequestBodyToJSON(value?: UpdateCoinRequestBody | null): any { +export function UpdateCoinRequestToJSON(value?: UpdateCoinRequest | null): any { if (value === undefined) { return undefined; } diff --git a/packages/sdk/src/sdk/api/generated/default/models/UpdateCommentRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/UpdateCommentRequestBody.ts deleted file mode 100644 index ad958840bb1..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/UpdateCommentRequestBody.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* 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 { CommentEntityType } from './CommentEntityType'; -import { - CommentEntityTypeFromJSON, - CommentEntityTypeFromJSONTyped, - CommentEntityTypeToJSON, -} from './CommentEntityType'; - -/** - * - * @export - * @interface UpdateCommentRequestBody - */ -export interface UpdateCommentRequestBody { - /** - * - * @type {CommentEntityType} - * @memberof UpdateCommentRequestBody - */ - entityType: CommentEntityType; - /** - * ID of the entity being commented on - * @type {number} - * @memberof UpdateCommentRequestBody - */ - entityId: number; - /** - * The updated comment text - * @type {string} - * @memberof UpdateCommentRequestBody - */ - body: string; - /** - * Array of user IDs mentioned in the comment (max 10) - * @type {Array} - * @memberof UpdateCommentRequestBody - */ - mentions?: Array; -} - -/** - * Check if a given object implements the UpdateCommentRequestBody interface. - */ -export function instanceOfUpdateCommentRequestBody(value: object): value is UpdateCommentRequestBody { - let isInstance = true; - isInstance = isInstance && "entityType" in value && value["entityType"] !== undefined; - isInstance = isInstance && "entityId" in value && value["entityId"] !== undefined; - isInstance = isInstance && "body" in value && value["body"] !== undefined; - - return isInstance; -} - -export function UpdateCommentRequestBodyFromJSON(json: any): UpdateCommentRequestBody { - return UpdateCommentRequestBodyFromJSONTyped(json, false); -} - -export function UpdateCommentRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): UpdateCommentRequestBody { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'entityType': CommentEntityTypeFromJSON(json['entityType']), - 'entityId': json['entityId'], - 'body': json['body'], - 'mentions': !exists(json, 'mentions') ? undefined : json['mentions'], - }; -} - -export function UpdateCommentRequestBodyToJSON(value?: UpdateCommentRequestBody | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'entityType': CommentEntityTypeToJSON(value.entityType), - 'entityId': value.entityId, - 'body': value.body, - 'mentions': value.mentions, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/UpdateDeveloperAppRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/UpdateDeveloperAppRequestBody.ts deleted file mode 100644 index a3bcbe4f3ac..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/UpdateDeveloperAppRequestBody.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface UpdateDeveloperAppRequestBody - */ -export interface UpdateDeveloperAppRequestBody { - /** - * Developer app name - * @type {string} - * @memberof UpdateDeveloperAppRequestBody - */ - name: string; - /** - * App description - * @type {string} - * @memberof UpdateDeveloperAppRequestBody - */ - description?: string; - /** - * App logo/image URL (camelCase) - * @type {string} - * @memberof UpdateDeveloperAppRequestBody - */ - imageUrl?: string; -} - -/** - * Check if a given object implements the UpdateDeveloperAppRequestBody interface. - */ -export function instanceOfUpdateDeveloperAppRequestBody(value: object): value is UpdateDeveloperAppRequestBody { - let isInstance = true; - isInstance = isInstance && "name" in value && value["name"] !== undefined; - - return isInstance; -} - -export function UpdateDeveloperAppRequestBodyFromJSON(json: any): UpdateDeveloperAppRequestBody { - return UpdateDeveloperAppRequestBodyFromJSONTyped(json, false); -} - -export function UpdateDeveloperAppRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): UpdateDeveloperAppRequestBody { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'name': json['name'], - 'description': !exists(json, 'description') ? undefined : json['description'], - 'imageUrl': !exists(json, 'imageUrl') ? undefined : json['imageUrl'], - }; -} - -export function UpdateDeveloperAppRequestBodyToJSON(value?: UpdateDeveloperAppRequestBody | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'name': value.name, - 'description': value.description, - 'imageUrl': value.imageUrl, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/UpdatePlaylistRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/UpdatePlaylistRequestBody.ts deleted file mode 100644 index b365194f1b0..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/UpdatePlaylistRequestBody.ts +++ /dev/null @@ -1,277 +0,0 @@ -/* 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 { AccessGate } from './AccessGate'; -import { - AccessGateFromJSON, - AccessGateFromJSONTyped, - AccessGateToJSON, -} from './AccessGate'; -import type { CreatePlaylistRequestBodyCopyrightLine } from './CreatePlaylistRequestBodyCopyrightLine'; -import { - CreatePlaylistRequestBodyCopyrightLineFromJSON, - CreatePlaylistRequestBodyCopyrightLineFromJSONTyped, - CreatePlaylistRequestBodyCopyrightLineToJSON, -} from './CreatePlaylistRequestBodyCopyrightLine'; -import type { CreatePlaylistRequestBodyProducerCopyrightLine } from './CreatePlaylistRequestBodyProducerCopyrightLine'; -import { - CreatePlaylistRequestBodyProducerCopyrightLineFromJSON, - CreatePlaylistRequestBodyProducerCopyrightLineFromJSONTyped, - CreatePlaylistRequestBodyProducerCopyrightLineToJSON, -} from './CreatePlaylistRequestBodyProducerCopyrightLine'; -import type { DdexResourceContributor } from './DdexResourceContributor'; -import { - DdexResourceContributorFromJSON, - DdexResourceContributorFromJSONTyped, - DdexResourceContributorToJSON, -} from './DdexResourceContributor'; -import type { Genre } from './Genre'; -import { - GenreFromJSON, - GenreFromJSONTyped, - GenreToJSON, -} from './Genre'; -import type { Mood } from './Mood'; -import { - MoodFromJSON, - MoodFromJSONTyped, - MoodToJSON, -} from './Mood'; -import type { PlaylistAddedTimestamp } from './PlaylistAddedTimestamp'; -import { - PlaylistAddedTimestampFromJSON, - PlaylistAddedTimestampFromJSONTyped, - PlaylistAddedTimestampToJSON, -} from './PlaylistAddedTimestamp'; - -/** - * Request body for updating playlist information. All fields are optional. - * @export - * @interface UpdatePlaylistRequestBody - */ -export interface UpdatePlaylistRequestBody { - /** - * Playlist or album name - * @type {string} - * @memberof UpdatePlaylistRequestBody - */ - playlistName?: string; - /** - * Playlist description - * @type {string} - * @memberof UpdatePlaylistRequestBody - */ - description?: string; - /** - * Whether the playlist is private - * @type {boolean} - * @memberof UpdatePlaylistRequestBody - */ - isPrivate?: boolean; - /** - * Whether this is an album - * @type {boolean} - * @memberof UpdatePlaylistRequestBody - */ - isAlbum?: boolean; - /** - * - * @type {Genre} - * @memberof UpdatePlaylistRequestBody - */ - genre?: Genre; - /** - * - * @type {Mood} - * @memberof UpdatePlaylistRequestBody - */ - mood?: Mood; - /** - * Comma-separated tags - * @type {string} - * @memberof UpdatePlaylistRequestBody - */ - tags?: string; - /** - * License type - * @type {string} - * @memberof UpdatePlaylistRequestBody - */ - license?: string; - /** - * Universal Product Code (for albums) - * @type {string} - * @memberof UpdatePlaylistRequestBody - */ - upc?: string; - /** - * Release date - * @type {Date} - * @memberof UpdatePlaylistRequestBody - */ - releaseDate?: Date; - /** - * IPFS CID for cover art - * @type {string} - * @memberof UpdatePlaylistRequestBody - */ - coverArtCid?: string; - /** - * Array of track IDs to include in the playlist - * @type {Array} - * @memberof UpdatePlaylistRequestBody - */ - playlistContents?: Array; - /** - * Whether streaming is restricted behind an access gate - * @type {boolean} - * @memberof UpdatePlaylistRequestBody - */ - isStreamGated?: boolean | null; - /** - * Whether the playlist/album is a scheduled release - * @type {boolean} - * @memberof UpdatePlaylistRequestBody - */ - isScheduledRelease?: boolean | null; - /** - * - * @type {AccessGate} - * @memberof UpdatePlaylistRequestBody - */ - streamConditions?: AccessGate | null; - /** - * DDEX application identifier - * @type {string} - * @memberof UpdatePlaylistRequestBody - */ - ddexApp?: string; - /** - * DDEX release identifiers - * @type {{ [key: string]: string; }} - * @memberof UpdatePlaylistRequestBody - */ - ddexReleaseIds?: { [key: string]: string; } | null; - /** - * DDEX resource contributors / artists - * @type {Array} - * @memberof UpdatePlaylistRequestBody - */ - artists?: Array | null; - /** - * - * @type {CreatePlaylistRequestBodyCopyrightLine} - * @memberof UpdatePlaylistRequestBody - */ - copyrightLine?: CreatePlaylistRequestBodyCopyrightLine | null; - /** - * - * @type {CreatePlaylistRequestBodyProducerCopyrightLine} - * @memberof UpdatePlaylistRequestBody - */ - producerCopyrightLine?: CreatePlaylistRequestBodyProducerCopyrightLine | null; - /** - * Parental warning type - * @type {string} - * @memberof UpdatePlaylistRequestBody - */ - parentalWarningType?: string | null; - /** - * Whether the image is autogenerated - * @type {boolean} - * @memberof UpdatePlaylistRequestBody - */ - isImageAutogenerated?: boolean | null; -} - -/** - * Check if a given object implements the UpdatePlaylistRequestBody interface. - */ -export function instanceOfUpdatePlaylistRequestBody(value: object): value is UpdatePlaylistRequestBody { - let isInstance = true; - - return isInstance; -} - -export function UpdatePlaylistRequestBodyFromJSON(json: any): UpdatePlaylistRequestBody { - return UpdatePlaylistRequestBodyFromJSONTyped(json, false); -} - -export function UpdatePlaylistRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): UpdatePlaylistRequestBody { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'playlistName': !exists(json, 'playlist_name') ? undefined : json['playlist_name'], - 'description': !exists(json, 'description') ? undefined : json['description'], - 'isPrivate': !exists(json, 'is_private') ? undefined : json['is_private'], - 'isAlbum': !exists(json, 'is_album') ? undefined : json['is_album'], - 'genre': !exists(json, 'genre') ? undefined : GenreFromJSON(json['genre']), - 'mood': !exists(json, 'mood') ? undefined : MoodFromJSON(json['mood']), - 'tags': !exists(json, 'tags') ? undefined : json['tags'], - 'license': !exists(json, 'license') ? undefined : json['license'], - 'upc': !exists(json, 'upc') ? undefined : json['upc'], - 'releaseDate': !exists(json, 'release_date') ? undefined : (new Date(json['release_date'])), - 'coverArtCid': !exists(json, 'cover_art_cid') ? undefined : json['cover_art_cid'], - 'playlistContents': !exists(json, 'playlist_contents') ? undefined : ((json['playlist_contents'] as Array).map(PlaylistAddedTimestampFromJSON)), - 'isStreamGated': !exists(json, 'is_stream_gated') ? undefined : json['is_stream_gated'], - 'isScheduledRelease': !exists(json, 'is_scheduled_release') ? undefined : json['is_scheduled_release'], - 'streamConditions': !exists(json, 'stream_conditions') ? undefined : AccessGateFromJSON(json['stream_conditions']), - 'ddexApp': !exists(json, 'ddex_app') ? undefined : json['ddex_app'], - 'ddexReleaseIds': !exists(json, 'ddex_release_ids') ? undefined : json['ddex_release_ids'], - 'artists': !exists(json, 'artists') ? undefined : (json['artists'] === null ? null : (json['artists'] as Array).map(DdexResourceContributorFromJSON)), - 'copyrightLine': !exists(json, 'copyright_line') ? undefined : CreatePlaylistRequestBodyCopyrightLineFromJSON(json['copyright_line']), - 'producerCopyrightLine': !exists(json, 'producer_copyright_line') ? undefined : CreatePlaylistRequestBodyProducerCopyrightLineFromJSON(json['producer_copyright_line']), - 'parentalWarningType': !exists(json, 'parental_warning_type') ? undefined : json['parental_warning_type'], - 'isImageAutogenerated': !exists(json, 'is_image_autogenerated') ? undefined : json['is_image_autogenerated'], - }; -} - -export function UpdatePlaylistRequestBodyToJSON(value?: UpdatePlaylistRequestBody | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'playlist_name': value.playlistName, - 'description': value.description, - 'is_private': value.isPrivate, - 'is_album': value.isAlbum, - 'genre': GenreToJSON(value.genre), - 'mood': MoodToJSON(value.mood), - 'tags': value.tags, - 'license': value.license, - 'upc': value.upc, - 'release_date': value.releaseDate === undefined ? undefined : (value.releaseDate.toISOString().substr(0,10)), - 'cover_art_cid': value.coverArtCid, - 'playlist_contents': value.playlistContents === undefined ? undefined : ((value.playlistContents as Array).map(PlaylistAddedTimestampToJSON)), - 'is_stream_gated': value.isStreamGated, - 'is_scheduled_release': value.isScheduledRelease, - 'stream_conditions': AccessGateToJSON(value.streamConditions), - 'ddex_app': value.ddexApp, - 'ddex_release_ids': value.ddexReleaseIds, - 'artists': value.artists === undefined ? undefined : (value.artists === null ? null : (value.artists as Array).map(DdexResourceContributorToJSON)), - 'copyright_line': CreatePlaylistRequestBodyCopyrightLineToJSON(value.copyrightLine), - 'producer_copyright_line': CreatePlaylistRequestBodyProducerCopyrightLineToJSON(value.producerCopyrightLine), - 'parental_warning_type': value.parentalWarningType, - 'is_image_autogenerated': value.isImageAutogenerated, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/UpdateTrackRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/UpdateTrackRequestBody.ts deleted file mode 100644 index b205d019d82..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/UpdateTrackRequestBody.ts +++ /dev/null @@ -1,335 +0,0 @@ -/* 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 { AccessGate } from './AccessGate'; -import { - AccessGateFromJSON, - AccessGateFromJSONTyped, - AccessGateToJSON, -} from './AccessGate'; -import type { FieldVisibility } from './FieldVisibility'; -import { - FieldVisibilityFromJSON, - FieldVisibilityFromJSONTyped, - FieldVisibilityToJSON, -} from './FieldVisibility'; -import type { Genre } from './Genre'; -import { - GenreFromJSON, - GenreFromJSONTyped, - GenreToJSON, -} from './Genre'; -import type { Mood } from './Mood'; -import { - MoodFromJSON, - MoodFromJSONTyped, - MoodToJSON, -} from './Mood'; -import type { RemixParentWrite } from './RemixParentWrite'; -import { - RemixParentWriteFromJSON, - RemixParentWriteFromJSONTyped, - RemixParentWriteToJSON, -} from './RemixParentWrite'; -import type { StemParent } from './StemParent'; -import { - StemParentFromJSON, - StemParentFromJSONTyped, - StemParentToJSON, -} from './StemParent'; - -/** - * Request body for updating track information. All fields are optional. - * @export - * @interface UpdateTrackRequestBody - */ -export interface UpdateTrackRequestBody { - /** - * Track title - * @type {string} - * @memberof UpdateTrackRequestBody - */ - title?: string; - /** - * - * @type {Genre} - * @memberof UpdateTrackRequestBody - */ - genre?: Genre; - /** - * Track description - * @type {string} - * @memberof UpdateTrackRequestBody - */ - description?: string | null; - /** - * - * @type {Mood} - * @memberof UpdateTrackRequestBody - */ - mood?: Mood | null; - /** - * Beats per minute (tempo) - * @type {number} - * @memberof UpdateTrackRequestBody - */ - bpm?: number | null; - /** - * Musical key of the track - * @type {string} - * @memberof UpdateTrackRequestBody - */ - musicalKey?: string | null; - /** - * Comma-separated tags - * @type {string} - * @memberof UpdateTrackRequestBody - */ - tags?: string | null; - /** - * License type - * @type {string} - * @memberof UpdateTrackRequestBody - */ - license?: string | null; - /** - * International Standard Recording Code - * @type {string} - * @memberof UpdateTrackRequestBody - */ - isrc?: string | null; - /** - * International Standard Musical Work Code - * @type {string} - * @memberof UpdateTrackRequestBody - */ - iswc?: string | null; - /** - * Release date - * @type {Date} - * @memberof UpdateTrackRequestBody - */ - releaseDate?: Date; - /** - * IPFS CID for the track audio file - * @type {string} - * @memberof UpdateTrackRequestBody - */ - trackCid?: string; - /** - * IPFS CID for the original track file - * @type {string} - * @memberof UpdateTrackRequestBody - */ - origFileCid?: string; - /** - * Original filename of the track - * @type {string} - * @memberof UpdateTrackRequestBody - */ - origFilename?: string; - /** - * IPFS CID for cover art - * @type {string} - * @memberof UpdateTrackRequestBody - */ - coverArtCid?: string; - /** - * Cover art sizes metadata - * @type {string} - * @memberof UpdateTrackRequestBody - */ - coverArtSizes?: string; - /** - * IPFS CID for the track preview - * @type {string} - * @memberof UpdateTrackRequestBody - */ - previewCid?: string; - /** - * Preview start time in seconds - * @type {number} - * @memberof UpdateTrackRequestBody - */ - previewStartSeconds?: number; - /** - * Track duration in seconds - * @type {number} - * @memberof UpdateTrackRequestBody - */ - duration?: number; - /** - * Whether the track is downloadable - * @type {boolean} - * @memberof UpdateTrackRequestBody - */ - isDownloadable?: boolean; - /** - * Whether the track is unlisted - * @type {boolean} - * @memberof UpdateTrackRequestBody - */ - isUnlisted?: boolean; - /** - * Whether streaming is restricted behind an access gate - * @type {boolean} - * @memberof UpdateTrackRequestBody - */ - isStreamGated?: boolean; - /** - * - * @type {AccessGate} - * @memberof UpdateTrackRequestBody - */ - streamConditions?: AccessGate | null; - /** - * - * @type {AccessGate} - * @memberof UpdateTrackRequestBody - */ - downloadConditions?: AccessGate | null; - /** - * - * @type {FieldVisibility} - * @memberof UpdateTrackRequestBody - */ - fieldVisibility?: FieldVisibility; - /** - * Placement hosts for the track - * @type {string} - * @memberof UpdateTrackRequestBody - */ - placementHosts?: string; - /** - * - * @type {StemParent} - * @memberof UpdateTrackRequestBody - */ - stemOf?: StemParent; - /** - * - * @type {RemixParentWrite} - * @memberof UpdateTrackRequestBody - */ - remixOf?: RemixParentWrite; - /** - * DDEX application identifier - * @type {string} - * @memberof UpdateTrackRequestBody - */ - ddexApp?: string | null; - /** - * Parental warning type - * @type {string} - * @memberof UpdateTrackRequestBody - */ - parentalWarningType?: string | null; -} - -/** - * Check if a given object implements the UpdateTrackRequestBody interface. - */ -export function instanceOfUpdateTrackRequestBody(value: object): value is UpdateTrackRequestBody { - let isInstance = true; - - return isInstance; -} - -export function UpdateTrackRequestBodyFromJSON(json: any): UpdateTrackRequestBody { - return UpdateTrackRequestBodyFromJSONTyped(json, false); -} - -export function UpdateTrackRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): UpdateTrackRequestBody { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'title': !exists(json, 'title') ? undefined : json['title'], - 'genre': !exists(json, 'genre') ? undefined : GenreFromJSON(json['genre']), - 'description': !exists(json, 'description') ? undefined : json['description'], - 'mood': !exists(json, 'mood') ? undefined : MoodFromJSON(json['mood']), - 'bpm': !exists(json, 'bpm') ? undefined : json['bpm'], - 'musicalKey': !exists(json, 'musical_key') ? undefined : json['musical_key'], - 'tags': !exists(json, 'tags') ? undefined : json['tags'], - 'license': !exists(json, 'license') ? undefined : json['license'], - 'isrc': !exists(json, 'isrc') ? undefined : json['isrc'], - 'iswc': !exists(json, 'iswc') ? undefined : json['iswc'], - 'releaseDate': !exists(json, 'release_date') ? undefined : (new Date(json['release_date'])), - 'trackCid': !exists(json, 'track_cid') ? undefined : json['track_cid'], - 'origFileCid': !exists(json, 'orig_file_cid') ? undefined : json['orig_file_cid'], - 'origFilename': !exists(json, 'orig_filename') ? undefined : json['orig_filename'], - 'coverArtCid': !exists(json, 'cover_art_cid') ? undefined : json['cover_art_cid'], - 'coverArtSizes': !exists(json, 'cover_art_sizes') ? undefined : json['cover_art_sizes'], - 'previewCid': !exists(json, 'preview_cid') ? undefined : json['preview_cid'], - 'previewStartSeconds': !exists(json, 'preview_start_seconds') ? undefined : json['preview_start_seconds'], - 'duration': !exists(json, 'duration') ? undefined : json['duration'], - 'isDownloadable': !exists(json, 'is_downloadable') ? undefined : json['is_downloadable'], - 'isUnlisted': !exists(json, 'is_unlisted') ? undefined : json['is_unlisted'], - 'isStreamGated': !exists(json, 'is_stream_gated') ? undefined : json['is_stream_gated'], - 'streamConditions': !exists(json, 'stream_conditions') ? undefined : AccessGateFromJSON(json['stream_conditions']), - 'downloadConditions': !exists(json, 'download_conditions') ? undefined : AccessGateFromJSON(json['download_conditions']), - 'fieldVisibility': !exists(json, 'field_visibility') ? undefined : FieldVisibilityFromJSON(json['field_visibility']), - 'placementHosts': !exists(json, 'placement_hosts') ? undefined : json['placement_hosts'], - 'stemOf': !exists(json, 'stem_of') ? undefined : StemParentFromJSON(json['stem_of']), - 'remixOf': !exists(json, 'remix_of') ? undefined : RemixParentWriteFromJSON(json['remix_of']), - 'ddexApp': !exists(json, 'ddex_app') ? undefined : json['ddex_app'], - 'parentalWarningType': !exists(json, 'parental_warning_type') ? undefined : json['parental_warning_type'], - }; -} - -export function UpdateTrackRequestBodyToJSON(value?: UpdateTrackRequestBody | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'title': value.title, - 'genre': GenreToJSON(value.genre), - 'description': value.description, - 'mood': MoodToJSON(value.mood), - 'bpm': value.bpm, - 'musical_key': value.musicalKey, - 'tags': value.tags, - 'license': value.license, - 'isrc': value.isrc, - 'iswc': value.iswc, - 'release_date': value.releaseDate === undefined ? undefined : (value.releaseDate.toISOString().substr(0,10)), - 'track_cid': value.trackCid, - 'orig_file_cid': value.origFileCid, - 'orig_filename': value.origFilename, - 'cover_art_cid': value.coverArtCid, - 'cover_art_sizes': value.coverArtSizes, - 'preview_cid': value.previewCid, - 'preview_start_seconds': value.previewStartSeconds, - 'duration': value.duration, - 'is_downloadable': value.isDownloadable, - 'is_unlisted': value.isUnlisted, - 'is_stream_gated': value.isStreamGated, - 'stream_conditions': AccessGateToJSON(value.streamConditions), - 'download_conditions': AccessGateToJSON(value.downloadConditions), - 'field_visibility': FieldVisibilityToJSON(value.fieldVisibility), - 'placement_hosts': value.placementHosts, - 'stem_of': StemParentToJSON(value.stemOf), - 'remix_of': RemixParentWriteToJSON(value.remixOf), - 'ddex_app': value.ddexApp, - 'parental_warning_type': value.parentalWarningType, - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/UpdateUserRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/UpdateUserRequestBody.ts deleted file mode 100644 index a79ffb8f04d..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/UpdateUserRequestBody.ts +++ /dev/null @@ -1,249 +0,0 @@ -/* 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 { CreateUserRequestBodyEvents } from './CreateUserRequestBodyEvents'; -import { - CreateUserRequestBodyEventsFromJSON, - CreateUserRequestBodyEventsFromJSONTyped, - CreateUserRequestBodyEventsToJSON, -} from './CreateUserRequestBodyEvents'; -import type { UserPlaylistLibrary } from './UserPlaylistLibrary'; -import { - UserPlaylistLibraryFromJSON, - UserPlaylistLibraryFromJSONTyped, - UserPlaylistLibraryToJSON, -} from './UserPlaylistLibrary'; - -/** - * Request body for updating user profile. All fields are optional. - * @export - * @interface UpdateUserRequestBody - */ -export interface UpdateUserRequestBody { - /** - * User handle. Can only be set if the user does not already have a handle. - * @type {string} - * @memberof UpdateUserRequestBody - */ - handle?: string; - /** - * Display name - * @type {string} - * @memberof UpdateUserRequestBody - */ - name?: string; - /** - * User bio - * @type {string} - * @memberof UpdateUserRequestBody - */ - bio?: string; - /** - * User location - * @type {string} - * @memberof UpdateUserRequestBody - */ - location?: string; - /** - * Website URL - * @type {string} - * @memberof UpdateUserRequestBody - */ - website?: string; - /** - * Donation link - * @type {string} - * @memberof UpdateUserRequestBody - */ - donation?: string; - /** - * Twitter handle (without @) - * @type {string} - * @memberof UpdateUserRequestBody - */ - twitterHandle?: string; - /** - * Instagram handle (without @) - * @type {string} - * @memberof UpdateUserRequestBody - */ - instagramHandle?: string; - /** - * TikTok handle (without @) - * @type {string} - * @memberof UpdateUserRequestBody - */ - tiktokHandle?: string; - /** - * Profile picture CID or URL - * @type {string} - * @memberof UpdateUserRequestBody - */ - profilePicture?: string; - /** - * Profile picture sizes metadata - * @type {string} - * @memberof UpdateUserRequestBody - */ - profilePictureSizes?: string; - /** - * Cover photo CID or URL - * @type {string} - * @memberof UpdateUserRequestBody - */ - coverPhoto?: string; - /** - * Cover photo sizes metadata - * @type {string} - * @memberof UpdateUserRequestBody - */ - coverPhotoSizes?: string; - /** - * Type of profile (e.g., 'label' for record labels) - * @type {string} - * @memberof UpdateUserRequestBody - */ - profileType?: UpdateUserRequestBodyProfileTypeEnum; - /** - * Whether the user is deactivated - * @type {boolean} - * @memberof UpdateUserRequestBody - */ - isDeactivated?: boolean; - /** - * Track hash ID to feature as artist pick - * @type {string} - * @memberof UpdateUserRequestBody - */ - artistPickTrackId?: string; - /** - * Whether to allow AI attribution - * @type {boolean} - * @memberof UpdateUserRequestBody - */ - allowAiAttribution?: boolean; - /** - * Solana USDC payout wallet address - * @type {string} - * @memberof UpdateUserRequestBody - */ - splUsdcPayoutWallet?: string; - /** - * Coin flair mint address - * @type {string} - * @memberof UpdateUserRequestBody - */ - coinFlairMint?: string; - /** - * - * @type {UserPlaylistLibrary} - * @memberof UpdateUserRequestBody - */ - playlistLibrary?: UserPlaylistLibrary; - /** - * - * @type {CreateUserRequestBodyEvents} - * @memberof UpdateUserRequestBody - */ - events?: CreateUserRequestBodyEvents; -} - - -/** - * @export - */ -export const UpdateUserRequestBodyProfileTypeEnum = { - Label: 'label' -} as const; -export type UpdateUserRequestBodyProfileTypeEnum = typeof UpdateUserRequestBodyProfileTypeEnum[keyof typeof UpdateUserRequestBodyProfileTypeEnum]; - - -/** - * Check if a given object implements the UpdateUserRequestBody interface. - */ -export function instanceOfUpdateUserRequestBody(value: object): value is UpdateUserRequestBody { - let isInstance = true; - - return isInstance; -} - -export function UpdateUserRequestBodyFromJSON(json: any): UpdateUserRequestBody { - return UpdateUserRequestBodyFromJSONTyped(json, false); -} - -export function UpdateUserRequestBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): UpdateUserRequestBody { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'handle': !exists(json, 'handle') ? undefined : json['handle'], - 'name': !exists(json, 'name') ? undefined : json['name'], - 'bio': !exists(json, 'bio') ? undefined : json['bio'], - 'location': !exists(json, 'location') ? undefined : json['location'], - 'website': !exists(json, 'website') ? undefined : json['website'], - 'donation': !exists(json, 'donation') ? undefined : json['donation'], - 'twitterHandle': !exists(json, 'twitter_handle') ? undefined : json['twitter_handle'], - 'instagramHandle': !exists(json, 'instagram_handle') ? undefined : json['instagram_handle'], - 'tiktokHandle': !exists(json, 'tiktok_handle') ? undefined : json['tiktok_handle'], - 'profilePicture': !exists(json, 'profile_picture') ? undefined : json['profile_picture'], - 'profilePictureSizes': !exists(json, 'profile_picture_sizes') ? undefined : json['profile_picture_sizes'], - 'coverPhoto': !exists(json, 'cover_photo') ? undefined : json['cover_photo'], - 'coverPhotoSizes': !exists(json, 'cover_photo_sizes') ? undefined : json['cover_photo_sizes'], - 'profileType': !exists(json, 'profile_type') ? undefined : json['profile_type'], - 'isDeactivated': !exists(json, 'is_deactivated') ? undefined : json['is_deactivated'], - 'artistPickTrackId': !exists(json, 'artist_pick_track_id') ? undefined : json['artist_pick_track_id'], - '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 : UserPlaylistLibraryFromJSON(json['playlist_library']), - 'events': !exists(json, 'events') ? undefined : CreateUserRequestBodyEventsFromJSON(json['events']), - }; -} - -export function UpdateUserRequestBodyToJSON(value?: UpdateUserRequestBody | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'handle': value.handle, - 'name': value.name, - 'bio': value.bio, - 'location': value.location, - 'website': value.website, - 'donation': value.donation, - 'twitter_handle': value.twitterHandle, - 'instagram_handle': value.instagramHandle, - 'tiktok_handle': value.tiktokHandle, - 'profile_picture': value.profilePicture, - 'profile_picture_sizes': value.profilePictureSizes, - 'cover_photo': value.coverPhoto, - 'cover_photo_sizes': value.coverPhotoSizes, - 'profile_type': value.profileType, - 'is_deactivated': value.isDeactivated, - 'artist_pick_track_id': value.artistPickTrackId, - 'allow_ai_attribution': value.allowAiAttribution, - 'spl_usdc_payout_wallet': value.splUsdcPayoutWallet, - 'coin_flair_mint': value.coinFlairMint, - 'playlist_library': UserPlaylistLibraryToJSON(value.playlistLibrary), - 'events': CreateUserRequestBodyEventsToJSON(value.events), - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/User.ts b/packages/sdk/src/sdk/api/generated/default/models/User.ts index e0c0eeff152..971e2d8be75 100644 --- a/packages/sdk/src/sdk/api/generated/default/models/User.ts +++ b/packages/sdk/src/sdk/api/generated/default/models/User.ts @@ -231,174 +231,6 @@ export interface User { * @memberof User */ wallet: string; - /** - * - * @type {string} - * @memberof User - */ - balance?: string; - /** - * - * @type {string} - * @memberof User - */ - associatedWalletsBalance?: string; - /** - * - * @type {string} - * @memberof User - */ - totalBalance?: string; - /** - * - * @type {string} - * @memberof User - */ - payoutWallet?: string; - /** - * - * @type {string} - * @memberof User - */ - waudioBalance?: string; - /** - * - * @type {string} - * @memberof User - */ - associatedSolWalletsBalance?: string; - /** - * - * @type {number} - * @memberof User - */ - blocknumber?: number; - /** - * - * @type {Date} - * @memberof User - */ - createdAt?: Date; - /** - * - * @type {Date} - * @memberof User - */ - updatedAt?: Date; - /** - * - * @type {boolean} - * @memberof User - */ - isStorageV2?: boolean; - /** - * - * @type {string} - * @memberof User - */ - creatorNodeEndpoint?: string; - /** - * - * @type {number} - * @memberof User - */ - currentUserFolloweeFollowCount?: number; - /** - * - * @type {boolean} - * @memberof User - */ - doesCurrentUserFollow?: boolean; - /** - * - * @type {boolean} - * @memberof User - */ - doesCurrentUserSubscribe?: boolean; - /** - * - * @type {boolean} - * @memberof User - */ - doesFollowCurrentUser?: boolean; - /** - * - * @type {string} - * @memberof User - */ - handleLc?: string; - /** - * - * @type {string} - * @memberof User - */ - profileType?: string; - /** - * - * @type {number} - * @memberof User - */ - userId?: number; - /** - * - * @type {boolean} - * @memberof User - */ - hasCollectibles?: boolean; - /** - * - * @type {boolean} - * @memberof User - */ - allowAiAttribution?: boolean; - /** - * - * @type {string} - * @memberof User - */ - coinFlairMint?: string; - /** - * - * @type {object} - * @memberof User - */ - artistCoinBadge?: object; - /** - * - * @type {string} - * @memberof User - */ - coverPhotoSizes?: string; - /** - * - * @type {object} - * @memberof User - */ - coverPhotoCids?: object; - /** - * - * @type {object} - * @memberof User - */ - coverPhotoLegacy?: object; - /** - * - * @type {string} - * @memberof User - */ - profilePictureSizes?: string; - /** - * - * @type {object} - * @memberof User - */ - profilePictureCids?: object; - /** - * - * @type {object} - * @memberof User - */ - profilePictureLegacy?: object; } /** @@ -475,34 +307,6 @@ export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User 'supportingCount': json['supporting_count'], 'totalAudioBalance': json['total_audio_balance'], 'wallet': json['wallet'], - 'balance': !exists(json, 'balance') ? undefined : json['balance'], - 'associatedWalletsBalance': !exists(json, 'associated_wallets_balance') ? undefined : json['associated_wallets_balance'], - 'totalBalance': !exists(json, 'total_balance') ? undefined : json['total_balance'], - 'payoutWallet': !exists(json, 'payout_wallet') ? undefined : json['payout_wallet'], - 'waudioBalance': !exists(json, 'waudio_balance') ? undefined : json['waudio_balance'], - 'associatedSolWalletsBalance': !exists(json, 'associated_sol_wallets_balance') ? undefined : json['associated_sol_wallets_balance'], - 'blocknumber': !exists(json, 'blocknumber') ? undefined : json['blocknumber'], - 'createdAt': !exists(json, 'created_at') ? undefined : (new Date(json['created_at'])), - 'updatedAt': !exists(json, 'updated_at') ? undefined : (new Date(json['updated_at'])), - 'isStorageV2': !exists(json, 'is_storage_v2') ? undefined : json['is_storage_v2'], - 'creatorNodeEndpoint': !exists(json, 'creator_node_endpoint') ? undefined : json['creator_node_endpoint'], - 'currentUserFolloweeFollowCount': !exists(json, 'current_user_followee_follow_count') ? undefined : json['current_user_followee_follow_count'], - 'doesCurrentUserFollow': !exists(json, 'does_current_user_follow') ? undefined : json['does_current_user_follow'], - 'doesCurrentUserSubscribe': !exists(json, 'does_current_user_subscribe') ? undefined : json['does_current_user_subscribe'], - 'doesFollowCurrentUser': !exists(json, 'does_follow_current_user') ? undefined : json['does_follow_current_user'], - 'handleLc': !exists(json, 'handle_lc') ? undefined : json['handle_lc'], - 'profileType': !exists(json, 'profile_type') ? undefined : json['profile_type'], - 'userId': !exists(json, 'user_id') ? undefined : json['user_id'], - 'hasCollectibles': !exists(json, 'has_collectibles') ? undefined : json['has_collectibles'], - 'allowAiAttribution': !exists(json, 'allow_ai_attribution') ? undefined : json['allow_ai_attribution'], - 'coinFlairMint': !exists(json, 'coin_flair_mint') ? undefined : json['coin_flair_mint'], - 'artistCoinBadge': !exists(json, 'artist_coin_badge') ? undefined : json['artist_coin_badge'], - 'coverPhotoSizes': !exists(json, 'cover_photo_sizes') ? undefined : json['cover_photo_sizes'], - 'coverPhotoCids': !exists(json, 'cover_photo_cids') ? undefined : json['cover_photo_cids'], - 'coverPhotoLegacy': !exists(json, 'cover_photo_legacy') ? undefined : json['cover_photo_legacy'], - 'profilePictureSizes': !exists(json, 'profile_picture_sizes') ? undefined : json['profile_picture_sizes'], - 'profilePictureCids': !exists(json, 'profile_picture_cids') ? undefined : json['profile_picture_cids'], - 'profilePictureLegacy': !exists(json, 'profile_picture_legacy') ? undefined : json['profile_picture_legacy'], }; } @@ -548,34 +352,6 @@ export function UserToJSON(value?: User | null): any { 'supporting_count': value.supportingCount, 'total_audio_balance': value.totalAudioBalance, 'wallet': value.wallet, - 'balance': value.balance, - 'associated_wallets_balance': value.associatedWalletsBalance, - 'total_balance': value.totalBalance, - 'payout_wallet': value.payoutWallet, - 'waudio_balance': value.waudioBalance, - 'associated_sol_wallets_balance': value.associatedSolWalletsBalance, - 'blocknumber': value.blocknumber, - 'created_at': value.createdAt === undefined ? undefined : (value.createdAt.toISOString()), - 'updated_at': value.updatedAt === undefined ? undefined : (value.updatedAt.toISOString()), - 'is_storage_v2': value.isStorageV2, - 'creator_node_endpoint': value.creatorNodeEndpoint, - 'current_user_followee_follow_count': value.currentUserFolloweeFollowCount, - 'does_current_user_follow': value.doesCurrentUserFollow, - 'does_current_user_subscribe': value.doesCurrentUserSubscribe, - 'does_follow_current_user': value.doesFollowCurrentUser, - 'handle_lc': value.handleLc, - 'profile_type': value.profileType, - 'user_id': value.userId, - 'has_collectibles': value.hasCollectibles, - 'allow_ai_attribution': value.allowAiAttribution, - 'coin_flair_mint': value.coinFlairMint, - 'artist_coin_badge': value.artistCoinBadge, - 'cover_photo_sizes': value.coverPhotoSizes, - 'cover_photo_cids': value.coverPhotoCids, - 'cover_photo_legacy': value.coverPhotoLegacy, - 'profile_picture_sizes': value.profilePictureSizes, - 'profile_picture_cids': value.profilePictureCids, - 'profile_picture_legacy': value.profilePictureLegacy, }; } diff --git a/packages/sdk/src/sdk/api/generated/default/models/UserPlaylistLibrary.ts b/packages/sdk/src/sdk/api/generated/default/models/UserPlaylistLibrary.ts deleted file mode 100644 index ef034bd1d8c..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/UserPlaylistLibrary.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* 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 { UserPlaylistLibraryContentsInner } from './UserPlaylistLibraryContentsInner'; -import { - UserPlaylistLibraryContentsInnerFromJSON, - UserPlaylistLibraryContentsInnerFromJSONTyped, - UserPlaylistLibraryContentsInnerToJSON, -} from './UserPlaylistLibraryContentsInner'; - -/** - * User's playlist library with support for folders and playlists - * @export - * @interface UserPlaylistLibrary - */ -export interface UserPlaylistLibrary { - /** - * Array of folders and playlist identifiers - * @type {Array} - * @memberof UserPlaylistLibrary - */ - contents: Array; -} - -/** - * Check if a given object implements the UserPlaylistLibrary interface. - */ -export function instanceOfUserPlaylistLibrary(value: object): value is UserPlaylistLibrary { - let isInstance = true; - isInstance = isInstance && "contents" in value && value["contents"] !== undefined; - - return isInstance; -} - -export function UserPlaylistLibraryFromJSON(json: any): UserPlaylistLibrary { - return UserPlaylistLibraryFromJSONTyped(json, false); -} - -export function UserPlaylistLibraryFromJSONTyped(json: any, ignoreDiscriminator: boolean): UserPlaylistLibrary { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'contents': ((json['contents'] as Array).map(UserPlaylistLibraryContentsInnerFromJSON)), - }; -} - -export function UserPlaylistLibraryToJSON(value?: UserPlaylistLibrary | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'contents': ((value.contents as Array).map(UserPlaylistLibraryContentsInnerToJSON)), - }; -} - diff --git a/packages/sdk/src/sdk/api/generated/default/models/UserPlaylistLibraryContentsInner.ts b/packages/sdk/src/sdk/api/generated/default/models/UserPlaylistLibraryContentsInner.ts deleted file mode 100644 index f3524c34107..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/UserPlaylistLibraryContentsInner.ts +++ /dev/null @@ -1,76 +0,0 @@ -/* 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 UserPlaylistLibraryContentsInner - * - * @export - */ -export type UserPlaylistLibraryContentsInner = PlaylistLibraryExplorePlaylistIdentifier | PlaylistLibraryFolder | PlaylistLibraryPlaylistIdentifier; - -export function UserPlaylistLibraryContentsInnerFromJSON(json: any): UserPlaylistLibraryContentsInner { - return UserPlaylistLibraryContentsInnerFromJSONTyped(json, false); -} - -export function UserPlaylistLibraryContentsInnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): UserPlaylistLibraryContentsInner { - if ((json === undefined) || (json === null)) { - return json; - } - return { ...PlaylistLibraryExplorePlaylistIdentifierFromJSONTyped(json, true), ...PlaylistLibraryFolderFromJSONTyped(json, true), ...PlaylistLibraryPlaylistIdentifierFromJSONTyped(json, true) }; -} - -export function UserPlaylistLibraryContentsInnerToJSON(value?: UserPlaylistLibraryContentsInner | 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/WriteResponse.ts b/packages/sdk/src/sdk/api/generated/default/models/WriteResponse.ts deleted file mode 100644 index c1b54d44354..00000000000 --- a/packages/sdk/src/sdk/api/generated/default/models/WriteResponse.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* 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'; -/** - * - * @export - * @interface WriteResponse - */ -export interface WriteResponse { - /** - * Whether the operation was successful - * @type {boolean} - * @memberof WriteResponse - */ - success?: boolean; - /** - * The blockchain transaction hash - * @type {string} - * @memberof WriteResponse - */ - transactionHash?: string; -} - -/** - * Check if a given object implements the WriteResponse interface. - */ -export function instanceOfWriteResponse(value: object): value is WriteResponse { - let isInstance = true; - - return isInstance; -} - -export function WriteResponseFromJSON(json: any): WriteResponse { - return WriteResponseFromJSONTyped(json, false); -} - -export function WriteResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): WriteResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'success': !exists(json, 'success') ? undefined : json['success'], - 'transactionHash': !exists(json, 'transaction_hash') ? undefined : json['transaction_hash'], - }; -} - -export function WriteResponseToJSON(value?: WriteResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'success': value.success, - 'transaction_hash': value.transactionHash, - }; -} - 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 9f15f71149e..e3db1f66a54 100644 --- a/packages/sdk/src/sdk/api/generated/default/models/index.ts +++ b/packages/sdk/src/sdk/api/generated/default/models/index.ts @@ -1,13 +1,10 @@ /* tslint:disable */ /* eslint-disable */ export * from './Access'; -export * from './AccessGate'; export * from './AccessInfoResponse'; export * from './Activity'; -export * from './AddManagerRequestBody'; export * from './AlbumBacklink'; export * from './AlbumsResponse'; -export * from './ApproveGrantRequestBody'; export * from './AuthorizedApp'; export * from './AuthorizedApps'; export * from './BalanceHistoryDataPoint'; @@ -16,7 +13,7 @@ export * from './BestSellingItem'; export * from './BestSellingResponse'; export * from './BlobInfo'; export * from './ChallengeResponse'; -export * from './ClaimRewardsRequestBody'; +export * from './ClaimRewardsRequest'; export * from './ClaimRewardsResponse'; export * from './ClaimRewardsResponseDataInner'; export * from './ClaimedPrize'; @@ -40,7 +37,6 @@ export * from './Collectibles'; export * from './CollectiblesResponse'; export * from './CollectionActivity'; export * from './Comment'; -export * from './CommentEntityType'; export * from './CommentMention'; export * from './CommentNotificationSetting'; export * from './CommentRepliesResponse'; @@ -48,38 +44,17 @@ export * from './CommentResponse'; export * from './ConnectedWallets'; export * from './ConnectedWalletsResponse'; export * from './CoverPhoto'; -export * from './CreateAccessKeyResponse'; -export * from './CreateCoinRequestBody'; +export * from './CreateCoinRequest'; export * from './CreateCoinResponse'; export * from './CreateCoinResponseData'; -export * from './CreateCommentRequestBody'; -export * from './CreateCommentResponse'; -export * from './CreateDeveloperAppRequestBody'; -export * from './CreateDeveloperAppResponse'; -export * from './CreateGrantRequestBody'; -export * from './CreatePlaylistRequestBody'; -export * from './CreatePlaylistRequestBodyCopyrightLine'; -export * from './CreatePlaylistRequestBodyProducerCopyrightLine'; -export * from './CreatePlaylistResponse'; -export * from './CreateRewardCodeRequestBody'; +export * from './CreateRewardCodeRequest'; export * from './CreateRewardCodeResponse'; -export * from './CreateTrackRequestBody'; -export * from './CreateTrackResponse'; -export * from './CreateUserDeveloperAppRequestBody'; -export * from './CreateUserDeveloperAppResponse'; -export * from './CreateUserRequestBody'; -export * from './CreateUserRequestBodyEvents'; -export * from './CreateUserResponse'; export * from './DashboardWalletUser'; export * from './DashboardWalletUsersResponse'; -export * from './DdexCopyright'; -export * from './DdexResourceContributor'; -export * from './DeactivateAccessKeyRequestBody'; -export * from './DeactivateAccessKeyResponse'; export * from './DecodedUserToken'; export * from './DeveloperApp'; export * from './DeveloperAppResponse'; -export * from './DeveloperAppsResponse'; +export * from './DeveloperApps'; export * from './EmailAccess'; export * from './EmailAccessResponse'; export * from './Event'; @@ -90,52 +65,39 @@ export * from './ExtendedPurchaseGate'; export * from './ExtendedTokenGate'; export * from './ExtendedUsdcGate'; export * from './Favorite'; -export * from './FavoriteRequestBody'; export * from './FavoritesResponse'; -export * from './FieldVisibility'; export * from './FollowGate'; export * from './FollowersResponse'; export * from './FollowingResponse'; -export * from './Genre'; export * from './GetChallenges'; export * from './GetSupportedUsers'; export * from './GetSupporters'; export * from './GetTipsResponse'; export * from './HistoryResponse'; export * from './ListenCount'; -export * from './MediaLink'; export * from './MonthlyAggregatePlay'; -export * from './Mood'; export * from './MutualFollowersResponse'; -export * from './PinCommentRequestBody'; +export * from './NftCollection'; +export * from './NftGate'; 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'; export * from './PlaylistsResponse'; -export * from './PrizeClaimRequestBody'; +export * from './PrizeClaimRequest'; export * from './PrizeClaimResponse'; export * from './PrizePublic'; export * from './PrizesResponse'; export * from './ProfilePicture'; export * from './PurchasersResponse'; -export * from './ReactCommentRequestBody'; export * from './RedeemAmountResponse'; export * from './RelatedArtistResponse'; export * from './RemixParent'; -export * from './RemixParentWrite'; export * from './RemixedTrackAggregate'; export * from './RemixersResponse'; -export * from './RemixesResponse'; -export * from './RemixingResponse'; export * from './ReplyComment'; -export * from './Repost'; -export * from './RepostRequestBody'; export * from './Reposts'; export * from './RewardCodeErrorResponse'; export * from './RewardCodeResponse'; @@ -145,8 +107,6 @@ export * from './SalesAggregateResponse'; export * from './SalesJsonContent'; export * from './SalesJsonResponse'; export * from './Stem'; -export * from './StemCategory'; -export * from './StemParent'; export * from './StemsResponse'; export * from './StreamUrlResponse'; export * from './SubscribersResponse'; @@ -164,31 +124,18 @@ export * from './TrackArtwork'; export * from './TrackCommentCountResponse'; export * from './TrackCommentNotificationResponse'; export * from './TrackCommentsResponse'; -export * from './TrackDownloadRequestBody'; export * from './TrackElement'; -export * from './TrackElementWrite'; -export * from './TrackFavoritesResponse'; -export * from './TrackId'; export * from './TrackInspect'; export * from './TrackInspectList'; -export * from './TrackRepostsResponse'; export * from './TrackResponse'; export * from './TrackSearch'; -export * from './TracksCountResponse'; export * from './TracksResponse'; -export * from './TrendingIdsResponse'; export * from './TrendingPlaylistsResponse'; -export * from './TrendingTimesIds'; export * from './UnclaimedIdResponse'; export * from './UndisbursedChallenge'; export * from './UndisbursedChallenges'; -export * from './UpdateCoinRequestBody'; +export * from './UpdateCoinRequest'; export * from './UpdateCoinResponse'; -export * from './UpdateCommentRequestBody'; -export * from './UpdateDeveloperAppRequestBody'; -export * from './UpdatePlaylistRequestBody'; -export * from './UpdateTrackRequestBody'; -export * from './UpdateUserRequestBody'; export * from './User'; export * from './UserCoin'; export * from './UserCoinAccount'; @@ -198,12 +145,9 @@ export * from './UserCoinsResponse'; export * from './UserCommentsResponse'; export * from './UserIdAddress'; export * from './UserIdsAddressesResponse'; -export * from './UserPlaylistLibrary'; -export * from './UserPlaylistLibraryContentsInner'; export * from './UserResponse'; export * from './UserSearch'; export * from './UserTrackListenCountsResponse'; export * from './UserTracksRemixedResponse'; export * from './UsersResponse'; export * from './VerifyToken'; -export * from './WriteResponse'; diff --git a/packages/sdk/src/sdk/api/generated/full/.openapi-generator/FILES b/packages/sdk/src/sdk/api/generated/full/.openapi-generator/FILES index 46828f852e8..42dcb4d043a 100644 --- a/packages/sdk/src/sdk/api/generated/full/.openapi-generator/FILES +++ b/packages/sdk/src/sdk/api/generated/full/.openapi-generator/FILES @@ -62,7 +62,6 @@ models/CollectionActivityFull.ts models/CollectionActivityFullWithoutTracks.ts models/CollectionLibraryResponseFull.ts models/Comment.ts -models/CommentEntityType.ts models/CommentMention.ts models/CommentMentionNotification.ts models/CommentMentionNotificationAction.ts diff --git a/packages/sdk/src/sdk/api/generated/full/models/Comment.ts b/packages/sdk/src/sdk/api/generated/full/models/Comment.ts index f1c108676f3..aeb0335fd67 100644 --- a/packages/sdk/src/sdk/api/generated/full/models/Comment.ts +++ b/packages/sdk/src/sdk/api/generated/full/models/Comment.ts @@ -14,12 +14,6 @@ */ import { exists, mapValues } from '../runtime'; -import type { CommentEntityType } from './CommentEntityType'; -import { - CommentEntityTypeFromJSON, - CommentEntityTypeFromJSONTyped, - CommentEntityTypeToJSON, -} from './CommentEntityType'; import type { CommentMention } from './CommentMention'; import { CommentMentionFromJSON, @@ -53,10 +47,10 @@ export interface Comment { entityId: string; /** * - * @type {CommentEntityType} + * @type {string} * @memberof Comment */ - entityType: CommentEntityType; + entityType: string; /** * * @type {string} @@ -178,7 +172,7 @@ export function CommentFromJSONTyped(json: any, ignoreDiscriminator: boolean): C 'id': json['id'], 'entityId': json['entity_id'], - 'entityType': CommentEntityTypeFromJSON(json['entity_type']), + 'entityType': json['entity_type'], 'userId': !exists(json, 'user_id') ? undefined : json['user_id'], 'message': json['message'], 'mentions': !exists(json, 'mentions') ? undefined : ((json['mentions'] as Array).map(CommentMentionFromJSON)), @@ -208,7 +202,7 @@ export function CommentToJSON(value?: Comment | null): any { 'id': value.id, 'entity_id': value.entityId, - 'entity_type': CommentEntityTypeToJSON(value.entityType), + 'entity_type': value.entityType, 'user_id': value.userId, 'message': value.message, 'mentions': value.mentions === undefined ? undefined : ((value.mentions as Array).map(CommentMentionToJSON)), diff --git a/packages/sdk/src/sdk/api/generated/full/models/CommentEntityType.ts b/packages/sdk/src/sdk/api/generated/full/models/CommentEntityType.ts deleted file mode 100644 index 1cb0f2ca916..00000000000 --- a/packages/sdk/src/sdk/api/generated/full/models/CommentEntityType.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -// @ts-nocheck -/** - * API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * 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. - */ - - -/** - * Type of entity that can be commented on - * @export - */ -export const CommentEntityType = { - Track: 'Track' -} as const; -export type CommentEntityType = typeof CommentEntityType[keyof typeof CommentEntityType]; - - -export function CommentEntityTypeFromJSON(json: any): CommentEntityType { - return CommentEntityTypeFromJSONTyped(json, false); -} - -export function CommentEntityTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): CommentEntityType { - return json as CommentEntityType; -} - -export function CommentEntityTypeToJSON(value?: CommentEntityType | null): any { - return value as any; -} - diff --git a/packages/sdk/src/sdk/api/generated/full/models/PlaylistFull.ts b/packages/sdk/src/sdk/api/generated/full/models/PlaylistFull.ts index a2a91186915..26422273a84 100644 --- a/packages/sdk/src/sdk/api/generated/full/models/PlaylistFull.ts +++ b/packages/sdk/src/sdk/api/generated/full/models/PlaylistFull.ts @@ -314,7 +314,7 @@ export interface PlaylistFull { * @type {string} * @memberof PlaylistFull */ - parentalWarningType?: string | null; + parentalWarningType?: string; } /** diff --git a/packages/sdk/src/sdk/api/generated/full/models/PlaylistFullWithoutTracks.ts b/packages/sdk/src/sdk/api/generated/full/models/PlaylistFullWithoutTracks.ts index f95067480c5..c9358f1be61 100644 --- a/packages/sdk/src/sdk/api/generated/full/models/PlaylistFullWithoutTracks.ts +++ b/packages/sdk/src/sdk/api/generated/full/models/PlaylistFullWithoutTracks.ts @@ -314,7 +314,7 @@ export interface PlaylistFullWithoutTracks { * @type {string} * @memberof PlaylistFullWithoutTracks */ - parentalWarningType?: string | null; + parentalWarningType?: string; } /** diff --git a/packages/sdk/src/sdk/api/generated/full/models/ReplyComment.ts b/packages/sdk/src/sdk/api/generated/full/models/ReplyComment.ts index 6cdcc0e7014..19ba5f7be55 100644 --- a/packages/sdk/src/sdk/api/generated/full/models/ReplyComment.ts +++ b/packages/sdk/src/sdk/api/generated/full/models/ReplyComment.ts @@ -14,12 +14,6 @@ */ import { exists, mapValues } from '../runtime'; -import type { CommentEntityType } from './CommentEntityType'; -import { - CommentEntityTypeFromJSON, - CommentEntityTypeFromJSONTyped, - CommentEntityTypeToJSON, -} from './CommentEntityType'; import type { CommentMention } from './CommentMention'; import { CommentMentionFromJSON, @@ -47,10 +41,10 @@ export interface ReplyComment { entityId: string; /** * - * @type {CommentEntityType} + * @type {string} * @memberof ReplyComment */ - entityType: CommentEntityType; + entityType: string; /** * * @type {string} @@ -148,7 +142,7 @@ export function ReplyCommentFromJSONTyped(json: any, ignoreDiscriminator: boolea 'id': json['id'], 'entityId': json['entity_id'], - 'entityType': CommentEntityTypeFromJSON(json['entity_type']), + 'entityType': json['entity_type'], 'userId': json['user_id'], 'message': json['message'], 'mentions': !exists(json, 'mentions') ? undefined : ((json['mentions'] as Array).map(CommentMentionFromJSON)), @@ -174,7 +168,7 @@ export function ReplyCommentToJSON(value?: ReplyComment | null): any { 'id': value.id, 'entity_id': value.entityId, - 'entity_type': CommentEntityTypeToJSON(value.entityType), + 'entity_type': value.entityType, 'user_id': value.userId, 'message': value.message, 'mentions': value.mentions === undefined ? undefined : ((value.mentions as Array).map(CommentMentionToJSON)), diff --git a/packages/sdk/src/sdk/api/generated/full/models/SearchPlaylistFull.ts b/packages/sdk/src/sdk/api/generated/full/models/SearchPlaylistFull.ts index fec116eeba0..68a038cba89 100644 --- a/packages/sdk/src/sdk/api/generated/full/models/SearchPlaylistFull.ts +++ b/packages/sdk/src/sdk/api/generated/full/models/SearchPlaylistFull.ts @@ -314,7 +314,7 @@ export interface SearchPlaylistFull { * @type {string} * @memberof SearchPlaylistFull */ - parentalWarningType?: string | null; + parentalWarningType?: string; } /** diff --git a/packages/sdk/src/sdk/api/generated/full/models/SearchTrackFull.ts b/packages/sdk/src/sdk/api/generated/full/models/SearchTrackFull.ts index 928cb4700e1..115a4150fd5 100644 --- a/packages/sdk/src/sdk/api/generated/full/models/SearchTrackFull.ts +++ b/packages/sdk/src/sdk/api/generated/full/models/SearchTrackFull.ts @@ -518,7 +518,7 @@ export interface SearchTrackFull { * @type {string} * @memberof SearchTrackFull */ - parentalWarningType?: string | null; + parentalWarningType?: string; /** * Whether or not the owner has restricted streaming behind an access gate * @type {boolean} diff --git a/packages/sdk/src/sdk/api/generated/full/models/TrackFull.ts b/packages/sdk/src/sdk/api/generated/full/models/TrackFull.ts index effcff618ac..e5dcdd01da7 100644 --- a/packages/sdk/src/sdk/api/generated/full/models/TrackFull.ts +++ b/packages/sdk/src/sdk/api/generated/full/models/TrackFull.ts @@ -518,7 +518,7 @@ export interface TrackFull { * @type {string} * @memberof TrackFull */ - parentalWarningType?: string | null; + parentalWarningType?: string; /** * Whether or not the owner has restricted streaming behind an access gate * @type {boolean} diff --git a/packages/sdk/src/sdk/api/generated/full/models/index.ts b/packages/sdk/src/sdk/api/generated/full/models/index.ts index 2fccf1ba452..0c5cc96ca24 100644 --- a/packages/sdk/src/sdk/api/generated/full/models/index.ts +++ b/packages/sdk/src/sdk/api/generated/full/models/index.ts @@ -47,7 +47,6 @@ export * from './CollectionActivityFull'; export * from './CollectionActivityFullWithoutTracks'; export * from './CollectionLibraryResponseFull'; export * from './Comment'; -export * from './CommentEntityType'; export * from './CommentMention'; export * from './CommentMentionNotification'; export * from './CommentMentionNotificationAction'; diff --git a/packages/sdk/src/sdk/api/grants/GrantsApi.ts b/packages/sdk/src/sdk/api/grants/GrantsApi.ts index fa76a10671b..b40563fb798 100644 --- a/packages/sdk/src/sdk/api/grants/GrantsApi.ts +++ b/packages/sdk/src/sdk/api/grants/GrantsApi.ts @@ -1,33 +1,19 @@ -import type { - AddManagerRequest as GeneratedAddManagerRequest, - ApproveGrantRequest as GeneratedApproveGrantRequest, - Configuration, - CreateGrantRequest as GeneratedCreateGrantRequest, - RemoveManagerRequest as GeneratedRemoveManagerRequest, - RevokeGrantRequest as GeneratedRevokeGrantRequest, - User, - UsersApi -} from '../../api/generated/default' +import type { UsersApi, Configuration, User } from '../../api/generated/default' import type { EntityManagerService } from '../../services' -import { - Action, - AdvancedOptions, - EntityType -} from '../../services/EntityManager/types' +import { Action, EntityType } from '../../services/EntityManager/types' import { encodeHashId } from '../../utils/hashId' import { parseParams } from '../../utils/parseParams' import { - AddManagerSchema, ApproveGrantSchema, + ApproveGrantRequest, + AddManagerRequest, + AddManagerSchema, + CreateGrantRequest, CreateGrantSchema, - RemoveManagerSchema, + RevokeGrantRequest, RevokeGrantSchema, - type EntityManagerAddManagerRequest, - type EntityManagerApproveGrantRequest, - type EntityManagerCreateGrantRequest, - type EntityManagerRemoveManagerRequest, - type EntityManagerRevokeGrantRequest + RemoveManagerRequest } from './types' export class GrantsApi { @@ -38,10 +24,11 @@ export class GrantsApi { private readonly usersApi: UsersApi ) {} - async createGrantWithEntityManager( - params: EntityManagerCreateGrantRequest, - advancedOptions?: AdvancedOptions - ) { + /** + * When user authorizes app to perform actions on their behalf. + * For user-to-user grants, use `addManager`. + */ + async createGrant(params: CreateGrantRequest) { const { userId, appApiKey } = await parseParams( 'createGrant', CreateGrantSchema @@ -50,122 +37,89 @@ export class GrantsApi { return await this.entityManager.manageEntity({ userId, entityType: EntityType.GRANT, - entityId: 0, + entityId: 0, // Contract requires uint, but we don't actually need this field for this action. Just use 0. action: Action.CREATE, metadata: JSON.stringify({ grantee_address: `0x${appApiKey}` - }), - ...advancedOptions + }) }) } - async createGrant( - params: EntityManagerCreateGrantRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - return await this.createGrantWithEntityManager(params) - } - const { userId, appApiKey } = await parseParams( - 'createGrant', - CreateGrantSchema - )(params) - const request: GeneratedCreateGrantRequest = { - id: encodeHashId(userId)!, - createGrantRequestBody: { appApiKey } - } - return await this.usersApi.createGrant(request, requestInit) - } - - async addManagerWithEntityManager( - params: EntityManagerAddManagerRequest, - advancedOptions?: AdvancedOptions - ) { + /** + * When user authorizes another user to perform actions on their behalf. + * The grant has to be approved by the proposed manager. + */ + async addManager(params: AddManagerRequest) { const { userId, managerUserId } = await parseParams( 'addManager', AddManagerSchema )(params) - const managerUser = await this.getManagerUser(managerUserId, 'addManager') + let managerUser: User | undefined + try { + managerUser = ( + await this.usersApi.getUser({ + id: encodeHashId(managerUserId)! + }) + ).data + if (!managerUser) { + throw new Error() + } + } catch (e) { + throw new Error( + '`managerUserId` passed to `addManager` method is invalid.' + ) + } return await this.entityManager.manageEntity({ userId, entityType: EntityType.GRANT, - entityId: 0, + entityId: 0, // Contract requires uint, but we don't actually need this field for this action. Just use 0. action: Action.CREATE, metadata: JSON.stringify({ - grantee_address: managerUser.ercWallet - }), - ...advancedOptions + grantee_address: managerUser!.ercWallet + }) }) } - async addManager( - params: EntityManagerAddManagerRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - return await this.addManagerWithEntityManager(params) - } + /** + * Revokes a user's manager access - can either be called by the manager user or the child user + */ + async removeManager(params: RemoveManagerRequest) { const { userId, managerUserId } = await parseParams( 'addManager', AddManagerSchema )(params) - const request: GeneratedAddManagerRequest = { - id: encodeHashId(userId)!, - addManagerRequestBody: { - managerUserId: encodeHashId(managerUserId)! + let managerUser: User | undefined + try { + managerUser = ( + await this.usersApi.getUser({ + id: encodeHashId(managerUserId)! + }) + ).data + if (!managerUser) { + throw new Error() } + } catch (e) { + throw new Error( + '`managerUserId` passed to `removeManager` method is invalid.' + ) } - return await this.usersApi.addManager(request, requestInit) - } - - async removeManagerWithEntityManager( - params: EntityManagerRemoveManagerRequest, - advancedOptions?: AdvancedOptions - ) { - const { userId, managerUserId } = await parseParams( - 'removeManager', - RemoveManagerSchema - )(params) - const managerUser = await this.getManagerUser( - managerUserId, - 'removeManager' - ) return await this.entityManager.manageEntity({ userId, entityType: EntityType.GRANT, - entityId: 0, + entityId: 0, // Contract requires uint, but we don't actually need this field for this action. Just use 0. action: Action.DELETE, metadata: JSON.stringify({ - grantee_address: managerUser.ercWallet - }), - ...advancedOptions + grantee_address: managerUser!.ercWallet + }) }) } - async removeManager( - params: EntityManagerRemoveManagerRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - return await this.removeManagerWithEntityManager(params) - } - const { userId, managerUserId } = await parseParams( - 'removeManager', - RemoveManagerSchema - )(params) - const request: GeneratedRemoveManagerRequest = { - id: encodeHashId(userId)!, - managerUserId: encodeHashId(managerUserId)! - } - return await this.usersApi.removeManager(request, requestInit) - } - - async revokeGrantWithEntityManager( - params: EntityManagerRevokeGrantRequest, - advancedOptions?: AdvancedOptions - ) { + /** + * When user revokes an app's authorization to perform actions on their behalf + */ + async revokeGrant(params: RevokeGrantRequest) { const { userId, appApiKey } = await parseParams( 'revokeGrant', RevokeGrantSchema @@ -174,37 +128,18 @@ export class GrantsApi { return await this.entityManager.manageEntity({ userId, entityType: EntityType.GRANT, - entityId: 0, + entityId: 0, // Contract requires uint, but we don't actually need this field for this action. Just use 0. action: Action.DELETE, metadata: JSON.stringify({ grantee_address: `0x${appApiKey}` - }), - ...advancedOptions + }) }) } - async revokeGrant( - params: EntityManagerRevokeGrantRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - return await this.revokeGrantWithEntityManager(params) - } - const { userId, appApiKey } = await parseParams( - 'revokeGrant', - RevokeGrantSchema - )(params) - const request: GeneratedRevokeGrantRequest = { - id: encodeHashId(userId)!, - address: appApiKey - } - return await this.usersApi.revokeGrant(request, requestInit) - } - - async approveGrantWithEntityManager( - params: EntityManagerApproveGrantRequest, - advancedOptions?: AdvancedOptions - ) { + /** + * Approve manager request + */ + async approveGrant(params: ApproveGrantRequest) { const { userId, grantorUserId } = await parseParams( 'approveGrant', ApproveGrantSchema @@ -217,45 +152,7 @@ export class GrantsApi { action: Action.APPROVE, metadata: JSON.stringify({ grantor_user_id: grantorUserId - }), - ...advancedOptions - }) - } - - async approveGrant( - params: EntityManagerApproveGrantRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - return await this.approveGrantWithEntityManager(params) - } - const { userId, grantorUserId } = await parseParams( - 'approveGrant', - ApproveGrantSchema - )(params) - const request: GeneratedApproveGrantRequest = { - id: encodeHashId(userId)!, - approveGrantRequestBody: { - grantorUserId: encodeHashId(grantorUserId)! - } - } - return await this.usersApi.approveGrant(request, requestInit) - } - - private async getManagerUser( - managerUserId: number, - operation: string - ): Promise { - const managerUser = ( - await this.usersApi.getUser({ - id: encodeHashId(managerUserId)! }) - ).data - if (!managerUser?.ercWallet) { - throw new Error( - `\`managerUserId\` passed to \`${operation}\` method is invalid.` - ) - } - return managerUser + }) } } diff --git a/packages/sdk/src/sdk/api/grants/types.ts b/packages/sdk/src/sdk/api/grants/types.ts index 47bbb2ff45e..415170edb31 100644 --- a/packages/sdk/src/sdk/api/grants/types.ts +++ b/packages/sdk/src/sdk/api/grants/types.ts @@ -10,23 +10,21 @@ export const CreateGrantSchema = z.object({ }) }) -export type EntityManagerCreateGrantRequest = z.input +export type CreateGrantRequest = z.input export const AddManagerSchema = z.object({ userId: HashId, managerUserId: HashId }) -export type EntityManagerAddManagerRequest = z.input +export type AddManagerRequest = z.input export const RemoveManagerSchema = z.object({ userId: HashId, managerUserId: HashId }) -export type EntityManagerRemoveManagerRequest = z.input< - typeof RemoveManagerSchema -> +export type RemoveManagerRequest = z.input export const RevokeGrantSchema = z.object({ userId: HashId, @@ -35,19 +33,11 @@ export const RevokeGrantSchema = z.object({ }) }) -export type EntityManagerRevokeGrantRequest = z.input +export type RevokeGrantRequest = z.input export const ApproveGrantSchema = z.object({ userId: HashId, grantorUserId: HashId }) -export type EntityManagerApproveGrantRequest = z.input< - typeof ApproveGrantSchema -> - -export type CreateGrantRequest = EntityManagerCreateGrantRequest -export type AddManagerRequest = EntityManagerAddManagerRequest -export type RemoveManagerRequest = EntityManagerRemoveManagerRequest -export type RevokeGrantRequest = EntityManagerRevokeGrantRequest -export type ApproveGrantRequest = EntityManagerApproveGrantRequest +export type ApproveGrantRequest = z.input diff --git a/packages/sdk/src/sdk/api/playlists/PlaylistsApi.test.ts b/packages/sdk/src/sdk/api/playlists/PlaylistsApi.test.ts index 921a4f9865c..e0d7e23b30c 100644 --- a/packages/sdk/src/sdk/api/playlists/PlaylistsApi.test.ts +++ b/packages/sdk/src/sdk/api/playlists/PlaylistsApi.test.ts @@ -8,7 +8,9 @@ import { EntityManagerClient } from '../../services/EntityManager' import { Logger } from '../../services/Logger' import { Storage } from '../../services/Storage' import { StorageNodeSelector } from '../../services/StorageNodeSelector' -import { Configuration, Mood, Genre } from '../generated/default' +import { Genre } from '../../types/Genre' +import { Mood } from '../../types/Mood' +import { Configuration } from '../generated/default' import { PlaylistsApi as GeneratedPlaylistsApi } from '../generated/default/apis/PlaylistsApi' import { TrackUploadHelper } from '../tracks/TrackUploadHelper' @@ -133,14 +135,9 @@ describe('PlaylistsApi', () => { name: 'coverArt' }, metadata: { - playlistName: 'My Playlist', - playlistContents: [ - { - trackId: 'yyNwXq7', - timestamp: 1 - } - ] - } + playlistName: 'My Playlist' + }, + trackIds: ['yyNwXq7'] }) expect(result).toStrictEqual({ @@ -158,14 +155,8 @@ describe('PlaylistsApi', () => { buffer: pngFile, name: 'coverArt' }, - metadata: { - playlistContents: [ - { - trackId: 'yyNwXq7', - timestamp: 1 - } - ] - } as any + metadata: {} as any, + trackIds: ['yyNwXq7'] }) }).rejects.toThrow() }) @@ -181,8 +172,8 @@ describe('PlaylistsApi', () => { }, metadata: { playlistName: 'My Playlist', - genre: Genre.Acoustic, - mood: Mood.Tender + genre: Genre.ACOUSTIC, + mood: Mood.TENDER }, trackMetadatas: [ { @@ -309,7 +300,7 @@ describe('PlaylistsApi', () => { }, metadata: { playlistName: 'My Playlist edited', - mood: Mood.Tender, + mood: Mood.TENDER, playlistContents: [] } }) @@ -331,8 +322,8 @@ describe('PlaylistsApi', () => { }, metadata: { playlistName: 'My Playlist edited', - playlistMood: Mood.Tender, - mod: Mood.Tender + playlistMood: Mood.TENDER, + mod: Mood.TENDER } as any }) }).rejects.toThrow() diff --git a/packages/sdk/src/sdk/api/playlists/PlaylistsApi.ts b/packages/sdk/src/sdk/api/playlists/PlaylistsApi.ts index 6f8e04fc68f..160000c5848 100644 --- a/packages/sdk/src/sdk/api/playlists/PlaylistsApi.ts +++ b/packages/sdk/src/sdk/api/playlists/PlaylistsApi.ts @@ -10,53 +10,42 @@ import { AdvancedOptions } from '../../services/EntityManager/types' import type { LoggerService } from '../../services/Logger' -import { decodeHashId, encodeHashId } from '../../utils/hashId' +import { encodeHashId } from '../../utils/hashId' import { parseParams } from '../../utils/parseParams' import { retry3 } from '../../utils/retry' import { Configuration, - PlaylistsApi as GeneratedPlaylistsApi, - TracksApi, - type DeletePlaylistRequest, - type RepostPlaylistRequest, - type UnrepostPlaylistRequest, - type FavoritePlaylistRequest, - type UnfavoritePlaylistRequest, - type SharePlaylistRequest, - type UpdateTrackRequestBody, - type CreateTrackRequestBody + PlaylistsApi as GeneratedPlaylistsApi } from '../generated/default' import { TrackUploadHelper } from '../tracks/TrackUploadHelper' import { AddTrackToPlaylistRequest, AddTrackToPlaylistSchema, + CreatePlaylistRequest, CreatePlaylistSchema, - EntityManagerDeletePlaylistRequest, + DeletePlaylistRequest, DeletePlaylistSchema, PlaylistMetadata, + PlaylistTrackMetadata, PublishPlaylistRequest, PublishPlaylistSchema, RemoveTrackFromPlaylistRequest, RemoveTrackFromPlaylistSchema, - EntityManagerRepostPlaylistRequest, + RepostPlaylistRequest, RepostPlaylistSchema, - EntityManagerUnrepostPlaylistRequest, - UnrepostPlaylistSchema, - EntityManagerFavoritePlaylistRequest, + FavoritePlaylistRequest, FavoritePlaylistSchema, - EntityManagerUnfavoritePlaylistRequest, + UnrepostPlaylistSchema, + UnfavoritePlaylistRequest, UnfavoritePlaylistSchema, + UpdatePlaylistRequest, + UploadPlaylistRequest, UploadPlaylistSchema, UpdatePlaylistSchema, UpdatePlaylistMetadataSchema, - EntityManagerSharePlaylistRequest, - SharePlaylistSchema, - EntityManagerCreatePlaylistRequest, - EntityManagerUpdatePlaylistRequest, - type UpdatePlaylistRequestWithImage, - type CreatePlaylistRequestWithFiles, - type UploadPlaylistRequest + SharePlaylistRequest, + SharePlaylistSchema } from './types' // Returns current timestamp in seconds, which is the expected @@ -68,7 +57,6 @@ const getCurrentTimestamp = () => { export class PlaylistsApi extends GeneratedPlaylistsApi { private readonly trackUploadHelper: TrackUploadHelper - private readonly tracksApi: TracksApi constructor( configuration: Configuration, private readonly storage: StorageService, @@ -76,7 +64,6 @@ export class PlaylistsApi extends GeneratedPlaylistsApi { private readonly logger: LoggerService ) { super(configuration) - this.tracksApi = new TracksApi(configuration) this.trackUploadHelper = new TrackUploadHelper(configuration) this.logger = logger.createPrefixedLogger('[playlists-api]') } @@ -84,8 +71,8 @@ export class PlaylistsApi extends GeneratedPlaylistsApi { /** @hidden * Create a playlist from existing tracks */ - async createPlaylistWithEntityManager( - params: EntityManagerCreatePlaylistRequest, + async createPlaylist( + params: CreatePlaylistRequest, advancedOptions?: AdvancedOptions ) { // Parse inputs @@ -98,172 +85,22 @@ export class PlaylistsApi extends GeneratedPlaylistsApi { return await this.createPlaylistInternal(parsedParameters, advancedOptions) } - override async createPlaylist( - params: CreatePlaylistRequestWithFiles, - requestInit?: RequestInit - ) { - if (this.entityManager) { - const { metadata } = params - return await this.createPlaylistWithEntityManager({ - userId: params.userId, - metadata - }) - } - return super.createPlaylist(params, requestInit) - } - /** @hidden * Upload a playlist * Uploads the specified tracks and combines them into a playlist */ async uploadPlaylist( params: UploadPlaylistRequest, - requestInit?: RequestInit + advancedOptions?: AdvancedOptions ) { - const { metadata: playlistMetadata, trackMetadatas } = params - const { userId, imageFile, audioFiles, onProgress } = await parseParams( + // Parse inputs + const parsedParameters = await parseParams( 'uploadPlaylist', UploadPlaylistSchema )(params) - const progresses = audioFiles.map(() => 0) - const [imageUploadResponse, ...audioUploadResponses] = await Promise.all([ - params.imageFile && - this.storage - .uploadFile({ - file: imageFile, - onProgress: (event) => - onProgress?.(event.loaded / event.total, { - ...event, - key: 'image' - }), - metadata: { - template: 'img_square' - } - }) - .start(), - ...audioFiles.map((trackFile, idx) => - this.storage - .uploadFile({ - file: trackFile, - onProgress: (progress) => { - progresses[idx] = - (progress.loaded / progress.total) * 0.5 + - progress.transcode * 0.5 - const overallProgress = - progresses.reduce((a, b) => a + b, 0) / audioFiles.length - onProgress?.(overallProgress, { - ...progress, - key: idx - }) - }, - metadata: { - template: 'audio', - placementHosts: trackMetadatas[idx]?.placementHosts, - previewStartSeconds: trackMetadatas[idx]?.previewStartSeconds - } - }) - .start() - ) - ]) - - // Write tracks to chain - const trackIds = await Promise.all( - trackMetadatas.map(async (t, i) => { - // Transform track metadata - const trackMetadata = this.combineMetadata( - this.trackUploadHelper.transformTrackUploadMetadataV2(t, userId), - playlistMetadata - ) - - const audioResponse = audioUploadResponses[i] - - if (!audioResponse) { - throw new Error(`Failed to upload track: ${t.title}`) - } - - // Update metadata to include uploaded CIDs - const updatedMetadata = - this.trackUploadHelper.populateTrackMetadataWithUploadResponseV2( - trackMetadata, - audioResponse, - imageUploadResponse - ) as CreateTrackRequestBody - - if (this.entityManager) { - const trackId = await this.trackUploadHelper.generateId('track') - await this.entityManager.manageEntity({ - userId, - entityType: EntityType.TRACK, - entityId: trackId, - action: Action.CREATE, - metadata: JSON.stringify({ - cid: '', - data: snakecaseKeys(updatedMetadata) - }) - }) - - return trackId - } - - const res = await this.tracksApi.createTrack( - { - userId: encodeHashId(userId)!, - metadata: updatedMetadata - }, - requestInit - ) - return decodeHashId(res.trackId!)! - }) - ) - - const timestamp = getCurrentTimestamp() - - if (this.entityManager) { - // Update metadata to include track ids - const updatedMetadata = { - ...params.metadata, - playlistContents: (trackIds ?? []).map((trackId) => ({ - trackId, - timestamp - })), - playlistImageSizesMultihash: imageUploadResponse?.orig_file_cid - } - const playlistId = await this.generatePlaylistId() - // Write playlist metadata to chain - const response = await this.entityManager.manageEntity({ - userId, - entityType: EntityType.PLAYLIST, - entityId: playlistId, - action: Action.CREATE, - metadata: JSON.stringify({ - cid: '', - data: snakecaseKeys(updatedMetadata) - }) - }) - - return { - ...response, - playlistId: encodeHashId(playlistId) - } - } - - // Update metadata to include track ids - const updatedMetadata = { - ...params.metadata, - playlistContents: (trackIds ?? []).map((trackId) => ({ - trackId: encodeHashId(trackId)!, - timestamp - })), - playlistImageSizesMultihash: imageUploadResponse?.orig_file_cid - } - return super.createPlaylist( - { - userId: encodeHashId(userId)!, - metadata: updatedMetadata - }, - requestInit - ) + // Call uploadPlaylistInternal with parsed inputs + return await this.uploadPlaylistInternal(parsedParameters, advancedOptions) } /** @hidden @@ -359,8 +196,8 @@ export class PlaylistsApi extends GeneratedPlaylistsApi { /** @hidden * Update a playlist */ - async updatePlaylistWithEntityManager( - params: EntityManagerUpdatePlaylistRequest, + async updatePlaylist( + params: UpdatePlaylistRequest, advancedOptions?: AdvancedOptions ) { // Parse inputs @@ -369,57 +206,15 @@ export class PlaylistsApi extends GeneratedPlaylistsApi { UpdatePlaylistSchema )(params) - return await this.entityManager.manageEntity({ - userId: parsedParameters.userId, - entityType: EntityType.PLAYLIST, - entityId: parsedParameters.playlistId, - action: Action.UPDATE, - metadata: JSON.stringify({ - cid: '', - data: snakecaseKeys(parsedParameters.metadata) - }), - ...advancedOptions - }) - } - - override async updatePlaylist( - params: UpdatePlaylistRequestWithImage, - requestInit?: RequestInit - ) { - // Upload art - const metadata = params.metadata - if (params.imageFile) { - const res = await this.storage - .uploadFile({ - file: params.imageFile, - onProgress: (event) => - params.onProgress?.(event.loaded / event.total, { - ...event, - key: 'image' - }), - metadata: { - template: 'img_square' - } - }) - .start() - metadata.coverArtCid = res.orig_file_cid - } - - if (this.entityManager) { - return await this.updatePlaylistWithEntityManager({ - userId: params.userId, - playlistId: params.playlistId, - metadata - }) - } - return super.updatePlaylist(params, requestInit) + // Call updatePlaylistInternal with parsed inputs + return await this.updatePlaylistInternal(parsedParameters, advancedOptions) } /** @hidden * Delete a playlist */ - async deletePlaylistWithEntityManager( - params: EntityManagerDeletePlaylistRequest, + async deletePlaylist( + params: DeletePlaylistRequest, advancedOptions?: AdvancedOptions ) { // Parse inputs @@ -437,21 +232,11 @@ export class PlaylistsApi extends GeneratedPlaylistsApi { }) } - override async deletePlaylist( - params: DeletePlaylistRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - return await this.deletePlaylistWithEntityManager(params) - } - return super.deletePlaylist(params, requestInit) - } - /** @hidden * Favorite a playlist */ - async favoritePlaylistWithEntityManager( - params: EntityManagerFavoritePlaylistRequest, + async favoritePlaylist( + params: FavoritePlaylistRequest, advancedOptions?: AdvancedOptions ) { // Parse inputs @@ -470,21 +255,11 @@ export class PlaylistsApi extends GeneratedPlaylistsApi { }) } - override async favoritePlaylist( - params: FavoritePlaylistRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - return await this.favoritePlaylistWithEntityManager(params) - } - return super.favoritePlaylist(params, requestInit) - } - /** @hidden * Unfavorite a playlist */ - async unfavoritePlaylistWithEntityManager( - params: EntityManagerUnfavoritePlaylistRequest, + async unfavoritePlaylist( + params: UnfavoritePlaylistRequest, advancedOptions?: AdvancedOptions ) { // Parse inputs @@ -502,26 +277,16 @@ export class PlaylistsApi extends GeneratedPlaylistsApi { }) } - override async unfavoritePlaylist( - params: UnfavoritePlaylistRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - return await this.unfavoritePlaylistWithEntityManager(params) - } - return super.unfavoritePlaylist(params, requestInit) - } - /** @hidden * Repost a playlist */ - async repostPlaylistWithEntityManager( - params: EntityManagerRepostPlaylistRequest, + async repostPlaylist( + params: RepostPlaylistRequest, advancedOptions?: AdvancedOptions ) { // Parse inputs const { userId, playlistId, metadata } = await parseParams( - 'repostPlaylist', + 'respostPlaylist', RepostPlaylistSchema )(params) @@ -535,27 +300,11 @@ export class PlaylistsApi extends GeneratedPlaylistsApi { }) } - override async repostPlaylist( - params: RepostPlaylistRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - // Map repostRequestBody (generated API) to metadata (entity manager schema) - const entityManagerParams = { - playlistId: params.playlistId, - userId: params.userId, - metadata: params.repostRequestBody - } - return await this.repostPlaylistWithEntityManager(entityManagerParams) - } - return super.repostPlaylist(params, requestInit) - } - /** @hidden * Unrepost a playlist */ - async unrepostPlaylistWithEntityManager( - params: EntityManagerUnrepostPlaylistRequest, + async unrepostPlaylist( + params: FavoritePlaylistRequest, advancedOptions?: AdvancedOptions ) { // Parse inputs @@ -573,21 +322,11 @@ export class PlaylistsApi extends GeneratedPlaylistsApi { }) } - override async unrepostPlaylist( - params: UnrepostPlaylistRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - return await this.unrepostPlaylistWithEntityManager(params) - } - return super.unrepostPlaylist(params, requestInit) - } - /** @hidden * Share a playlist */ - async sharePlaylistWithEntityManager( - params: EntityManagerSharePlaylistRequest, + async sharePlaylist( + params: SharePlaylistRequest, advancedOptions?: AdvancedOptions ) { // Parse inputs @@ -605,23 +344,14 @@ export class PlaylistsApi extends GeneratedPlaylistsApi { }) } - override async sharePlaylist( - params: SharePlaylistRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - return await this.sharePlaylistWithEntityManager(params) - } - return super.sharePlaylist(params, requestInit) - } - /** @internal * Combines the metadata for a track and a collection (playlist or album), * taking the metadata from the playlist when the track is missing it. */ - private combineMetadata< - T extends CreateTrackRequestBody | UpdateTrackRequestBody - >(trackMetadata: T, playlistMetadata: PlaylistMetadata) { + private combineMetadata( + trackMetadata: PlaylistTrackMetadata, + playlistMetadata: PlaylistMetadata + ) { const metadata = trackMetadata if (!metadata.mood) metadata.mood = playlistMetadata.mood @@ -655,8 +385,8 @@ export class PlaylistsApi extends GeneratedPlaylistsApi { userId: string playlistId: string updateMetadata: ( - fetchedMetadata: EntityManagerUpdatePlaylistRequest['metadata'] - ) => EntityManagerUpdatePlaylistRequest['metadata'] + fetchedMetadata: UpdatePlaylistRequest['metadata'] + ) => UpdatePlaylistRequest['metadata'] }, advancedOptions?: AdvancedOptions ) { @@ -675,32 +405,220 @@ export class PlaylistsApi extends GeneratedPlaylistsApi { UpdatePlaylistMetadataSchema.shape ) - const picked = pick(playlist, supportedUpdateFields) as Record< - string, - unknown - > - const metadataForUpdate: EntityManagerUpdatePlaylistRequest['metadata'] = { - ...picked, - ...(picked.releaseDate != null - ? { - releaseDate: - typeof picked.releaseDate === 'string' - ? new Date(picked.releaseDate) - : (picked.releaseDate as Date) - } - : {}) - } - - return await this.updatePlaylistWithEntityManager( + return await this.updatePlaylist( { userId, playlistId, - metadata: updateMetadata(metadataForUpdate) + metadata: updateMetadata(pick(playlist, supportedUpdateFields)) }, advancedOptions ) } + /** @internal + * Method to upload a playlist with already parsed inputs + * This is used for both playlists and albums + */ + public async uploadPlaylistInternal( + { + userId, + imageFile, + audioFiles, + onProgress, + metadata, + trackMetadatas + }: z.infer & { + metadata: Metadata + }, + advancedOptions?: AdvancedOptions + ) { + const progresses = audioFiles.map(() => 0) + // Upload track audio and cover art to storage node + const [coverArtResponse, ...audioResponses] = await Promise.all([ + retry3( + async () => + await this.storage + .uploadFile({ + file: imageFile, + onProgress: (progress) => + onProgress?.( + progresses.reduce((a, b) => a + b, 0) / audioFiles.length, + { ...progress, key: 'image' } + ), + metadata: { + template: 'img_square' + } + }) + .start(), + (e) => { + this.logger.info('Retrying uploadPlaylistCoverArt', e) + } + ), + ...audioFiles.map( + async (trackFile, idx) => + await retry3( + async () => + await this.storage + .uploadFile({ + file: trackFile, + onProgress: (progress) => { + progresses[idx] = + (progress.loaded / progress.total) * 0.5 + + progress.transcode * 0.5 + const overallProgress = + progresses.reduce((a, b) => a + b, 0) / audioFiles.length + onProgress?.(overallProgress, { + ...progress, + key: idx + }) + }, + metadata: { + template: 'audio', + ...this.trackUploadHelper.extractMediorumUploadOptions( + trackMetadatas[idx]! + ) + } + }) + .start(), + (e) => { + this.logger.info('Retrying uploadTrackAudio', e) + } + ) + ) + ]) + + // Write tracks to chain + const trackIds = await Promise.all( + trackMetadatas.map(async (parsedTrackMetadata, i) => { + // Transform track metadata + const trackMetadata = this.combineMetadata( + this.trackUploadHelper.transformTrackUploadMetadata( + parsedTrackMetadata, + userId + ), + metadata + ) + + const audioResponse = audioResponses[i] + + if (!audioResponse) { + throw new Error(`Failed to upload track: ${trackMetadata.title}`) + } + + // Update metadata to include uploaded CIDs + const updatedMetadata = + this.trackUploadHelper.populateTrackMetadataWithUploadResponse( + trackMetadata, + audioResponse, + coverArtResponse + ) + + const trackId = await this.trackUploadHelper.generateId('track') + await this.entityManager.manageEntity({ + userId, + entityType: EntityType.TRACK, + entityId: trackId, + action: Action.CREATE, + metadata: JSON.stringify({ + cid: '', + data: snakecaseKeys(updatedMetadata) + }), + ...advancedOptions + }) + + return trackId + }) + ) + + const playlistId = await this.trackUploadHelper.generateId('playlist') + const timestamp = getCurrentTimestamp() + + // Update metadata to include track ids and cover art cid + const updatedMetadata = { + ...metadata, + isPrivate: false, + playlistContents: trackIds.map((trackId) => ({ + trackId, + timestamp + })), + playlistImageSizesMultihash: coverArtResponse?.orig_file_cid + } + + // Write playlist metadata to chain + const response = await this.entityManager.manageEntity({ + userId, + entityType: EntityType.PLAYLIST, + entityId: playlistId, + action: Action.CREATE, + metadata: JSON.stringify({ + cid: '', + data: snakecaseKeys(updatedMetadata) + }), + ...advancedOptions + }) + return { + ...response, + playlistId: encodeHashId(playlistId) + } + } + + /** @internal + * Method to update a playlist with already parsed inputs + * This is used for both playlists and albums + */ + public async updatePlaylistInternal< + Metadata extends Partial + >( + { + userId, + playlistId, + imageFile, + onProgress, + metadata + }: z.infer & { + metadata: Metadata + }, + advancedOptions?: AdvancedOptions + ) { + // Upload cover art to storage node + const coverArtResponse = + imageFile && + (await retry3( + async () => + await this.storage + .uploadFile({ + file: imageFile, + onProgress, + metadata: { + template: 'img_square' + } + }) + .start(), + (e) => { + this.logger.info('Retrying uploadPlaylistCoverArt', e) + } + )) + + const updatedMetadata = { + ...metadata, + ...(coverArtResponse + ? { playlistImageSizesMultihash: coverArtResponse.orig_file_cid } + : {}) + } + + return await this.entityManager.manageEntity({ + userId, + entityType: EntityType.PLAYLIST, + entityId: playlistId, + action: Action.UPDATE, + metadata: JSON.stringify({ + cid: '', + data: snakecaseKeys(updatedMetadata) + }), + ...advancedOptions + }) + } + /** @internal * Method to create a playlist with already parsed inputs * This is used for both playlists and albums @@ -763,7 +681,7 @@ export class PlaylistsApi extends GeneratedPlaylistsApi { return { ...response, - playlistId: encodeHashId(playlistId) ?? undefined + playlistId: encodeHashId(playlistId) } } diff --git a/packages/sdk/src/sdk/api/playlists/types.ts b/packages/sdk/src/sdk/api/playlists/types.ts index 18e549b79c7..25e147c85e4 100644 --- a/packages/sdk/src/sdk/api/playlists/types.ts +++ b/packages/sdk/src/sdk/api/playlists/types.ts @@ -1,15 +1,14 @@ import { z } from 'zod' -import { ProgressEventSchema } from '../../services/Storage/types' +import { + ProgressEventHandlerSchema, + ProgressEventSchema +} from '../../services/Storage/types' import { DDEXResourceContributor, DDEXCopyright } from '../../types/DDEX' import { AudioFile, ImageFile } from '../../types/File' +import { Genre } from '../../types/Genre' import { HashId } from '../../types/HashId' -import { - Genre, - Mood, - type CreatePlaylistRequest, - type UpdatePlaylistRequest -} from '../generated/default' +import { Mood } from '../../types/Mood' import { UploadTrackMetadataSchema } from '../tracks/types' const CreatePlaylistMetadataSchema = z @@ -17,7 +16,6 @@ const CreatePlaylistMetadataSchema = z description: z.optional(z.string().max(1000)), playlistName: z.string(), isPrivate: z.optional(z.boolean()), - isAlbum: z.optional(z.boolean()), coverArtCid: z.optional(z.string()), license: z.optional(z.string()), mood: z.optional(z.enum(Object.values(Mood) as [Mood, ...Mood[]])), @@ -49,9 +47,7 @@ export const CreatePlaylistSchema = z }) .strict() -export type EntityManagerCreatePlaylistRequest = z.input< - typeof CreatePlaylistSchema -> +export type CreatePlaylistRequest = z.input export const UploadPlaylistMetadataSchema = CreatePlaylistMetadataSchema.extend( { @@ -73,6 +69,35 @@ const PlaylistTrackMetadataSchema = UploadTrackMetadataSchema.partial({ */ export type PlaylistTrackMetadata = z.infer +export const UpdatePlaylistMetadataSchema = + UploadPlaylistMetadataSchema.partial() + .merge( + z.object({ + isPrivate: z.optional(z.boolean()), + playlistContents: z.optional( + z.array( + z.object({ + timestamp: z.number(), + metadataTimestamp: z.optional(z.number()), + trackId: HashId + }) + ) + ), + coverArtCid: z.optional(z.string()) + }) + ) + .strict() + +export const UpdatePlaylistSchema = z + .object({ + userId: HashId, + playlistId: HashId, + imageFile: z.optional(ImageFile), + metadata: UpdatePlaylistMetadataSchema, + onProgress: ProgressEventHandlerSchema.optional() + }) + .strict() + export const UploadPlaylistProgressEventSchema = ProgressEventSchema.extend({ /** * Index of the track being uploaded in the playlist tracks array, or 'image' if for the image @@ -117,6 +142,8 @@ export const UploadPlaylistSchema = z }) .strict() +export type UpdatePlaylistRequest = z.input + export type UploadPlaylistRequest = Omit< z.input, 'onProgress' @@ -124,50 +151,6 @@ export type UploadPlaylistRequest = Omit< onProgress?: UploadPlaylistProgressHandler } -export const UpdatePlaylistMetadataSchema = - UploadPlaylistMetadataSchema.partial() - .merge( - z.object({ - isPrivate: z.optional(z.boolean()), - playlistContents: z.optional( - z.array( - z.object({ - timestamp: z.number(), - metadataTimestamp: z.optional(z.number()), - trackId: HashId - }) - ) - ), - coverArtCid: z.optional(z.string()) - }) - ) - .strict() - -export const UpdatePlaylistSchema = z - .object({ - userId: HashId, - playlistId: HashId, - imageFile: z.optional(ImageFile), - metadata: UpdatePlaylistMetadataSchema, - onProgress: UploadPlaylistProgressHandlerSchema.optional() - }) - .strict() - -export type EntityManagerUpdatePlaylistRequest = z.input< - typeof UpdatePlaylistSchema -> - -export type PlaylistImageParameters = { - imageFile?: z.input - onProgress?: UploadPlaylistProgressHandler -} - -export type CreatePlaylistRequestWithFiles = CreatePlaylistRequest & - PlaylistImageParameters - -export type UpdatePlaylistRequestWithImage = UpdatePlaylistRequest & - PlaylistImageParameters - export const PublishPlaylistSchema = z .object({ userId: HashId, @@ -206,9 +189,7 @@ export const DeletePlaylistSchema = z }) .strict() -export type EntityManagerDeletePlaylistRequest = z.input< - typeof DeletePlaylistSchema -> +export type DeletePlaylistRequest = z.input export const FavoritePlaylistSchema = z .object({ @@ -221,16 +202,14 @@ export const FavoritePlaylistSchema = z * Is this a save of a repost? Used to dispatch notifications * when a user favorites another user's repost */ - isSaveOfRepost: z.optional(z.boolean()) + isSaveOfRepost: z.boolean() }) .strict() ) }) .strict() -export type EntityManagerFavoritePlaylistRequest = z.input< - typeof FavoritePlaylistSchema -> +export type FavoritePlaylistRequest = z.input export const UnfavoritePlaylistSchema = z .object({ @@ -239,9 +218,7 @@ export const UnfavoritePlaylistSchema = z }) .strict() -export type EntityManagerUnfavoritePlaylistRequest = z.input< - typeof UnfavoritePlaylistSchema -> +export type UnfavoritePlaylistRequest = z.input export const RepostPlaylistSchema = z .object({ @@ -252,18 +229,16 @@ export const RepostPlaylistSchema = z .object({ /** * Is this a repost of a repost? Used to dispatch notifications - * when a user reposts content that someone they follow has already reposted + * when a user favorites another user's repost */ - isRepostOfRepost: z.optional(z.boolean()) + isRepostOfRepost: z.boolean() }) .strict() ) }) .strict() -export type EntityManagerRepostPlaylistRequest = z.input< - typeof RepostPlaylistSchema -> +export type RepostPlaylistRequest = z.input export const UnrepostPlaylistSchema = z .object({ @@ -272,9 +247,7 @@ export const UnrepostPlaylistSchema = z }) .strict() -export type EntityManagerUnrepostPlaylistRequest = z.input< - typeof UnrepostPlaylistSchema -> +export type UnrepostPlaylistRequest = z.input export const SharePlaylistSchema = z .object({ @@ -283,6 +256,4 @@ export const SharePlaylistSchema = z }) .strict() -export type EntityManagerSharePlaylistRequest = z.input< - typeof SharePlaylistSchema -> +export type SharePlaylistRequest = z.input diff --git a/packages/sdk/src/sdk/api/tracks/TrackUploadHelper.ts b/packages/sdk/src/sdk/api/tracks/TrackUploadHelper.ts index 3fd5f6b3285..84730603e78 100644 --- a/packages/sdk/src/sdk/api/tracks/TrackUploadHelper.ts +++ b/packages/sdk/src/sdk/api/tracks/TrackUploadHelper.ts @@ -1,10 +1,6 @@ import type { UploadResponse } from '../../services/Storage/types' import { decodeHashId } from '../../utils/hashId' -import { - BaseAPI, - type CreateTrackRequestBody, - type UpdateTrackRequestBody -} from '../generated/default' +import { BaseAPI } from '../generated/default' import type { PlaylistTrackMetadata } from '../playlists/types' export class TrackUploadHelper extends BaseAPI { @@ -61,79 +57,6 @@ export class TrackUploadHelper extends BaseAPI { return metadata } - public transformTrackUploadMetadataV2< - T extends CreateTrackRequestBody | UpdateTrackRequestBody - >(inputMetadata: T, userId: number): T { - const metadata: T = { - ...inputMetadata, - ownerId: userId - } - - const isStreamGated = metadata.streamConditions !== undefined - const isUsdcGated = 'usdc_purchase' in (metadata.streamConditions ?? {}) - const isUnlisted = metadata.isUnlisted - - // If track is stream gated and not usdc purchase gated, set remixes to false - if (isStreamGated && !isUsdcGated && metadata.fieldVisibility) { - metadata.fieldVisibility.remixes = false - } - - // If track is public, set required visibility fields to true - if (!isUnlisted) { - metadata.fieldVisibility = { - remixes: true, // default, but overwritten - ...metadata.fieldVisibility, - genre: true, - mood: true, - tags: true, - share: true, - playCount: true - } - } - return metadata - } - - public populateTrackMetadataWithUploadResponseV2< - T extends CreateTrackRequestBody | UpdateTrackRequestBody - >( - trackMetadata: T, - audioResponse?: UploadResponse, - coverArtResponse?: UploadResponse - ): T { - let updated = { - ...trackMetadata - } - if (audioResponse) { - updated = { - ...updated, - trackCid: audioResponse.results['320'], - previewCid: - trackMetadata.previewStartSeconds !== undefined && - trackMetadata.previewStartSeconds !== null - ? audioResponse.results[ - `320_preview|${trackMetadata.previewStartSeconds}` - ] - : trackMetadata.previewCid, - origFileCid: audioResponse.orig_file_cid, - origFilename: audioResponse.orig_filename || trackMetadata.origFilename, - duration: parseInt(audioResponse?.probe?.format?.duration ?? '0', 10), - bpm: audioResponse.audio_analysis_results?.bpm - ? audioResponse.audio_analysis_results.bpm - : trackMetadata.bpm, - musicalKey: audioResponse.audio_analysis_results?.key - ? audioResponse.audio_analysis_results.key - : trackMetadata.musicalKey - } - } - if (coverArtResponse) { - updated = { - ...updated, - coverArtSizes: coverArtResponse.orig_file_cid - } - } - return updated - } - public populateTrackMetadataWithUploadResponse( trackMetadata: Partial, audioResponse?: UploadResponse, @@ -174,4 +97,19 @@ export class TrackUploadHelper extends BaseAPI { } return updated } + + public extractMediorumUploadOptions(metadata: PlaylistTrackMetadata) { + const uploadOptions: { [key: string]: string } = {} + if ( + metadata.previewStartSeconds !== undefined && + metadata.previewStartSeconds !== null + ) { + uploadOptions.previewStartSeconds = + metadata.previewStartSeconds.toString() + } + if (metadata.placementHosts) { + uploadOptions.placement_hosts = metadata.placementHosts + } + return uploadOptions + } } diff --git a/packages/sdk/src/sdk/api/tracks/TracksApi.test.ts b/packages/sdk/src/sdk/api/tracks/TracksApi.test.ts index 0d69af4cbda..6110b84e7d7 100644 --- a/packages/sdk/src/sdk/api/tracks/TracksApi.test.ts +++ b/packages/sdk/src/sdk/api/tracks/TracksApi.test.ts @@ -146,15 +146,13 @@ describe('TracksApi', () => { describe('uploadTrack', () => { it('uploads a track if valid metadata is provided', async () => { - const result = await tracks.createTrack({ + const result = await tracks.uploadTrack({ userId: '7eP5n', imageFile: { buffer: pngFile, name: 'coverArt' }, metadata: { - trackCid: - 'bafkreihzvsc5jqhxzdygntlqqd7kqtx3lul77d22v54a47m26n5q426z7i', title: 'BachGavotte', genre: Genre.ELECTRONIC, mood: Mood.TENDER @@ -174,14 +172,13 @@ describe('TracksApi', () => { it('throws an error if invalid metadata is provided', async () => { await expect(async () => { - await tracks.createTrack({ + await tracks.uploadTrack({ userId: '7eP5n', imageFile: { buffer: pngFile, name: 'coverArt' }, metadata: { - // intentionally missing trackCid, genre title: 'BachGavotte' } as any, audioFile: { diff --git a/packages/sdk/src/sdk/api/tracks/TracksApi.ts b/packages/sdk/src/sdk/api/tracks/TracksApi.ts index 03e0f022407..40e18e3a840 100644 --- a/packages/sdk/src/sdk/api/tracks/TracksApi.ts +++ b/packages/sdk/src/sdk/api/tracks/TracksApi.ts @@ -27,49 +27,41 @@ import { DownloadTrackRequest, TracksApi as GeneratedTracksApi, ExtendedPaymentSplit, - instanceOfExtendedPurchaseGate, - type DeleteTrackRequest, - type FavoriteTrackRequest, - type UnfavoriteTrackRequest, - type ShareTrackRequest, - type RepostTrackRequest, - type UnrepostTrackRequest, - type RecordTrackDownloadRequest + instanceOfExtendedPurchaseGate } from '../generated/default' import { RequiredError } from '../generated/default/runtime' import { TrackUploadHelper } from './TrackUploadHelper' import { - EntityManagerDeleteTrackRequest, + DeleteTrackRequest, DeleteTrackSchema, - EntityManagerRepostTrackRequest, + RepostTrackRequest, RepostTrackSchema, - EntityManagerFavoriteTrackRequest, + FavoriteTrackRequest, FavoriteTrackSchema, - EntityManagerUnrepostTrackRequest, + UnrepostTrackRequest, UnrepostTrackSchema, - EntityManagerUnfavoriteTrackRequest, + UnfavoriteTrackRequest, UnfavoriteTrackSchema, - EntityManagerUpdateTrackRequest, + UpdateTrackRequest, + UploadTrackRequest, PurchaseTrackRequest, PurchaseTrackSchema, GetPurchaseTrackInstructionsRequest, GetPurchaseTrackInstructionsSchema, - EntityManagerRecordTrackDownloadRequest, + RecordTrackDownloadRequest, RecordTrackDownloadSchema, UploadTrackFilesRequest, + UploadTrackSchema, UpdateTrackSchema, UploadTrackFilesSchema, ShareTrackSchema, - EntityManagerShareTrackRequest, + ShareTrackRequest, type PublishTrackRequest, PublishTrackSchema, type PublishStemRequest, - type UploadTrackFilesTask, - type UpdateTrackRequestWithFiles, - type CreateTrackRequestWithFiles, PublishStemSchema, - UploadTrackSchema + type UploadTrackFilesTask } from './types' // Extend that new class @@ -116,6 +108,8 @@ export class TracksApi extends GeneratedTracksApi { if (params.apiKey) queryParams.append('api_key', params.apiKey) if (params.skipCheck !== undefined) queryParams.append('skip_check', String(params.skipCheck)) + if (params.noRedirect !== undefined) + queryParams.append('no_redirect', String(params.noRedirect)) const path = `/tracks/{track_id}/stream`.replace( `{${'track_id'}}`, @@ -352,12 +346,17 @@ export class TracksApi extends GeneratedTracksApi { } } - override async createTrack( - params: CreateTrackRequestWithFiles, - requestInit?: RequestInit + /** + * Upload a track + */ + async uploadTrack( + params: UploadTrackRequest, + advancedOptions?: AdvancedOptions ) { - // Upload files - let metadata = params.metadata + // Validate inputs + await parseParams('uploadTrack', UploadTrackSchema)(params) + + // Upload track files const { audioUploadResponse, imageUploadResponse } = await this.uploadTrackFiles({ audioFile: params.audioFile, @@ -369,109 +368,80 @@ export class TracksApi extends GeneratedTracksApi { onProgress: params.onProgress }).start() - metadata = this.trackUploadHelper.transformTrackUploadMetadataV2( - metadata, - decodeHashId(params.userId)! - ) - - metadata = this.trackUploadHelper.populateTrackMetadataWithUploadResponseV2( - metadata, - audioUploadResponse, - imageUploadResponse - ) - - if (this.entityManager) { - const { metadata } = await parseParams( - 'createTrack', - UploadTrackSchema - )(params) - return this.writeTrackToChain(params.userId, metadata) + if (!audioUploadResponse || !imageUploadResponse) { + throw new Error('uploadTrack: Missing upload responses') } - return super.createTrack( + + // Write track metadata to chain + return this.publishTrack( { userId: params.userId, - metadata + metadata: params.metadata, + audioUploadResponse, + imageUploadResponse }, - requestInit + advancedOptions ) } /** @hidden - * Update a track with entity manager + * Update a track */ - async updateTrackWithEntityManager( - params: EntityManagerUpdateTrackRequest, + async updateTrack( + params: UpdateTrackRequest, advancedOptions?: AdvancedOptions ) { // Parse inputs - const { userId, trackId, metadata } = await parseParams( - 'updateTrack', - UpdateTrackSchema - )(params) - - // Write metadata to chain - return await this.entityManager.manageEntity({ + const { userId, - entityType: EntityType.TRACK, - entityId: trackId, - action: Action.UPDATE, - metadata: JSON.stringify({ - cid: '', - data: { - ...snakecaseKeys(metadata), - download_conditions: - metadata.downloadConditions && - snakecaseKeys(metadata.downloadConditions), - stream_conditions: - metadata.streamConditions && - snakecaseKeys(metadata.streamConditions), - stem_of: metadata.stemOf && snakecaseKeys(metadata.stemOf) - } - }), - ...advancedOptions - }) - } + trackId, + audioFile, + imageFile, + metadata: parsedMetadata, + onProgress, + generatePreview + } = await parseParams('updateTrack', UpdateTrackSchema)(params) + + // Transform metadata + const metadata = this.trackUploadHelper.transformTrackUploadMetadata( + parsedMetadata, + userId + ) - override async updateTrack( - params: UpdateTrackRequestWithFiles, - requestInit?: RequestInit - ) { - // Upload files - let metadata = params.metadata const { audioUploadResponse, imageUploadResponse } = await this.uploadTrackFiles({ - audioFile: params.audioFile, - imageFile: params.imageFile, + audioFile, + imageFile, fileMetadata: { - placementHosts: params.metadata.placementHosts, - previewStartSeconds: params.metadata.previewStartSeconds + placementHosts: parsedMetadata.placementHosts, + previewStartSeconds: parsedMetadata.previewStartSeconds }, - onProgress: params.onProgress + onProgress }).start() - metadata = this.trackUploadHelper.transformTrackUploadMetadataV2( - metadata, - decodeHashId(params.userId)! - ) - - metadata = this.trackUploadHelper.populateTrackMetadataWithUploadResponseV2( - metadata, - audioUploadResponse, - imageUploadResponse - ) + // Update metadata to include uploaded CIDs + const updatedMetadata = + this.trackUploadHelper.populateTrackMetadataWithUploadResponse( + metadata, + audioUploadResponse, + imageUploadResponse + ) // Generate preview if requested and no audio file was uploaded // (as that would handle the preview generation already) - if ( - params.generatePreview && - metadata.previewStartSeconds !== undefined && - !params.audioFile - ) { + if (generatePreview && !audioFile) { + if (updatedMetadata.previewStartSeconds === undefined) { + throw new Error('No track preview start time specified') + } + if (!updatedMetadata.audioUploadId) { + throw new Error('Missing required audio_upload_id') + } + const previewCid = await retry3( async () => await this.storage.generatePreview({ - cid: metadata.trackCid!, - secondOffset: metadata.previewStartSeconds! + cid: updatedMetadata.trackCid!, + secondOffset: updatedMetadata.previewStartSeconds! }), (e) => { this.logger.info('Retrying generatePreview', e) @@ -479,35 +449,37 @@ export class TracksApi extends GeneratedTracksApi { ) // Update metadata to include updated preview CID - metadata.previewCid = previewCid + updatedMetadata.previewCid = previewCid } - if (this.entityManager) { - const res = await this.updateTrackWithEntityManager({ - trackId: params.trackId, - userId: params.userId, - metadata - }) - return { - success: true, - transactionHash: res.transactionHash - } - } - return super.updateTrack( - { - trackId: params.trackId, - userId: params.userId, - metadata: params.metadata - }, - requestInit - ) + // Write metadata to chain + return await this.entityManager.manageEntity({ + userId, + entityType: EntityType.TRACK, + entityId: trackId, + action: Action.UPDATE, + metadata: JSON.stringify({ + cid: '', + data: { + ...snakecaseKeys(updatedMetadata), + download_conditions: + updatedMetadata.downloadConditions && + snakecaseKeys(updatedMetadata.downloadConditions), + stream_conditions: + updatedMetadata.streamConditions && + snakecaseKeys(updatedMetadata.streamConditions), + stem_of: metadata.stemOf && snakecaseKeys(metadata.stemOf) + } + }), + ...advancedOptions + }) } /** @hidden * Delete a track */ - async deleteTrackWithEntityManager( - params: EntityManagerDeleteTrackRequest, + async deleteTrack( + params: DeleteTrackRequest, advancedOptions?: AdvancedOptions ) { // Parse inputs @@ -525,25 +497,11 @@ export class TracksApi extends GeneratedTracksApi { }) } - override async deleteTrack( - params: DeleteTrackRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - const res = await this.deleteTrackWithEntityManager(params) - return { - success: true, - transactionHash: res.transactionHash - } - } - return super.deleteTrack(params, requestInit) - } - /** @hidden * Favorite a track */ - async favoriteTrackWithEntityManager( - params: EntityManagerFavoriteTrackRequest, + async favoriteTrack( + params: FavoriteTrackRequest, advancedOptions?: AdvancedOptions ) { // Parse inputs @@ -562,25 +520,11 @@ export class TracksApi extends GeneratedTracksApi { }) } - override async favoriteTrack( - params: FavoriteTrackRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - const res = await this.favoriteTrackWithEntityManager(params) - return { - success: true, - transactionHash: res.transactionHash - } - } - return super.favoriteTrack(params, requestInit) - } - /** @hidden * Unfavorite a track */ - async unfavoriteTrackWithEntityManager( - params: EntityManagerUnfavoriteTrackRequest, + async unfavoriteTrack( + params: UnfavoriteTrackRequest, advancedOptions?: AdvancedOptions ) { // Parse inputs @@ -598,25 +542,11 @@ export class TracksApi extends GeneratedTracksApi { }) } - override async unfavoriteTrack( - params: UnfavoriteTrackRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - const res = await this.unfavoriteTrackWithEntityManager(params) - return { - success: true, - transactionHash: res.transactionHash - } - } - return super.unfavoriteTrack(params, requestInit) - } - /** @hidden * Share a track */ - async shareTrackWithEntityManager( - params: EntityManagerShareTrackRequest, + async shareTrack( + params: ShareTrackRequest, advancedOptions?: AdvancedOptions ) { // Parse inputs @@ -634,25 +564,11 @@ export class TracksApi extends GeneratedTracksApi { }) } - override async shareTrack( - params: ShareTrackRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - const res = await this.shareTrackWithEntityManager(params) - return { - success: true, - transactionHash: res.transactionHash - } - } - return super.shareTrack(params, requestInit) - } - /** @hidden * Repost a track */ - async repostTrackWithEntityManager( - params: EntityManagerRepostTrackRequest, + async repostTrack( + params: RepostTrackRequest, advancedOptions?: AdvancedOptions ) { // Parse inputs @@ -671,30 +587,11 @@ export class TracksApi extends GeneratedTracksApi { }) } - override async repostTrack( - params: RepostTrackRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - const entityManagerParams = { - trackId: params.trackId, - userId: params.userId, - metadata: params.repostRequestBody - } - const res = await this.repostTrackWithEntityManager(entityManagerParams) - return { - success: true, - transactionHash: res.transactionHash - } - } - return super.repostTrack(params, requestInit) - } - /** @hidden * Unrepost a track */ - async unrepostTrackWithEntityManager( - params: EntityManagerUnrepostTrackRequest, + async unrepostTrack( + params: UnrepostTrackRequest, advancedOptions?: AdvancedOptions ) { // Parse inputs @@ -712,27 +609,13 @@ export class TracksApi extends GeneratedTracksApi { }) } - override async unrepostTrack( - params: UnrepostTrackRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - const res = await this.unrepostTrackWithEntityManager(params) - return { - success: true, - transactionHash: res.transactionHash - } - } - return super.unrepostTrack(params, requestInit) - } - /** * @hidden * * Records that a track was downloaded. */ - public async recordTrackDownloadWithEntityManager( - params: EntityManagerRecordTrackDownloadRequest, + public async recordTrackDownload( + params: RecordTrackDownloadRequest, advancedOptions?: AdvancedOptions ) { const { userId, trackId } = await parseParams( @@ -759,20 +642,6 @@ export class TracksApi extends GeneratedTracksApi { }) } - override async recordTrackDownload( - params: RecordTrackDownloadRequest, - requestInit?: RequestInit - ) { - if (this.entityManager) { - const res = await this.recordTrackDownloadWithEntityManager(params) - return { - success: true, - transactionHash: res.transactionHash - } - } - return super.recordTrackDownload(params, requestInit) - } - /** * Gets the Solana instructions that purchase the track * @@ -797,8 +666,8 @@ export class TracksApi extends GeneratedTracksApi { // Fetch track this.logger.debug('Fetching track purchase info...', { trackId }) const { data: track } = await this.getTrackAccessInfo({ - trackId: encodeHashId(trackId)!, // use hashed trackId - userId: encodeHashId(userId)! // use hashed userId + trackId: params.trackId, // use hashed trackId + userId: params.userId // use hashed userId }) // Validate purchase attempt diff --git a/packages/sdk/src/sdk/api/tracks/types.ts b/packages/sdk/src/sdk/api/tracks/types.ts index 94b0625765c..b94f66c15f4 100644 --- a/packages/sdk/src/sdk/api/tracks/types.ts +++ b/packages/sdk/src/sdk/api/tracks/types.ts @@ -9,14 +9,10 @@ import { DDEXRightsController } from '../../types/DDEX' import { AudioFile, ImageFile } from '../../types/File' +import { Genre } from '../../types/Genre' import { HashId } from '../../types/HashId' -import { - Mood, - Genre, - StemCategory, - type UpdateTrackRequest, - type CreateTrackRequest -} from '../generated/default' +import { Mood } from '../../types/Mood' +import { StemCategory } from '../../types/StemCategory' import { MAX_DESCRIPTION_LENGTH } from './constants' @@ -82,29 +78,22 @@ export const USDCPurchaseConditions = z .object({ usdcPurchase: z.object({ price: z.number().positive(), - splits: z.array( - z.object({ - userId: z.number().optional(), - percentage: z.number().min(0).max(100), - payoutWallet: z.string(), - amount: z.number().positive() - }) - ) + splits: z.any() }) }) .strict() export const UploadStemMetadataSchema = z.object({ - category: z.enum( - Object.values(StemCategory) as [StemCategory, ...StemCategory[]] - ), + category: z + .enum(Object.values(StemCategory) as [StemCategory, ...StemCategory[]]) + .default(StemCategory.OTHER), parentTrackId: HashId }) export const UploadTrackMetadataSchema = z.object({ trackId: z.optional(HashId), aiAttributionUserId: z.optional(HashId), - description: z.optional(z.string().max(MAX_DESCRIPTION_LENGTH).nullable()), + description: z.optional(z.string().max(MAX_DESCRIPTION_LENGTH)), fieldVisibility: z.optional( z.object({ mood: z.optional(z.boolean()), @@ -115,16 +104,25 @@ export const UploadTrackMetadataSchema = z.object({ remixes: z.optional(z.boolean()) }) ), - genre: z.enum(Object.values(Genre) as [Genre, ...Genre[]]), + genre: z + .enum(Object.values(Genre) as [Genre, ...Genre[]]) + .nullable() + .refine((val) => val !== null, { + message: messages.genreRequiredError + }) + .refine((val) => val !== Genre.ALL, { + message: messages.genreAllError + }), isrc: z.optional(z.string().nullable()), isUnlisted: z.optional(z.boolean()), iswc: z.optional(z.string().nullable()), license: z.optional(z.string().nullable()), - mood: z.optional(z.enum(Object.values(Mood) as [Mood, ...Mood[]]).nullable()), + mood: z.optional(z.enum(Object.values(Mood) as [Mood, ...Mood[]])).nullable(), isStreamGated: z.optional(z.boolean()), streamConditions: z .optional( z.union([ + CollectibleGatedConditions, FollowGatedConditions, TipGatedConditions, USDCPurchaseConditions, @@ -136,6 +134,7 @@ export const UploadTrackMetadataSchema = z.object({ downloadConditions: z .optional( z.union([ + CollectibleGatedConditions, FollowGatedConditions, TipGatedConditions, USDCPurchaseConditions, @@ -158,7 +157,7 @@ export const UploadTrackMetadataSchema = z.object({ .strict() ), stemOf: z.optional(UploadStemMetadataSchema.strict()), - tags: z.optional(z.string()).nullable(), + tags: z.optional(z.string()), title: z.string({ required_error: messages.titleRequiredError }), @@ -173,7 +172,7 @@ export const UploadTrackMetadataSchema = z.object({ isDownloadable: z.optional(z.boolean()), isOriginalAvailable: z.optional(z.boolean()), ddexReleaseIds: z.optional(z.record(z.string()).nullable()), - ddexApp: z.optional(z.string()).nullable(), + ddexApp: z.optional(z.string()), artists: z.optional(z.array(DDEXResourceContributor)).nullable(), resourceContributors: z.optional(z.array(DDEXResourceContributor).nullable()), indirectResourceContributors: z.optional( @@ -278,7 +277,7 @@ export const UpdateTrackSchema = z }) .strict() -export type EntityManagerUpdateTrackRequest = Omit< +export type UpdateTrackRequest = Omit< z.input, 'onProgress' > & { @@ -292,7 +291,7 @@ export const DeleteTrackSchema = z }) .strict() -export type EntityManagerDeleteTrackRequest = z.input +export type DeleteTrackRequest = z.input export const FavoriteTrackSchema = z .object({ @@ -305,16 +304,14 @@ export const FavoriteTrackSchema = z * Is this a save of a repost? Used to dispatch notifications * when a user favorites another user's repost */ - isSaveOfRepost: z.optional(z.boolean()) + isSaveOfRepost: z.boolean() }) .strict() ) }) .strict() -export type EntityManagerFavoriteTrackRequest = z.input< - typeof FavoriteTrackSchema -> +export type FavoriteTrackRequest = z.input export const UnfavoriteTrackSchema = z .object({ @@ -323,9 +320,7 @@ export const UnfavoriteTrackSchema = z }) .strict() -export type EntityManagerUnfavoriteTrackRequest = z.input< - typeof UnfavoriteTrackSchema -> +export type UnfavoriteTrackRequest = z.input export const RepostTrackSchema = z .object({ @@ -336,16 +331,16 @@ export const RepostTrackSchema = z .object({ /** * Is this a repost of a repost? Used to dispatch notifications - * when a user reposts content that someone they follow has already reposted + * when a user favorites another user's repost */ - isRepostOfRepost: z.optional(z.boolean()) + isRepostOfRepost: z.boolean() }) .strict() ) }) .strict() -export type EntityManagerRepostTrackRequest = z.input +export type RepostTrackRequest = z.input export const UnrepostTrackSchema = z .object({ @@ -354,9 +349,7 @@ export const UnrepostTrackSchema = z }) .strict() -export type EntityManagerUnrepostTrackRequest = z.input< - typeof UnrepostTrackSchema -> +export type UnrepostTrackRequest = z.input export const RecordTrackDownloadSchema = z .object({ @@ -372,9 +365,9 @@ export const ShareTrackSchema = z }) .strict() -export type EntityManagerShareTrackRequest = z.input +export type ShareTrackRequest = z.input -export type EntityManagerRecordTrackDownloadRequest = z.input< +export type RecordTrackDownloadRequest = z.input< typeof RecordTrackDownloadSchema > @@ -482,17 +475,3 @@ export type UploadTrackFilesTask = { }> abort: () => void } - -export type TrackFileUploadParams = { - audioFile?: z.input - imageFile?: z.input - onProgress?: UploadTrackFilesProgressHandler - /** When true, regenerate the track preview (e.g. when preview start or track CID changed). Used for update. */ - generatePreview?: boolean -} - -export type CreateTrackRequestWithFiles = CreateTrackRequest & - TrackFileUploadParams - -export type UpdateTrackRequestWithFiles = UpdateTrackRequest & - TrackFileUploadParams diff --git a/packages/sdk/src/sdk/api/users/UsersApi.test.ts b/packages/sdk/src/sdk/api/users/UsersApi.test.ts index 39da127b43a..cf7df74c39b 100644 --- a/packages/sdk/src/sdk/api/users/UsersApi.test.ts +++ b/packages/sdk/src/sdk/api/users/UsersApi.test.ts @@ -104,6 +104,7 @@ describe('UsersApi', () => { audiusWalletClient, endpoint: 'https://discoveryprovider.audius.co' }), + new Logger(), claimableTokens, solanaClient, emailEncryption @@ -116,8 +117,7 @@ describe('UsersApi', () => { describe('updateProfile', () => { it('updates the user profile if valid metadata is provided', async () => { - const result = await users.updateUser({ - id: '7eP5n', + const result = await users.updateProfile({ userId: '7eP5n', profilePictureFile: { buffer: pngFile, @@ -143,8 +143,7 @@ describe('UsersApi', () => { }) it('updates the user profile if partial valid metadata is provided', async () => { - const result = await users.updateUser({ - id: '7eP5n', + const result = await users.updateProfile({ userId: '7eP5n', metadata: { bio: 'The bio has been updated' @@ -159,8 +158,7 @@ describe('UsersApi', () => { it('throws an error if invalid metadata is provided', async () => { await expect(async () => { - await users.updateUser({ - id: '7eP5n', + await users.updateProfile({ userId: '7eP5n', metadata: { asdf: '123' @@ -171,8 +169,7 @@ describe('UsersApi', () => { it('throws an error if invalid request is sent', async () => { await expect(async () => { - await users.updateUser({ - id: '7eP5n', + await users.updateProfile({ metadata: { bio: 'New bio' } } as any) }).rejects.toThrow() diff --git a/packages/sdk/src/sdk/api/users/UsersApi.ts b/packages/sdk/src/sdk/api/users/UsersApi.ts index 6a880dc609b..01e7231e162 100644 --- a/packages/sdk/src/sdk/api/users/UsersApi.ts +++ b/packages/sdk/src/sdk/api/users/UsersApi.ts @@ -9,29 +9,31 @@ import { EntityManagerService, EntityType } from '../../services/EntityManager/types' +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, Id } from '../../types/HashId' +import { HashId } from '../../types/HashId' import { generateMetadataCidV1 } from '../../utils/cid' import { decodeHashId, encodeHashId } from '../../utils/hashId' import { parseParams } from '../../utils/parseParams' +import { retry3 } from '../../utils/retry' import { Configuration, DownloadPurchasesAsCSVRequest, DownloadSalesAsCSVRequest, DownloadUSDCWithdrawalsAsCSVRequest, - UsersApi as GeneratedUsersApi, - type UserPlaylistLibrary + UsersApi as GeneratedUsersApi } from '../generated/default' import * as runtime from '../generated/default/runtime' import { AddAssociatedWalletRequest, AddAssociatedWalletSchema, + CreateUserRequest, CreateUserSchema, EmailRequest, EmailSchema, - EntityManagerFollowUserRequest, + FollowUserRequest, FollowUserSchema, RemoveAssociatedWalletRequest, RemoveAssociatedWalletSchema, @@ -39,21 +41,16 @@ import { SendTipReactionRequestSchema, SendTipRequest, SendTipSchema, - EntityManagerSubscribeToUserRequest, + SubscribeToUserRequest, SubscribeToUserSchema, - EntityManagerUnfollowUserRequest, + UnfollowUserRequest, UnfollowUserSchema, - EntityManagerUnsubscribeFromUserRequest, + UnsubscribeFromUserRequest, UnsubscribeFromUserSchema, UpdateCollectiblesRequest, UpdateCollectiblesSchema, - UpdateProfileSchema, - type EntityManagerCreateUserRequest, - type EntityManagerUpdateProfileRequest, - type UpdateUserRequestWithFiles, - type CreateUserRequestWithFiles, - type UserFileUploadParams, - type EntityManagerPlaylistLibraryContents + UpdateProfileRequest, + UpdateProfileSchema } from './types' export class UsersApi extends GeneratedUsersApi { @@ -61,11 +58,13 @@ export class UsersApi extends GeneratedUsersApi { configuration: Configuration, private readonly storage: StorageService, private readonly entityManager: EntityManagerService, + private readonly logger: LoggerService, private readonly claimableTokens: ClaimableTokensClient, private readonly solanaClient: SolanaClient, private readonly emailEncryption: EmailEncryptionService ) { super(configuration) + this.logger = logger.createPrefixedLogger('[users-api]') } /** @hidden @@ -88,14 +87,12 @@ export class UsersApi extends GeneratedUsersApi { /** @hidden * Create a user */ - async createUserWithEntityManager( - params: EntityManagerCreateUserRequest, + async createUser( + params: CreateUserRequest, advancedOptions?: AdvancedOptions ) { - const { metadata } = await parseParams( - 'createUser', - CreateUserSchema - )(params) + const { onProgress, profilePictureFile, coverArtFile, metadata } = + await parseParams('createUser', CreateUserSchema)(params) const { data } = await this.generateUserId() if (!data) { @@ -103,7 +100,59 @@ export class UsersApi extends GeneratedUsersApi { } const userId = HashId.parse(data) - const entityMetadata = snakecaseKeys(metadata) + const [profilePictureResp, coverArtResp] = await Promise.all([ + profilePictureFile && + retry3( + async () => + await this.storage + .uploadFile({ + file: profilePictureFile, + onProgress, + metadata: { + template: 'img_square' + } + }) + .start(), + (e) => { + this.logger.info('Retrying uploadProfilePicture', e) + } + ), + coverArtFile && + retry3( + async () => + await this.storage + .uploadFile({ + file: coverArtFile, + onProgress, + metadata: { + template: 'img_backdrop' + } + }) + .start(), + (e) => { + this.logger.info('Retrying uploadProfileCoverArt', e) + } + ) + ]) + + const updatedMetadata = { + ...metadata, + userId, + ...(profilePictureResp + ? { + profilePicture: profilePictureResp?.orig_file_cid, + profilePictureSizes: profilePictureResp?.orig_file_cid + } + : {}), + ...(coverArtResp + ? { + coverPhoto: coverArtResp?.orig_file_cid, + coverPhotoSizes: coverArtResp?.orig_file_cid + } + : {}) + } + + const entityMetadata = snakecaseKeys(updatedMetadata) const cid = (await generateMetadataCidV1(entityMetadata)).toString() @@ -120,29 +169,7 @@ export class UsersApi extends GeneratedUsersApi { ...advancedOptions }) - return { blockHash, blockNumber, metadata } - } - - override async createUser( - params: CreateUserRequestWithFiles, - requestInit?: RequestInit - ) { - const metadata = await this.updateMetadataWithFiles(params.metadata, params) - if (this.entityManager) { - const res = await this.createUserWithEntityManager({ - metadata - }) - return { - success: true, - transactionHash: res.blockHash - } - } - return super.createUser( - { - metadata - }, - requestInit - ) + return { blockHash, blockNumber, metadata: updatedMetadata } } /** @hidden @@ -178,15 +205,66 @@ export class UsersApi extends GeneratedUsersApi { /** @hidden * Update a user profile */ - async updateUserWithEntityManager( - params: EntityManagerUpdateProfileRequest, + async updateProfile( + params: UpdateProfileRequest, advancedOptions?: AdvancedOptions ) { - const { userId, metadata } = await parseParams( - 'updateUser', - UpdateProfileSchema - )(params) - const cid = (await generateMetadataCidV1(metadata)).toString() + // Parse inputs + const { onProgress, profilePictureFile, coverArtFile, userId, metadata } = + await parseParams('updateProfile', UpdateProfileSchema)(params) + + const [profilePictureResp, coverArtResp] = await Promise.all([ + profilePictureFile && + retry3( + async () => + await this.storage + .uploadFile({ + file: profilePictureFile, + onProgress, + metadata: { + template: 'img_square' + } + }) + .start(), + (e) => { + this.logger.info('Retrying uploadProfilePicture', e) + } + ), + coverArtFile && + retry3( + async () => + await this.storage + .uploadFile({ + file: coverArtFile, + onProgress, + metadata: { + template: 'img_backdrop' + } + }) + .start(), + (e) => { + this.logger.info('Retrying uploadProfileCoverArt', e) + } + ) + ]) + + const updatedMetadata = snakecaseKeys({ + ...metadata, + ...(profilePictureResp + ? { + profilePicture: profilePictureResp?.orig_file_cid, + profilePictureSizes: profilePictureResp?.orig_file_cid + } + : {}), + ...(coverArtResp + ? { + coverPhoto: coverArtResp?.orig_file_cid, + coverPhotoSizes: coverArtResp?.orig_file_cid + } + : {}) + }) + + const cid = (await generateMetadataCidV1(updatedMetadata)).toString() // Write metadata to chain return await this.entityManager.manageEntity({ @@ -196,118 +274,17 @@ export class UsersApi extends GeneratedUsersApi { action: Action.UPDATE, metadata: JSON.stringify({ cid, - data: snakecaseKeys(metadata) + data: updatedMetadata }), ...advancedOptions }) } - private async updateMetadataWithFiles< - T extends - | CreateUserRequestWithFiles['metadata'] - | UpdateUserRequestWithFiles['metadata'] - >(metadata: T, fileUploadParams: UserFileUploadParams) { - const { onProgress, profilePictureFile, coverArtFile } = fileUploadParams - const [profilePictureResp, coverArtResp] = await Promise.all([ - profilePictureFile - ? await this.storage - .uploadFile({ - file: profilePictureFile, - onProgress, - metadata: { - template: 'img_square' - } - }) - .start() - : null, - coverArtFile - ? await this.storage - .uploadFile({ - file: coverArtFile, - onProgress, - metadata: { - template: 'img_backdrop' - } - }) - .start() - : null - ]) - if (profilePictureResp) { - metadata.profilePicture = profilePictureResp.orig_file_cid - metadata.profilePictureSizes = profilePictureResp.orig_file_cid - } - if (coverArtResp) { - metadata.coverPhoto = coverArtResp.orig_file_cid - metadata.coverPhotoSizes = coverArtResp.orig_file_cid - } - return metadata - } - - private mapLibraryContentsToEntityManagerFormat( - libraryItems: UserPlaylistLibrary['contents'] - ): EntityManagerPlaylistLibraryContents { - const items: EntityManagerPlaylistLibraryContents = [] - for (const item of libraryItems) { - if (item.type === 'folder') { - const folder = { - id: item.id, - type: 'folder' as const, - name: item.name, - contents: this.mapLibraryContentsToEntityManagerFormat(item.contents) - } - items.push(folder) - } - if (item.type === 'playlist') { - items.push({ - playlist_id: item.playlistId, - type: 'playlist' as const - }) - } - if (item.type === 'explore_playlist') { - items.push({ - playlist_id: item.playlistId, - type: 'explore_playlist' as const - }) - } - } - return items - } - - override async updateUser( - params: UpdateUserRequestWithFiles, - requestInit?: RequestInit - ) { - const metadata = await this.updateMetadataWithFiles(params.metadata, params) - if (this.entityManager) { - return await this.updateUserWithEntityManager({ - userId: Id.parse(params.id)!, - metadata: { - ...metadata, - playlistLibrary: metadata.playlistLibrary?.contents - ? { - contents: this.mapLibraryContentsToEntityManagerFormat( - metadata.playlistLibrary?.contents || [] - ) - } - : undefined - } - }) - } - return super.updateUser( - { - id: params.id, - userId: params.userId, - metadata - }, - requestInit - ) - } - /** @hidden * Follow a user */ - async followUserWithEntityManager( - params: EntityManagerFollowUserRequest, + async followUser( + params: FollowUserRequest, advancedOptions?: AdvancedOptions ) { // Parse inputs @@ -325,27 +302,11 @@ export class UsersApi extends GeneratedUsersApi { }) } - override async followUser( - params: EntityManagerFollowUserRequest | { id: string }, - requestInit?: RequestInit - ) { - if (this.entityManager && 'userId' in params) { - const res = await this.followUserWithEntityManager( - params as EntityManagerFollowUserRequest - ) - return { - success: true, - transactionHash: res.transactionHash - } - } - return super.followUser(params as any, requestInit) - } - /** @hidden * Unfollow a user */ - async unfollowUserWithEntityManager( - params: EntityManagerUnfollowUserRequest, + async unfollowUser( + params: UnfollowUserRequest, advancedOptions?: AdvancedOptions ) { // Parse inputs @@ -363,27 +324,11 @@ export class UsersApi extends GeneratedUsersApi { }) } - override async unfollowUser( - params: EntityManagerUnfollowUserRequest | { id: string }, - requestInit?: RequestInit - ) { - if (this.entityManager && 'userId' in params) { - const res = await this.unfollowUserWithEntityManager( - params as EntityManagerUnfollowUserRequest - ) - return { - success: true, - transactionHash: res.transactionHash - } - } - return super.unfollowUser(params as any, requestInit) - } - /** @hidden * Subscribe to a user */ - async subscribeToUserWithEntityManager( - params: EntityManagerSubscribeToUserRequest, + async subscribeToUser( + params: SubscribeToUserRequest, advancedOptions?: AdvancedOptions ) { // Parse inputs @@ -401,27 +346,11 @@ export class UsersApi extends GeneratedUsersApi { }) } - override async subscribeToUser( - params: EntityManagerSubscribeToUserRequest | { id: string }, - requestInit?: RequestInit - ) { - if (this.entityManager && 'userId' in params) { - const res = await this.subscribeToUserWithEntityManager( - params as EntityManagerSubscribeToUserRequest - ) - return { - success: true, - transactionHash: res.transactionHash - } - } - return super.subscribeToUser(params as any, requestInit) - } - /** @hidden * Unsubscribe from a user */ - async unsubscribeFromUserWithEntityManager( - params: EntityManagerUnsubscribeFromUserRequest, + async unsubscribeFromUser( + params: UnsubscribeFromUserRequest, advancedOptions?: AdvancedOptions ) { // Parse inputs @@ -439,22 +368,6 @@ export class UsersApi extends GeneratedUsersApi { }) } - override async unsubscribeFromUser( - params: EntityManagerUnsubscribeFromUserRequest | { id: string }, - requestInit?: RequestInit - ) { - if (this.entityManager && 'userId' in params) { - const res = await this.unsubscribeFromUserWithEntityManager( - params as EntityManagerUnsubscribeFromUserRequest - ) - return { - success: true, - transactionHash: res.transactionHash - } - } - return super.unsubscribeFromUser(params as any, requestInit) - } - /** * Downloads the sales the user has made as a CSV file. * Similar to generated raw method, but forced response type as blob diff --git a/packages/sdk/src/sdk/api/users/types.ts b/packages/sdk/src/sdk/api/users/types.ts index 3fedc4d7af1..442954ce9bc 100644 --- a/packages/sdk/src/sdk/api/users/types.ts +++ b/packages/sdk/src/sdk/api/users/types.ts @@ -1,6 +1,5 @@ import { z } from 'zod' -import type { CreateUserRequest, UpdateUserRequest } from '../..' import { ProgressHandler } from '../../services/Storage/types' import { EthAddressSchema } from '../../types/EthAddress' import { ImageFile } from '../../types/File' @@ -35,7 +34,7 @@ export const CreateUserSchema = z.object({ .strict() }) -export type EntityManagerCreateUserRequest = Omit< +export type CreateUserRequest = Omit< z.input, 'onProgress' > & { @@ -101,10 +100,6 @@ const PlaylistLibrarySchema = z.object({ ) }) -export type EntityManagerPlaylistLibraryContents = z.input< - typeof PlaylistLibrarySchema ->['contents'] - export const UpdateProfileSchema = z .object({ userId: HashId, @@ -137,7 +132,7 @@ export const UpdateProfileSchema = z }) .strict() -export type EntityManagerUpdateProfileRequest = Omit< +export type UpdateProfileRequest = Omit< z.input, 'onProgress' > & { @@ -153,7 +148,7 @@ export const FollowUserSchema = z }) .strict() -export type EntityManagerFollowUserRequest = z.input +export type FollowUserRequest = z.input export const UnfollowUserSchema = z .object({ @@ -162,9 +157,7 @@ export const UnfollowUserSchema = z }) .strict() -export type EntityManagerUnfollowUserRequest = z.input< - typeof UnfollowUserSchema -> +export type UnfollowUserRequest = z.input export const SubscribeToUserSchema = z .object({ @@ -173,9 +166,7 @@ export const SubscribeToUserSchema = z }) .strict() -export type EntityManagerSubscribeToUserRequest = z.input< - typeof SubscribeToUserSchema -> +export type SubscribeToUserRequest = z.input export const UnsubscribeFromUserSchema = z .object({ @@ -184,7 +175,7 @@ export const UnsubscribeFromUserSchema = z }) .strict() -export type EntityManagerUnsubscribeFromUserRequest = z.input< +export type UnsubscribeFromUserRequest = z.input< typeof UnsubscribeFromUserSchema > @@ -288,15 +279,3 @@ export const UpdateCollectiblesSchema = z.object({ }) export type UpdateCollectiblesRequest = z.input - -export type UserFileUploadParams = { - profilePictureFile?: z.input - coverArtFile?: z.input - onProgress?: ProgressHandler -} - -export type CreateUserRequestWithFiles = CreateUserRequest & - UserFileUploadParams - -export type UpdateUserRequestWithFiles = UpdateUserRequest & - UserFileUploadParams diff --git a/packages/sdk/src/sdk/index.ts b/packages/sdk/src/sdk/index.ts index 33d7fe50be2..6680447650b 100644 --- a/packages/sdk/src/sdk/index.ts +++ b/packages/sdk/src/sdk/index.ts @@ -29,29 +29,14 @@ export * from './api/tracks/types' export * from './api/users/types' export * from './middleware' export * from './types/File' +export * from './types/Genre' +export * from './types/StemCategory' export * from './types/HashId' +export * from './types/Mood' export * from './types/Timeout' export * from './api/developer-apps/types' export * from './api/dashboard-wallet-users/types' -export type { - AddManagerRequest, - ApproveGrantRequest, - CreateGrantRequest, - EntityManagerAddManagerRequest, - EntityManagerApproveGrantRequest, - EntityManagerCreateGrantRequest, - EntityManagerRemoveManagerRequest, - EntityManagerRevokeGrantRequest, - RemoveManagerRequest, - RevokeGrantRequest -} from './api/grants/types' -export { - AddManagerSchema, - ApproveGrantSchema, - CreateGrantSchema, - RemoveManagerSchema, - RevokeGrantSchema -} from './api/grants/types' +export * from './api/grants/types' export * from './services' export { productionConfig } from './config/production' export { developmentConfig } from './config/development' diff --git a/packages/sdk/src/sdk/sdk.ts b/packages/sdk/src/sdk/sdk.ts index 9669a1efb6d..008cbb12b17 100644 --- a/packages/sdk/src/sdk/sdk.ts +++ b/packages/sdk/src/sdk/sdk.ts @@ -455,6 +455,7 @@ const initializeApis = ({ apiClientConfig, services.storage, services.entityManager, + services.logger, services.claimableTokensClient, services.solanaClient, services.emailEncryptionService diff --git a/packages/sdk/src/sdk/services/EntityManager/EntityManagerClient.ts b/packages/sdk/src/sdk/services/EntityManager/EntityManagerClient.ts index 4477b2616e2..e360c24b1d9 100644 --- a/packages/sdk/src/sdk/services/EntityManager/EntityManagerClient.ts +++ b/packages/sdk/src/sdk/services/EntityManager/EntityManagerClient.ts @@ -127,8 +127,7 @@ export class EntityManagerClient implements EntityManagerService { return { blockHash: jsonResponse.receipt.blockHash, - blockNumber: jsonResponse.receipt.blockNumber, - transactionHash: jsonResponse.receipt.transactionHash + blockNumber: jsonResponse.receipt.blockNumber } } else { if (response.status === 429) { diff --git a/packages/sdk/src/sdk/services/EntityManager/types.ts b/packages/sdk/src/sdk/services/EntityManager/types.ts index 54decce02c9..aa5ead6b17e 100644 --- a/packages/sdk/src/sdk/services/EntityManager/types.ts +++ b/packages/sdk/src/sdk/services/EntityManager/types.ts @@ -6,7 +6,6 @@ import type { LoggerService } from '../Logger' export type EntityManagerTransactionReceipt = { blockHash: string blockNumber: number - transactionHash: string } export type EntityManagerConfigInternal = { diff --git a/packages/web/src/common/store/cache/collections/createAlbumSaga.ts b/packages/web/src/common/store/cache/collections/createAlbumSaga.ts index bca976e522c..90e7df94136 100644 --- a/packages/web/src/common/store/cache/collections/createAlbumSaga.ts +++ b/packages/web/src/common/store/cache/collections/createAlbumSaga.ts @@ -168,20 +168,11 @@ function* createAndConfirmAlbum( throw new Error('No userId set, cannot create album') } - const metadata = albumMetadataForCreateWithSDK(formFields) - metadata.playlistContents = initTrack - ? [ - { - trackId: Id.parse(initTrack.track_id), - timestamp: Date.now() / 1000 - } - ] - : undefined - yield* call([sdk.albums, sdk.albums.createAlbum], { userId: Id.parse(userId), albumId: Id.parse(albumId), - metadata + trackIds: initTrack ? [Id.parse(initTrack.track_id)] : undefined, + metadata: albumMetadataForCreateWithSDK(formFields) }) const { data: album } = yield* call( diff --git a/packages/web/src/common/store/cache/collections/createPlaylistSaga.ts b/packages/web/src/common/store/cache/collections/createPlaylistSaga.ts index 71976c8067d..44ca8969bb7 100644 --- a/packages/web/src/common/store/cache/collections/createPlaylistSaga.ts +++ b/packages/web/src/common/store/cache/collections/createPlaylistSaga.ts @@ -191,20 +191,11 @@ function* createAndConfirmPlaylist( throw new Error('No userId set, cannot repost collection') } - const metadata = playlistMetadataForCreateWithSDK(formFields) - metadata.playlistId = Id.parse(playlistId) - metadata.playlistContents = initTrack - ? [ - { - timestamp: Math.round(Date.now() / 1000), // must use seconds - trackId: Id.parse(initTrack.track_id) - } - ] - : [] - yield* call([sdk.playlists, sdk.playlists.createPlaylist], { userId: Id.parse(userId), - metadata + playlistId: Id.parse(playlistId), + trackIds: initTrack ? [Id.parse(initTrack.track_id)] : undefined, + metadata: playlistMetadataForCreateWithSDK(formFields) }) // Merge the confirmed playlist with the optimistic playlist, preferring 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 5d99a9bbcbb..e56d2e7a8f7 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({ - reward: { + claimRewardsRequest: { challengeId, specifier: specifierWithAmount.specifier, userId diff --git a/packages/web/src/common/store/pages/deactivate-account/sagas.ts b/packages/web/src/common/store/pages/deactivate-account/sagas.ts index ee69facc4bc..cdf81d012ac 100644 --- a/packages/web/src/common/store/pages/deactivate-account/sagas.ts +++ b/packages/web/src/common/store/pages/deactivate-account/sagas.ts @@ -6,6 +6,7 @@ import { getContext, confirmerActions, confirmerSelectors, + confirmTransaction, getSDK } from '@audius/common/store' import { waitForValue } from '@audius/common/utils' @@ -36,10 +37,22 @@ function* handleDeactivateAccount() { DEACTIVATE_CONFIRMATION_UID, function* () { yield* put(make(Name.DEACTIVATE_ACCOUNT_REQUEST, {})) - yield* call(audiusBackendInstance.updateCreator, { + const result = yield* call(audiusBackendInstance.updateCreator, { metadata: { ...userMetadata, is_deactivated: true }, sdk }) + if (!result) return + const { blockHash, blockNumber } = result + const confirmed = yield* call( + confirmTransaction, + blockHash, + blockNumber + ) + if (!confirmed) { + throw new Error( + `Could not confirm account deactivation for user ${accountUserId}` + ) + } }, // @ts-ignore: confirmer is untyped function* () { diff --git a/packages/web/src/common/store/pages/signon/sagas.ts b/packages/web/src/common/store/pages/signon/sagas.ts index bbb5cd7ffa3..1fe4fd16fdc 100644 --- a/packages/web/src/common/store/pages/signon/sagas.ts +++ b/packages/web/src/common/store/pages/signon/sagas.ts @@ -51,10 +51,9 @@ import { } from '@audius/common/utils' import { OptionalId, - CreateUserRequestWithFiles, + CreateUserRequest, Id, - decodeHashId, - type UpdateUserRequestWithFiles + UpdateProfileRequest } from '@audius/sdk' import { isEmpty } from 'lodash' import { @@ -492,19 +491,18 @@ function* signUp() { throw new Error('Account user ID does not exist') } userId = account.user.user_id - const completeProfileMetadataRequest: UpdateUserRequestWithFiles = - { - id: Id.parse(userId), - userId: Id.parse(userId), - profilePictureFile: signOn.profileImage?.file as File, - metadata: { - location: location ?? undefined, - name, - handle - } + const completeProfileMetadataRequest: UpdateProfileRequest = { + userId: Id.parse(userId), + profilePictureFile: signOn.profileImage?.file as File, + metadata: { + location: location ?? undefined, + name, + handle } - yield* call( - [sdk.users, sdk.users.updateUser], + } + + const { blockHash, blockNumber } = yield* call( + [sdk.users, sdk.users.updateProfile], completeProfileMetadataRequest ) @@ -518,6 +516,7 @@ function* signUp() { yield* fork(sendPostSignInRecoveryEmail, { handle, email }) + yield* call(confirmTransaction, blockHash, blockNumber) yield* put( make(Name.CREATE_ACCOUNT_COMPLETE_GUEST_PROFILE, { handle, @@ -556,8 +555,7 @@ function* signUp() { sdk.services.audiusWalletClient.getAddresses ]) - const events: CreateUserRequestWithFiles['metadata']['events'] = - {} + const events: CreateUserRequest['metadata']['events'] = {} if (referrer) { events.referrer = OptionalId.parse(referrer) } @@ -565,7 +563,7 @@ function* signUp() { events.isMobileUser = true } - const createUserMetadata: CreateUserRequestWithFiles = { + const createUserMetadata: CreateUserRequest = { profilePictureFile: signOn.profileImage?.file as File, coverArtFile: signOn.coverPhoto?.file as File, metadata: { @@ -577,14 +575,11 @@ function* signUp() { } } - const { userId: returnedUserId } = yield* call( + const { metadata } = yield* call( [sdk.users, sdk.users.createUser], createUserMetadata ) - if (!returnedUserId) { - throw new Error('User ID not returned from createUser') - } - userId = decodeHashId(returnedUserId)! + userId = metadata.userId } yield* put( diff --git a/packages/web/src/common/store/player/sagas.ts b/packages/web/src/common/store/player/sagas.ts index aed5cae9cbf..6fcefe6a2a7 100644 --- a/packages/web/src/common/store/player/sagas.ts +++ b/packages/web/src/common/store/player/sagas.ts @@ -144,7 +144,7 @@ export function* watchPlay() { ) const isLongFormContent = - track.genre === Genre.Podcasts || track.genre === Genre.Audiobooks + track.genre === Genre.PODCASTS || track.genre === Genre.AUDIOBOOKS const createEndChannel = async (url: string) => { const endChannel = eventChannel((emitter) => { @@ -325,7 +325,7 @@ export function* watchSeek() { const track = yield* queryTrack(trackId) const currentUserId = yield* call(queryCurrentUserId) const isLongFormContent = - track?.genre === Genre.Podcasts || track?.genre === Genre.Audiobooks + track?.genre === Genre.PODCASTS || track?.genre === Genre.AUDIOBOOKS if (isLongFormContent) { yield* put( diff --git a/packages/web/src/common/store/social/collections/sagas.ts b/packages/web/src/common/store/social/collections/sagas.ts index 9f6f8f0da80..9e82372ec95 100644 --- a/packages/web/src/common/store/social/collections/sagas.ts +++ b/packages/web/src/common/store/social/collections/sagas.ts @@ -138,7 +138,7 @@ export function* confirmRepostCollection( yield* call([sdk.playlists, sdk.playlists.repostPlaylist], { userId: Id.parse(userId), playlistId: Id.parse(collectionId), - repostRequestBody: { + metadata: { isRepostOfRepost: metadata?.is_repost_of_repost ?? false } }) diff --git a/packages/web/src/common/store/social/tracks/sagas.ts b/packages/web/src/common/store/social/tracks/sagas.ts index 8598c49e8c3..3a87f4573e4 100644 --- a/packages/web/src/common/store/social/tracks/sagas.ts +++ b/packages/web/src/common/store/social/tracks/sagas.ts @@ -176,10 +176,7 @@ export function* confirmRepostTrack( function* () { yield* call([sdk.tracks, sdk.tracks.repostTrack], { trackId: Id.parse(trackId), - userId: Id.parse(user.user_id), - repostRequestBody: metadata - ? { isRepostOfRepost: metadata.is_repost_of_repost } - : undefined + userId: Id.parse(user.user_id) }) return trackId diff --git a/packages/web/src/common/store/social/users/sagas.ts b/packages/web/src/common/store/social/users/sagas.ts index fba2fc0a948..b52f2fb811a 100644 --- a/packages/web/src/common/store/social/users/sagas.ts +++ b/packages/web/src/common/store/social/users/sagas.ts @@ -10,7 +10,8 @@ import { Name, Kind, ID, UserMetadata } from '@audius/common/models' import { usersSocialActions as socialActions, getContext, - confirmerActions + confirmerActions, + confirmTransaction } from '@audius/common/store' import { makeKindId, route } from '@audius/common/utils' import { Id } from '@audius/sdk' @@ -112,10 +113,23 @@ function* confirmFollowUser( confirmerActions.requestConfirmation( makeKindId(Kind.USERS, userId), function* () { - yield* call([sdk.users, sdk.users.followUser], { - userId: Id.parse(accountId), - followeeUserId: Id.parse(userId) - }) + const { blockHash, blockNumber } = yield* call( + [sdk.users, sdk.users.followUser], + { + userId: Id.parse(accountId), + followeeUserId: Id.parse(userId) + } + ) + const confirmed = yield* call( + confirmTransaction, + blockHash, + blockNumber + ) + if (!confirmed) { + throw new Error( + `Could not confirm follow user for user id ${userId} and account id ${accountId}` + ) + } return accountId }, function* () { @@ -247,10 +261,23 @@ function* confirmUnfollowUser(userId: ID, accountId: ID) { confirmerActions.requestConfirmation( makeKindId(Kind.USERS, userId), function* () { - yield* call([sdk.users, sdk.users.unfollowUser], { - userId: Id.parse(accountId), - followeeUserId: Id.parse(userId) - }) + const { blockHash, blockNumber } = yield* call( + [sdk.users, sdk.users.unfollowUser], + { + userId: Id.parse(accountId), + followeeUserId: Id.parse(userId) + } + ) + const confirmed = yield* call( + confirmTransaction, + blockHash, + blockNumber + ) + if (!confirmed) { + throw new Error( + `Could not confirm unfollow user for user id ${userId} and account id ${accountId}` + ) + } return accountId }, function* () { @@ -339,10 +366,23 @@ function* confirmSubscribeToUser(userId: ID, accountId: ID) { confirmerActions.requestConfirmation( makeKindId(Kind.USERS, userId), function* () { - yield* call([sdk.users, sdk.users.subscribeToUser], { - subscribeeUserId: Id.parse(userId), - userId: Id.parse(accountId) - }) + const { blockHash, blockNumber } = yield* call( + [sdk.users, sdk.users.subscribeToUser], + { + subscribeeUserId: Id.parse(userId), + userId: Id.parse(accountId) + } + ) + const confirmed = yield* call( + confirmTransaction, + blockHash, + blockNumber + ) + if (!confirmed) { + throw new Error( + `Could not confirm subscribe to user for user id ${userId} and account id ${accountId}` + ) + } return accountId }, function* () {}, @@ -394,11 +434,23 @@ function* confirmUnsubscribeFromUser(userId: ID, accountId: ID) { confirmerActions.requestConfirmation( makeKindId(Kind.USERS, userId), function* () { - yield* call([sdk.users, sdk.users.unsubscribeFromUser], { - subscribeeUserId: Id.parse(userId), - userId: Id.parse(accountId) - }) - + const { blockHash, blockNumber } = yield* call( + [sdk.users, sdk.users.unsubscribeFromUser], + { + subscribeeUserId: Id.parse(userId), + userId: Id.parse(accountId) + } + ) + const confirmed = yield* call( + confirmTransaction, + blockHash, + blockNumber + ) + if (!confirmed) { + throw new Error( + `Could not confirm unsubscribe from user for user id ${userId} and account id ${accountId}` + ) + } return accountId }, function* () {}, diff --git a/packages/web/src/common/store/upload/sagaHelpers.ts b/packages/web/src/common/store/upload/sagaHelpers.ts index d3d9721b848..26df30f94ae 100644 --- a/packages/web/src/common/store/upload/sagaHelpers.ts +++ b/packages/web/src/common/store/upload/sagaHelpers.ts @@ -101,20 +101,12 @@ export function* getUSDCMetadata(stream_conditions: USDCPurchaseConditions) { const ownerUserbank = yield* call(getOrCreateUSDCUserBank, wallet) const priceCents = stream_conditions.usdc_purchase.price const priceWei = Number(USDC(priceCents / 100).value.toString()) - const payoutWallet = ownerUserbank?.toString() ?? '' const conditionsWithMetadata: USDCPurchaseConditions = { usdc_purchase: { price: priceCents, - ...(stream_conditions.usdc_purchase.albumTrackPrice != null && { - albumTrackPrice: stream_conditions.usdc_purchase.albumTrackPrice - }), - splits: [ - { - payout_wallet: payoutWallet, - percentage: 100, - amount: priceWei - } - ] + splits: { + [ownerUserbank?.toString() ?? '']: priceWei + } } } return conditionsWithMetadata diff --git a/packages/web/src/components/collection/CollectionCard.test.tsx b/packages/web/src/components/collection/CollectionCard.test.tsx index ce63f92252c..f0491eec45d 100644 --- a/packages/web/src/components/collection/CollectionCard.test.tsx +++ b/packages/web/src/components/collection/CollectionCard.test.tsx @@ -109,7 +109,7 @@ describe('CollectionCard', () => { ...testCollection, access: { stream: false }, stream_conditions: { - usdc_purchase: { price: 10, albumTrackPrice: 1, splits: [] } + usdc_purchase: { price: 10, albumTrackPrice: 1, splits: {} } } }) @@ -125,7 +125,7 @@ describe('CollectionCard', () => { ...testCollection, access: { stream: true, download: true }, stream_conditions: { - usdc_purchase: { price: 10, albumTrackPrice: 1, splits: [] } + usdc_purchase: { price: 10, albumTrackPrice: 1, splits: {} } } }) diff --git a/packages/web/src/components/edit/fields/price-and-audience/priceAndAudienceSchema.ts b/packages/web/src/components/edit/fields/price-and-audience/priceAndAudienceSchema.ts index 65815e6190f..867c451d34c 100644 --- a/packages/web/src/components/edit/fields/price-and-audience/priceAndAudienceSchema.ts +++ b/packages/web/src/components/edit/fields/price-and-audience/priceAndAudienceSchema.ts @@ -48,7 +48,7 @@ const refineMinPrice = isContentUSDCPurchaseGated(streamConditions) ) { const price = streamConditions.usdc_purchase[key] - return price != null && price > 0 && price >= minContentPriceCents + return price !== undefined && price > 0 && price >= minContentPriceCents } return true } @@ -62,7 +62,7 @@ const refineMaxPrice = isContentUSDCPurchaseGated(streamConditions) ) { const price = streamConditions.usdc_purchase[key] - return price != null && price <= maxContentPriceCents + return price !== undefined && price <= maxContentPriceCents } return true } diff --git a/packages/web/src/components/menu/TrackMenu.tsx b/packages/web/src/components/menu/TrackMenu.tsx index c1994ca48c1..ea3e979fd16 100644 --- a/packages/web/src/components/menu/TrackMenu.tsx +++ b/packages/web/src/components/menu/TrackMenu.tsx @@ -186,7 +186,7 @@ const TrackMenu = ({ const albumInfo = partialTrack?.album_backlink const isLongFormContent = - genre === Genre.Podcasts || genre === Genre.Audiobooks + genre === Genre.PODCASTS || genre === Genre.AUDIOBOOKS const shareMenuItem = { text: messages.share, diff --git a/packages/web/src/components/now-playing/NowPlaying.tsx b/packages/web/src/components/now-playing/NowPlaying.tsx index e08e86142de..cdc948e45c3 100644 --- a/packages/web/src/components/now-playing/NowPlaying.tsx +++ b/packages/web/src/components/now-playing/NowPlaying.tsx @@ -163,7 +163,7 @@ const NowPlaying = g( const playbackRate = useSelector(getPlaybackRate) const isLongFormContent = - track?.genre === Genre.Podcasts || track?.genre === Genre.Audiobooks + track?.genre === Genre.PODCASTS || track?.genre === Genre.AUDIOBOOKS const startSeeking = useCallback(() => { clearInterval(seekInterval.current) @@ -313,7 +313,7 @@ const NowPlaying = g( const onPrevious = () => { const isLongFormContent = - track?.genre === Genre.Podcasts || track?.genre === Genre.Audiobooks + track?.genre === Genre.PODCASTS || track?.genre === Genre.AUDIOBOOKS if (isLongFormContent) { const position = timing.position const newPosition = position - SKIP_DURATION_SEC @@ -333,7 +333,7 @@ const NowPlaying = g( const onNext = () => { const isLongFormContent = - track?.genre === Genre.Podcasts || track?.genre === Genre.Audiobooks + track?.genre === Genre.PODCASTS || track?.genre === Genre.AUDIOBOOKS if (isLongFormContent) { const newPosition = timing.position + SKIP_DURATION_SEC seek(Math.min(newPosition, timing.duration)) diff --git a/packages/web/src/components/play-bar/desktop/PlayBar.tsx b/packages/web/src/components/play-bar/desktop/PlayBar.tsx index 60f6aa0f3f0..4ae13dad39a 100644 --- a/packages/web/src/components/play-bar/desktop/PlayBar.tsx +++ b/packages/web/src/components/play-bar/desktop/PlayBar.tsx @@ -95,8 +95,8 @@ const PlayBar = () => { const isStreamGated = currentTrack?.is_stream_gated || false const trackPermalink = currentTrack?.permalink || '' const isLongFormContent = - currentTrack?.genre === Genre.Podcasts || - currentTrack?.genre === Genre.Audiobooks + currentTrack?.genre === Genre.PODCASTS || + currentTrack?.genre === Genre.AUDIOBOOKS const playable = !!uid diff --git a/packages/web/src/components/play-bar/next-button/NextButtonProvider.tsx b/packages/web/src/components/play-bar/next-button/NextButtonProvider.tsx index 50acc5a1456..71a9d64d37d 100644 --- a/packages/web/src/components/play-bar/next-button/NextButtonProvider.tsx +++ b/packages/web/src/components/play-bar/next-button/NextButtonProvider.tsx @@ -9,7 +9,7 @@ type NextButtonProviderProps = NextButtonProps | ForwardSkipButtonProps const NextButtonProvider = (props: NextButtonProviderProps) => { const track = useCurrentTrack() const isLongFormContent = - track?.genre === Genre.Podcasts || track?.genre === Genre.Audiobooks + track?.genre === Genre.PODCASTS || track?.genre === Genre.AUDIOBOOKS return isLongFormContent ? ( ) : ( diff --git a/packages/web/src/components/play-bar/previous-button/PreviousButtonProvider.tsx b/packages/web/src/components/play-bar/previous-button/PreviousButtonProvider.tsx index 4980718686c..afe029089a1 100644 --- a/packages/web/src/components/play-bar/previous-button/PreviousButtonProvider.tsx +++ b/packages/web/src/components/play-bar/previous-button/PreviousButtonProvider.tsx @@ -11,7 +11,7 @@ type PreviousButtonProviderProps = PreviousButtonProps | BackwardSkipButtonProps const PreviousButtonProvider = (props: PreviousButtonProviderProps) => { const track = useCurrentTrack() const isLongFormContent = - track?.genre === Genre.Podcasts || track?.genre === Genre.Audiobooks + track?.genre === Genre.PODCASTS || track?.genre === Genre.AUDIOBOOKS return isLongFormContent ? ( ) : ( diff --git a/packages/web/src/components/track/GiantTrackTile.tsx b/packages/web/src/components/track/GiantTrackTile.tsx index abcc9c8bd1c..3654462830f 100644 --- a/packages/web/src/components/track/GiantTrackTile.tsx +++ b/packages/web/src/components/track/GiantTrackTile.tsx @@ -214,7 +214,7 @@ export const GiantTrackTile = ({ const isRemixContest = !!remixContest const isLongFormContent = - genre === Genre.Podcasts || genre === Genre.Audiobooks + genre === Genre.PODCASTS || genre === Genre.AUDIOBOOKS const isUSDCPurchaseGated = isContentUSDCPurchaseGated(streamConditions) const { data: track } = useTrack(trackId, { select: (track) => pick(track, ['is_downloadable', 'preview_cid']) @@ -272,7 +272,7 @@ export const GiantTrackTile = ({ isScheduledRelease={isScheduledRelease} isRemix={isRemix} isStreamGated={isStreamGated} - isPodcast={genre === Genre.Podcasts} + isPodcast={genre === Genre.PODCASTS} streamConditions={streamConditions} isRemixContest={!!isRemixContest} /> diff --git a/packages/web/src/components/track/helpers.ts b/packages/web/src/components/track/helpers.ts index b074fcb2735..9802cd0699d 100644 --- a/packages/web/src/components/track/helpers.ts +++ b/packages/web/src/components/track/helpers.ts @@ -1,5 +1,6 @@ import { Collection, FieldVisibility, Track, User } from '@audius/common/models' import { TQCollection } from '@audius/common/src/api/tan-query/models' +import { Genre } from '@audius/common/utils' const defaultFieldVisibility: FieldVisibility = { genre: true, @@ -21,7 +22,7 @@ export const getTrackWithFallback = (track: Track | null | undefined) => { followee_saves: [], duration: 0, save_count: 0, - genre: '', + genre: Genre.ALL, field_visibility: defaultFieldVisibility, has_current_user_reposted: false, has_current_user_saved: false, diff --git a/packages/web/src/components/track/mobile/TrackTile.tsx b/packages/web/src/components/track/mobile/TrackTile.tsx index 24610d989e7..586d1d71d98 100644 --- a/packages/web/src/components/track/mobile/TrackTile.tsx +++ b/packages/web/src/components/track/mobile/TrackTile.tsx @@ -236,7 +236,7 @@ export const TrackTile = ({ const onClickOverflow = useCallback( (trackId: ID) => { const isLongFormContent = - genre === Genre.Podcasts || genre === Genre.Audiobooks + genre === Genre.PODCASTS || genre === Genre.AUDIOBOOKS const repostAction = !isOwner && hasStreamAccess @@ -395,7 +395,7 @@ export const TrackTile = ({ {duration ? formatLineupTileDuration( duration, - genre === Genre.Podcasts || genre === Genre.Audiobooks + genre === Genre.PODCASTS || genre === Genre.AUDIOBOOKS ) : null} diff --git a/packages/web/src/components/trending-genre-selection/TrendingGenreSelectionPage.tsx b/packages/web/src/components/trending-genre-selection/TrendingGenreSelectionPage.tsx index 88fe13c3533..a301b15ae15 100644 --- a/packages/web/src/components/trending-genre-selection/TrendingGenreSelectionPage.tsx +++ b/packages/web/src/components/trending-genre-selection/TrendingGenreSelectionPage.tsx @@ -6,8 +6,8 @@ import { } from '@audius/common/store' import { Genre, + ELECTRONIC_PREFIX, TRENDING_GENRES, - toTrendingGenre, route } from '@audius/common/utils' import { connect } from 'react-redux' @@ -37,7 +37,9 @@ const ConnectedTrendingGenreSelectionPage = ({ resetAllTrending }: ConnectedTrendingGenreSelectionPageProps) => { const setTrimmedGenre = (genre: string | null) => { - setTrendingGenre(toTrendingGenre(genre)) + const trimmedGenre = + genre !== null ? genre.replace(ELECTRONIC_PREFIX, '') : genre + setTrendingGenre(trimmedGenre as Genre | null) resetAllTrending() setTrendingTimeRange(timeRange) goToTrending() diff --git a/packages/web/src/components/user-generated-text/UserGeneratedText.tsx b/packages/web/src/components/user-generated-text/UserGeneratedText.tsx index ec3948ec187..eeecf185c0f 100644 --- a/packages/web/src/components/user-generated-text/UserGeneratedText.tsx +++ b/packages/web/src/components/user-generated-text/UserGeneratedText.tsx @@ -69,8 +69,7 @@ const RenderLink = ({ attributes, content }: IntermediateRepresentation) => { } else if (instanceOfPlaylistResponse(res)) { setUnfurledContent(formatCollectionName({ collection: res.data[0] })) } else if (instanceOfUserResponse(res)) { - const user = Array.isArray(res.data) ? res.data[0] : res.data - if (user) setUnfurledContent(formatUserName({ user })) + setUnfurledContent(formatUserName({ user: res.data })) } } } diff --git a/packages/web/src/hooks/useLaunchCoin.ts b/packages/web/src/hooks/useLaunchCoin.ts index a0b26556240..9785ecb858c 100644 --- a/packages/web/src/hooks/useLaunchCoin.ts +++ b/packages/web/src/hooks/useLaunchCoin.ts @@ -217,7 +217,7 @@ export const useLaunchCoin = () => { // Create coin in Audius database await sdk.coins.createCoin({ userId: Id.parse(userId), - metadata: { + createCoinRequest: { mint: mintPublicKey, ticker: `${symbolUpper}`, decimals: LAUNCHPAD_COIN_DECIMALS, diff --git a/packages/web/src/pages/edit-page/EditTrackPage.tsx b/packages/web/src/pages/edit-page/EditTrackPage.tsx index efd7e715d86..80d3be6b81e 100644 --- a/packages/web/src/pages/edit-page/EditTrackPage.tsx +++ b/packages/web/src/pages/edit-page/EditTrackPage.tsx @@ -9,7 +9,6 @@ import { useReplaceTrackProgressModal } from '@audius/common/store' import { removeNullable } from '@audius/common/utils' -import type { Genre, Mood } from '@audius/sdk' import { useNavigate, useParams } from 'react-router' import { EditTrackForm } from 'components/edit-track/EditTrackForm' @@ -111,8 +110,7 @@ export const EditTrackPage = (props: EditPageProps) => { const trackAsMetadataForUpload: TrackMetadataForUpload = { ...(track as TrackMetadata), - genre: (track?.genre as Genre) ?? '', - mood: (track?.mood as Mood) ?? null, + mood: track?.mood || null, artwork: { url: coverArtUrl || '' }, diff --git a/packages/web/src/pages/oauth-login-page/OAuthSignUpPage.tsx b/packages/web/src/pages/oauth-login-page/OAuthSignUpPage.tsx index f6ee020bbea..3a977e42af1 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() - await sdk.users.createUser({ + const { blockHash, blockNumber } = await sdk.users.createUser({ metadata: { handle: data.handle, name: data.displayName.trim(), @@ -128,6 +128,13 @@ export const OAuthSignUpPage = () => { } }) + if (blockHash && blockNumber) { + await sdk.services.entityManager.confirmWrite({ + blockHash, + blockNumber + }) + } + let accountData let retries = 0 const maxRetries = 15 diff --git a/packages/web/src/pages/settings-page/components/desktop/DeveloperApps/AppDetailsPage.tsx b/packages/web/src/pages/settings-page/components/desktop/DeveloperApps/AppDetailsPage.tsx index e9434241217..261298c9488 100644 --- a/packages/web/src/pages/settings-page/components/desktop/DeveloperApps/AppDetailsPage.tsx +++ b/packages/web/src/pages/settings-page/components/desktop/DeveloperApps/AppDetailsPage.tsx @@ -22,14 +22,12 @@ const AUDIUS_SDK_LINK = 'https://docs.audius.co/developers' const messages = { secretReminder: - "Remember to save your API Secret and Bearer Token. You won't be able to view them again.", + "Remember to save your API Secret. You won't be able to view it again.", description: 'Description', apiKey: 'api key', copyApiKeyLabel: 'copy api key', apiSecret: 'api secret', copyApiSecretLabel: 'copy api secret', - bearerToken: 'bearer token', - copyBearerTokenLabel: 'copy bearer token', copied: 'Copied!', readTheDocs: 'Read the Developer Docs', goBack: 'Back to Your Apps' @@ -42,7 +40,7 @@ export const AppDetailsPage = (props: AppDetailsPageProps) => { setPage(CreateAppsPages.YOUR_APPS) }, [setPage]) - const { name, description, apiKey, apiSecret, bearerToken } = params ?? {} + const { name, description, apiKey, apiSecret } = params || {} const copyApiKey = useCallback(() => { if (!apiKey) return copyToClipboard(apiKey) @@ -53,16 +51,11 @@ export const AppDetailsPage = (props: AppDetailsPageProps) => { copyToClipboard(apiSecret) }, [apiSecret]) - const copyBearerToken = useCallback(() => { - if (!bearerToken) return - copyToClipboard(bearerToken) - }, [bearerToken]) - if (!params) return null return (
- {!apiSecret && !bearerToken ? null : ( + {!apiSecret ? null : ( { > - - -
- )} - {!bearerToken ? null : ( -
- {messages.bearerToken} - - {bearerToken} - - - - diff --git a/packages/web/src/pages/sign-up-page/pages/SelectArtistsPage.tsx b/packages/web/src/pages/sign-up-page/pages/SelectArtistsPage.tsx index 9d30fd87d74..53c3bbfb708 100644 --- a/packages/web/src/pages/sign-up-page/pages/SelectArtistsPage.tsx +++ b/packages/web/src/pages/sign-up-page/pages/SelectArtistsPage.tsx @@ -5,11 +5,7 @@ import { useSuggestedArtists, useTopArtistsInGenre } from '@audius/common/api' import { selectArtistsPageMessages } from '@audius/common/messages' import { UserMetadata } from '@audius/common/models' import { selectArtistsSchema } from '@audius/common/schemas' -import { - type GenreLabel, - convertGenreLabelToValue, - route -} from '@audius/common/utils' +import { Genre, convertGenreLabelToValue, route } from '@audius/common/utils' import { Flex, Paper, SelectablePill, Text, useTheme } from '@audius/harmony' import { animated, useSpring } from '@react-spring/web' import { Form, Formik, useFormikContext } from 'formik' @@ -214,9 +210,7 @@ export const SelectArtistsPage = () => { disableScroll={!isMobile} > {artistGenres.map((genre) => { - const genreValue = convertGenreLabelToValue( - genre as GenreLabel - ) + const genreValue = convertGenreLabelToValue(genre as Genre) return ( // TODO: max of 6, kebab overflow { key={genre} name='trending-genre-filter' type='radio' - label={getCanonicalName(genre) ?? ''} + label={getCanonicalName(genre)} value={genre} size='large' isSelected={genre === currentGenre} diff --git a/packages/web/src/pages/trending-page/components/desktop/TrendingPageContent.tsx b/packages/web/src/pages/trending-page/components/desktop/TrendingPageContent.tsx index 3692d83c741..b1e42625e16 100644 --- a/packages/web/src/pages/trending-page/components/desktop/TrendingPageContent.tsx +++ b/packages/web/src/pages/trending-page/components/desktop/TrendingPageContent.tsx @@ -7,8 +7,8 @@ import { trendingUndergroundPageLineupSelectors } from '@audius/common/store' import { + ELECTRONIC_PREFIX, getCanonicalName, - toTrendingGenre, TRENDING_GENRES } from '@audius/common/utils' import { @@ -188,7 +188,9 @@ const TrendingPageContent = ({ containerRef }: TrendingPageContentProps) => { const setGenreAndRefresh = useCallback( (genre: string | null) => { - setTrendingGenre(toTrendingGenre(genre)) + const trimmedGenre = + genre !== null ? genre.replace(ELECTRONIC_PREFIX, '') : genre + setTrendingGenre(trimmedGenre) // Call reset to change everything everything to skeleton tiles makeResetTrending(TimeRange.WEEK)() diff --git a/packages/web/src/pages/trending-page/components/mobile/TrendingPageContent.tsx b/packages/web/src/pages/trending-page/components/mobile/TrendingPageContent.tsx index 8b0228c7268..70466487458 100644 --- a/packages/web/src/pages/trending-page/components/mobile/TrendingPageContent.tsx +++ b/packages/web/src/pages/trending-page/components/mobile/TrendingPageContent.tsx @@ -312,7 +312,7 @@ const TrendingPageMobileContent = ({