@typeship-ax/cli 0.20.0 → 0.21.1

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 (99) hide show
  1. package/AGENTS.md +3 -3
  2. package/README.md +2 -2
  3. package/api.json +7355 -6233
  4. package/api.md +332 -398
  5. package/dist/api-identity.d.ts.map +1 -1
  6. package/dist/api-identity.js +6 -1
  7. package/dist/cli.js +15 -15
  8. package/dist/core/http.d.ts +26 -14
  9. package/dist/core/http.d.ts.map +1 -1
  10. package/dist/core/http.js +90 -19
  11. package/dist/core/pagination.d.ts +8 -8
  12. package/dist/core/pagination.d.ts.map +1 -1
  13. package/dist/core/pagination.js +7 -16
  14. package/dist/errors.d.ts +4 -4
  15. package/dist/errors.d.ts.map +1 -1
  16. package/dist/errors.js +7 -7
  17. package/dist/index.d.ts +33 -19
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +37 -17
  20. package/dist/ops.d.ts +1 -1
  21. package/dist/ops.d.ts.map +1 -1
  22. package/dist/ops.js +39 -42
  23. package/dist/resources/api-keys.d.ts +10 -10
  24. package/dist/resources/api-keys.d.ts.map +1 -1
  25. package/dist/resources/api-keys.js +6 -6
  26. package/dist/resources/deliveries.d.ts +46 -0
  27. package/dist/resources/deliveries.d.ts.map +1 -0
  28. package/dist/resources/deliveries.js +70 -0
  29. package/dist/resources/drafts.d.ts +155 -0
  30. package/dist/resources/drafts.d.ts.map +1 -0
  31. package/dist/resources/drafts.js +230 -0
  32. package/dist/resources/files.d.ts +23 -0
  33. package/dist/resources/files.d.ts.map +1 -0
  34. package/dist/resources/files.js +38 -0
  35. package/dist/resources/generate.d.ts +14 -14
  36. package/dist/resources/generate.d.ts.map +1 -1
  37. package/dist/resources/generate.js +7 -7
  38. package/dist/resources/generations.d.ts +65 -21
  39. package/dist/resources/generations.d.ts.map +1 -1
  40. package/dist/resources/generations.js +67 -20
  41. package/dist/resources/organization.d.ts +18 -0
  42. package/dist/resources/organization.d.ts.map +1 -0
  43. package/dist/resources/{account.js → organization.js} +10 -10
  44. package/dist/resources/projects.d.ts +36 -126
  45. package/dist/resources/projects.d.ts.map +1 -1
  46. package/dist/resources/projects.js +21 -171
  47. package/dist/resources/publications.d.ts +46 -0
  48. package/dist/resources/publications.d.ts.map +1 -0
  49. package/dist/resources/publications.js +70 -0
  50. package/dist/resources/releases.d.ts +66 -0
  51. package/dist/resources/releases.d.ts.map +1 -0
  52. package/dist/resources/releases.js +101 -0
  53. package/dist/resources/spec-revisions.d.ts +85 -0
  54. package/dist/resources/spec-revisions.d.ts.map +1 -0
  55. package/dist/resources/spec-revisions.js +116 -0
  56. package/dist/resources/specs.d.ts +72 -0
  57. package/dist/resources/specs.d.ts.map +1 -0
  58. package/dist/resources/specs.js +107 -0
  59. package/dist/resources/targets.d.ts +42 -262
  60. package/dist/resources/targets.d.ts.map +1 -1
  61. package/dist/resources/targets.js +28 -407
  62. package/dist/schemas.d.ts.map +1 -1
  63. package/dist/schemas.js +149 -154
  64. package/dist/types.d.ts +1281 -1611
  65. package/dist/types.d.ts.map +1 -1
  66. package/dist/types.js +44 -49
  67. package/package.json +1 -1
  68. package/src/api-identity.ts +6 -2
  69. package/src/cli.ts +16 -16
  70. package/src/core/http.ts +89 -24
  71. package/src/core/pagination.ts +13 -23
  72. package/src/errors.ts +7 -7
  73. package/src/index.ts +41 -23
  74. package/src/ops.ts +40 -43
  75. package/src/resources/api-keys.ts +13 -16
  76. package/src/resources/deliveries.ts +139 -0
  77. package/src/resources/drafts.ts +422 -0
  78. package/src/resources/files.ts +68 -0
  79. package/src/resources/generate.ts +16 -19
  80. package/src/resources/generations.ts +146 -35
  81. package/src/resources/{account.ts → organization.ts} +14 -14
  82. package/src/resources/projects.ts +42 -337
  83. package/src/resources/publications.ts +139 -0
  84. package/src/resources/releases.ts +199 -0
  85. package/src/resources/spec-revisions.ts +237 -0
  86. package/src/resources/specs.ts +200 -0
  87. package/src/resources/targets.ts +57 -760
  88. package/src/schemas.ts +149 -154
  89. package/src/types.ts +1357 -1692
  90. package/dist/resources/account.d.ts +0 -18
  91. package/dist/resources/account.d.ts.map +0 -1
  92. package/dist/resources/definition-revisions.d.ts +0 -75
  93. package/dist/resources/definition-revisions.d.ts.map +0 -1
  94. package/dist/resources/definition-revisions.js +0 -142
  95. package/dist/resources/definitions.d.ts +0 -50
  96. package/dist/resources/definitions.d.ts.map +0 -1
  97. package/dist/resources/definitions.js +0 -73
  98. package/src/resources/definition-revisions.ts +0 -265
  99. package/src/resources/definitions.ts +0 -146
