@smithery/api 0.35.0 → 0.37.0
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/CHANGELOG.md +18 -0
- package/lib/mcp-transport.d.mts +12 -0
- package/lib/mcp-transport.d.mts.map +1 -1
- package/lib/mcp-transport.d.ts +12 -0
- package/lib/mcp-transport.d.ts.map +1 -1
- package/lib/mcp-transport.js +5 -2
- package/lib/mcp-transport.js.map +1 -1
- package/lib/mcp-transport.mjs +5 -2
- package/lib/mcp-transport.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/experimental/connect/mcp.d.mts +4 -2
- package/resources/experimental/connect/mcp.d.mts.map +1 -1
- package/resources/experimental/connect/mcp.d.ts +4 -2
- package/resources/experimental/connect/mcp.d.ts.map +1 -1
- package/resources/experimental/connect/mcp.js +4 -2
- package/resources/experimental/connect/mcp.js.map +1 -1
- package/resources/experimental/connect/mcp.mjs +4 -2
- package/resources/experimental/connect/mcp.mjs.map +1 -1
- package/resources/skills/index.d.mts +2 -1
- package/resources/skills/index.d.mts.map +1 -1
- package/resources/skills/index.d.ts +2 -1
- package/resources/skills/index.d.ts.map +1 -1
- package/resources/skills/index.js +3 -1
- package/resources/skills/index.js.map +1 -1
- package/resources/skills/index.mjs +1 -0
- package/resources/skills/index.mjs.map +1 -1
- package/resources/skills/reviews.d.mts +48 -44
- package/resources/skills/reviews.d.mts.map +1 -1
- package/resources/skills/reviews.d.ts +48 -44
- package/resources/skills/reviews.d.ts.map +1 -1
- package/resources/skills/reviews.js +23 -4
- package/resources/skills/reviews.js.map +1 -1
- package/resources/skills/reviews.mjs +23 -4
- package/resources/skills/reviews.mjs.map +1 -1
- package/resources/skills/skills.d.mts +6 -2
- package/resources/skills/skills.d.mts.map +1 -1
- package/resources/skills/skills.d.ts +6 -2
- package/resources/skills/skills.d.ts.map +1 -1
- package/resources/skills/skills.js +4 -0
- package/resources/skills/skills.js.map +1 -1
- package/resources/skills/skills.mjs +4 -0
- package/resources/skills/skills.mjs.map +1 -1
- package/resources/skills/votes.d.mts +55 -0
- package/resources/skills/votes.d.mts.map +1 -0
- package/resources/skills/votes.d.ts +55 -0
- package/resources/skills/votes.d.ts.map +1 -0
- package/resources/skills/votes.js +35 -0
- package/resources/skills/votes.js.map +1 -0
- package/resources/skills/votes.mjs +31 -0
- package/resources/skills/votes.mjs.map +1 -0
- package/src/lib/mcp-transport.ts +21 -2
- package/src/resources/experimental/connect/mcp.ts +4 -2
- package/src/resources/skills/index.ts +13 -0
- package/src/resources/skills/reviews.ts +75 -50
- package/src/resources/skills/skills.ts +30 -0
- package/src/resources/skills/votes.ts +91 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../../core/resource.mjs";
|
|
3
|
+
import { buildHeaders } from "../../internal/headers.mjs";
|
|
4
|
+
import { path } from "../../internal/utils/path.mjs";
|
|
5
|
+
export class Votes extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Upvote or downvote a skill. Updates existing vote if one exists.
|
|
8
|
+
*/
|
|
9
|
+
create(slug, params, options) {
|
|
10
|
+
const { namespace, ...body } = params;
|
|
11
|
+
return this._client.post(path `/skills/${namespace}/${slug}/vote`, { body, ...options });
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Remove vote from a skill
|
|
15
|
+
*/
|
|
16
|
+
delete(slug, params, options) {
|
|
17
|
+
const { namespace } = params;
|
|
18
|
+
return this._client.delete(path `/skills/${namespace}/${slug}/vote`, {
|
|
19
|
+
...options,
|
|
20
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get upvote/downvote counts and current user's vote (if authenticated)
|
|
25
|
+
*/
|
|
26
|
+
get(slug, params, options) {
|
|
27
|
+
const { namespace } = params;
|
|
28
|
+
return this._client.get(path `/skills/${namespace}/${slug}/vote`, options);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=votes.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"votes.mjs","sourceRoot":"","sources":["../../src/resources/skills/votes.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC;;OAEG;IACH,MAAM,CAAC,IAAY,EAAE,MAAwB,EAAE,OAAwB;QACrE,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QACtC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,WAAW,SAAS,IAAI,IAAI,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1F,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAY,EAAE,MAAwB,EAAE,OAAwB;QACrE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,WAAW,SAAS,IAAI,IAAI,OAAO,EAAE;YAClE,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,IAAY,EAAE,MAAqB,EAAE,OAAwB;QAC/D,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,WAAW,SAAS,IAAI,IAAI,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC;CACF"}
|
package/src/lib/mcp-transport.ts
CHANGED
|
@@ -60,6 +60,19 @@ export interface CreateConnectionOptions {
|
|
|
60
60
|
* If connectionId is not provided, this is required.
|
|
61
61
|
*/
|
|
62
62
|
mcpUrl?: string;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Enable MCP init/initialized handshake to receive server version info.
|
|
66
|
+
*
|
|
67
|
+
* When `false` (default), skips the handshake for faster connection.
|
|
68
|
+
* Smithery Connect is stateless, so the handshake is not required.
|
|
69
|
+
*
|
|
70
|
+
* Set to `true` if you need `client.getServerVersion()` or protocol
|
|
71
|
+
* version negotiation.
|
|
72
|
+
*
|
|
73
|
+
* @default false
|
|
74
|
+
*/
|
|
75
|
+
handshake?: boolean;
|
|
63
76
|
}
|
|
64
77
|
|
|
65
78
|
export interface SmitheryConnection {
|
|
@@ -147,13 +160,19 @@ export async function createConnection(options: CreateConnectionOptions): Promis
|
|
|
147
160
|
const url = new URL(`/connect/${namespace}/${connectionId}/mcp`, client.baseURL).href;
|
|
148
161
|
|
|
149
162
|
// Create transport with auth headers
|
|
150
|
-
|
|
163
|
+
// Skip MCP init handshake by default (stateless server).
|
|
164
|
+
// Setting sessionId tricks the SDK into thinking we're reconnecting.
|
|
165
|
+
const transportOptions = {
|
|
151
166
|
requestInit: {
|
|
152
167
|
headers: {
|
|
153
168
|
Authorization: `Bearer ${client.apiKey}`,
|
|
154
169
|
},
|
|
155
170
|
},
|
|
156
|
-
}
|
|
171
|
+
};
|
|
172
|
+
const transport = new StreamableHTTPClientTransport(
|
|
173
|
+
new URL(url),
|
|
174
|
+
options.handshake ? transportOptions : { ...transportOptions, sessionId: 'smithery-stateless' },
|
|
175
|
+
);
|
|
157
176
|
|
|
158
177
|
return { transport, connectionId, url };
|
|
159
178
|
}
|
|
@@ -7,8 +7,10 @@ import { path } from '../../../internal/utils/path';
|
|
|
7
7
|
|
|
8
8
|
export class Mcp extends APIResource {
|
|
9
9
|
/**
|
|
10
|
-
* Streamable HTTP
|
|
11
|
-
*
|
|
10
|
+
* Stateless MCP endpoint using Streamable HTTP transport. Accepts JSON-RPC
|
|
11
|
+
* requests and notifications. Session management is handled internally by
|
|
12
|
+
* Connect—clients should not send mcp-session-id headers. Requires service token
|
|
13
|
+
* with mcp scope.
|
|
12
14
|
*
|
|
13
15
|
* @example
|
|
14
16
|
* ```ts
|
|
@@ -5,10 +5,14 @@ export {
|
|
|
5
5
|
type CreateReviewRequest,
|
|
6
6
|
type CreateReviewResponse,
|
|
7
7
|
type ReviewItem,
|
|
8
|
+
type ReviewVoteRequest,
|
|
9
|
+
type ReviewVoteResponse,
|
|
8
10
|
type ReviewsListResponse,
|
|
9
11
|
type ReviewCreateParams,
|
|
10
12
|
type ReviewListParams,
|
|
11
13
|
type ReviewDeleteParams,
|
|
14
|
+
type ReviewUnvoteParams,
|
|
15
|
+
type ReviewVoteParams,
|
|
12
16
|
type ReviewItemsReviewsPage,
|
|
13
17
|
} from './reviews';
|
|
14
18
|
export {
|
|
@@ -19,3 +23,12 @@ export {
|
|
|
19
23
|
type SkillGetParams,
|
|
20
24
|
type SkillListResponsesSkillsPage,
|
|
21
25
|
} from './skills';
|
|
26
|
+
export {
|
|
27
|
+
Votes,
|
|
28
|
+
type SkillVoteCounts,
|
|
29
|
+
type SkillVoteRequest,
|
|
30
|
+
type SkillVoteResponse,
|
|
31
|
+
type VoteCreateParams,
|
|
32
|
+
type VoteDeleteParams,
|
|
33
|
+
type VoteGetParams,
|
|
34
|
+
} from './votes';
|
|
@@ -9,8 +9,7 @@ import { path } from '../../internal/utils/path';
|
|
|
9
9
|
|
|
10
10
|
export class Reviews extends APIResource {
|
|
11
11
|
/**
|
|
12
|
-
* Submit a review for a skill
|
|
13
|
-
* already exists.
|
|
12
|
+
* Submit a review for a skill. Updates existing review if one already exists.
|
|
14
13
|
*/
|
|
15
14
|
create(
|
|
16
15
|
slug: string,
|
|
@@ -22,7 +21,7 @@ export class Reviews extends APIResource {
|
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
/**
|
|
25
|
-
* Get paginated list of reviews
|
|
24
|
+
* Get paginated list of reviews with vote counts
|
|
26
25
|
*/
|
|
27
26
|
list(
|
|
28
27
|
slug: string,
|
|
@@ -37,7 +36,7 @@ export class Reviews extends APIResource {
|
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
/**
|
|
40
|
-
* Delete your
|
|
39
|
+
* Delete your review
|
|
41
40
|
*/
|
|
42
41
|
delete(slug: string, params: ReviewDeleteParams, options?: RequestOptions): APIPromise<void> {
|
|
43
42
|
const { namespace } = params;
|
|
@@ -46,25 +45,42 @@ export class Reviews extends APIResource {
|
|
|
46
45
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
47
46
|
});
|
|
48
47
|
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Remove vote from a review
|
|
51
|
+
*/
|
|
52
|
+
unvote(reviewID: string, params: ReviewUnvoteParams, options?: RequestOptions): APIPromise<void> {
|
|
53
|
+
const { namespace, slug } = params;
|
|
54
|
+
return this._client.delete(path`/skills/${namespace}/${slug}/reviews/${reviewID}/vote`, {
|
|
55
|
+
...options,
|
|
56
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Upvote or downvote a review. Updates existing vote if one exists.
|
|
62
|
+
*/
|
|
63
|
+
vote(reviewID: string, params: ReviewVoteParams, options?: RequestOptions): APIPromise<ReviewVoteResponse> {
|
|
64
|
+
const { namespace, slug, ...body } = params;
|
|
65
|
+
return this._client.post(path`/skills/${namespace}/${slug}/reviews/${reviewID}/vote`, {
|
|
66
|
+
body,
|
|
67
|
+
...options,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
49
70
|
}
|
|
50
71
|
|
|
51
72
|
export type ReviewItemsReviewsPage = ReviewsPage<ReviewItem>;
|
|
52
73
|
|
|
53
74
|
export interface CreateReviewRequest {
|
|
54
75
|
/**
|
|
55
|
-
*
|
|
76
|
+
* Review text (required)
|
|
56
77
|
*/
|
|
57
|
-
|
|
78
|
+
review: string;
|
|
58
79
|
|
|
59
80
|
/**
|
|
60
81
|
* Optional agent model name (e.g., 'claude-3.5-sonnet')
|
|
61
82
|
*/
|
|
62
83
|
agentModel?: string;
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Optional review comment
|
|
66
|
-
*/
|
|
67
|
-
comment?: string;
|
|
68
84
|
}
|
|
69
85
|
|
|
70
86
|
export interface CreateReviewResponse {
|
|
@@ -73,14 +89,12 @@ export interface CreateReviewResponse {
|
|
|
73
89
|
*/
|
|
74
90
|
id: string;
|
|
75
91
|
|
|
76
|
-
comment: string | null;
|
|
77
|
-
|
|
78
92
|
/**
|
|
79
93
|
* ISO 8601 timestamp
|
|
80
94
|
*/
|
|
81
95
|
createdAt: string;
|
|
82
96
|
|
|
83
|
-
|
|
97
|
+
review: string;
|
|
84
98
|
}
|
|
85
99
|
|
|
86
100
|
export interface ReviewItem {
|
|
@@ -90,58 +104,47 @@ export interface ReviewItem {
|
|
|
90
104
|
|
|
91
105
|
agentModel: string | null;
|
|
92
106
|
|
|
93
|
-
comment: string | null;
|
|
94
|
-
|
|
95
107
|
/**
|
|
96
108
|
* ISO 8601 timestamp
|
|
97
109
|
*/
|
|
98
110
|
createdAt: string;
|
|
99
111
|
|
|
100
|
-
|
|
112
|
+
downvotes: number;
|
|
113
|
+
|
|
114
|
+
review: string;
|
|
115
|
+
|
|
116
|
+
upvotes: number;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface ReviewVoteRequest {
|
|
120
|
+
/**
|
|
121
|
+
* true for thumbs up, false for thumbs down
|
|
122
|
+
*/
|
|
123
|
+
isPositive: boolean;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface ReviewVoteResponse {
|
|
127
|
+
createdAt: string;
|
|
128
|
+
|
|
129
|
+
isPositive: boolean;
|
|
101
130
|
}
|
|
102
131
|
|
|
103
132
|
export interface ReviewsListResponse {
|
|
104
133
|
pagination: ReviewsListResponse.Pagination;
|
|
105
134
|
|
|
106
135
|
reviews: Array<ReviewItem>;
|
|
107
|
-
|
|
108
|
-
summary: ReviewsListResponse.Summary;
|
|
109
136
|
}
|
|
110
137
|
|
|
111
138
|
export namespace ReviewsListResponse {
|
|
112
139
|
export interface Pagination {
|
|
113
|
-
/**
|
|
114
|
-
* Current page number (1-indexed)
|
|
115
|
-
*/
|
|
116
140
|
currentPage: number;
|
|
117
141
|
|
|
118
|
-
/**
|
|
119
|
-
* Number of results per page
|
|
120
|
-
*/
|
|
121
142
|
pageSize: number;
|
|
122
143
|
|
|
123
|
-
/**
|
|
124
|
-
* Total number of matching reviews
|
|
125
|
-
*/
|
|
126
144
|
totalCount: number;
|
|
127
145
|
|
|
128
|
-
/**
|
|
129
|
-
* Total number of pages available
|
|
130
|
-
*/
|
|
131
146
|
totalPages: number;
|
|
132
147
|
}
|
|
133
|
-
|
|
134
|
-
export interface Summary {
|
|
135
|
-
/**
|
|
136
|
-
* Average rating across all reviews
|
|
137
|
-
*/
|
|
138
|
-
averageRating: number;
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Total number of reviews
|
|
142
|
-
*/
|
|
143
|
-
totalReviews: number;
|
|
144
|
-
}
|
|
145
148
|
}
|
|
146
149
|
|
|
147
150
|
export interface ReviewCreateParams {
|
|
@@ -151,19 +154,14 @@ export interface ReviewCreateParams {
|
|
|
151
154
|
namespace: string;
|
|
152
155
|
|
|
153
156
|
/**
|
|
154
|
-
* Body param:
|
|
157
|
+
* Body param: Review text (required)
|
|
155
158
|
*/
|
|
156
|
-
|
|
159
|
+
review: string;
|
|
157
160
|
|
|
158
161
|
/**
|
|
159
162
|
* Body param: Optional agent model name (e.g., 'claude-3.5-sonnet')
|
|
160
163
|
*/
|
|
161
164
|
agentModel?: string;
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Body param: Optional review comment
|
|
165
|
-
*/
|
|
166
|
-
comment?: string;
|
|
167
165
|
}
|
|
168
166
|
|
|
169
167
|
export interface ReviewListParams extends ReviewsPageParams {
|
|
@@ -177,15 +175,42 @@ export interface ReviewDeleteParams {
|
|
|
177
175
|
namespace: string;
|
|
178
176
|
}
|
|
179
177
|
|
|
178
|
+
export interface ReviewUnvoteParams {
|
|
179
|
+
namespace: string;
|
|
180
|
+
|
|
181
|
+
slug: string;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export interface ReviewVoteParams {
|
|
185
|
+
/**
|
|
186
|
+
* Path param
|
|
187
|
+
*/
|
|
188
|
+
namespace: string;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Path param
|
|
192
|
+
*/
|
|
193
|
+
slug: string;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Body param: true for thumbs up, false for thumbs down
|
|
197
|
+
*/
|
|
198
|
+
isPositive: boolean;
|
|
199
|
+
}
|
|
200
|
+
|
|
180
201
|
export declare namespace Reviews {
|
|
181
202
|
export {
|
|
182
203
|
type CreateReviewRequest as CreateReviewRequest,
|
|
183
204
|
type CreateReviewResponse as CreateReviewResponse,
|
|
184
205
|
type ReviewItem as ReviewItem,
|
|
206
|
+
type ReviewVoteRequest as ReviewVoteRequest,
|
|
207
|
+
type ReviewVoteResponse as ReviewVoteResponse,
|
|
185
208
|
type ReviewsListResponse as ReviewsListResponse,
|
|
186
209
|
type ReviewItemsReviewsPage as ReviewItemsReviewsPage,
|
|
187
210
|
type ReviewCreateParams as ReviewCreateParams,
|
|
188
211
|
type ReviewListParams as ReviewListParams,
|
|
189
212
|
type ReviewDeleteParams as ReviewDeleteParams,
|
|
213
|
+
type ReviewUnvoteParams as ReviewUnvoteParams,
|
|
214
|
+
type ReviewVoteParams as ReviewVoteParams,
|
|
190
215
|
};
|
|
191
216
|
}
|
|
@@ -10,15 +10,30 @@ import {
|
|
|
10
10
|
ReviewItem,
|
|
11
11
|
ReviewItemsReviewsPage,
|
|
12
12
|
ReviewListParams,
|
|
13
|
+
ReviewUnvoteParams,
|
|
14
|
+
ReviewVoteParams,
|
|
15
|
+
ReviewVoteRequest,
|
|
16
|
+
ReviewVoteResponse,
|
|
13
17
|
Reviews,
|
|
14
18
|
ReviewsListResponse,
|
|
15
19
|
} from './reviews';
|
|
20
|
+
import * as VotesAPI from './votes';
|
|
21
|
+
import {
|
|
22
|
+
SkillVoteCounts,
|
|
23
|
+
SkillVoteRequest,
|
|
24
|
+
SkillVoteResponse,
|
|
25
|
+
VoteCreateParams,
|
|
26
|
+
VoteDeleteParams,
|
|
27
|
+
VoteGetParams,
|
|
28
|
+
Votes,
|
|
29
|
+
} from './votes';
|
|
16
30
|
import { APIPromise } from '../../core/api-promise';
|
|
17
31
|
import { PagePromise, SkillsPage, type SkillsPageParams } from '../../core/pagination';
|
|
18
32
|
import { RequestOptions } from '../../internal/request-options';
|
|
19
33
|
import { path } from '../../internal/utils/path';
|
|
20
34
|
|
|
21
35
|
export class Skills extends APIResource {
|
|
36
|
+
votes: VotesAPI.Votes = new VotesAPI.Votes(this._client);
|
|
22
37
|
reviews: ReviewsAPI.Reviews = new ReviewsAPI.Reviews(this._client);
|
|
23
38
|
|
|
24
39
|
/**
|
|
@@ -194,6 +209,7 @@ export interface SkillGetParams {
|
|
|
194
209
|
namespace: string;
|
|
195
210
|
}
|
|
196
211
|
|
|
212
|
+
Skills.Votes = Votes;
|
|
197
213
|
Skills.Reviews = Reviews;
|
|
198
214
|
|
|
199
215
|
export declare namespace Skills {
|
|
@@ -205,15 +221,29 @@ export declare namespace Skills {
|
|
|
205
221
|
type SkillGetParams as SkillGetParams,
|
|
206
222
|
};
|
|
207
223
|
|
|
224
|
+
export {
|
|
225
|
+
Votes as Votes,
|
|
226
|
+
type SkillVoteCounts as SkillVoteCounts,
|
|
227
|
+
type SkillVoteRequest as SkillVoteRequest,
|
|
228
|
+
type SkillVoteResponse as SkillVoteResponse,
|
|
229
|
+
type VoteCreateParams as VoteCreateParams,
|
|
230
|
+
type VoteDeleteParams as VoteDeleteParams,
|
|
231
|
+
type VoteGetParams as VoteGetParams,
|
|
232
|
+
};
|
|
233
|
+
|
|
208
234
|
export {
|
|
209
235
|
Reviews as Reviews,
|
|
210
236
|
type CreateReviewRequest as CreateReviewRequest,
|
|
211
237
|
type CreateReviewResponse as CreateReviewResponse,
|
|
212
238
|
type ReviewItem as ReviewItem,
|
|
239
|
+
type ReviewVoteRequest as ReviewVoteRequest,
|
|
240
|
+
type ReviewVoteResponse as ReviewVoteResponse,
|
|
213
241
|
type ReviewsListResponse as ReviewsListResponse,
|
|
214
242
|
type ReviewItemsReviewsPage as ReviewItemsReviewsPage,
|
|
215
243
|
type ReviewCreateParams as ReviewCreateParams,
|
|
216
244
|
type ReviewListParams as ReviewListParams,
|
|
217
245
|
type ReviewDeleteParams as ReviewDeleteParams,
|
|
246
|
+
type ReviewUnvoteParams as ReviewUnvoteParams,
|
|
247
|
+
type ReviewVoteParams as ReviewVoteParams,
|
|
218
248
|
};
|
|
219
249
|
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../core/resource';
|
|
4
|
+
import { APIPromise } from '../../core/api-promise';
|
|
5
|
+
import { buildHeaders } from '../../internal/headers';
|
|
6
|
+
import { RequestOptions } from '../../internal/request-options';
|
|
7
|
+
import { path } from '../../internal/utils/path';
|
|
8
|
+
|
|
9
|
+
export class Votes extends APIResource {
|
|
10
|
+
/**
|
|
11
|
+
* Upvote or downvote a skill. Updates existing vote if one exists.
|
|
12
|
+
*/
|
|
13
|
+
create(slug: string, params: VoteCreateParams, options?: RequestOptions): APIPromise<SkillVoteResponse> {
|
|
14
|
+
const { namespace, ...body } = params;
|
|
15
|
+
return this._client.post(path`/skills/${namespace}/${slug}/vote`, { body, ...options });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Remove vote from a skill
|
|
20
|
+
*/
|
|
21
|
+
delete(slug: string, params: VoteDeleteParams, options?: RequestOptions): APIPromise<void> {
|
|
22
|
+
const { namespace } = params;
|
|
23
|
+
return this._client.delete(path`/skills/${namespace}/${slug}/vote`, {
|
|
24
|
+
...options,
|
|
25
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Get upvote/downvote counts and current user's vote (if authenticated)
|
|
31
|
+
*/
|
|
32
|
+
get(slug: string, params: VoteGetParams, options?: RequestOptions): APIPromise<SkillVoteCounts> {
|
|
33
|
+
const { namespace } = params;
|
|
34
|
+
return this._client.get(path`/skills/${namespace}/${slug}/vote`, options);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface SkillVoteCounts {
|
|
39
|
+
downvotes: number;
|
|
40
|
+
|
|
41
|
+
upvotes: number;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Current user's vote, null if not voted
|
|
45
|
+
*/
|
|
46
|
+
userVote: boolean | null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface SkillVoteRequest {
|
|
50
|
+
/**
|
|
51
|
+
* true for thumbs up, false for thumbs down
|
|
52
|
+
*/
|
|
53
|
+
isPositive: boolean;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface SkillVoteResponse {
|
|
57
|
+
createdAt: string;
|
|
58
|
+
|
|
59
|
+
isPositive: boolean;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface VoteCreateParams {
|
|
63
|
+
/**
|
|
64
|
+
* Path param
|
|
65
|
+
*/
|
|
66
|
+
namespace: string;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Body param: true for thumbs up, false for thumbs down
|
|
70
|
+
*/
|
|
71
|
+
isPositive: boolean;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface VoteDeleteParams {
|
|
75
|
+
namespace: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface VoteGetParams {
|
|
79
|
+
namespace: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export declare namespace Votes {
|
|
83
|
+
export {
|
|
84
|
+
type SkillVoteCounts as SkillVoteCounts,
|
|
85
|
+
type SkillVoteRequest as SkillVoteRequest,
|
|
86
|
+
type SkillVoteResponse as SkillVoteResponse,
|
|
87
|
+
type VoteCreateParams as VoteCreateParams,
|
|
88
|
+
type VoteDeleteParams as VoteDeleteParams,
|
|
89
|
+
type VoteGetParams as VoteGetParams,
|
|
90
|
+
};
|
|
91
|
+
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.37.0'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.37.0";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.37.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.37.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|