@lobehub/market-sdk 0.31.7 → 0.31.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +196 -1
- package/dist/index.mjs +190 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1966,6 +1966,114 @@ interface CodeInterpreterToolParams {
|
|
|
1966
1966
|
searchLocalFiles: SearchLocalFilesParams;
|
|
1967
1967
|
writeLocalFile: WriteLocalFileParams;
|
|
1968
1968
|
}
|
|
1969
|
+
/**
|
|
1970
|
+
* Author information for a plugin comment
|
|
1971
|
+
*/
|
|
1972
|
+
interface PluginCommentAuthor {
|
|
1973
|
+
avatar?: string;
|
|
1974
|
+
background?: string | null;
|
|
1975
|
+
displayName?: string | null;
|
|
1976
|
+
id?: number;
|
|
1977
|
+
identifier?: string;
|
|
1978
|
+
sourceType?: string | null;
|
|
1979
|
+
tags?: string[];
|
|
1980
|
+
type: 'agent' | 'user';
|
|
1981
|
+
}
|
|
1982
|
+
/**
|
|
1983
|
+
* A single plugin comment item
|
|
1984
|
+
*/
|
|
1985
|
+
interface PluginCommentItem {
|
|
1986
|
+
author: PluginCommentAuthor | null;
|
|
1987
|
+
content: string;
|
|
1988
|
+
createdAt: string;
|
|
1989
|
+
downvotes: number;
|
|
1990
|
+
id: number;
|
|
1991
|
+
parentId: number | null;
|
|
1992
|
+
rating?: number;
|
|
1993
|
+
replyCount: number;
|
|
1994
|
+
updatedAt: string;
|
|
1995
|
+
upvotes: number;
|
|
1996
|
+
}
|
|
1997
|
+
/**
|
|
1998
|
+
* Created plugin comment entity
|
|
1999
|
+
*/
|
|
2000
|
+
interface PluginCommentCreateItem {
|
|
2001
|
+
agentId: number | null;
|
|
2002
|
+
content: string;
|
|
2003
|
+
createdAt: string;
|
|
2004
|
+
downvotes: number;
|
|
2005
|
+
id: number;
|
|
2006
|
+
parentId: number | null;
|
|
2007
|
+
pluginId: number;
|
|
2008
|
+
updatedAt: string;
|
|
2009
|
+
upvotes: number;
|
|
2010
|
+
userId: number | null;
|
|
2011
|
+
}
|
|
2012
|
+
/**
|
|
2013
|
+
* Rating payload returned when creating a comment with a score
|
|
2014
|
+
*/
|
|
2015
|
+
interface PluginCommentRating {
|
|
2016
|
+
score: number;
|
|
2017
|
+
}
|
|
2018
|
+
/**
|
|
2019
|
+
* Response returned by the create comment endpoint
|
|
2020
|
+
*/
|
|
2021
|
+
interface PluginCommentCreateResponse extends PluginCommentCreateItem {
|
|
2022
|
+
rating?: PluginCommentRating;
|
|
2023
|
+
}
|
|
2024
|
+
/**
|
|
2025
|
+
* Latest comment for the authenticated user/agent on a plugin
|
|
2026
|
+
*/
|
|
2027
|
+
interface PluginLatestOwnComment {
|
|
2028
|
+
createdAt: string;
|
|
2029
|
+
id: number;
|
|
2030
|
+
parentId: number | null;
|
|
2031
|
+
replyCount: number;
|
|
2032
|
+
}
|
|
2033
|
+
/**
|
|
2034
|
+
* Response returned by the delete comment endpoint
|
|
2035
|
+
*/
|
|
2036
|
+
interface PluginCommentDeleteResponse {
|
|
2037
|
+
success: boolean;
|
|
2038
|
+
}
|
|
2039
|
+
/**
|
|
2040
|
+
* Query parameters for listing plugin comments
|
|
2041
|
+
*/
|
|
2042
|
+
interface PluginCommentListQuery {
|
|
2043
|
+
order?: 'asc' | 'desc';
|
|
2044
|
+
page?: number;
|
|
2045
|
+
pageSize?: number;
|
|
2046
|
+
sort?: 'createdAt' | 'upvotes';
|
|
2047
|
+
}
|
|
2048
|
+
/**
|
|
2049
|
+
* Paginated response for plugin comments
|
|
2050
|
+
*/
|
|
2051
|
+
interface PluginCommentListResponse {
|
|
2052
|
+
currentPage: number;
|
|
2053
|
+
items: PluginCommentItem[];
|
|
2054
|
+
pageSize: number;
|
|
2055
|
+
totalCount: number;
|
|
2056
|
+
totalPages: number;
|
|
2057
|
+
}
|
|
2058
|
+
/**
|
|
2059
|
+
* Rating distribution counts by score (1-5)
|
|
2060
|
+
*/
|
|
2061
|
+
interface PluginRatingDistribution {
|
|
2062
|
+
1: number;
|
|
2063
|
+
2: number;
|
|
2064
|
+
3: number;
|
|
2065
|
+
4: number;
|
|
2066
|
+
5: number;
|
|
2067
|
+
totalCount: number;
|
|
2068
|
+
}
|
|
2069
|
+
/**
|
|
2070
|
+
* Reaction response type
|
|
2071
|
+
*/
|
|
2072
|
+
interface PluginCommentReactionResponse {
|
|
2073
|
+
commentId: number;
|
|
2074
|
+
id: number;
|
|
2075
|
+
type: string;
|
|
2076
|
+
}
|
|
1969
2077
|
|
|
1970
2078
|
/**
|
|
1971
2079
|
* Connect Types for LobeHub Market SDK
|
|
@@ -5932,6 +6040,93 @@ declare class PluginsService extends BaseSDK {
|
|
|
5932
6040
|
topicId: string;
|
|
5933
6041
|
userId: string;
|
|
5934
6042
|
}): Promise<RunBuildInToolsResponse>;
|
|
6043
|
+
/**
|
|
6044
|
+
* Submits or updates a rating for a plugin
|
|
6045
|
+
*
|
|
6046
|
+
* @param identifier - Unique plugin identifier
|
|
6047
|
+
* @param score - Rating score (1-5)
|
|
6048
|
+
* @param options - Optional request options
|
|
6049
|
+
* @returns Promise resolving to the submitted score
|
|
6050
|
+
*/
|
|
6051
|
+
submitRating(identifier: string, score: number, options?: globalThis.RequestInit): Promise<{
|
|
6052
|
+
score: number;
|
|
6053
|
+
}>;
|
|
6054
|
+
/**
|
|
6055
|
+
* Deletes the current user/agent's rating for a plugin
|
|
6056
|
+
*
|
|
6057
|
+
* @param identifier - Unique plugin identifier
|
|
6058
|
+
* @param options - Optional request options
|
|
6059
|
+
* @returns Promise resolving to success status
|
|
6060
|
+
*/
|
|
6061
|
+
deleteRating(identifier: string, options?: globalThis.RequestInit): Promise<{
|
|
6062
|
+
success: boolean;
|
|
6063
|
+
}>;
|
|
6064
|
+
/**
|
|
6065
|
+
* Gets the rating distribution for a plugin
|
|
6066
|
+
*
|
|
6067
|
+
* @param identifier - Unique plugin identifier
|
|
6068
|
+
* @param options - Optional request options
|
|
6069
|
+
* @returns Promise resolving to the rating distribution
|
|
6070
|
+
*/
|
|
6071
|
+
getRatingDistribution(identifier: string, options?: globalThis.RequestInit): Promise<PluginRatingDistribution>;
|
|
6072
|
+
/**
|
|
6073
|
+
* Gets paginated comments for a plugin
|
|
6074
|
+
*
|
|
6075
|
+
* @param identifier - Unique plugin identifier
|
|
6076
|
+
* @param params - Query parameters for pagination and sorting
|
|
6077
|
+
* @param options - Optional request options
|
|
6078
|
+
* @returns Promise resolving to the paginated comment list
|
|
6079
|
+
*/
|
|
6080
|
+
getComments(identifier: string, params?: PluginCommentListQuery, options?: globalThis.RequestInit): Promise<PluginCommentListResponse>;
|
|
6081
|
+
/**
|
|
6082
|
+
* Gets the latest comment for the authenticated user or agent on a plugin
|
|
6083
|
+
*
|
|
6084
|
+
* @param identifier - Unique plugin identifier
|
|
6085
|
+
* @param options - Optional request options
|
|
6086
|
+
* @returns Promise resolving to the latest own comment or null when none exists
|
|
6087
|
+
*/
|
|
6088
|
+
getLatestOwnComment(identifier: string, options?: globalThis.RequestInit): Promise<PluginLatestOwnComment | null>;
|
|
6089
|
+
/**
|
|
6090
|
+
* Creates a comment on a plugin, optionally with a rating
|
|
6091
|
+
*
|
|
6092
|
+
* @param identifier - Unique plugin identifier
|
|
6093
|
+
* @param data - Comment data with content, optional score, and optional parentId
|
|
6094
|
+
* @param options - Optional request options
|
|
6095
|
+
* @returns Promise resolving to the created comment (with optional rating field)
|
|
6096
|
+
*/
|
|
6097
|
+
createComment(identifier: string, data: {
|
|
6098
|
+
content: string;
|
|
6099
|
+
parentId?: number;
|
|
6100
|
+
score?: number;
|
|
6101
|
+
}, options?: globalThis.RequestInit): Promise<PluginCommentCreateResponse>;
|
|
6102
|
+
/**
|
|
6103
|
+
* Deletes a comment from a plugin
|
|
6104
|
+
*
|
|
6105
|
+
* @param identifier - Unique plugin identifier
|
|
6106
|
+
* @param commentId - Comment ID to delete
|
|
6107
|
+
* @param options - Optional request options
|
|
6108
|
+
* @returns Promise resolving to success status
|
|
6109
|
+
*/
|
|
6110
|
+
deleteComment(identifier: string, commentId: number, options?: globalThis.RequestInit): Promise<PluginCommentDeleteResponse>;
|
|
6111
|
+
/**
|
|
6112
|
+
* Adds or updates a reaction on a comment
|
|
6113
|
+
*
|
|
6114
|
+
* @param commentId - Comment ID to react to
|
|
6115
|
+
* @param type - Reaction type ('upvote' or 'downvote')
|
|
6116
|
+
* @param options - Optional request options
|
|
6117
|
+
* @returns Promise resolving to the created reaction
|
|
6118
|
+
*/
|
|
6119
|
+
addReaction(commentId: number, type: 'downvote' | 'upvote', options?: globalThis.RequestInit): Promise<PluginCommentReactionResponse>;
|
|
6120
|
+
/**
|
|
6121
|
+
* Removes a reaction from a comment
|
|
6122
|
+
*
|
|
6123
|
+
* @param commentId - Comment ID to remove reaction from
|
|
6124
|
+
* @param options - Optional request options
|
|
6125
|
+
* @returns Promise resolving to success status
|
|
6126
|
+
*/
|
|
6127
|
+
removeReaction(commentId: number, options?: globalThis.RequestInit): Promise<{
|
|
6128
|
+
success: boolean;
|
|
6129
|
+
}>;
|
|
5935
6130
|
}
|
|
5936
6131
|
|
|
5937
6132
|
/**
|
|
@@ -6884,4 +7079,4 @@ declare function buildTrustedClientPayload(params: {
|
|
|
6884
7079
|
userId: string;
|
|
6885
7080
|
}): TrustedClientPayload;
|
|
6886
7081
|
|
|
6887
|
-
export { type AccountMeta, type AdminListQueryParams, type AdminListResponse, type AdminPluginParams, type AgentCreateRequest, type AgentCreateResponse, type AgentDetailQuery, type AgentExtension, type AgentForkItem, type AgentForkRequest, type AgentForkResponse, type AgentForkSourceResponse, type AgentForksResponse, type AgentGroupCreateRequest, type AgentGroupCreateResponse, type AgentGroupDetail, type AgentGroupDetailQuery, type AgentGroupForkItem, type AgentGroupForkRequest, type AgentGroupForkResponse, type AgentGroupForkSourceResponse, type AgentGroupForksResponse, type AgentGroupItem, type AgentGroupListQuery, type AgentGroupListResponse, type AgentGroupModifyRequest, type AgentGroupModifyResponse, type AgentGroupStatus, type AgentGroupStatusChangeResponse, type AgentGroupVersionCreateRequest, type AgentGroupVersionCreateResponse, type AgentInstallCountRequest, type AgentInstallCountResponse, type AgentInterface, type AgentItemDetail, type AgentListQuery, type AgentListResponse, type AgentModifyRequest, type AgentModifyResponse, type AgentProfileEntity, type AgentProfileResponse, type AgentSecurityRequirement, type AgentSecurityScheme, type AgentSkill, type AgentStatus, type AgentStatusChangeResponse, type AgentUploadRequest, type AgentUploadResponse, type AgentUploadVersion, type AgentVersionCreateRequest, type AgentVersionCreateResponse, type AgentVersionLocalization, type AgentVersionModifyRequest, type AgentVersionModifyResponse, type AuthorizationCodeTokenRequest, type AuthorizeParams, type AuthorizeResponse, type CallSkillToolResponse, type CheckFavoriteQuery, type CheckFavoriteResponse, type CheckFollowQuery, type CheckFollowResponse, type CheckLikeQuery, type CheckLikeResponse, type ClientRegistrationError, type ClientRegistrationRequest, type ClientRegistrationResponse, type CodeInterpreterToolName, type CodeInterpreterToolParams, type ConnectProvider, type ConnectProviderDetail, type ConnectProviderScopes, type ConnectionHealth, type ConnectionStats, type CreateMemberAgent, type DiscoveryDocument, type EditLocalFileParams, type ExecuteCodeParams, type ExportFileParams, type FavoriteListResponse, type FavoriteQuery, type FavoriteRequest, type FeedbackClientInfo, type FollowListItem, type FollowListResponse, type FollowRequest, type GetAllConnectionsHealthResponse, type GetAuthorizeUrlParams, type GetCommandOutputParams, type GetConnectProviderResponse, type GetConnectionHealthResponse, type GetConnectionStatsResponse, type GetConnectionStatusResponse, type GetSkillStatusResponse, type GetSkillToolResponse, type GlobLocalFilesParams, type GrepContentParams, type InteractionTargetType, type KillCommandParams, type LikeListResponse, type LikeQuery, type LikeRequest, type ListConnectProvidersResponse, type ListConnectionsResponse, type ListLocalFilesParams, type ListSkillProvidersResponse, type ListSkillToolsResponse, MarketAPIError, MarketAdmin, type MarketReportGitHubSkillParams, type MarketReportGitHubSkillResponse, type MarketReportSkillInstallParams, type MarketReportSkillInstallResponse, MarketSDK, type MarketSDKOptions, type MarketSkillAuthor, type MarketSkillCategory, type MarketSkillCategoryQuery, type MarketSkillDetail, type MarketSkillDetailQuery, type MarketSkillGitHubMeta, type MarketSkillListItem, type MarketSkillListQuery, type MarketSkillListResponse, type MarketSkillManifest, type MarketSkillResource, type MarketSkillVersionSummary, type MarketSkillVersionsResponse, type MemberAgent, type MoveLocalFilesParams, type MoveOperation, type OAuthConnection, type OAuthTokenResponse, type OwnAgentGroupListQuery, type OwnAgentListQuery, type PaginationQuery, type PluginI18nImportParams, type PluginI18nImportResponse, type PluginItem, type PluginListResponse, type PluginLocalization, type PluginQueryParams, type PluginUpdateParams, type PluginVersionCreateParams, type PluginVersionUpdateParams, type ProgrammingLanguage, type ReadLocalFileParams, type RefreshConnectionResponse, type RefreshTokenRequest, type RegisterUserRequest, type RegisterUserResponse, type RegisteredUserProfile, type RenameLocalFileParams, type ReviewStatus, ReviewStatusEnumSchema, type RevokeConnectionResponse, type RunBuildInToolsError, type RunBuildInToolsRequest, type RunBuildInToolsResponse, type RunBuildInToolsSuccessData, type RunCommandParams, SDK_USER_AGENT, SDK_VERSION, type SearchLocalFilesParams, type SharedTokenState, type SkillCallParams, type SkillCommentAuthor, type SkillCommentCreateItem, type SkillCommentCreateResponse, type SkillCommentDeleteResponse, type SkillCommentItem, type SkillCommentListItem, type SkillCommentListQuery, type SkillCommentListResponse, type SkillCommentRating, type SkillErrorResponse, type SkillLatestOwnComment, type SkillProviderInfo, type SkillProviderStatus, type SkillRatingDistribution, type SkillTool, StatusEnumSchema, type SubmitFeedbackRequest, type SubmitFeedbackResponse, type SuccessResponse, type ToggleLikeResponse, type TrustedClientPayload, type UnclaimedPluginItem, type UpdateAgentProfileRequest, type UpdateAgentProfileResponse, type UpdateMemberAgent, type UpdateUserInfoRequest, type UpdateUserInfoResponse, type UserAgentGroupItem, type UserAgentItem, type UserInfoQuery, type UserInfoResponse, type UserProfile, VisibilityEnumSchema, type WriteLocalFileParams, buildTrustedClientPayload, createTrustedClientToken, generateNonce };
|
|
7082
|
+
export { type AccountMeta, type AdminListQueryParams, type AdminListResponse, type AdminPluginParams, type AgentCreateRequest, type AgentCreateResponse, type AgentDetailQuery, type AgentExtension, type AgentForkItem, type AgentForkRequest, type AgentForkResponse, type AgentForkSourceResponse, type AgentForksResponse, type AgentGroupCreateRequest, type AgentGroupCreateResponse, type AgentGroupDetail, type AgentGroupDetailQuery, type AgentGroupForkItem, type AgentGroupForkRequest, type AgentGroupForkResponse, type AgentGroupForkSourceResponse, type AgentGroupForksResponse, type AgentGroupItem, type AgentGroupListQuery, type AgentGroupListResponse, type AgentGroupModifyRequest, type AgentGroupModifyResponse, type AgentGroupStatus, type AgentGroupStatusChangeResponse, type AgentGroupVersionCreateRequest, type AgentGroupVersionCreateResponse, type AgentInstallCountRequest, type AgentInstallCountResponse, type AgentInterface, type AgentItemDetail, type AgentListQuery, type AgentListResponse, type AgentModifyRequest, type AgentModifyResponse, type AgentProfileEntity, type AgentProfileResponse, type AgentSecurityRequirement, type AgentSecurityScheme, type AgentSkill, type AgentStatus, type AgentStatusChangeResponse, type AgentUploadRequest, type AgentUploadResponse, type AgentUploadVersion, type AgentVersionCreateRequest, type AgentVersionCreateResponse, type AgentVersionLocalization, type AgentVersionModifyRequest, type AgentVersionModifyResponse, type AuthorizationCodeTokenRequest, type AuthorizeParams, type AuthorizeResponse, type CallSkillToolResponse, type CheckFavoriteQuery, type CheckFavoriteResponse, type CheckFollowQuery, type CheckFollowResponse, type CheckLikeQuery, type CheckLikeResponse, type ClientRegistrationError, type ClientRegistrationRequest, type ClientRegistrationResponse, type CodeInterpreterToolName, type CodeInterpreterToolParams, type ConnectProvider, type ConnectProviderDetail, type ConnectProviderScopes, type ConnectionHealth, type ConnectionStats, type CreateMemberAgent, type DiscoveryDocument, type EditLocalFileParams, type ExecuteCodeParams, type ExportFileParams, type FavoriteListResponse, type FavoriteQuery, type FavoriteRequest, type FeedbackClientInfo, type FollowListItem, type FollowListResponse, type FollowRequest, type GetAllConnectionsHealthResponse, type GetAuthorizeUrlParams, type GetCommandOutputParams, type GetConnectProviderResponse, type GetConnectionHealthResponse, type GetConnectionStatsResponse, type GetConnectionStatusResponse, type GetSkillStatusResponse, type GetSkillToolResponse, type GlobLocalFilesParams, type GrepContentParams, type InteractionTargetType, type KillCommandParams, type LikeListResponse, type LikeQuery, type LikeRequest, type ListConnectProvidersResponse, type ListConnectionsResponse, type ListLocalFilesParams, type ListSkillProvidersResponse, type ListSkillToolsResponse, MarketAPIError, MarketAdmin, type MarketReportGitHubSkillParams, type MarketReportGitHubSkillResponse, type MarketReportSkillInstallParams, type MarketReportSkillInstallResponse, MarketSDK, type MarketSDKOptions, type MarketSkillAuthor, type MarketSkillCategory, type MarketSkillCategoryQuery, type MarketSkillDetail, type MarketSkillDetailQuery, type MarketSkillGitHubMeta, type MarketSkillListItem, type MarketSkillListQuery, type MarketSkillListResponse, type MarketSkillManifest, type MarketSkillResource, type MarketSkillVersionSummary, type MarketSkillVersionsResponse, type MemberAgent, type MoveLocalFilesParams, type MoveOperation, type OAuthConnection, type OAuthTokenResponse, type OwnAgentGroupListQuery, type OwnAgentListQuery, type PaginationQuery, type PluginCommentAuthor, type PluginCommentCreateItem, type PluginCommentCreateResponse, type PluginCommentDeleteResponse, type PluginCommentItem, type PluginCommentListQuery, type PluginCommentListResponse, type PluginCommentRating, type PluginCommentReactionResponse, type PluginI18nImportParams, type PluginI18nImportResponse, type PluginItem, type PluginLatestOwnComment, type PluginListResponse, type PluginLocalization, type PluginQueryParams, type PluginRatingDistribution, type PluginUpdateParams, type PluginVersionCreateParams, type PluginVersionUpdateParams, type ProgrammingLanguage, type ReadLocalFileParams, type RefreshConnectionResponse, type RefreshTokenRequest, type RegisterUserRequest, type RegisterUserResponse, type RegisteredUserProfile, type RenameLocalFileParams, type ReviewStatus, ReviewStatusEnumSchema, type RevokeConnectionResponse, type RunBuildInToolsError, type RunBuildInToolsRequest, type RunBuildInToolsResponse, type RunBuildInToolsSuccessData, type RunCommandParams, SDK_USER_AGENT, SDK_VERSION, type SearchLocalFilesParams, type SharedTokenState, type SkillCallParams, type SkillCommentAuthor, type SkillCommentCreateItem, type SkillCommentCreateResponse, type SkillCommentDeleteResponse, type SkillCommentItem, type SkillCommentListItem, type SkillCommentListQuery, type SkillCommentListResponse, type SkillCommentRating, type SkillErrorResponse, type SkillLatestOwnComment, type SkillProviderInfo, type SkillProviderStatus, type SkillRatingDistribution, type SkillTool, StatusEnumSchema, type SubmitFeedbackRequest, type SubmitFeedbackResponse, type SuccessResponse, type ToggleLikeResponse, type TrustedClientPayload, type UnclaimedPluginItem, type UpdateAgentProfileRequest, type UpdateAgentProfileResponse, type UpdateMemberAgent, type UpdateUserInfoRequest, type UpdateUserInfoResponse, type UserAgentGroupItem, type UserAgentItem, type UserInfoQuery, type UserInfoResponse, type UserProfile, VisibilityEnumSchema, type WriteLocalFileParams, buildTrustedClientPayload, createTrustedClientToken, generateNonce };
|
package/dist/index.mjs
CHANGED
|
@@ -3414,6 +3414,196 @@ var PluginsService = class extends BaseSDK {
|
|
|
3414
3414
|
async exportFile(path, uploadUrl, context) {
|
|
3415
3415
|
return this.runBuildInTool("exportFile", { path, uploadUrl }, context);
|
|
3416
3416
|
}
|
|
3417
|
+
// ============================================================================
|
|
3418
|
+
// Rating Methods
|
|
3419
|
+
// ============================================================================
|
|
3420
|
+
/**
|
|
3421
|
+
* Submits or updates a rating for a plugin
|
|
3422
|
+
*
|
|
3423
|
+
* @param identifier - Unique plugin identifier
|
|
3424
|
+
* @param score - Rating score (1-5)
|
|
3425
|
+
* @param options - Optional request options
|
|
3426
|
+
* @returns Promise resolving to the submitted score
|
|
3427
|
+
*/
|
|
3428
|
+
async submitRating(identifier, score, options) {
|
|
3429
|
+
log17("Submitting rating for plugin %s: %d", identifier, score);
|
|
3430
|
+
const result = await this.request(
|
|
3431
|
+
`/v1/plugins/${encodeURIComponent(identifier)}/ratings`,
|
|
3432
|
+
{
|
|
3433
|
+
...options,
|
|
3434
|
+
body: JSON.stringify({ score }),
|
|
3435
|
+
method: "POST"
|
|
3436
|
+
}
|
|
3437
|
+
);
|
|
3438
|
+
log17("Rating submitted for plugin %s: %d", identifier, result.score);
|
|
3439
|
+
return result;
|
|
3440
|
+
}
|
|
3441
|
+
/**
|
|
3442
|
+
* Deletes the current user/agent's rating for a plugin
|
|
3443
|
+
*
|
|
3444
|
+
* @param identifier - Unique plugin identifier
|
|
3445
|
+
* @param options - Optional request options
|
|
3446
|
+
* @returns Promise resolving to success status
|
|
3447
|
+
*/
|
|
3448
|
+
async deleteRating(identifier, options) {
|
|
3449
|
+
log17("Deleting rating for plugin %s", identifier);
|
|
3450
|
+
const result = await this.request(
|
|
3451
|
+
`/v1/plugins/${encodeURIComponent(identifier)}/ratings`,
|
|
3452
|
+
{
|
|
3453
|
+
...options,
|
|
3454
|
+
method: "DELETE"
|
|
3455
|
+
}
|
|
3456
|
+
);
|
|
3457
|
+
log17("Rating deleted for plugin %s", identifier);
|
|
3458
|
+
return result;
|
|
3459
|
+
}
|
|
3460
|
+
/**
|
|
3461
|
+
* Gets the rating distribution for a plugin
|
|
3462
|
+
*
|
|
3463
|
+
* @param identifier - Unique plugin identifier
|
|
3464
|
+
* @param options - Optional request options
|
|
3465
|
+
* @returns Promise resolving to the rating distribution
|
|
3466
|
+
*/
|
|
3467
|
+
async getRatingDistribution(identifier, options) {
|
|
3468
|
+
log17("Getting rating distribution for plugin: %s", identifier);
|
|
3469
|
+
const result = await this.request(
|
|
3470
|
+
`/v1/plugins/${encodeURIComponent(identifier)}/ratings/distribution`,
|
|
3471
|
+
options
|
|
3472
|
+
);
|
|
3473
|
+
log17("Rating distribution retrieved for plugin %s: %d total", identifier, result.totalCount);
|
|
3474
|
+
return result;
|
|
3475
|
+
}
|
|
3476
|
+
// ============================================================================
|
|
3477
|
+
// Comment Methods
|
|
3478
|
+
// ============================================================================
|
|
3479
|
+
/**
|
|
3480
|
+
* Gets paginated comments for a plugin
|
|
3481
|
+
*
|
|
3482
|
+
* @param identifier - Unique plugin identifier
|
|
3483
|
+
* @param params - Query parameters for pagination and sorting
|
|
3484
|
+
* @param options - Optional request options
|
|
3485
|
+
* @returns Promise resolving to the paginated comment list
|
|
3486
|
+
*/
|
|
3487
|
+
async getComments(identifier, params = {}, options) {
|
|
3488
|
+
const queryString = this.buildQueryString(params);
|
|
3489
|
+
log17("Getting comments for plugin %s: %O", identifier, params);
|
|
3490
|
+
const result = await this.request(
|
|
3491
|
+
`/v1/plugins/${encodeURIComponent(identifier)}/comments${queryString}`,
|
|
3492
|
+
options
|
|
3493
|
+
);
|
|
3494
|
+
log17(
|
|
3495
|
+
"Retrieved %d comments for plugin %s (page %d/%d)",
|
|
3496
|
+
result.items.length,
|
|
3497
|
+
identifier,
|
|
3498
|
+
result.currentPage,
|
|
3499
|
+
result.totalPages
|
|
3500
|
+
);
|
|
3501
|
+
return result;
|
|
3502
|
+
}
|
|
3503
|
+
/**
|
|
3504
|
+
* Gets the latest comment for the authenticated user or agent on a plugin
|
|
3505
|
+
*
|
|
3506
|
+
* @param identifier - Unique plugin identifier
|
|
3507
|
+
* @param options - Optional request options
|
|
3508
|
+
* @returns Promise resolving to the latest own comment or null when none exists
|
|
3509
|
+
*/
|
|
3510
|
+
async getLatestOwnComment(identifier, options) {
|
|
3511
|
+
log17("Getting latest own comment for plugin %s", identifier);
|
|
3512
|
+
const result = await this.request(
|
|
3513
|
+
`/v1/plugins/${encodeURIComponent(identifier)}/comments/latest`,
|
|
3514
|
+
options
|
|
3515
|
+
);
|
|
3516
|
+
if (result) {
|
|
3517
|
+
log17("Retrieved latest own comment for plugin %s: id=%d", identifier, result.id);
|
|
3518
|
+
} else {
|
|
3519
|
+
log17("No own comments found for plugin %s", identifier);
|
|
3520
|
+
}
|
|
3521
|
+
return result;
|
|
3522
|
+
}
|
|
3523
|
+
/**
|
|
3524
|
+
* Creates a comment on a plugin, optionally with a rating
|
|
3525
|
+
*
|
|
3526
|
+
* @param identifier - Unique plugin identifier
|
|
3527
|
+
* @param data - Comment data with content, optional score, and optional parentId
|
|
3528
|
+
* @param options - Optional request options
|
|
3529
|
+
* @returns Promise resolving to the created comment (with optional rating field)
|
|
3530
|
+
*/
|
|
3531
|
+
async createComment(identifier, data, options) {
|
|
3532
|
+
log17("Creating comment on plugin %s", identifier);
|
|
3533
|
+
const result = await this.request(
|
|
3534
|
+
`/v1/plugins/${encodeURIComponent(identifier)}/comments`,
|
|
3535
|
+
{
|
|
3536
|
+
...options,
|
|
3537
|
+
body: JSON.stringify(data),
|
|
3538
|
+
method: "POST"
|
|
3539
|
+
}
|
|
3540
|
+
);
|
|
3541
|
+
log17("Comment created on plugin %s: id=%d", identifier, result.id);
|
|
3542
|
+
return result;
|
|
3543
|
+
}
|
|
3544
|
+
/**
|
|
3545
|
+
* Deletes a comment from a plugin
|
|
3546
|
+
*
|
|
3547
|
+
* @param identifier - Unique plugin identifier
|
|
3548
|
+
* @param commentId - Comment ID to delete
|
|
3549
|
+
* @param options - Optional request options
|
|
3550
|
+
* @returns Promise resolving to success status
|
|
3551
|
+
*/
|
|
3552
|
+
async deleteComment(identifier, commentId, options) {
|
|
3553
|
+
log17("Deleting comment %d from plugin %s", commentId, identifier);
|
|
3554
|
+
const result = await this.request(
|
|
3555
|
+
`/v1/plugins/${encodeURIComponent(identifier)}/comments/${commentId}`,
|
|
3556
|
+
{
|
|
3557
|
+
...options,
|
|
3558
|
+
method: "DELETE"
|
|
3559
|
+
}
|
|
3560
|
+
);
|
|
3561
|
+
log17("Comment %d deleted from plugin %s", commentId, identifier);
|
|
3562
|
+
return result;
|
|
3563
|
+
}
|
|
3564
|
+
// ============================================================================
|
|
3565
|
+
// Reaction Methods
|
|
3566
|
+
// ============================================================================
|
|
3567
|
+
/**
|
|
3568
|
+
* Adds or updates a reaction on a comment
|
|
3569
|
+
*
|
|
3570
|
+
* @param commentId - Comment ID to react to
|
|
3571
|
+
* @param type - Reaction type ('upvote' or 'downvote')
|
|
3572
|
+
* @param options - Optional request options
|
|
3573
|
+
* @returns Promise resolving to the created reaction
|
|
3574
|
+
*/
|
|
3575
|
+
async addReaction(commentId, type, options) {
|
|
3576
|
+
log17("Adding %s reaction to comment %d", type, commentId);
|
|
3577
|
+
const result = await this.request(
|
|
3578
|
+
`/v1/plugins/comments/${commentId}/reactions`,
|
|
3579
|
+
{
|
|
3580
|
+
...options,
|
|
3581
|
+
body: JSON.stringify({ type }),
|
|
3582
|
+
method: "POST"
|
|
3583
|
+
}
|
|
3584
|
+
);
|
|
3585
|
+
log17("Reaction added to comment %d: %s (id=%d)", commentId, result.type, result.id);
|
|
3586
|
+
return result;
|
|
3587
|
+
}
|
|
3588
|
+
/**
|
|
3589
|
+
* Removes a reaction from a comment
|
|
3590
|
+
*
|
|
3591
|
+
* @param commentId - Comment ID to remove reaction from
|
|
3592
|
+
* @param options - Optional request options
|
|
3593
|
+
* @returns Promise resolving to success status
|
|
3594
|
+
*/
|
|
3595
|
+
async removeReaction(commentId, options) {
|
|
3596
|
+
log17("Removing reaction from comment %d", commentId);
|
|
3597
|
+
const result = await this.request(
|
|
3598
|
+
`/v1/plugins/comments/${commentId}/reactions`,
|
|
3599
|
+
{
|
|
3600
|
+
...options,
|
|
3601
|
+
method: "DELETE"
|
|
3602
|
+
}
|
|
3603
|
+
);
|
|
3604
|
+
log17("Reaction removed from comment %d", commentId);
|
|
3605
|
+
return result;
|
|
3606
|
+
}
|
|
3417
3607
|
};
|
|
3418
3608
|
|
|
3419
3609
|
// src/market/services/SkillService.ts
|