@@ -0,0 +1,199 @@
1
+ // typeship — releases 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
+ RateLimitedError,
18
+ UnauthorizedError,
19
+ } from "../errors.js";
20
+ import type {
21
+ Release,
22
+ ReleaseId,
23
+ ReleaseList,
24
+ ReleaseListRead,
25
+ ReleaseRead,
26
+ ReleaseResponse,
27
+ ReleaseResponseRead,
28
+ TargetId,
29
+ } from "../types.js";
30
+
31
+ export class ReleasesResource {
32
+ constructor(private readonly _core: HttpCore) {}
33
+ /**
34
+ * List releases
35
+ *
36
+ * Auto-paginates: `for await (const item of …)` walks every page.
37
+ * `GET /releases`
38
+ */
39
+ list(params?: ReleasesListParams, options?: RequestOptions): PagePromise<ReleaseRead, ReleasesListError> {
40
+ return paginate<ReleaseRead, ReleasesListError>(this._core, {
41
+ method: "GET",
42
+ path: "/releases",
43
+ security: [{"apiKey":[]}],
44
+ query: {
45
+ limit: params?.limit,
46
+ cursor: params?.cursor,
47
+ target_id: params?.targetId,
48
+ },
49
+ errors: {
50
+ "400": BadRequestError,
51
+ "401": UnauthorizedError,
52
+ "403": ForbiddenError,
53
+ "404": NotFoundError,
54
+ "429": RateLimitedError,
55
+ "500": InternalServerError,
56
+ },
57
+ idempotent: true,
58
+ schemaKey: "releases.list",
59
+ options,
60
+ }, {
61
+ style: "cursor",
62
+ itemsField: "data",
63
+ cursorParam: "cursor",
64
+ nextCursorField: "next_cursor",
65
+ hasMoreField: "has_more",
66
+ limitParam: "limit",
67
+ });
68
+ }
69
+
70
+ /**
71
+ * Get an immutable release
72
+ * `GET /releases/{release_id}`
73
+ */
74
+ async get(releaseId: ReleaseId, options?: RequestOptions): Promise<ReleaseResponseRead> {
75
+ return this._core.requestData<ReleaseResponseRead, ReleasesGetError>({
76
+ method: "GET",
77
+ path: `/releases/${encodeURIComponent(String(releaseId))}`,
78
+ security: [{"apiKey":[]}],
79
+ errors: {
80
+ "401": UnauthorizedError,
81
+ "403": ForbiddenError,
82
+ "404": NotFoundError,
83
+ "429": RateLimitedError,
84
+ "500": InternalServerError,
85
+ },
86
+ idempotent: true,
87
+ schemaKey: "releases.get",
88
+ options,
89
+ });
90
+ }
91
+
92
+ /**
93
+ * Retry publishing an exact release
94
+ *
95
+ * Retries publishing the specified release through its repository workflow. Uses that release's
96
+ * version and accepted commit, even if a newer Draft or release exists.
97
+ *
98
+ * A `502` response means the repository publishing workflow could not be dispatched.
99
+ *
100
+ * A `Idempotency-Key` UUID is generated per call (stable across retries) unless you pass one.
101
+ * `POST /releases/{release_id}/republish`
102
+ */
103
+ async republish(
104
+ releaseId: ReleaseId,
105
+ params?: ReleasesRepublishParams,
106
+ options?: RequestOptions,
107
+ ): Promise<ReleaseResponseRead> {
108
+ return this._core.requestData<ReleaseResponseRead, ReleasesRepublishError>({
109
+ method: "POST",
110
+ path: `/releases/${encodeURIComponent(String(releaseId))}/republish`,
111
+ security: [{"apiKey":[]}],
112
+ headers: {
113
+ "Idempotency-Key": params?.idempotencyKey === undefined ? undefined : String(params?.idempotencyKey),
114
+ },
115
+ errors: {
116
+ "400": BadRequestError,
117
+ "401": UnauthorizedError,
118
+ "403": ForbiddenError,
119
+ "404": NotFoundError,
120
+ "409": ConflictError,
121
+ "429": RateLimitedError,
122
+ "500": InternalServerError,
123
+ "502": BadGatewayError,
124
+ },
125
+ idempotencyKey: "Idempotency-Key",
126
+ schemaKey: "releases.republish",
127
+ options,
128
+ });
129
+ }
130
+ }
131
+
132
+ export interface ReleasesListParams {
133
+ /**
134
+ * Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
135
+ * representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
136
+ * invalid_request. List query parameters must appear only once; unrecognized parameters also
137
+ * return 400.
138
+ */
139
+ limit?: number;
140
+ /**
141
+ * Opaque cursor from the preceding page's next_cursor. Valid only for the same organization,
142
+ * operation, filters, and ordering that issued it. Omit to start at the first page. Empty,
143
+ * malformed, or repeated cursors return 400 invalid_request. The page limit may change between
144
+ * requests.
145
+ */
146
+ cursor?: string;
147
+ /** Only releases of this Target. */
148
+ targetId?: TargetId;
149
+ }
150
+
151
+ /** Typed errors `list` can throw. */
152
+ export type ReleasesListError =
153
+ | BadRequestError
154
+ | UnauthorizedError
155
+ | ForbiddenError
156
+ | NotFoundError
157
+ | RateLimitedError
158
+ | InternalServerError
159
+ | UnexpectedApiError
160
+ | ResponseParseError
161
+ | TransportError
162
+ | ValidationError;
163
+
164
+ /** Typed errors `get` can throw. */
165
+ export type ReleasesGetError =
166
+ | UnauthorizedError
167
+ | ForbiddenError
168
+ | NotFoundError
169
+ | RateLimitedError
170
+ | InternalServerError
171
+ | UnexpectedApiError
172
+ | ResponseParseError
173
+ | TransportError
174
+ | ValidationError;
175
+
176
+ export interface ReleasesRepublishParams {
177
+ /**
178
+ * Identifies one logical write for 24 hours. The key is scoped to the authenticated organization
179
+ * and operation; generation without an organization uses a hashed network identity. Retrying the
180
+ * same method, path, query, If-Match header, and JSON body replays the original response. Reusing
181
+ * the key with changed intent returns 409. After expiry the key starts a new write.
182
+ */
183
+ idempotencyKey?: string;
184
+ }
185
+
186
+ /** Typed errors `republish` can throw. */
187
+ export type ReleasesRepublishError =
188
+ | BadRequestError
189
+ | UnauthorizedError
190
+ | ForbiddenError
191
+ | NotFoundError
192
+ | ConflictError
193
+ | RateLimitedError
194
+ | InternalServerError
195
+ | BadGatewayError
196
+ | UnexpectedApiError
197
+ | ResponseParseError
198
+ | TransportError
199
+ | ValidationError;
@@ -0,0 +1,237 @@
1
+ // typeship — specRevisions 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
+ SpecId,
20
+ SpecRevision,
21
+ SpecRevisionFile,
22
+ SpecRevisionFileList,
23
+ SpecRevisionFileListRead,
24
+ SpecRevisionFileRead,
25
+ SpecRevisionId,
26
+ SpecRevisionList,
27
+ SpecRevisionListRead,
28
+ SpecRevisionRead,
29
+ SpecRevisionResponse,
30
+ SpecRevisionResponseRead,
31
+ } from "../types.js";
32
+
33
+ export class SpecRevisionsResource {
34
+ constructor(private readonly _core: HttpCore) {}
35
+ /**
36
+ * List Spec Revisions
37
+ *
38
+ * Lists Spec Revisions, newest first. Source content is not included; list a revision's files
39
+ * with listSpecRevisionFiles.
40
+ *
41
+ * Auto-paginates: `for await (const item of …)` walks every page.
42
+ * `GET /spec-revisions`
43
+ */
44
+ list(
45
+ params?: SpecRevisionsListParams,
46
+ options?: RequestOptions,
47
+ ): PagePromise<SpecRevisionRead, SpecRevisionsListError> {
48
+ return paginate<SpecRevisionRead, SpecRevisionsListError>(this._core, {
49
+ method: "GET",
50
+ path: "/spec-revisions",
51
+ security: [{"apiKey":[]}],
52
+ query: {
53
+ limit: params?.limit,
54
+ cursor: params?.cursor,
55
+ spec_id: params?.specId,
56
+ },
57
+ errors: {
58
+ "400": BadRequestError,
59
+ "401": UnauthorizedError,
60
+ "403": ForbiddenError,
61
+ "404": NotFoundError,
62
+ "429": RateLimitedError,
63
+ "500": InternalServerError,
64
+ },
65
+ idempotent: true,
66
+ schemaKey: "specRevisions.list",
67
+ options,
68
+ }, {
69
+ style: "cursor",
70
+ itemsField: "data",
71
+ cursorParam: "cursor",
72
+ nextCursorField: "next_cursor",
73
+ hasMoreField: "has_more",
74
+ limitParam: "limit",
75
+ });
76
+ }
77
+
78
+ /**
79
+ * Get a Spec Revision
80
+ *
81
+ * Returns metadata for a saved Spec Revision with a Diagnostics summary. Pass
82
+ * `include=diagnostics` to add every Diagnostic, evaluated with the Spec's current patches and
83
+ * Diagnostic policy. List its source files and resolved document with listSpecRevisionFiles.
84
+ * `GET /spec-revisions/{spec_revision_id}`
85
+ */
86
+ async get(
87
+ specRevisionId: SpecRevisionId,
88
+ params?: SpecRevisionsGetParams,
89
+ options?: RequestOptions,
90
+ ): Promise<SpecRevisionResponseRead> {
91
+ return this._core.requestData<SpecRevisionResponseRead, SpecRevisionsGetError>({
92
+ method: "GET",
93
+ path: `/spec-revisions/${encodeURIComponent(String(specRevisionId))}`,
94
+ security: [{"apiKey":[]}],
95
+ query: {
96
+ include: params?.include,
97
+ },
98
+ errors: {
99
+ "400": BadRequestError,
100
+ "401": UnauthorizedError,
101
+ "403": ForbiddenError,
102
+ "404": NotFoundError,
103
+ "429": RateLimitedError,
104
+ "500": InternalServerError,
105
+ },
106
+ idempotent: true,
107
+ schemaKey: "specRevisions.get",
108
+ options,
109
+ });
110
+ }
111
+
112
+ /**
113
+ * List a Spec Revision's files
114
+ *
115
+ * Lists the captured source files and the resolved document Typeship generated from, ordered by
116
+ * path. Read content with getFile.
117
+ *
118
+ * Auto-paginates: `for await (const item of …)` walks every page.
119
+ * `GET /spec-revisions/{spec_revision_id}/files`
120
+ */
121
+ listFiles(
122
+ specRevisionId: SpecRevisionId,
123
+ params?: SpecRevisionsListFilesParams,
124
+ options?: RequestOptions,
125
+ ): PagePromise<SpecRevisionFileRead, SpecRevisionsListFilesError> {
126
+ return paginate<SpecRevisionFileRead, SpecRevisionsListFilesError>(this._core, {
127
+ method: "GET",
128
+ path: `/spec-revisions/${encodeURIComponent(String(specRevisionId))}/files`,
129
+ security: [{"apiKey":[]}],
130
+ query: {
131
+ limit: params?.limit,
132
+ cursor: params?.cursor,
133
+ },
134
+ errors: {
135
+ "400": BadRequestError,
136
+ "401": UnauthorizedError,
137
+ "403": ForbiddenError,
138
+ "404": NotFoundError,
139
+ "429": RateLimitedError,
140
+ "500": InternalServerError,
141
+ },
142
+ idempotent: true,
143
+ schemaKey: "specRevisions.listFiles",
144
+ options,
145
+ }, {
146
+ style: "cursor",
147
+ itemsField: "data",
148
+ cursorParam: "cursor",
149
+ nextCursorField: "next_cursor",
150
+ hasMoreField: "has_more",
151
+ limitParam: "limit",
152
+ });
153
+ }
154
+ }
155
+
156
+ export interface SpecRevisionsListParams {
157
+ /**
158
+ * Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
159
+ * representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
160
+ * invalid_request. List query parameters must appear only once; unrecognized parameters also
161
+ * return 400.
162
+ */
163
+ limit?: number;
164
+ /**
165
+ * Opaque cursor from the preceding page's next_cursor. Valid only for the same organization,
166
+ * operation, filters, and ordering that issued it. Omit to start at the first page. Empty,
167
+ * malformed, or repeated cursors return 400 invalid_request. The page limit may change between
168
+ * requests.
169
+ */
170
+ cursor?: string;
171
+ /** Only revisions of this Spec. */
172
+ specId?: SpecId;
173
+ }
174
+
175
+ /** Typed errors `list` can throw. */
176
+ export type SpecRevisionsListError =
177
+ | BadRequestError
178
+ | UnauthorizedError
179
+ | ForbiddenError
180
+ | NotFoundError
181
+ | RateLimitedError
182
+ | InternalServerError
183
+ | UnexpectedApiError
184
+ | ResponseParseError
185
+ | TransportError
186
+ | ValidationError;
187
+
188
+ export interface SpecRevisionsGetParams {
189
+ /**
190
+ * Add related data to the response. `diagnostics` adds the `diagnostics` and `patch_diagnostics`
191
+ * arrays.
192
+ */
193
+ include?: "diagnostics";
194
+ }
195
+
196
+ /** Typed errors `get` can throw. */
197
+ export type SpecRevisionsGetError =
198
+ | BadRequestError
199
+ | UnauthorizedError
200
+ | ForbiddenError
201
+ | NotFoundError
202
+ | RateLimitedError
203
+ | InternalServerError
204
+ | UnexpectedApiError
205
+ | ResponseParseError
206
+ | TransportError
207
+ | ValidationError;
208
+
209
+ export interface SpecRevisionsListFilesParams {
210
+ /**
211
+ * Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
212
+ * representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
213
+ * invalid_request. List query parameters must appear only once; unrecognized parameters also
214
+ * return 400.
215
+ */
216
+ limit?: number;
217
+ /**
218
+ * Opaque cursor from the preceding page's next_cursor. Valid only for the same organization,
219
+ * operation, filters, and ordering that issued it. Omit to start at the first page. Empty,
220
+ * malformed, or repeated cursors return 400 invalid_request. The page limit may change between
221
+ * requests.
222
+ */
223
+ cursor?: string;
224
+ }
225
+
226
+ /** Typed errors `listFiles` can throw. */
227
+ export type SpecRevisionsListFilesError =
228
+ | BadRequestError
229
+ | UnauthorizedError
230
+ | ForbiddenError
231
+ | NotFoundError
232
+ | RateLimitedError
233
+ | InternalServerError
234
+ | UnexpectedApiError
235
+ | ResponseParseError
236
+ | TransportError
237
+ | ValidationError;
@@ -0,0 +1,200 @@
1
+ // typeship — specs resource.
2
+ // Generated by typeship — https://typeship.dev
3
+
4
+ import { HttpCore, type RequestOptions } from "../core/http.js";
5
+ import {
6
+ ResponseParseError,
7
+ TransportError,
8
+ UnexpectedApiError,
9
+ ValidationError,
10
+ BadGatewayError,
11
+ BadRequestError,
12
+ ConflictError,
13
+ ForbiddenError,
14
+ InternalServerError,
15
+ NotFoundError,
16
+ PreconditionFailedError,
17
+ RateLimitedError,
18
+ UnauthorizedError,
19
+ UnprocessableEntityError,
20
+ } from "../errors.js";
21
+ import type { Spec, SpecId, SpecRead, SpecUpdateRequest } from "../types.js";
22
+
23
+ export class SpecsResource {
24
+ constructor(private readonly _core: HttpCore) {}
25
+ /**
26
+ * Get a Spec
27
+ * `GET /specs/{spec_id}`
28
+ */
29
+ async get(specId: SpecId, options?: RequestOptions): Promise<SpecRead> {
30
+ return this._core.requestData<SpecRead, SpecsGetError>({
31
+ method: "GET",
32
+ path: `/specs/${encodeURIComponent(String(specId))}`,
33
+ security: [{"apiKey":[]}],
34
+ errors: {
35
+ "401": UnauthorizedError,
36
+ "403": ForbiddenError,
37
+ "404": NotFoundError,
38
+ "429": RateLimitedError,
39
+ "500": InternalServerError,
40
+ },
41
+ idempotent: true,
42
+ schemaKey: "specs.get",
43
+ options,
44
+ });
45
+ }
46
+
47
+ /**
48
+ * Update and resolve a Spec
49
+ *
50
+ * Resolves the source files before saving the update and records a new Spec Revision when the
51
+ * source changes.
52
+ * Omitted fields remain unchanged; supplied objects and arrays replace the whole field.
53
+ * If the Spec or its Project configuration changes during validation, returns 409
54
+ * resource_changed without saving the rejected update. Retrieve the current Spec and Project,
55
+ * reconcile your changes,
56
+ * and submit a new request with a new Idempotency-Key if using one.
57
+ *
58
+ * See [conditional writes](https://typeship.dev/docs/typeship-api#conditional-writes) for ETag
59
+ * and If-Match.
60
+ *
61
+ * A `Idempotency-Key` UUID is generated per call (stable across retries) unless you pass one.
62
+ * `PATCH /specs/{spec_id}`
63
+ */
64
+ async update(
65
+ specId: SpecId,
66
+ body: SpecUpdateRequest,
67
+ params?: SpecsUpdateParams,
68
+ options?: RequestOptions,
69
+ ): Promise<SpecRead> {
70
+ return this._core.requestData<SpecRead, SpecsUpdateError>({
71
+ method: "PATCH",
72
+ path: `/specs/${encodeURIComponent(String(specId))}`,
73
+ security: [{"apiKey":[]}],
74
+ headers: {
75
+ "If-Match": params?.ifMatch === undefined ? undefined : String(params?.ifMatch),
76
+ "Idempotency-Key": params?.idempotencyKey === undefined ? undefined : String(params?.idempotencyKey),
77
+ },
78
+ body,
79
+ errors: {
80
+ "400": BadRequestError,
81
+ "401": UnauthorizedError,
82
+ "403": ForbiddenError,
83
+ "404": NotFoundError,
84
+ "409": ConflictError,
85
+ "412": PreconditionFailedError,
86
+ "422": UnprocessableEntityError,
87
+ "429": RateLimitedError,
88
+ "500": InternalServerError,
89
+ },
90
+ idempotencyKey: "Idempotency-Key",
91
+ schemaKey: "specs.update",
92
+ options,
93
+ });
94
+ }
95
+
96
+ /**
97
+ * Refresh a Spec from its configured source
98
+ *
99
+ * Fetches the configured source now and creates a new Spec Revision only when its content
100
+ * changes. Diagnostics then reads that revision. If automatic generation is enabled, refresh
101
+ * queues generation for active Targets even when the source is unchanged.
102
+ *
103
+ * A `Idempotency-Key` UUID is generated per call (stable across retries) unless you pass one.
104
+ * `POST /specs/{spec_id}/refresh`
105
+ */
106
+ async refresh(specId: SpecId, params?: SpecsRefreshParams, options?: RequestOptions): Promise<SpecRead> {
107
+ return this._core.requestData<SpecRead, SpecsRefreshError>({
108
+ method: "POST",
109
+ path: `/specs/${encodeURIComponent(String(specId))}/refresh`,
110
+ security: [{"apiKey":[]}],
111
+ headers: {
112
+ "Idempotency-Key": params?.idempotencyKey === undefined ? undefined : String(params?.idempotencyKey),
113
+ },
114
+ errors: {
115
+ "400": BadRequestError,
116
+ "401": UnauthorizedError,
117
+ "403": ForbiddenError,
118
+ "404": NotFoundError,
119
+ "409": ConflictError,
120
+ "422": UnprocessableEntityError,
121
+ "429": RateLimitedError,
122
+ "500": InternalServerError,
123
+ "502": BadGatewayError,
124
+ },
125
+ idempotencyKey: "Idempotency-Key",
126
+ schemaKey: "specs.refresh",
127
+ options,
128
+ });
129
+ }
130
+ }
131
+
132
+ /** Typed errors `get` can throw. */
133
+ export type SpecsGetError =
134
+ | UnauthorizedError
135
+ | ForbiddenError
136
+ | NotFoundError
137
+ | RateLimitedError
138
+ | InternalServerError
139
+ | UnexpectedApiError
140
+ | ResponseParseError
141
+ | TransportError
142
+ | ValidationError;
143
+
144
+ export interface SpecsUpdateParams {
145
+ /**
146
+ * ETag from a preceding response. The write applies only if the resource still has that version;
147
+ * otherwise it returns 412 precondition_failed without changes. Omit to write the current
148
+ * version. See https://typeship.dev/docs/typeship-api#conditional-writes.
149
+ */
150
+ ifMatch?: string;
151
+ /**
152
+ * Identifies one logical write for 24 hours. The key is scoped to the authenticated organization
153
+ * and operation; generation without an organization uses a hashed network identity. Retrying the
154
+ * same method, path, query, If-Match header, and JSON body replays the original response. Reusing
155
+ * the key with changed intent returns 409. After expiry the key starts a new write.
156
+ */
157
+ idempotencyKey?: string;
158
+ }
159
+
160
+ /** Typed errors `update` can throw. */
161
+ export type SpecsUpdateError =
162
+ | BadRequestError
163
+ | UnauthorizedError
164
+ | ForbiddenError
165
+ | NotFoundError
166
+ | ConflictError
167
+ | PreconditionFailedError
168
+ | UnprocessableEntityError
169
+ | RateLimitedError
170
+ | InternalServerError
171
+ | UnexpectedApiError
172
+ | ResponseParseError
173
+ | TransportError
174
+ | ValidationError;
175
+
176
+ export interface SpecsRefreshParams {
177
+ /**
178
+ * Identifies one logical write for 24 hours. The key is scoped to the authenticated organization
179
+ * and operation; generation without an organization uses a hashed network identity. Retrying the
180
+ * same method, path, query, If-Match header, and JSON body replays the original response. Reusing
181
+ * the key with changed intent returns 409. After expiry the key starts a new write.
182
+ */
183
+ idempotencyKey?: string;
184
+ }
185
+
186
+ /** Typed errors `refresh` can throw. */
187
+ export type SpecsRefreshError =
188
+ | BadRequestError
189
+ | UnauthorizedError
190
+ | ForbiddenError
191
+ | NotFoundError
192
+ | ConflictError
193
+ | UnprocessableEntityError
194
+ | RateLimitedError
195
+ | InternalServerError
196
+ | BadGatewayError
197
+ | UnexpectedApiError
198
+ | ResponseParseError
199
+ | TransportError
200
+ | ValidationError;