@typeship-ax/mcp 0.19.0 → 0.21.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 +7519 -6363
  4. package/api.md +8015 -6765
  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 +40 -43
  25. package/dist/resources/api-keys.d.ts +16 -15
  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 +47 -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 +157 -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 +67 -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 +50 -139
  47. package/dist/resources/projects.d.ts.map +1 -1
  48. package/dist/resources/projects.js +29 -179
  49. package/dist/resources/publications.d.ts +47 -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 +68 -0
  53. package/dist/resources/releases.d.ts.map +1 -0
  54. package/dist/resources/releases.js +102 -0
  55. package/dist/resources/spec-revisions.d.ts +87 -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 +73 -0
  59. package/dist/resources/specs.d.ts.map +1 -0
  60. package/dist/resources/specs.js +108 -0
  61. package/dist/resources/targets.d.ts +48 -267
  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 +1320 -1637
  67. package/dist/types.d.ts.map +1 -1
  68. package/dist/types.js +84 -76
  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 +41 -44
  79. package/src/resources/api-keys.ts +19 -21
  80. package/src/resources/deliveries.ts +140 -0
  81. package/src/resources/drafts.ts +424 -0
  82. package/src/resources/files.ts +68 -0
  83. package/src/resources/generate.ts +16 -19
  84. package/src/resources/generations.ts +148 -35
  85. package/src/resources/{account.ts → organization.ts} +14 -14
  86. package/src/resources/projects.ts +56 -350
  87. package/src/resources/publications.ts +140 -0
  88. package/src/resources/releases.ts +201 -0
  89. package/src/resources/spec-revisions.ts +239 -0
  90. package/src/resources/specs.ts +201 -0
  91. package/src/resources/targets.ts +63 -765
  92. package/src/schemas.ts +143 -149
  93. package/src/types.ts +1418 -1740
  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":[]}],
@@ -135,20 +132,21 @@ export interface ApiKeysListParams {
135
132
  /**
136
133
  * Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
137
134
  * representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
138
- * invalid_request. List query parameters must appear only once; unrecognized parameters also
139
- * return 400.
135
+ * input_invalid. List query parameters must appear only once; repeated or unrecognized parameters
136
+ * return 400 query_param_invalid.
140
137
  */
141
138
  limit?: number;
142
139
  /**
143
- * Opaque cursor from the preceding page's next_cursor. Valid only for the same account,
144
- * operation, filters, and ordering that issued it. Omit to start at the first page. Empty,
145
- * malformed, or repeated cursors return 400 invalid_request. The page limit may change between
146
- * requests.
140
+ * Opaque cursor from the preceding page's next_cursor. Valid only for the same organization,
141
+ * operation, filters, and ordering that issued it. Omit to start at the first page. Empty or
142
+ * malformed cursors, and cursors issued for different filters, return 400 cursor_invalid; start
143
+ * again from the first page. Repeated cursors return 400 query_param_invalid. The page limit may
144
+ * change between requests.
147
145
  */
148
146
  cursor?: string;
149
147
  }
150
148
 
151
- /** Every error `list` can produce, as a discriminated union. */
149
+ /** Typed errors `list` can throw. */
152
150
  export type ApiKeysListError =
153
151
  | BadRequestError
154
152
  | UnauthorizedError
@@ -160,8 +158,8 @@ export type ApiKeysListError =
160
158
  | TransportError
161
159
  | ValidationError;
162
160
 
163
- /** Every error `retrieve` can produce, as a discriminated union. */
164
- export type ApiKeysRetrieveError =
161
+ /** Typed errors `get` can throw. */
162
+ export type ApiKeysGetError =
165
163
  | UnauthorizedError
166
164
  | ForbiddenError
167
165
  | NotFoundError
@@ -181,7 +179,7 @@ export interface ApiKeysRevokeParams {
181
179
  ifMatch?: string;
182
180
  }
183
181
 
184
- /** Every error `revoke` can produce, as a discriminated union. */
182
+ /** Typed errors `revoke` can throw. */
185
183
  export type ApiKeysRevokeError =
186
184
  | BadRequestError
187
185
  | UnauthorizedError
