From 1bd06ae91951e13569dea0105d9ff89834732f80 Mon Sep 17 00:00:00 2001 From: Marcus Pasell <3690498+rickyrombo@users.noreply.github.com> Date: Fri, 13 Feb 2026 13:59:35 -0800 Subject: [PATCH] Fix comments callsites w/ new autogen --- .../tan-query/comments/useDeleteComment.ts | 6 +- .../api/tan-query/comments/useEditComment.ts | 24 +++--- .../api/tan-query/comments/usePinComment.ts | 24 ++++-- .../api/tan-query/comments/usePostComment.ts | 18 ++-- .../tan-query/comments/useReactToComment.ts | 15 +++- .../tan-query/comments/useReportComment.ts | 6 +- .../sdk/src/sdk/api/comments/CommentsAPI.ts | 30 +++---- .../api/generated/default/apis/CommentsApi.ts | 38 +++++++++ .../default/models/CommentEntityType.ts | 2 +- .../models/CreateCommentRequestBody.ts | 22 ++++- .../default/models/PinCommentRequestBody.ts | 67 +++++++++++++++ .../default/models/ReactCommentRequestBody.ts | 83 +++++++++++++++++++ .../models/UpdateCommentRequestBody.ts | 33 ++++++++ .../sdk/api/generated/default/models/index.ts | 2 + 14 files changed, 324 insertions(+), 46 deletions(-) create mode 100644 packages/sdk/src/sdk/api/generated/default/models/PinCommentRequestBody.ts create mode 100644 packages/sdk/src/sdk/api/generated/default/models/ReactCommentRequestBody.ts diff --git a/packages/common/src/api/tan-query/comments/useDeleteComment.ts b/packages/common/src/api/tan-query/comments/useDeleteComment.ts index 0319d0841f9..eaab048aed7 100644 --- a/packages/common/src/api/tan-query/comments/useDeleteComment.ts +++ b/packages/common/src/api/tan-query/comments/useDeleteComment.ts @@ -1,3 +1,4 @@ +import { Id } from '@audius/sdk' import { useMutation, useQueryClient } from '@tanstack/react-query' import { cloneDeep } from 'lodash' import { useDispatch } from 'react-redux' @@ -27,7 +28,10 @@ export const useDeleteComment = () => { const dispatch = useDispatch() return useMutation({ mutationFn: async ({ commentId, userId }: DeleteCommentArgs) => { - const commentData = { userId, entityId: commentId } + const commentData = { + userId: Id.parse(userId), + commentId: Id.parse(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 492d448a48c..3d20f0c1886 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 } from '@audius/sdk' +import { EntityType, CommentMention, Id } 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, - entityType = EntityType.TRACK + mentions }: EditCommentArgs) => { - const commentData = { - body: newMessage, - userId, - entityId: commentId, - trackId, - entityType, - mentions: mentions?.map((mention) => mention.userId) ?? [] - } const sdk = await audiusSdk() - await sdk.comments.editComment(commentData) + 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) ?? [] + } + }) }, 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 669605a26a4..b9e25b51133 100644 --- a/packages/common/src/api/tan-query/comments/usePinComment.ts +++ b/packages/common/src/api/tan-query/comments/usePinComment.ts @@ -1,3 +1,4 @@ +import { Id } from '@audius/sdk' import { useMutation, useQueryClient } from '@tanstack/react-query' import { cloneDeep } from 'lodash' import { useDispatch } from 'react-redux' @@ -29,12 +30,23 @@ export const usePinComment = () => { mutationFn: async (args: PinCommentArgs) => { const { userId, commentId, isPinned, trackId } = args const sdk = await audiusSdk() - return await sdk.comments.pinComment({ - userId, - entityId: commentId, - trackId, - isPin: isPinned - }) + if (isPinned) { + return await sdk.comments.pinComment({ + userId: Id.parse(userId)!, + commentId: Id.parse(commentId)!, + metadata: { + entityId: trackId + } + }) + } else { + return await sdk.comments.unpinComment({ + userId: Id.parse(userId)!, + commentId: Id.parse(commentId)!, + metadata: { + entityId: trackId + } + }) + } }, 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 a704b047343..f068348d38a 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 } from '@audius/sdk' +import { CommentMention, EntityType, Id } from '@audius/sdk' import { useMutation, useQueryClient } from '@tanstack/react-query' import { cloneDeep } from 'lodash' @@ -32,11 +32,17 @@ export const usePostComment = () => { return useMutation({ mutationFn: async (args: PostCommentArgs) => { const sdk = await audiusSdk() - return await sdk.comments.postComment({ - ...args, - mentions: args.mentions?.map((mention) => mention.userId) ?? [], - entityId: args.trackId, - commentId: args.newId + 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 + } }) }, 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 8960d383fba..92862a5cd1b 100644 --- a/packages/common/src/api/tan-query/comments/useReactToComment.ts +++ b/packages/common/src/api/tan-query/comments/useReactToComment.ts @@ -1,3 +1,4 @@ +import { Id } from '@audius/sdk' import { useMutation, useQueryClient } from '@tanstack/react-query' import { useDispatch } from 'react-redux' @@ -29,7 +30,19 @@ export const useReactToComment = () => { trackId }: ReactToCommentArgs) => { const sdk = await audiusSdk() - await sdk.comments.reactComment({ userId, commentId, isLiked, trackId }) + 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' } + }) + } }, 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 8e75b629098..cfe0d94f9d2 100644 --- a/packages/common/src/api/tan-query/comments/useReportComment.ts +++ b/packages/common/src/api/tan-query/comments/useReportComment.ts @@ -1,3 +1,4 @@ +import { Id } from '@audius/sdk' import { useMutation, useQueryClient } from '@tanstack/react-query' import { cloneDeep } from 'lodash' import { useDispatch } from 'react-redux' @@ -28,7 +29,10 @@ export const useReportComment = () => { return useMutation({ mutationFn: async ({ userId, commentId }: ReportCommentArgs) => { const sdk = await audiusSdk() - await sdk.comments.reportComment(userId, commentId) + await sdk.comments.reportComment({ + userId: Id.parse(userId)!, + commentId: Id.parse(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/sdk/src/sdk/api/comments/CommentsAPI.ts b/packages/sdk/src/sdk/api/comments/CommentsAPI.ts index 61ccdd675ba..3c58fba3d1d 100644 --- a/packages/sdk/src/sdk/api/comments/CommentsAPI.ts +++ b/packages/sdk/src/sdk/api/comments/CommentsAPI.ts @@ -85,16 +85,17 @@ export class CommentsApi extends GeneratedCommentsApi { requestInit?: RequestInit ) { if (this.entityManager) { - const { createCommentRequestBody, userId } = params - const metadata: EntityManagerCreateCommentRequest = { + const { metadata, userId } = params + const commentId = await this.createCommentWithEntityManager({ userId, - entityId: createCommentRequestBody.entityId, - entityType: createCommentRequestBody.entityType, - body: createCommentRequestBody.body, - commentId: createCommentRequestBody.commentId, - parentCommentId: createCommentRequestBody.parentId - } - const commentId = await this.createCommentWithEntityManager(metadata) + 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 @@ -132,14 +133,13 @@ export class CommentsApi extends GeneratedCommentsApi { requestInit?: RequestInit ) { if (this.entityManager) { - const { updateCommentRequestBody, userId, commentId } = params - const metadata: EntityManagerUpdateCommentRequest = { + const { metadata, userId, commentId } = params + await this.updateCommentWithEntityManager({ userId, entityId: commentId, - trackId: commentId, // trackId is used for the entity being commented on - body: updateCommentRequestBody.body - } - await this.updateCommentWithEntityManager(metadata) + trackId: encodeHashId(metadata.entityId) ?? '', + body: metadata.body + }) return { success: true } 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 cf97bd90bf3..7c3d8a785e6 100644 --- a/packages/sdk/src/sdk/api/generated/default/apis/CommentsApi.ts +++ b/packages/sdk/src/sdk/api/generated/default/apis/CommentsApi.ts @@ -20,6 +20,8 @@ import type { CommentResponse, CreateCommentRequestBody, CreateCommentResponse, + PinCommentRequestBody, + ReactCommentRequestBody, UnclaimedIdResponse, UpdateCommentRequestBody, WriteResponse, @@ -33,6 +35,10 @@ import { CreateCommentRequestBodyToJSON, CreateCommentResponseFromJSON, CreateCommentResponseToJSON, + PinCommentRequestBodyFromJSON, + PinCommentRequestBodyToJSON, + ReactCommentRequestBodyFromJSON, + ReactCommentRequestBodyToJSON, UnclaimedIdResponseFromJSON, UnclaimedIdResponseToJSON, UpdateCommentRequestBodyFromJSON, @@ -65,11 +71,13 @@ export interface GetCommentRepliesRequest { export interface PinCommentRequest { commentId: string; userId: string; + metadata: PinCommentRequestBody; } export interface ReactToCommentRequest { commentId: string; userId: string; + metadata: ReactCommentRequestBody; } export interface ReportCommentRequest { @@ -80,11 +88,13 @@ export interface ReportCommentRequest { export interface UnpinCommentRequest { commentId: string; userId: string; + metadata: PinCommentRequestBody; } export interface UnreactToCommentRequest { commentId: string; userId: string; + metadata: ReactCommentRequestBody; } export interface UpdateCommentRequest { @@ -315,6 +325,10 @@ export class CommentsApi extends runtime.BaseAPI { 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) { @@ -323,6 +337,8 @@ export class CommentsApi extends runtime.BaseAPI { 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); } @@ -339,6 +355,7 @@ export class CommentsApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, + body: PinCommentRequestBodyToJSON(params.metadata), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); @@ -365,6 +382,10 @@ export class CommentsApi extends runtime.BaseAPI { 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) { @@ -373,6 +394,8 @@ export class CommentsApi extends runtime.BaseAPI { 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); } @@ -389,6 +412,7 @@ export class CommentsApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, + body: ReactCommentRequestBodyToJSON(params.metadata), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); @@ -465,6 +489,10 @@ export class CommentsApi extends runtime.BaseAPI { 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) { @@ -473,6 +501,8 @@ export class CommentsApi extends runtime.BaseAPI { 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); } @@ -489,6 +519,7 @@ export class CommentsApi extends runtime.BaseAPI { method: 'DELETE', headers: headerParameters, query: queryParameters, + body: PinCommentRequestBodyToJSON(params.metadata), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); @@ -515,6 +546,10 @@ export class CommentsApi extends runtime.BaseAPI { 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) { @@ -523,6 +558,8 @@ export class CommentsApi extends runtime.BaseAPI { 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); } @@ -539,6 +576,7 @@ export class CommentsApi extends runtime.BaseAPI { method: 'DELETE', headers: headerParameters, query: queryParameters, + body: ReactCommentRequestBodyToJSON(params.metadata), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => WriteResponseFromJSON(jsonValue)); diff --git a/packages/sdk/src/sdk/api/generated/default/models/CommentEntityType.ts b/packages/sdk/src/sdk/api/generated/default/models/CommentEntityType.ts index de4afdece48..02a05fabdf1 100644 --- a/packages/sdk/src/sdk/api/generated/default/models/CommentEntityType.ts +++ b/packages/sdk/src/sdk/api/generated/default/models/CommentEntityType.ts @@ -15,7 +15,7 @@ /** - * Type of entity that can be commented on + * * @export */ export const CommentEntityType = { diff --git a/packages/sdk/src/sdk/api/generated/default/models/CreateCommentRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/CreateCommentRequestBody.ts index 810de0a90bd..381ab926df6 100644 --- a/packages/sdk/src/sdk/api/generated/default/models/CreateCommentRequestBody.ts +++ b/packages/sdk/src/sdk/api/generated/default/models/CreateCommentRequestBody.ts @@ -35,10 +35,10 @@ export interface CreateCommentRequestBody { entityType: CommentEntityType; /** * ID of the entity being commented on - * @type {string} + * @type {number} * @memberof CreateCommentRequestBody */ - entityId: string; + entityId: number; /** * Comment text * @type {string} @@ -46,7 +46,7 @@ export interface CreateCommentRequestBody { */ body: string; /** - * Optional comment ID + * Optional comment ID (will be generated if not provided) * @type {number} * @memberof CreateCommentRequestBody */ @@ -57,6 +57,18 @@ export interface CreateCommentRequestBody { * @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; } /** @@ -86,6 +98,8 @@ export function CreateCommentRequestBodyFromJSONTyped(json: any, ignoreDiscrimin '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'], }; } @@ -103,6 +117,8 @@ export function CreateCommentRequestBodyToJSON(value?: CreateCommentRequestBody '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/PinCommentRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/PinCommentRequestBody.ts new file mode 100644 index 00000000000..75e2154e034 --- /dev/null +++ b/packages/sdk/src/sdk/api/generated/default/models/PinCommentRequestBody.ts @@ -0,0 +1,67 @@ +/* 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 PinCommentRequestBody + */ +export interface PinCommentRequestBody { + /** + * ID of the entity (track or playlist) 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 && "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 { + + 'entityId': json['entityId'], + }; +} + +export function PinCommentRequestBodyToJSON(value?: PinCommentRequestBody | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'entityId': value.entityId, + }; +} + diff --git a/packages/sdk/src/sdk/api/generated/default/models/ReactCommentRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/ReactCommentRequestBody.ts new file mode 100644 index 00000000000..f206127caa7 --- /dev/null +++ b/packages/sdk/src/sdk/api/generated/default/models/ReactCommentRequestBody.ts @@ -0,0 +1,83 @@ +/* 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 or playlist) 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/UpdateCommentRequestBody.ts b/packages/sdk/src/sdk/api/generated/default/models/UpdateCommentRequestBody.ts index 405fc89e152..ad958840bb1 100644 --- a/packages/sdk/src/sdk/api/generated/default/models/UpdateCommentRequestBody.ts +++ b/packages/sdk/src/sdk/api/generated/default/models/UpdateCommentRequestBody.ts @@ -14,18 +14,43 @@ */ 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; } /** @@ -33,6 +58,8 @@ export interface UpdateCommentRequestBody { */ 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; @@ -48,7 +75,10 @@ export function UpdateCommentRequestBodyFromJSONTyped(json: any, ignoreDiscrimin } return { + 'entityType': CommentEntityTypeFromJSON(json['entityType']), + 'entityId': json['entityId'], 'body': json['body'], + 'mentions': !exists(json, 'mentions') ? undefined : json['mentions'], }; } @@ -61,7 +91,10 @@ export function UpdateCommentRequestBodyToJSON(value?: UpdateCommentRequestBody } 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/index.ts b/packages/sdk/src/sdk/api/generated/default/models/index.ts index 6b05c354502..791c42ad9fd 100644 --- a/packages/sdk/src/sdk/api/generated/default/models/index.ts +++ b/packages/sdk/src/sdk/api/generated/default/models/index.ts @@ -98,6 +98,7 @@ export * from './MediaLink'; export * from './MonthlyAggregatePlay'; export * from './Mood'; export * from './MutualFollowersResponse'; +export * from './PinCommentRequestBody'; export * from './Playlist'; export * from './PlaylistAddedTimestamp'; export * from './PlaylistArtwork'; @@ -111,6 +112,7 @@ export * from './PrizePublic'; export * from './PrizesResponse'; export * from './ProfilePicture'; export * from './PurchasersResponse'; +export * from './ReactCommentRequestBody'; export * from './RedeemAmountResponse'; export * from './RelatedArtistResponse'; export * from './RemixParent';