@typeship-ax/mcp 0.19.0 → 0.20.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.
Files changed (103) hide show
  1. package/AGENTS.md +3 -3
  2. package/README.md +1 -1
  3. package/api.json +7440 -6316
  4. package/api.md +7856 -6638
  5. package/dist/api-identity.d.ts.map +1 -1
  6. package/dist/api-identity.js +6 -1
  7. package/dist/core/http.d.ts +26 -14
  8. package/dist/core/http.d.ts.map +1 -1
  9. package/dist/core/http.js +90 -19
  10. package/dist/core/pagination.d.ts +8 -8
  11. package/dist/core/pagination.d.ts.map +1 -1
  12. package/dist/core/pagination.js +7 -16
  13. package/dist/errors.d.ts +4 -4
  14. package/dist/errors.d.ts.map +1 -1
  15. package/dist/errors.js +7 -7
  16. package/dist/index.d.ts +33 -19
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +37 -17
  19. package/dist/mcp-protocol.js +2 -2
  20. package/dist/mcp.d.ts.map +1 -1
  21. package/dist/mcp.js +6 -5
  22. package/dist/ops.d.ts +1 -1
  23. package/dist/ops.d.ts.map +1 -1
  24. package/dist/ops.js +39 -42
  25. package/dist/resources/api-keys.d.ts +10 -10
  26. package/dist/resources/api-keys.d.ts.map +1 -1
  27. package/dist/resources/api-keys.js +6 -6
  28. package/dist/resources/deliveries.d.ts +46 -0
  29. package/dist/resources/deliveries.d.ts.map +1 -0
  30. package/dist/resources/deliveries.js +70 -0
  31. package/dist/resources/drafts.d.ts +155 -0
  32. package/dist/resources/drafts.d.ts.map +1 -0
  33. package/dist/resources/drafts.js +230 -0
  34. package/dist/resources/files.d.ts +23 -0
  35. package/dist/resources/files.d.ts.map +1 -0
  36. package/dist/resources/files.js +38 -0
  37. package/dist/resources/generate.d.ts +14 -14
  38. package/dist/resources/generate.d.ts.map +1 -1
  39. package/dist/resources/generate.js +7 -7
  40. package/dist/resources/generations.d.ts +65 -21
  41. package/dist/resources/generations.d.ts.map +1 -1
  42. package/dist/resources/generations.js +67 -20
  43. package/dist/resources/organization.d.ts +18 -0
  44. package/dist/resources/organization.d.ts.map +1 -0
  45. package/dist/resources/{account.js → organization.js} +10 -10
  46. package/dist/resources/projects.d.ts +36 -126
  47. package/dist/resources/projects.d.ts.map +1 -1
  48. package/dist/resources/projects.js +21 -171
  49. package/dist/resources/publications.d.ts +46 -0
  50. package/dist/resources/publications.d.ts.map +1 -0
  51. package/dist/resources/publications.js +70 -0
  52. package/dist/resources/releases.d.ts +66 -0
  53. package/dist/resources/releases.d.ts.map +1 -0
  54. package/dist/resources/releases.js +101 -0
  55. package/dist/resources/spec-revisions.d.ts +85 -0
  56. package/dist/resources/spec-revisions.d.ts.map +1 -0
  57. package/dist/resources/spec-revisions.js +116 -0
  58. package/dist/resources/specs.d.ts +72 -0
  59. package/dist/resources/specs.d.ts.map +1 -0
  60. package/dist/resources/specs.js +107 -0
  61. package/dist/resources/targets.d.ts +42 -262
  62. package/dist/resources/targets.d.ts.map +1 -1
  63. package/dist/resources/targets.js +28 -407
  64. package/dist/schemas.d.ts.map +1 -1
  65. package/dist/schemas.js +143 -149
  66. package/dist/types.d.ts +1281 -1611
  67. package/dist/types.d.ts.map +1 -1
  68. package/dist/types.js +44 -49
  69. package/package.json +1 -1
  70. package/server.json +2 -2
  71. package/src/api-identity.ts +6 -2
  72. package/src/core/http.ts +89 -24
  73. package/src/core/pagination.ts +13 -23
  74. package/src/errors.ts +7 -7
  75. package/src/index.ts +41 -23
  76. package/src/mcp-protocol.ts +2 -2
  77. package/src/mcp.ts +7 -6
  78. package/src/ops.ts +40 -43
  79. package/src/resources/api-keys.ts +13 -16
  80. package/src/resources/deliveries.ts +139 -0
  81. package/src/resources/drafts.ts +422 -0
  82. package/src/resources/files.ts +68 -0
  83. package/src/resources/generate.ts +16 -19
  84. package/src/resources/generations.ts +146 -35
  85. package/src/resources/{account.ts → organization.ts} +14 -14
  86. package/src/resources/projects.ts +42 -337
  87. package/src/resources/publications.ts +139 -0
  88. package/src/resources/releases.ts +199 -0
  89. package/src/resources/spec-revisions.ts +237 -0
  90. package/src/resources/specs.ts +200 -0
  91. package/src/resources/targets.ts +57 -760
  92. package/src/schemas.ts +143 -149
  93. package/src/types.ts +1357 -1692
  94. package/dist/resources/account.d.ts +0 -18
  95. package/dist/resources/account.d.ts.map +0 -1
  96. package/dist/resources/definition-revisions.d.ts +0 -75
  97. package/dist/resources/definition-revisions.d.ts.map +0 -1
  98. package/dist/resources/definition-revisions.js +0 -142
  99. package/dist/resources/definitions.d.ts +0 -50
  100. package/dist/resources/definitions.d.ts.map +0 -1
  101. package/dist/resources/definitions.js +0 -73
  102. package/src/resources/definition-revisions.ts +0 -265
  103. package/src/resources/definitions.ts +0 -146