@@ -0,0 +1,140 @@
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 resource_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
+ * input_invalid. List query parameters must appear only once; repeated or unrecognized parameters
102
+ * return 400 query_param_invalid.
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 or
108
+ * malformed cursors, and cursors issued for different filters, return 400 cursor_invalid; start
109
+ * again from the first page. Repeated cursors return 400 query_param_invalid. The page limit may
110
+ * change between requests.
111
+ */
112
+ cursor?: string;
113
+ /** Only Deliveries of this Target. */
114
+ targetId?: TargetId;
115
+ }
116
+
117
+ /** Typed errors `list` can throw. */
118
+ export type DeliveriesListError =
119
+ | BadRequestError
120
+ | UnauthorizedError
121
+ | ForbiddenError
122
+ | NotFoundError
123
+ | RateLimitedError
124
+ | InternalServerError
125
+ | UnexpectedApiError
126
+ | ResponseParseError
127
+ | TransportError
128
+ | ValidationError;
129
+
130
+ /** Typed errors `get` can throw. */
131
+ export type DeliveriesGetError =
132
+ | UnauthorizedError
133
+ | ForbiddenError
134
+ | NotFoundError
135
+ | RateLimitedError
136
+ | InternalServerError
137
+ | UnexpectedApiError
138
+ | ResponseParseError
139
+ | TransportError
140
+ | ValidationError;
@@ -0,0 +1,424 @@
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
+ * input_invalid. List query parameters must appear only once; repeated or unrecognized parameters
292
+ * return 400 query_param_invalid.
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 or
298
+ * malformed cursors, and cursors issued for different filters, return 400 cursor_invalid; start
299
+ * again from the first page. Repeated cursors return 400 query_param_invalid. The page limit may
300
+ * change between requests.
301
+ */
302
+ cursor?: string;
303
+ /** Only Drafts of this Target. */
304
+ targetId?: TargetId;
305
+ /** Only Drafts with this status. */
306
+ status?: DraftStatus;
307
+ }
308
+
309
+ /** Typed errors `list` can throw. */
310
+ export type DraftsListError =
311
+ | BadRequestError
312
+ | UnauthorizedError
313
+ | ForbiddenError
314
+ | NotFoundError
315
+ | RateLimitedError
316
+ | InternalServerError
317
+ | UnexpectedApiError
318
+ | ResponseParseError
319
+ | TransportError
320
+ | ValidationError;
321
+
322
+ /** Typed errors `get` can throw. */
323
+ export type DraftsGetError =
324
+ | UnauthorizedError
325
+ | ForbiddenError
326
+ | NotFoundError
327
+ | RateLimitedError
328
+ | InternalServerError
329
+ | UnexpectedApiError
330
+ | ResponseParseError
331
+ | TransportError
332
+ | ValidationError;
333
+
334
+ export interface DraftsUpdateParams {
335
+ /**
336
+ * ETag from a preceding response. The write applies only if the resource still has that version;
337
+ * otherwise it returns 412 precondition_failed without changes. Omit to write the current
338
+ * version. See https://typeship.dev/docs/typeship-api#conditional-writes.
339
+ */
340
+ ifMatch?: string;
341
+ }
342
+
343
+ /** Typed errors `update` can throw. */
344
+ export type DraftsUpdateError =
345
+ | BadRequestError
346
+ | UnauthorizedError
347
+ | ForbiddenError
348
+ | NotFoundError
349
+ | ConflictError
350
+ | PreconditionFailedError
351
+ | UnprocessableEntityError
352
+ | RateLimitedError
353
+ | InternalServerError
354
+ | BadGatewayError
355
+ | UnexpectedApiError
356
+ | ResponseParseError
357
+ | TransportError
358
+ | ValidationError;
359
+
360
+ export interface DraftsListFilesParams {
361
+ /**
362
+ * conflicted: conflicts only. customized: files that differ from the last merged package.
363
+ * history: files affected by a default-branch history rewrite. Omit for conflicted and customized
364
+ * files.
365
+ */
366
+ filter?: "conflicted" | "customized" | "history";
367
+ /**
368
+ * Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
369
+ * representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
370
+ * input_invalid. List query parameters must appear only once; repeated or unrecognized parameters
371
+ * return 400 query_param_invalid.
372
+ */
373
+ limit?: number;
374
+ /**
375
+ * Opaque cursor from the preceding page's next_cursor. Valid only for the same organization,
376
+ * operation, filters, and ordering that issued it. Omit to start at the first page. Empty or
377
+ * malformed cursors, and cursors issued for different filters, return 400 cursor_invalid; start
378
+ * again from the first page. Repeated cursors return 400 query_param_invalid. The page limit may
379
+ * change between requests.
380
+ */
381
+ cursor?: string;
382
+ }
383
+
384
+ /** Typed errors `listFiles` can throw. */
385
+ export type DraftsListFilesError =
386
+ | BadRequestError
387
+ | UnauthorizedError
388
+ | ForbiddenError
389
+ | NotFoundError
390
+ | ConflictError
391
+ | RateLimitedError
392
+ | InternalServerError
393
+ | UnexpectedApiError
394
+ | ResponseParseError
395
+ | TransportError
396
+ | ValidationError;
397
+
398
+ /** Typed errors `resolve` can throw. */
399
+ export type DraftsResolveError =
400
+ | BadRequestError
401
+ | UnauthorizedError
402
+ | ForbiddenError
403
+ | NotFoundError
404
+ | ConflictError
405
+ | RateLimitedError
406
+ | InternalServerError
407
+ | UnexpectedApiError
408
+ | ResponseParseError
409
+ | TransportError
410
+ | ValidationError;
411
+
412
+ /** Typed errors `recover` can throw. */
413
+ export type DraftsRecoverError =
414
+ | BadRequestError
415
+ | UnauthorizedError
416
+ | ForbiddenError
417
+ | NotFoundError
418
+ | ConflictError
419
+ | RateLimitedError
420
+ | InternalServerError
421
+ | UnexpectedApiError
422
+ | ResponseParseError
423
+ | TransportError
424
+ | ValidationError;