@@ -1,7 +1,7 @@
1
1
  // typeship — apiKeys resource.
2
2
  // Generated by typeship — https://typeship.dev
3
3
 
4
- import { HttpCore, type ApiResult, type RequestOptions } from "../core/http.js";
4
+ import { HttpCore, type RequestOptions } from "../core/http.js";
5
5
  import { paginate, PagePromise } from "../core/pagination.js";
6
6
  import {
7
7
  ResponseParseError,
@@ -66,16 +66,13 @@ export class ApiKeysResource {
66
66
  }
67
67
 
68
68
  /**
69
- * Retrieve an API key
69
+ * Get an API key
70
70
  *
71
71
  * Returns the key summary and its ETag for conditional revocation.
72
72
  * `GET /api-keys/{api_key_id}`
73
73
  */
74
- async retrieve(
75
- apiKeyId: string,
76
- options?: RequestOptions,
77
- ): Promise<ApiResult<ApiKeyResponseRead, ApiKeysRetrieveError>> {
78
- return this._core.request<ApiKeyResponseRead, ApiKeysRetrieveError>({
74
+ async get(apiKeyId: string, options?: RequestOptions): Promise<ApiKeyResponseRead> {
75
+ return this._core.requestData<ApiKeyResponseRead, ApiKeysGetError>({
79
76
  method: "GET",
80
77
  path: `/api-keys/${encodeURIComponent(String(apiKeyId))}`,
81
78
  security: [{"apiKey":[]}],
@@ -87,7 +84,7 @@ export class ApiKeysResource {
87
84
  "500": InternalServerError,
88
85
  },
89
86
  idempotent: true,
90
- schemaKey: "apiKeys.retrieve",
87
+ schemaKey: "apiKeys.get",
91
88
  options,
92
89
  });
93
90
  }
@@ -98,7 +95,7 @@ export class ApiKeysResource {
98
95
  * Revokes a key. Repeating the request returns the same result.
99
96
  *
100
97
  * With OAuth, members can revoke their own keys; organization admins can revoke any key.
101
- * Organization API keys can revoke any key in their account.
98
+ * Organization API keys can revoke any key in their organization.
102
99
  * See [conditional writes](https://typeship.dev/docs/typeship-api#conditional-writes) for ETag
103
100
  * and If-Match.
104
101
  * `DELETE /api-keys/{api_key_id}`
@@ -107,8 +104,8 @@ export class ApiKeysResource {
107
104
  apiKeyId: string,
108
105
  params?: ApiKeysRevokeParams,
109
106
  options?: RequestOptions,
110
- ): Promise<ApiResult<ApiKeyResponseRead, ApiKeysRevokeError>> {
111
- return this._core.request<ApiKeyResponseRead, ApiKeysRevokeError>({
107
+ ): Promise<ApiKeyResponseRead> {
108
+ return this._core.requestData<ApiKeyResponseRead, ApiKeysRevokeError>({
112
109
  method: "DELETE",
113
110
  path: `/api-keys/${encodeURIComponent(String(apiKeyId))}`,
114
111
  security: [{"apiKey":[]}],
@@ -140,7 +137,7 @@ export interface ApiKeysListParams {
140
137
  */
141
138
  limit?: number;
142
139
  /**
143
- * Opaque cursor from the preceding page's next_cursor. Valid only for the same account,
140
+ * Opaque cursor from the preceding page's next_cursor. Valid only for the same organization,
144
141
  * operation, filters, and ordering that issued it. Omit to start at the first page. Empty,
145
142
  * malformed, or repeated cursors return 400 invalid_request. The page limit may change between
146
143
  * requests.
@@ -148,7 +145,7 @@ export interface ApiKeysListParams {
148
145
  cursor?: string;
149
146
  }
150
147
 
151
- /** Every error `list` can produce, as a discriminated union. */
148
+ /** Typed errors `list` can throw. */
152
149
  export type ApiKeysListError =
153
150
  | BadRequestError
154
151
  | UnauthorizedError
@@ -160,8 +157,8 @@ export type ApiKeysListError =
160
157
  | TransportError
161
158
  | ValidationError;
162
159
 
163
- /** Every error `retrieve` can produce, as a discriminated union. */
164
- export type ApiKeysRetrieveError =
160
+ /** Typed errors `get` can throw. */
161
+ export type ApiKeysGetError =
165
162
  | UnauthorizedError
166
163
  | ForbiddenError
167
164
  | NotFoundError
@@ -181,7 +178,7 @@ export interface ApiKeysRevokeParams {
181
178
  ifMatch?: string;
182
179
  }
183
180
 
184
- /** Every error `revoke` can produce, as a discriminated union. */
181
+ /** Typed errors `revoke` can throw. */
185
182
  export type ApiKeysRevokeError =
186
183
  | BadRequestError
187
184
  | UnauthorizedError
@@ -0,0 +1,139 @@
1
+ // typeship — deliveries resource.
2
+ // Generated by typeship — https://typeship.dev
3
+
4
+ import { HttpCore, type RequestOptions } from "../core/http.js";
5
+ import { paginate, PagePromise } from "../core/pagination.js";
6
+ import {
7
+ ResponseParseError,
8
+ TransportError,
9
+ UnexpectedApiError,
10
+ ValidationError,
11
+ BadRequestError,
12
+ ForbiddenError,
13
+ InternalServerError,
14
+ NotFoundError,
15
+ RateLimitedError,
16
+ UnauthorizedError,
17
+ } from "../errors.js";
18
+ import type {
19
+ Delivery,
20
+ DeliveryId,
21
+ DeliveryList,
22
+ DeliveryListRead,
23
+ DeliveryRead,
24
+ DeliveryResponse,
25
+ DeliveryResponseRead,
26
+ TargetId,
27
+ } from "../types.js";
28
+
29
+ export class DeliveriesResource {
30
+ constructor(private readonly _core: HttpCore) {}
31
+ /**
32
+ * List Deliveries
33
+ *
34
+ * Auto-paginates: `for await (const item of …)` walks every page.
35
+ * `GET /deliveries`
36
+ */
37
+ list(
38
+ params?: DeliveriesListParams,
39
+ options?: RequestOptions,
40
+ ): PagePromise<DeliveryRead, DeliveriesListError> {
41
+ return paginate<DeliveryRead, DeliveriesListError>(this._core, {
42
+ method: "GET",
43
+ path: "/deliveries",
44
+ security: [{"apiKey":[]}],
45
+ query: {
46
+ limit: params?.limit,
47
+ cursor: params?.cursor,
48
+ target_id: params?.targetId,
49
+ },
50
+ errors: {
51
+ "400": BadRequestError,
52
+ "401": UnauthorizedError,
53
+ "403": ForbiddenError,
54
+ "404": NotFoundError,
55
+ "429": RateLimitedError,
56
+ "500": InternalServerError,
57
+ },
58
+ idempotent: true,
59
+ schemaKey: "deliveries.list",
60
+ options,
61
+ }, {
62
+ style: "cursor",
63
+ itemsField: "data",
64
+ cursorParam: "cursor",
65
+ nextCursorField: "next_cursor",
66
+ hasMoreField: "has_more",
67
+ limitParam: "limit",
68
+ });
69
+ }
70
+
71
+ /**
72
+ * Get a Delivery
73
+ *
74
+ * Returns the configured repository or hosted MCP Delivery for a Target. A Delivery in another
75
+ * organization returns 404 not_found.
76
+ * `GET /deliveries/{delivery_id}`
77
+ */
78
+ async get(deliveryId: DeliveryId, options?: RequestOptions): Promise<DeliveryResponseRead> {
79
+ return this._core.requestData<DeliveryResponseRead, DeliveriesGetError>({
80
+ method: "GET",
81
+ path: `/deliveries/${encodeURIComponent(String(deliveryId))}`,
82
+ security: [{"apiKey":[]}],
83
+ errors: {
84
+ "401": UnauthorizedError,
85
+ "403": ForbiddenError,
86
+ "404": NotFoundError,
87
+ "429": RateLimitedError,
88
+ "500": InternalServerError,
89
+ },
90
+ idempotent: true,
91
+ schemaKey: "deliveries.get",
92
+ options,
93
+ });
94
+ }
95
+ }
96
+
97
+ export interface DeliveriesListParams {
98
+ /**
99
+ * Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
100
+ * representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
101
+ * invalid_request. List query parameters must appear only once; unrecognized parameters also
102
+ * return 400.
103
+ */
104
+ limit?: number;
105
+ /**
106
+ * Opaque cursor from the preceding page's next_cursor. Valid only for the same organization,
107
+ * operation, filters, and ordering that issued it. Omit to start at the first page. Empty,
108
+ * malformed, or repeated cursors return 400 invalid_request. The page limit may change between
109
+ * requests.
110
+ */
111
+ cursor?: string;
112
+ /** Only Deliveries of this Target. */
113
+ targetId?: TargetId;
114
+ }
115
+
116
+ /** Typed errors `list` can throw. */
117
+ export type DeliveriesListError =
118
+ | BadRequestError
119
+ | UnauthorizedError
120
+ | ForbiddenError
121
+ | NotFoundError
122
+ | RateLimitedError
123
+ | InternalServerError
124
+ | UnexpectedApiError
125
+ | ResponseParseError
126
+ | TransportError
127
+ | ValidationError;
128
+
129
+ /** Typed errors `get` can throw. */
130
+ export type DeliveriesGetError =
131
+ | UnauthorizedError
132
+ | ForbiddenError
133
+ | NotFoundError
134
+ | RateLimitedError
135
+ | InternalServerError
136
+ | UnexpectedApiError
137
+ | ResponseParseError
138
+ | TransportError
139
+ | ValidationError;
@@ -0,0 +1,422 @@
1
+ // typeship — drafts resource.
2
+ // Generated by typeship — https://typeship.dev
3
+
4
+ import { HttpCore, type RequestOptions } from "../core/http.js";
5
+ import { paginate, PagePromise } from "../core/pagination.js";
6
+ import {
7
+ ResponseParseError,
8
+ TransportError,
9
+ UnexpectedApiError,
10
+ ValidationError,
11
+ BadGatewayError,
12
+ BadRequestError,
13
+ ConflictError,
14
+ ForbiddenError,
15
+ InternalServerError,
16
+ NotFoundError,
17
+ PreconditionFailedError,
18
+ RateLimitedError,
19
+ UnauthorizedError,
20
+ UnprocessableEntityError,
21
+ } from "../errors.js";
22
+ import type {
23
+ Draft,
24
+ DraftFile,
25
+ DraftFileList,
26
+ DraftFileListRead,
27
+ DraftFileRead,
28
+ DraftId,
29
+ DraftList,
30
+ DraftListRead,
31
+ DraftRead,
32
+ DraftRecoverRequest,
33
+ DraftResolveRequest,
34
+ DraftResponse,
35
+ DraftResponseRead,
36
+ DraftStatus,
37
+ DraftUpdateRequest,
38
+ TargetId,
39
+ } from "../types.js";
40
+
41
+ export class DraftsResource {
42
+ constructor(private readonly _core: HttpCore) {}
43
+ /**
44
+ * List Drafts
45
+ *
46
+ * Lists open and merged Drafts, newest first. Each Target has one open Draft; each merge adds a
47
+ * merged Draft.
48
+ *
49
+ * Auto-paginates: `for await (const item of …)` walks every page.
50
+ * `GET /drafts`
51
+ */
52
+ list(params?: DraftsListParams, options?: RequestOptions): PagePromise<DraftRead, DraftsListError> {
53
+ return paginate<DraftRead, DraftsListError>(this._core, {
54
+ method: "GET",
55
+ path: "/drafts",
56
+ security: [{"apiKey":[]}],
57
+ query: {
58
+ limit: params?.limit,
59
+ cursor: params?.cursor,
60
+ target_id: params?.targetId,
61
+ status: params?.status,
62
+ },
63
+ errors: {
64
+ "400": BadRequestError,
65
+ "401": UnauthorizedError,
66
+ "403": ForbiddenError,
67
+ "404": NotFoundError,
68
+ "429": RateLimitedError,
69
+ "500": InternalServerError,
70
+ },
71
+ idempotent: true,
72
+ schemaKey: "drafts.list",
73
+ options,
74
+ }, {
75
+ style: "cursor",
76
+ itemsField: "data",
77
+ cursorParam: "cursor",
78
+ nextCursorField: "next_cursor",
79
+ hasMoreField: "has_more",
80
+ limitParam: "limit",
81
+ });
82
+ }
83
+
84
+ /**
85
+ * Get a Draft
86
+ *
87
+ * Returns the Draft's status. An open Draft also reports its typed reason when action is
88
+ * required, next version and its source, readiness, checks, and conflict counts. The response
89
+ * carries an `ETag`; send it in `If-Match` when updating the Draft to avoid changing a newer
90
+ * version selection.
91
+ * `GET /drafts/{draft_id}`
92
+ */
93
+ async get(draftId: DraftId, options?: RequestOptions): Promise<DraftResponseRead> {
94
+ return this._core.requestData<DraftResponseRead, DraftsGetError>({
95
+ method: "GET",
96
+ path: `/drafts/${encodeURIComponent(String(draftId))}`,
97
+ security: [{"apiKey":[]}],
98
+ errors: {
99
+ "401": UnauthorizedError,
100
+ "403": ForbiddenError,
101
+ "404": NotFoundError,
102
+ "429": RateLimitedError,
103
+ "500": InternalServerError,
104
+ },
105
+ idempotent: true,
106
+ schemaKey: "drafts.get",
107
+ options,
108
+ });
109
+ }
110
+
111
+ /**
112
+ * Select an exact Draft version or return to automatic versioning
113
+ *
114
+ * Checks your version choice against the required version bump, then regenerates the existing
115
+ * Draft pull request.
116
+ *
117
+ * Send the Draft's `ETag` in `If-Match` to reject an intervening change with 412
118
+ * precondition_failed before saving or regenerating. Omitting `If-Match` applies the selection to
119
+ * the current Draft. version_next is required; null restores automatic selection.
120
+ *
121
+ * A `502` response means the selected version was saved, but regeneration failed. Follow the
122
+ * error's retryable and suggested_action fields. Repeating an unfinished selection resumes
123
+ * generation; repeating a completed selection starts no new work. If using If-Match, retrieve the
124
+ * Draft and confirm the saved selection before retrying with its current ETag.
125
+ * A `409 draft_merged` means the Draft merged; retrieve the Target and select a version on its
126
+ * `draft_id`. A `409 target_busy` means the Target is publishing; wait and retry. A `409
127
+ * version_occupied` means the version is already released; retrieve the Draft and releases,
128
+ * choose a new version, and retry.
129
+ * See [conditional writes](https://typeship.dev/docs/typeship-api#conditional-writes) for ETag
130
+ * and If-Match.
131
+ * `PATCH /drafts/{draft_id}`
132
+ */
133
+ async update(
134
+ draftId: DraftId,
135
+ body: DraftUpdateRequest,
136
+ params?: DraftsUpdateParams,
137
+ options?: RequestOptions,
138
+ ): Promise<DraftResponseRead> {
139
+ return this._core.requestData<DraftResponseRead, DraftsUpdateError>({
140
+ method: "PATCH",
141
+ path: `/drafts/${encodeURIComponent(String(draftId))}`,
142
+ security: [{"apiKey":[]}],
143
+ headers: {
144
+ "If-Match": params?.ifMatch === undefined ? undefined : String(params?.ifMatch),
145
+ },
146
+ body,
147
+ errors: {
148
+ "400": BadRequestError,
149
+ "401": UnauthorizedError,
150
+ "403": ForbiddenError,
151
+ "404": NotFoundError,
152
+ "409": ConflictError,
153
+ "412": PreconditionFailedError,
154
+ "422": UnprocessableEntityError,
155
+ "429": RateLimitedError,
156
+ "500": InternalServerError,
157
+ "502": BadGatewayError,
158
+ },
159
+ schemaKey: "drafts.update",
160
+ options,
161
+ });
162
+ }
163
+
164
+ /**
165
+ * List customized and conflicted files on a Draft
166
+ *
167
+ * Lists the Draft's files that differ from the last merged package or need a conflict decision,
168
+ * ordered by path, without file content. Each conflict names its kind, the saved decision, and
169
+ * the sides you can read with getFile. With `filter=history`, lists files affected by a
170
+ * default-branch history rewrite; the list is empty when none is pending.
171
+ *
172
+ * Returns `409 resource_changed` while Typeship is carrying the Draft's latest commit forward
173
+ * (status working), or when the Draft changes between pages.
174
+ *
175
+ * Auto-paginates: `for await (const item of …)` walks every page.
176
+ * `GET /drafts/{draft_id}/files`
177
+ */
178
+ listFiles(
179
+ draftId: DraftId,
180
+ params?: DraftsListFilesParams,
181
+ options?: RequestOptions,
182
+ ): PagePromise<DraftFileRead, DraftsListFilesError> {
183
+ return paginate<DraftFileRead, DraftsListFilesError>(this._core, {
184
+ method: "GET",
185
+ path: `/drafts/${encodeURIComponent(String(draftId))}/files`,
186
+ security: [{"apiKey":[]}],
187
+ query: {
188
+ filter: params?.filter,
189
+ limit: params?.limit,
190
+ cursor: params?.cursor,
191
+ },
192
+ errors: {
193
+ "400": BadRequestError,
194
+ "401": UnauthorizedError,
195
+ "403": ForbiddenError,
196
+ "404": NotFoundError,
197
+ "409": ConflictError,
198
+ "429": RateLimitedError,
199
+ "500": InternalServerError,
200
+ },
201
+ idempotent: true,
202
+ schemaKey: "drafts.listFiles",
203
+ options,
204
+ }, {
205
+ style: "cursor",
206
+ itemsField: "data",
207
+ cursorParam: "cursor",
208
+ nextCursorField: "next_cursor",
209
+ hasMoreField: "has_more",
210
+ limitParam: "limit",
211
+ });
212
+ }
213
+
214
+ /**
215
+ * Resolve selected Draft files
216
+ *
217
+ * Resolves conflicts on the Draft's head_sha: keep yours or generated, or supply final content as
218
+ * text or, for binary files, base64. Choosing generated for a customized path replaces it with
219
+ * the generated file, or deletes a Draft-only file.
220
+ *
221
+ * Conflict decisions are saved together and can be replaced until applied. Choosing generated for
222
+ * customized paths commits those changes together on the Draft branch. Returns the Draft. When
223
+ * every conflict has a decision, `conflicts.decided` equals `conflicts.total` and Typeship
224
+ * continues the Draft and runs checks. Paths that already match the Draft change nothing.
225
+ * `POST /drafts/{draft_id}/resolve`
226
+ */
227
+ async resolve(
228
+ draftId: DraftId,
229
+ body: DraftResolveRequest,
230
+ options?: RequestOptions,
231
+ ): Promise<DraftResponseRead> {
232
+ return this._core.requestData<DraftResponseRead, DraftsResolveError>({
233
+ method: "POST",
234
+ path: `/drafts/${encodeURIComponent(String(draftId))}/resolve`,
235
+ security: [{"apiKey":[]}],
236
+ body,
237
+ errors: {
238
+ "400": BadRequestError,
239
+ "401": UnauthorizedError,
240
+ "403": ForbiddenError,
241
+ "404": NotFoundError,
242
+ "409": ConflictError,
243
+ "429": RateLimitedError,
244
+ "500": InternalServerError,
245
+ },
246
+ schemaKey: "drafts.resolve",
247
+ options,
248
+ });
249
+ }
250
+
251
+ /**
252
+ * Approve recovery from rewritten default-branch history
253
+ *
254
+ * When the Draft has status `action_required` and reason `history_rewritten`, review affected
255
+ * files with `listDraftFiles` and `filter=history`, then approve with the Draft's
256
+ * `history_recovery` revisions. Approval saves the recovery without changing Git and returns the
257
+ * Draft; the next generation rebuilds it from the rewritten default branch. The previous Draft
258
+ * branch stays available, and overlapping code comes back as conflicts to resolve. A rewritten
259
+ * Draft branch alone needs no approval.
260
+ * `POST /drafts/{draft_id}/recover`
261
+ */
262
+ async recover(
263
+ draftId: DraftId,
264
+ body: DraftRecoverRequest,
265
+ options?: RequestOptions,
266
+ ): Promise<DraftResponseRead> {
267
+ return this._core.requestData<DraftResponseRead, DraftsRecoverError>({
268
+ method: "POST",
269
+ path: `/drafts/${encodeURIComponent(String(draftId))}/recover`,
270
+ security: [{"apiKey":[]}],
271
+ body,
272
+ errors: {
273
+ "400": BadRequestError,
274
+ "401": UnauthorizedError,
275
+ "403": ForbiddenError,
276
+ "404": NotFoundError,
277
+ "409": ConflictError,
278
+ "429": RateLimitedError,
279
+ "500": InternalServerError,
280
+ },
281
+ schemaKey: "drafts.recover",
282
+ options,
283
+ });
284
+ }
285
+ }
286
+
287
+ export interface DraftsListParams {
288
+ /**
289
+ * Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
290
+ * representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
291
+ * invalid_request. List query parameters must appear only once; unrecognized parameters also
292
+ * return 400.
293
+ */
294
+ limit?: number;
295
+ /**
296
+ * Opaque cursor from the preceding page's next_cursor. Valid only for the same organization,
297
+ * operation, filters, and ordering that issued it. Omit to start at the first page. Empty,
298
+ * malformed, or repeated cursors return 400 invalid_request. The page limit may change between
299
+ * requests.
300
+ */
301
+ cursor?: string;
302
+ /** Only Drafts of this Target. */
303
+ targetId?: TargetId;
304
+ /** Only Drafts with this status. */
305
+ status?: DraftStatus;
306
+ }
307
+
308
+ /** Typed errors `list` can throw. */
309
+ export type DraftsListError =
310
+ | BadRequestError
311
+ | UnauthorizedError
312
+ | ForbiddenError
313
+ | NotFoundError
314
+ | RateLimitedError
315
+ | InternalServerError
316
+ | UnexpectedApiError
317
+ | ResponseParseError
318
+ | TransportError
319
+ | ValidationError;
320
+
321
+ /** Typed errors `get` can throw. */
322
+ export type DraftsGetError =
323
+ | UnauthorizedError
324
+ | ForbiddenError
325
+ | NotFoundError
326
+ | RateLimitedError
327
+ | InternalServerError
328
+ | UnexpectedApiError
329
+ | ResponseParseError
330
+ | TransportError
331
+ | ValidationError;
332
+
333
+ export interface DraftsUpdateParams {
334
+ /**
335
+ * ETag from a preceding response. The write applies only if the resource still has that version;
336
+ * otherwise it returns 412 precondition_failed without changes. Omit to write the current
337
+ * version. See https://typeship.dev/docs/typeship-api#conditional-writes.
338
+ */
339
+ ifMatch?: string;
340
+ }
341
+
342
+ /** Typed errors `update` can throw. */
343
+ export type DraftsUpdateError =
344
+ | BadRequestError
345
+ | UnauthorizedError
346
+ | ForbiddenError
347
+ | NotFoundError
348
+ | ConflictError
349
+ | PreconditionFailedError
350
+ | UnprocessableEntityError
351
+ | RateLimitedError
352
+ | InternalServerError
353
+ | BadGatewayError
354
+ | UnexpectedApiError
355
+ | ResponseParseError
356
+ | TransportError
357
+ | ValidationError;
358
+
359
+ export interface DraftsListFilesParams {
360
+ /**
361
+ * conflicted: conflicts only. customized: files that differ from the last merged package.
362
+ * history: files affected by a default-branch history rewrite. Omit for conflicted and customized
363
+ * files.
364
+ */
365
+ filter?: "conflicted" | "customized" | "history";
366
+ /**
367
+ * Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
368
+ * representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
369
+ * invalid_request. List query parameters must appear only once; unrecognized parameters also
370
+ * return 400.
371
+ */
372
+ limit?: number;
373
+ /**
374
+ * Opaque cursor from the preceding page's next_cursor. Valid only for the same organization,
375
+ * operation, filters, and ordering that issued it. Omit to start at the first page. Empty,
376
+ * malformed, or repeated cursors return 400 invalid_request. The page limit may change between
377
+ * requests.
378
+ */
379
+ cursor?: string;
380
+ }
381
+
382
+ /** Typed errors `listFiles` can throw. */
383
+ export type DraftsListFilesError =
384
+ | BadRequestError
385
+ | UnauthorizedError
386
+ | ForbiddenError
387
+ | NotFoundError
388
+ | ConflictError
389
+ | RateLimitedError
390
+ | InternalServerError
391
+ | UnexpectedApiError
392
+ | ResponseParseError
393
+ | TransportError
394
+ | ValidationError;
395
+
396
+ /** Typed errors `resolve` can throw. */
397
+ export type DraftsResolveError =
398
+ | BadRequestError
399
+ | UnauthorizedError
400
+ | ForbiddenError
401
+ | NotFoundError
402
+ | ConflictError
403
+ | RateLimitedError
404
+ | InternalServerError
405
+ | UnexpectedApiError
406
+ | ResponseParseError
407
+ | TransportError
408
+ | ValidationError;
409
+
410
+ /** Typed errors `recover` can throw. */
411
+ export type DraftsRecoverError =
412
+ | BadRequestError
413
+ | UnauthorizedError
414
+ | ForbiddenError
415
+ | NotFoundError
416
+ | ConflictError
417
+ | RateLimitedError
418
+ | InternalServerError
419
+ | UnexpectedApiError
420
+ | ResponseParseError
421
+ | TransportError
422
+ | ValidationError;