harmont_cloud_raw/lib.rs
1//! GENERATED by `make codegen-sdk-rs` (progenitor). Do not edit by hand.
2mod progenitor_client;
3
4#[allow(unused_imports)]
5use progenitor_client::{encode_path, ClientHooks, OperationInfo, RequestBuilderExt};
6#[allow(unused_imports)]
7pub use progenitor_client::{ByteStream, ClientInfo, Error, ResponseValue};
8/// Types used as operation parameters and responses.
9#[allow(clippy::all)]
10pub mod types {
11 /// Error types.
12 pub mod error {
13 /// Error from a `TryFrom` or `FromStr` implementation.
14 pub struct ConversionError(::std::borrow::Cow<'static, str>);
15 impl ::std::error::Error for ConversionError {}
16 impl ::std::fmt::Display for ConversionError {
17 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
18 ::std::fmt::Display::fmt(&self.0, f)
19 }
20 }
21
22 impl ::std::fmt::Debug for ConversionError {
23 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
24 ::std::fmt::Debug::fmt(&self.0, f)
25 }
26 }
27
28 impl From<&'static str> for ConversionError {
29 fn from(value: &'static str) -> Self {
30 Self(value.into())
31 }
32 }
33
34 impl From<String> for ConversionError {
35 fn from(value: String) -> Self {
36 Self(value.into())
37 }
38 }
39 }
40
41 ///Requests access to Harmont. Records a sign-up attempt and notifies
42 /// admins. Rate-limited per client IP.
43 ///
44 /// <details><summary>JSON schema</summary>
45 ///
46 /// ```json
47 ///{
48 /// "title": "AccessRequestRequest",
49 /// "description": "Requests access to Harmont. Records a sign-up attempt
50 /// and notifies admins. Rate-limited per client IP.",
51 /// "examples": [
52 /// {
53 /// "email": "alice@example.com",
54 /// "message": "We'd love to try Harmont for our CI.",
55 /// "name": "Alice"
56 /// }
57 /// ],
58 /// "type": "object",
59 /// "required": [
60 /// "email",
61 /// "name"
62 /// ],
63 /// "properties": {
64 /// "email": {
65 /// "description": "The email requesting access.",
66 /// "type": "string"
67 /// },
68 /// "message": {
69 /// "description": "Optional message to the Harmont team (max 2000
70 /// characters).",
71 /// "type": [
72 /// "string",
73 /// "null"
74 /// ]
75 /// },
76 /// "name": {
77 /// "description": "The requester's name.",
78 /// "type": "string"
79 /// }
80 /// }
81 ///}
82 /// ```
83 /// </details>
84 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
85 pub struct AccessRequestRequest {
86 ///The email requesting access.
87 pub email: ::std::string::String,
88 ///Optional message to the Harmont team (max 2000 characters).
89 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
90 pub message: ::std::option::Option<::std::string::String>,
91 ///The requester's name.
92 pub name: ::std::string::String,
93 }
94
95 ///A personal API key. The secret is returned only once, at creation.
96 ///
97 /// <details><summary>JSON schema</summary>
98 ///
99 /// ```json
100 ///{
101 /// "title": "ApiToken",
102 /// "description": "A personal API key. The secret is returned only once,
103 /// at creation.",
104 /// "type": "object",
105 /// "required": [
106 /// "created_at",
107 /// "id"
108 /// ],
109 /// "properties": {
110 /// "created_at": {
111 /// "description": "When the key was created.",
112 /// "type": "string",
113 /// "format": "date-time"
114 /// },
115 /// "description": {
116 /// "description": "Human label for the key.",
117 /// "type": [
118 /// "string",
119 /// "null"
120 /// ]
121 /// },
122 /// "expires_at": {
123 /// "description": "When the key expires, or null if it never
124 /// expires.",
125 /// "type": [
126 /// "string",
127 /// "null"
128 /// ],
129 /// "format": "date-time"
130 /// },
131 /// "id": {
132 /// "description": "Stable key id.",
133 /// "type": "string",
134 /// "format": "uuid"
135 /// },
136 /// "last_used_at": {
137 /// "description": "When the key was last used to authenticate, if
138 /// ever.",
139 /// "type": [
140 /// "string",
141 /// "null"
142 /// ],
143 /// "format": "date-time"
144 /// }
145 /// }
146 ///}
147 /// ```
148 /// </details>
149 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
150 pub struct ApiToken {
151 ///When the key was created.
152 pub created_at: ::chrono::DateTime<::chrono::offset::Utc>,
153 ///Human label for the key.
154 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
155 pub description: ::std::option::Option<::std::string::String>,
156 ///When the key expires, or null if it never expires.
157 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
158 pub expires_at: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
159 ///Stable key id.
160 pub id: ::uuid::Uuid,
161 ///When the key was last used to authenticate, if ever.
162 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
163 pub last_used_at: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
164 }
165
166 ///Creates a personal API key.
167 ///
168 /// <details><summary>JSON schema</summary>
169 ///
170 /// ```json
171 ///{
172 /// "title": "ApiTokenCreateRequest",
173 /// "description": "Creates a personal API key.",
174 /// "examples": [
175 /// {
176 /// "description": "Laptop CLI",
177 /// "expires_at": null
178 /// }
179 /// ],
180 /// "type": "object",
181 /// "required": [
182 /// "description"
183 /// ],
184 /// "properties": {
185 /// "description": {
186 /// "description": "Human label for the key.",
187 /// "type": "string"
188 /// },
189 /// "expires_at": {
190 /// "description": "Optional expiry; null or omitted means the key
191 /// never expires.",
192 /// "type": [
193 /// "string",
194 /// "null"
195 /// ],
196 /// "format": "date-time"
197 /// }
198 /// }
199 ///}
200 /// ```
201 /// </details>
202 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
203 pub struct ApiTokenCreateRequest {
204 ///Human label for the key.
205 pub description: ::std::string::String,
206 ///Optional expiry; null or omitted means the key never expires.
207 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
208 pub expires_at: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
209 }
210
211 ///The created key and its raw secret. The secret is shown only here, once.
212 ///
213 /// <details><summary>JSON schema</summary>
214 ///
215 /// ```json
216 ///{
217 /// "title": "ApiTokenCreateResponse",
218 /// "description": "The created key and its raw secret. The secret is shown
219 /// only here, once.",
220 /// "type": "object",
221 /// "required": [
222 /// "api_token",
223 /// "token"
224 /// ],
225 /// "properties": {
226 /// "api_token": {
227 /// "$ref": "#/components/schemas/ApiToken"
228 /// },
229 /// "token": {
230 /// "description": "The raw API key secret. Store it now; it is never
231 /// shown again.",
232 /// "type": "string"
233 /// }
234 /// }
235 ///}
236 /// ```
237 /// </details>
238 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
239 pub struct ApiTokenCreateResponse {
240 pub api_token: ApiToken,
241 ///The raw API key secret. Store it now; it is never shown again.
242 pub token: ::std::string::String,
243 }
244
245 ///Every personal API key belonging to the current user.
246 ///
247 /// <details><summary>JSON schema</summary>
248 ///
249 /// ```json
250 ///{
251 /// "title": "ApiTokenListResponse",
252 /// "description": "Every personal API key belonging to the current user.",
253 /// "type": "object",
254 /// "required": [
255 /// "api_tokens"
256 /// ],
257 /// "properties": {
258 /// "api_tokens": {
259 /// "description": "The user's personal API keys.",
260 /// "type": "array",
261 /// "items": {
262 /// "$ref": "#/components/schemas/ApiToken"
263 /// }
264 /// }
265 /// }
266 ///}
267 /// ```
268 /// </details>
269 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
270 pub struct ApiTokenListResponse {
271 ///The user's personal API keys.
272 pub api_tokens: ::std::vec::Vec<ApiToken>,
273 }
274
275 ///GitHub OAuth callback payload from the SPA.
276 ///
277 /// <details><summary>JSON schema</summary>
278 ///
279 /// ```json
280 ///{
281 /// "title": "AuthGithubRequest",
282 /// "description": "GitHub OAuth callback payload from the SPA.",
283 /// "examples": [
284 /// {
285 /// "code": "abc123def456"
286 /// }
287 /// ],
288 /// "type": "object",
289 /// "required": [
290 /// "code"
291 /// ],
292 /// "properties": {
293 /// "code": {
294 /// "description": "The authorization code returned by GitHub to the
295 /// SPA.",
296 /// "type": "string"
297 /// }
298 /// }
299 ///}
300 /// ```
301 /// </details>
302 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
303 pub struct AuthGithubRequest {
304 ///The authorization code returned by GitHub to the SPA.
305 pub code: ::std::string::String,
306 }
307
308 ///Google OAuth callback payload from the SPA.
309 ///
310 /// <details><summary>JSON schema</summary>
311 ///
312 /// ```json
313 ///{
314 /// "title": "AuthGoogleRequest",
315 /// "description": "Google OAuth callback payload from the SPA.",
316 /// "examples": [
317 /// {
318 /// "code": "4/0Afg...",
319 /// "redirect_uri": "https://app.harmont.dev/auth/google/callback"
320 /// }
321 /// ],
322 /// "type": "object",
323 /// "required": [
324 /// "code",
325 /// "redirect_uri"
326 /// ],
327 /// "properties": {
328 /// "code": {
329 /// "description": "The authorization code returned by Google to the
330 /// SPA.",
331 /// "type": "string"
332 /// },
333 /// "redirect_uri": {
334 /// "description": "The redirect URI the SPA used; must match the OAuth
335 /// client config.",
336 /// "type": "string"
337 /// }
338 /// }
339 ///}
340 /// ```
341 /// </details>
342 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
343 pub struct AuthGoogleRequest {
344 ///The authorization code returned by Google to the SPA.
345 pub code: ::std::string::String,
346 ///The redirect URI the SPA used; must match the OAuth client config.
347 pub redirect_uri: ::std::string::String,
348 }
349
350 ///A freshly minted session bearer token and the authenticated user.
351 ///
352 /// <details><summary>JSON schema</summary>
353 ///
354 /// ```json
355 ///{
356 /// "title": "AuthTokenResponse",
357 /// "description": "A freshly minted session bearer token and the
358 /// authenticated user.",
359 /// "type": "object",
360 /// "required": [
361 /// "token",
362 /// "user"
363 /// ],
364 /// "properties": {
365 /// "token": {
366 /// "description": "The raw session bearer token. Send it as
367 /// `Authorization: Bearer <token>`.",
368 /// "type": "string"
369 /// },
370 /// "user": {
371 /// "$ref": "#/components/schemas/User"
372 /// }
373 /// }
374 ///}
375 /// ```
376 /// </details>
377 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
378 pub struct AuthTokenResponse {
379 ///The raw session bearer token. Send it as `Authorization: Bearer
380 /// <token>`.
381 pub token: ::std::string::String,
382 pub user: User,
383 }
384
385 ///The organization's current balance — the sum of every ledger entry
386 /// (credits positive, debits negative). May be negative.
387 ///
388 /// <details><summary>JSON schema</summary>
389 ///
390 /// ```json
391 ///{
392 /// "title": "BalanceResponse",
393 /// "description": "The organization's current balance — the sum of every
394 /// ledger entry (credits positive, debits negative). May be negative.",
395 /// "type": "object",
396 /// "required": [
397 /// "balance_cents"
398 /// ],
399 /// "properties": {
400 /// "balance_cents": {
401 /// "description": "Current balance in cents (credits − debits). May be
402 /// negative.",
403 /// "type": "integer"
404 /// }
405 /// }
406 ///}
407 /// ```
408 /// </details>
409 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
410 pub struct BalanceResponse {
411 ///Current balance in cents (credits − debits). May be negative.
412 pub balance_cents: i64,
413 }
414
415 ///One run of a pipeline, identified by its pipeline-scoped number.
416 ///
417 /// <details><summary>JSON schema</summary>
418 ///
419 /// ```json
420 ///{
421 /// "title": "Build",
422 /// "description": "One run of a pipeline, identified by its
423 /// pipeline-scoped number.",
424 /// "type": "object",
425 /// "required": [
426 /// "created_at",
427 /// "number",
428 /// "state"
429 /// ],
430 /// "properties": {
431 /// "branch": {
432 /// "description": "Source branch.",
433 /// "type": [
434 /// "string",
435 /// "null"
436 /// ]
437 /// },
438 /// "commit": {
439 /// "description": "Source commit SHA.",
440 /// "type": [
441 /// "string",
442 /// "null"
443 /// ]
444 /// },
445 /// "created_at": {
446 /// "description": "When the build row was created.",
447 /// "type": "string",
448 /// "format": "date-time"
449 /// },
450 /// "error_code": {
451 /// "description": "Stable build-level error code, if the build failed
452 /// at the build level.",
453 /// "type": [
454 /// "string",
455 /// "null"
456 /// ]
457 /// },
458 /// "error_message": {
459 /// "description": "Human-readable build-level error message, if any.",
460 /// "type": [
461 /// "string",
462 /// "null"
463 /// ]
464 /// },
465 /// "finished_at": {
466 /// "description": "When the build reached a terminal state.",
467 /// "type": [
468 /// "string",
469 /// "null"
470 /// ],
471 /// "format": "date-time"
472 /// },
473 /// "message": {
474 /// "description": "Commit/build message.",
475 /// "type": [
476 /// "string",
477 /// "null"
478 /// ]
479 /// },
480 /// "number": {
481 /// "description": "The build's number, sequential and unique within
482 /// its pipeline.",
483 /// "type": "integer"
484 /// },
485 /// "scheduled_at": {
486 /// "description": "When the build was queued.",
487 /// "type": [
488 /// "string",
489 /// "null"
490 /// ],
491 /// "format": "date-time"
492 /// },
493 /// "source": {
494 /// "description": "How the build was triggered (e.g. `api`, `webhook`,
495 /// `ui`).",
496 /// "type": [
497 /// "string",
498 /// "null"
499 /// ]
500 /// },
501 /// "started_at": {
502 /// "description": "When the build started running.",
503 /// "type": [
504 /// "string",
505 /// "null"
506 /// ],
507 /// "format": "date-time"
508 /// },
509 /// "state": {
510 /// "description": "The rolled-up build state.",
511 /// "type": "string",
512 /// "enum": [
513 /// "scheduled",
514 /// "running",
515 /// "failing",
516 /// "passed",
517 /// "failed",
518 /// "canceling",
519 /// "canceled"
520 /// ]
521 /// }
522 /// }
523 ///}
524 /// ```
525 /// </details>
526 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
527 pub struct Build {
528 ///Source branch.
529 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
530 pub branch: ::std::option::Option<::std::string::String>,
531 ///Source commit SHA.
532 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
533 pub commit: ::std::option::Option<::std::string::String>,
534 ///When the build row was created.
535 pub created_at: ::chrono::DateTime<::chrono::offset::Utc>,
536 ///Stable build-level error code, if the build failed at the build
537 /// level.
538 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
539 pub error_code: ::std::option::Option<::std::string::String>,
540 ///Human-readable build-level error message, if any.
541 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
542 pub error_message: ::std::option::Option<::std::string::String>,
543 ///When the build reached a terminal state.
544 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
545 pub finished_at: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
546 ///Commit/build message.
547 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
548 pub message: ::std::option::Option<::std::string::String>,
549 ///The build's number, sequential and unique within its pipeline.
550 pub number: i64,
551 ///When the build was queued.
552 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
553 pub scheduled_at: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
554 ///How the build was triggered (e.g. `api`, `webhook`, `ui`).
555 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
556 pub source: ::std::option::Option<::std::string::String>,
557 ///When the build started running.
558 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
559 pub started_at: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
560 ///The rolled-up build state.
561 pub state: BuildState,
562 }
563
564 ///A page of a pipeline's builds (newest first), with an opaque cursor.
565 ///
566 /// <details><summary>JSON schema</summary>
567 ///
568 /// ```json
569 ///{
570 /// "title": "BuildList",
571 /// "description": "A page of a pipeline's builds (newest first), with an
572 /// opaque cursor.",
573 /// "type": "object",
574 /// "required": [
575 /// "data",
576 /// "next_cursor"
577 /// ],
578 /// "properties": {
579 /// "data": {
580 /// "description": "The builds on this page, newest first.",
581 /// "type": "array",
582 /// "items": {
583 /// "$ref": "#/components/schemas/Build"
584 /// }
585 /// },
586 /// "next_cursor": {
587 /// "description": "Opaque cursor for the next page. Pass it as the
588 /// `cursor` query parameter; `null` when there are no more pages.",
589 /// "type": [
590 /// "string",
591 /// "null"
592 /// ]
593 /// }
594 /// }
595 ///}
596 /// ```
597 /// </details>
598 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
599 pub struct BuildList {
600 ///The builds on this page, newest first.
601 pub data: ::std::vec::Vec<Build>,
602 ///Opaque cursor for the next page. Pass it as the `cursor` query
603 /// parameter; `null` when there are no more pages.
604 pub next_cursor: ::std::option::Option<::std::string::String>,
605 }
606
607 ///The rolled-up build state.
608 ///
609 /// <details><summary>JSON schema</summary>
610 ///
611 /// ```json
612 ///{
613 /// "description": "The rolled-up build state.",
614 /// "type": "string",
615 /// "enum": [
616 /// "scheduled",
617 /// "running",
618 /// "failing",
619 /// "passed",
620 /// "failed",
621 /// "canceling",
622 /// "canceled"
623 /// ]
624 ///}
625 /// ```
626 /// </details>
627 #[derive(
628 :: serde :: Deserialize,
629 :: serde :: Serialize,
630 Clone,
631 Copy,
632 Debug,
633 Eq,
634 Hash,
635 Ord,
636 PartialEq,
637 PartialOrd,
638 )]
639 pub enum BuildState {
640 #[serde(rename = "scheduled")]
641 Scheduled,
642 #[serde(rename = "running")]
643 Running,
644 #[serde(rename = "failing")]
645 Failing,
646 #[serde(rename = "passed")]
647 Passed,
648 #[serde(rename = "failed")]
649 Failed,
650 #[serde(rename = "canceling")]
651 Canceling,
652 #[serde(rename = "canceled")]
653 Canceled,
654 }
655
656 impl ::std::fmt::Display for BuildState {
657 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
658 match *self {
659 Self::Scheduled => f.write_str("scheduled"),
660 Self::Running => f.write_str("running"),
661 Self::Failing => f.write_str("failing"),
662 Self::Passed => f.write_str("passed"),
663 Self::Failed => f.write_str("failed"),
664 Self::Canceling => f.write_str("canceling"),
665 Self::Canceled => f.write_str("canceled"),
666 }
667 }
668 }
669
670 impl ::std::str::FromStr for BuildState {
671 type Err = self::error::ConversionError;
672 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
673 match value {
674 "scheduled" => Ok(Self::Scheduled),
675 "running" => Ok(Self::Running),
676 "failing" => Ok(Self::Failing),
677 "passed" => Ok(Self::Passed),
678 "failed" => Ok(Self::Failed),
679 "canceling" => Ok(Self::Canceling),
680 "canceled" => Ok(Self::Canceled),
681 _ => Err("invalid value".into()),
682 }
683 }
684 }
685
686 impl ::std::convert::TryFrom<&str> for BuildState {
687 type Error = self::error::ConversionError;
688 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
689 value.parse()
690 }
691 }
692
693 impl ::std::convert::TryFrom<&::std::string::String> for BuildState {
694 type Error = self::error::ConversionError;
695 fn try_from(
696 value: &::std::string::String,
697 ) -> ::std::result::Result<Self, self::error::ConversionError> {
698 value.parse()
699 }
700 }
701
702 impl ::std::convert::TryFrom<::std::string::String> for BuildState {
703 type Error = self::error::ConversionError;
704 fn try_from(
705 value: ::std::string::String,
706 ) -> ::std::result::Result<Self, self::error::ConversionError> {
707 value.parse()
708 }
709 }
710
711 ///Starts a Stripe Checkout Session crediting the organization identified
712 /// by the path (`:org`). The body carries only the top-up amount in cents.
713 ///
714 /// <details><summary>JSON schema</summary>
715 ///
716 /// ```json
717 ///{
718 /// "title": "CheckoutRequest",
719 /// "description": "Starts a Stripe Checkout Session crediting the
720 /// organization identified by the path (`:org`). The body carries only the
721 /// top-up amount in cents.",
722 /// "type": "object",
723 /// "required": [
724 /// "amount_cents"
725 /// ],
726 /// "properties": {
727 /// "amount_cents": {
728 /// "description": "The credit top-up amount in cents. Must be a
729 /// positive integer within the supported bounds (100–1,000,000).",
730 /// "type": "integer",
731 /// "maximum": 1000000.0,
732 /// "minimum": 100.0
733 /// }
734 /// }
735 ///}
736 /// ```
737 /// </details>
738 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
739 pub struct CheckoutRequest {
740 ///The credit top-up amount in cents. Must be a positive integer within
741 /// the supported bounds (100–1,000,000).
742 pub amount_cents: i64,
743 }
744
745 ///The hosted Stripe Checkout URL. Redirect the customer here to complete
746 /// the top-up; on success Stripe fires a webhook that posts the matching
747 /// credit.
748 ///
749 /// <details><summary>JSON schema</summary>
750 ///
751 /// ```json
752 ///{
753 /// "title": "CheckoutResponse",
754 /// "description": "The hosted Stripe Checkout URL. Redirect the customer
755 /// here to complete the top-up; on success Stripe fires a webhook that
756 /// posts the matching credit.",
757 /// "type": "object",
758 /// "required": [
759 /// "checkout_url"
760 /// ],
761 /// "properties": {
762 /// "checkout_url": {
763 /// "description": "The hosted Stripe Checkout Session URL.",
764 /// "type": "string"
765 /// }
766 /// }
767 ///}
768 /// ```
769 /// </details>
770 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
771 pub struct CheckoutResponse {
772 ///The hosted Stripe Checkout Session URL.
773 pub checkout_url: ::std::string::String,
774 }
775
776 ///The CLI polls with its nonce to claim the session token the SPA
777 /// transferred.
778 ///
779 /// <details><summary>JSON schema</summary>
780 ///
781 /// ```json
782 ///{
783 /// "title": "CliClaimRequest",
784 /// "description": "The CLI polls with its nonce to claim the session token
785 /// the SPA transferred.",
786 /// "examples": [
787 /// {
788 /// "nonce": "a7Kp...random"
789 /// }
790 /// ],
791 /// "type": "object",
792 /// "required": [
793 /// "nonce"
794 /// ],
795 /// "properties": {
796 /// "nonce": {
797 /// "description": "The nonce the CLI generated for this loopback
798 /// handoff.",
799 /// "type": "string"
800 /// }
801 /// }
802 ///}
803 /// ```
804 /// </details>
805 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
806 pub struct CliClaimRequest {
807 ///The nonce the CLI generated for this loopback handoff.
808 pub nonce: ::std::string::String,
809 }
810
811 ///A short, human-typeable code the user re-types into the CLI.
812 ///
813 /// <details><summary>JSON schema</summary>
814 ///
815 /// ```json
816 ///{
817 /// "title": "CliCodeResponse",
818 /// "description": "A short, human-typeable code the user re-types into the
819 /// CLI.",
820 /// "examples": [
821 /// {
822 /// "code": "K7P2QR9MX3WZ4NTV"
823 /// }
824 /// ],
825 /// "type": "object",
826 /// "required": [
827 /// "code"
828 /// ],
829 /// "properties": {
830 /// "code": {
831 /// "description": "The single-use paste code. Valid for five
832 /// minutes.",
833 /// "type": "string"
834 /// }
835 /// }
836 ///}
837 /// ```
838 /// </details>
839 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
840 pub struct CliCodeResponse {
841 ///The single-use paste code. Valid for five minutes.
842 pub code: ::std::string::String,
843 }
844
845 ///The CLI redeems a paste code the user typed in, receiving the session
846 /// token.
847 ///
848 /// <details><summary>JSON schema</summary>
849 ///
850 /// ```json
851 ///{
852 /// "title": "CliRedeemRequest",
853 /// "description": "The CLI redeems a paste code the user typed in,
854 /// receiving the session token.",
855 /// "examples": [
856 /// {
857 /// "code": "K7P2QR9MX3WZ4NTV"
858 /// }
859 /// ],
860 /// "type": "object",
861 /// "required": [
862 /// "code"
863 /// ],
864 /// "properties": {
865 /// "code": {
866 /// "description": "The paste code shown by the SPA.",
867 /// "type": "string"
868 /// }
869 /// }
870 ///}
871 /// ```
872 /// </details>
873 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
874 pub struct CliRedeemRequest {
875 ///The paste code shown by the SPA.
876 pub code: ::std::string::String,
877 }
878
879 ///The raw session bearer token handed to the CLI.
880 ///
881 /// <details><summary>JSON schema</summary>
882 ///
883 /// ```json
884 ///{
885 /// "title": "CliTokenResponse",
886 /// "description": "The raw session bearer token handed to the CLI.",
887 /// "type": "object",
888 /// "required": [
889 /// "token"
890 /// ],
891 /// "properties": {
892 /// "token": {
893 /// "description": "The raw session bearer token. Send it as
894 /// `Authorization: Bearer <token>`.",
895 /// "type": "string"
896 /// }
897 /// }
898 ///}
899 /// ```
900 /// </details>
901 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
902 pub struct CliTokenResponse {
903 ///The raw session bearer token. Send it as `Authorization: Bearer
904 /// <token>`.
905 pub token: ::std::string::String,
906 }
907
908 ///The SPA hands a fresh session token to a locally-running CLI that
909 /// generated `nonce` and is polling the claim endpoint.
910 ///
911 /// <details><summary>JSON schema</summary>
912 ///
913 /// ```json
914 ///{
915 /// "title": "CliTransferRequest",
916 /// "description": "The SPA hands a fresh session token to a
917 /// locally-running CLI that generated `nonce` and is polling the claim
918 /// endpoint.",
919 /// "examples": [
920 /// {
921 /// "nonce": "a7Kp...random"
922 /// }
923 /// ],
924 /// "type": "object",
925 /// "required": [
926 /// "nonce"
927 /// ],
928 /// "properties": {
929 /// "nonce": {
930 /// "description": "The opaque nonce the CLI generated and is polling
931 /// claim with.",
932 /// "type": "string"
933 /// }
934 /// }
935 ///}
936 /// ```
937 /// </details>
938 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
939 pub struct CliTransferRequest {
940 ///The opaque nonce the CLI generated and is polling claim with.
941 pub nonce: ::std::string::String,
942 }
943
944 ///Binds an existing GitHub App installation (identified by its GitHub
945 /// numeric installation id) to this organization.
946 ///
947 /// <details><summary>JSON schema</summary>
948 ///
949 /// ```json
950 ///{
951 /// "title": "ConnectInstallationRequest",
952 /// "description": "Binds an existing GitHub App installation (identified
953 /// by its GitHub numeric installation id) to this organization.",
954 /// "type": "object",
955 /// "required": [
956 /// "installation_id"
957 /// ],
958 /// "properties": {
959 /// "installation_id": {
960 /// "description": "GitHub's numeric installation id to bind.",
961 /// "type": "integer"
962 /// }
963 /// }
964 ///}
965 /// ```
966 /// </details>
967 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
968 pub struct ConnectInstallationRequest {
969 ///GitHub's numeric installation id to bind.
970 pub installation_id: i64,
971 }
972
973 ///Creates a build for a pipeline. Two paths: supply pre-rendered v0 IR
974 /// JSON in `pipeline_ir` (the `hm run` / API path), or omit `pipeline_ir`
975 /// to have the engine render the registered pipeline's IR in a sandbox VM
976 /// (decision #5 — rendering never happens on the API host). The IR is then
977 /// parsed and planned in-process; on a plan/render rejection the build row
978 /// is created with its error fields set and the request returns 422.
979 ///
980 /// <details><summary>JSON schema</summary>
981 ///
982 /// ```json
983 ///{
984 /// "title": "CreateBuildRequest",
985 /// "description": "Creates a build for a pipeline. Two paths: supply
986 /// pre-rendered v0 IR JSON in `pipeline_ir` (the `hm run` / API path), or
987 /// omit `pipeline_ir` to have the engine render the registered pipeline's
988 /// IR in a sandbox VM (decision #5 — rendering never happens on the API
989 /// host). The IR is then parsed and planned in-process; on a plan/render
990 /// rejection the build row is created with its error fields set and the
991 /// request returns 422.",
992 /// "type": "object",
993 /// "required": [
994 /// "branch",
995 /// "commit"
996 /// ],
997 /// "properties": {
998 /// "branch": {
999 /// "description": "Source branch.",
1000 /// "type": "string"
1001 /// },
1002 /// "commit": {
1003 /// "description": "Source commit SHA.",
1004 /// "type": "string"
1005 /// },
1006 /// "env": {
1007 /// "description": "Build-level environment variables.",
1008 /// "type": [
1009 /// "object",
1010 /// "null"
1011 /// ],
1012 /// "additionalProperties": {
1013 /// "type": "string"
1014 /// }
1015 /// },
1016 /// "message": {
1017 /// "description": "Optional build/commit message.",
1018 /// "type": [
1019 /// "string",
1020 /// "null"
1021 /// ]
1022 /// },
1023 /// "pipeline_ir": {
1024 /// "description": "The pre-rendered v0 IR JSON the engine materialises
1025 /// into jobs. When absent/blank the engine renders the pipeline's IR in a
1026 /// sandbox VM instead.",
1027 /// "type": [
1028 /// "string",
1029 /// "null"
1030 /// ]
1031 /// },
1032 /// "source": {
1033 /// "description": "How the build was triggered (e.g. `api`, `ui`).
1034 /// Defaults to `api`.",
1035 /// "type": [
1036 /// "string",
1037 /// "null"
1038 /// ]
1039 /// },
1040 /// "source_b64": {
1041 /// "description": "Base64-encoded source tarball (expected to be
1042 /// gzipped; the API validates only that it is valid base64, not the archive
1043 /// format) — the `hm run` local-code upload path. When present, the API
1044 /// stores it at the build's key and derives the internal,
1045 /// runner-token-authenticated `source_url`; it takes precedence over any
1046 /// caller-supplied `source_url`.",
1047 /// "type": [
1048 /// "string",
1049 /// "null"
1050 /// ]
1051 /// },
1052 /// "source_sha256": {
1053 /// "description": "SHA-256 of the source archive, verified by the
1054 /// sandbox before rendering (in-sandbox-render path). Defaults to empty
1055 /// when omitted.",
1056 /// "type": [
1057 /// "string",
1058 /// "null"
1059 /// ]
1060 /// },
1061 /// "source_url": {
1062 /// "description": "URL to the build's source archive, fetched by the
1063 /// sandbox. Ignored when `source_b64` is supplied (the API derives this
1064 /// internally).",
1065 /// "type": [
1066 /// "string",
1067 /// "null"
1068 /// ]
1069 /// }
1070 /// }
1071 ///}
1072 /// ```
1073 /// </details>
1074 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
1075 pub struct CreateBuildRequest {
1076 ///Source branch.
1077 pub branch: ::std::string::String,
1078 ///Source commit SHA.
1079 pub commit: ::std::string::String,
1080 ///Build-level environment variables.
1081 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1082 pub env: ::std::option::Option<
1083 ::std::collections::HashMap<::std::string::String, ::std::string::String>,
1084 >,
1085 ///Optional build/commit message.
1086 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1087 pub message: ::std::option::Option<::std::string::String>,
1088 ///The pre-rendered v0 IR JSON the engine materialises into jobs. When
1089 /// absent/blank the engine renders the pipeline's IR in a sandbox VM
1090 /// instead.
1091 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1092 pub pipeline_ir: ::std::option::Option<::std::string::String>,
1093 ///How the build was triggered (e.g. `api`, `ui`). Defaults to `api`.
1094 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1095 pub source: ::std::option::Option<::std::string::String>,
1096 ///Base64-encoded source tarball (expected to be gzipped; the API
1097 /// validates only that it is valid base64, not the archive format) —
1098 /// the `hm run` local-code upload path. When present, the API stores it
1099 /// at the build's key and derives the internal,
1100 /// runner-token-authenticated `source_url`; it takes precedence over
1101 /// any caller-supplied `source_url`.
1102 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1103 pub source_b64: ::std::option::Option<::std::string::String>,
1104 ///SHA-256 of the source archive, verified by the sandbox before
1105 /// rendering (in-sandbox-render path). Defaults to empty when omitted.
1106 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1107 pub source_sha256: ::std::option::Option<::std::string::String>,
1108 ///URL to the build's source archive, fetched by the sandbox. Ignored
1109 /// when `source_b64` is supplied (the API derives this internally).
1110 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1111 pub source_url: ::std::option::Option<::std::string::String>,
1112 }
1113
1114 ///Creates a pipeline within an organization. The slug is derived from the
1115 /// name; a slug collision within the organization is rejected.
1116 ///
1117 /// <details><summary>JSON schema</summary>
1118 ///
1119 /// ```json
1120 ///{
1121 /// "title": "CreatePipelineRequest",
1122 /// "description": "Creates a pipeline within an organization. The slug is
1123 /// derived from the name; a slug collision within the organization is
1124 /// rejected.",
1125 /// "type": "object",
1126 /// "required": [
1127 /// "default_branch",
1128 /// "name",
1129 /// "repository"
1130 /// ],
1131 /// "properties": {
1132 /// "default_branch": {
1133 /// "description": "The branch built by default.",
1134 /// "type": "string"
1135 /// },
1136 /// "description": {
1137 /// "description": "Optional human description.",
1138 /// "type": [
1139 /// "string",
1140 /// "null"
1141 /// ]
1142 /// },
1143 /// "name": {
1144 /// "description": "Display name.",
1145 /// "type": "string"
1146 /// },
1147 /// "repository": {
1148 /// "description": "The source repository this pipeline builds.",
1149 /// "type": "string"
1150 /// }
1151 /// }
1152 ///}
1153 /// ```
1154 /// </details>
1155 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
1156 pub struct CreatePipelineRequest {
1157 ///The branch built by default.
1158 pub default_branch: ::std::string::String,
1159 ///Optional human description.
1160 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1161 pub description: ::std::option::Option<::std::string::String>,
1162 ///Display name.
1163 pub name: ::std::string::String,
1164 ///The source repository this pipeline builds.
1165 pub repository: ::std::string::String,
1166 }
1167
1168 ///The authenticated Harmont user and their personal-org slug.
1169 ///
1170 /// <details><summary>JSON schema</summary>
1171 ///
1172 /// ```json
1173 ///{
1174 /// "title": "CurrentUserResponse",
1175 /// "description": "The authenticated Harmont user and their personal-org
1176 /// slug.",
1177 /// "type": "object",
1178 /// "required": [
1179 /// "email",
1180 /// "uuid"
1181 /// ],
1182 /// "properties": {
1183 /// "email": {
1184 /// "description": "The user's email address.",
1185 /// "type": "string"
1186 /// },
1187 /// "name": {
1188 /// "description": "Display name.",
1189 /// "type": [
1190 /// "string",
1191 /// "null"
1192 /// ]
1193 /// },
1194 /// "personal_org_slug": {
1195 /// "description": "Slug of the user's personal organization.",
1196 /// "type": [
1197 /// "string",
1198 /// "null"
1199 /// ]
1200 /// },
1201 /// "uuid": {
1202 /// "description": "Stable user id.",
1203 /// "type": "string",
1204 /// "format": "uuid"
1205 /// }
1206 /// }
1207 ///}
1208 /// ```
1209 /// </details>
1210 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
1211 pub struct CurrentUserResponse {
1212 ///The user's email address.
1213 pub email: ::std::string::String,
1214 ///Display name.
1215 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1216 pub name: ::std::option::Option<::std::string::String>,
1217 ///Slug of the user's personal organization.
1218 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1219 pub personal_org_slug: ::std::option::Option<::std::string::String>,
1220 ///Stable user id.
1221 pub uuid: ::uuid::Uuid,
1222 }
1223
1224 ///The Harmont error envelope.
1225 ///
1226 /// <details><summary>JSON schema</summary>
1227 ///
1228 /// ```json
1229 ///{
1230 /// "title": "Error",
1231 /// "description": "The Harmont error envelope.",
1232 /// "type": "object",
1233 /// "required": [
1234 /// "error"
1235 /// ],
1236 /// "properties": {
1237 /// "error": {
1238 /// "type": "object",
1239 /// "required": [
1240 /// "code",
1241 /// "message",
1242 /// "type"
1243 /// ],
1244 /// "properties": {
1245 /// "code": {
1246 /// "description": "Catalog code.",
1247 /// "type": "string"
1248 /// },
1249 /// "doc_url": {
1250 /// "description": "Docs link for this error.",
1251 /// "type": "string"
1252 /// },
1253 /// "message": {
1254 /// "description": "Human-readable message.",
1255 /// "type": "string"
1256 /// },
1257 /// "request_id": {
1258 /// "description": "Correlates with server logs/traces.",
1259 /// "type": "string"
1260 /// },
1261 /// "type": {
1262 /// "description": "Stable machine error type.",
1263 /// "type": "string"
1264 /// }
1265 /// }
1266 /// }
1267 /// }
1268 ///}
1269 /// ```
1270 /// </details>
1271 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
1272 pub struct Error {
1273 pub error: ErrorError,
1274 }
1275
1276 ///`ErrorError`
1277 ///
1278 /// <details><summary>JSON schema</summary>
1279 ///
1280 /// ```json
1281 ///{
1282 /// "type": "object",
1283 /// "required": [
1284 /// "code",
1285 /// "message",
1286 /// "type"
1287 /// ],
1288 /// "properties": {
1289 /// "code": {
1290 /// "description": "Catalog code.",
1291 /// "type": "string"
1292 /// },
1293 /// "doc_url": {
1294 /// "description": "Docs link for this error.",
1295 /// "type": "string"
1296 /// },
1297 /// "message": {
1298 /// "description": "Human-readable message.",
1299 /// "type": "string"
1300 /// },
1301 /// "request_id": {
1302 /// "description": "Correlates with server logs/traces.",
1303 /// "type": "string"
1304 /// },
1305 /// "type": {
1306 /// "description": "Stable machine error type.",
1307 /// "type": "string"
1308 /// }
1309 /// }
1310 ///}
1311 /// ```
1312 /// </details>
1313 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
1314 pub struct ErrorError {
1315 ///Catalog code.
1316 pub code: ::std::string::String,
1317 ///Docs link for this error.
1318 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1319 pub doc_url: ::std::option::Option<::std::string::String>,
1320 ///Human-readable message.
1321 pub message: ::std::string::String,
1322 ///Correlates with server logs/traces.
1323 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1324 pub request_id: ::std::option::Option<::std::string::String>,
1325 ///Stable machine error type.
1326 #[serde(rename = "type")]
1327 pub type_: ::std::string::String,
1328 }
1329
1330 ///A GitHub App installation the organization has connected. The numeric
1331 /// `installation_id` is GitHub's installation id (used to address
1332 /// sync/unbind), while `id` is Harmont's internal row id.
1333 ///
1334 /// <details><summary>JSON schema</summary>
1335 ///
1336 /// ```json
1337 ///{
1338 /// "title": "GithubInstallation",
1339 /// "description": "A GitHub App installation the organization has
1340 /// connected. The numeric `installation_id` is GitHub's installation id
1341 /// (used to address sync/unbind), while `id` is Harmont's internal row
1342 /// id.",
1343 /// "type": "object",
1344 /// "required": [
1345 /// "account_login",
1346 /// "account_type",
1347 /// "created_at",
1348 /// "id",
1349 /// "installation_id",
1350 /// "updated_at"
1351 /// ],
1352 /// "properties": {
1353 /// "account_login": {
1354 /// "description": "The GitHub account (org or user) the App is
1355 /// installed on.",
1356 /// "type": "string"
1357 /// },
1358 /// "account_type": {
1359 /// "description": "`Organization` or `User`.",
1360 /// "type": "string"
1361 /// },
1362 /// "created_at": {
1363 /// "description": "When the installation row was first mirrored.",
1364 /// "type": "string",
1365 /// "format": "date-time"
1366 /// },
1367 /// "id": {
1368 /// "description": "Harmont's internal installation row id.",
1369 /// "type": "integer"
1370 /// },
1371 /// "installation_id": {
1372 /// "description": "GitHub's numeric installation id.",
1373 /// "type": "integer"
1374 /// },
1375 /// "updated_at": {
1376 /// "description": "When the installation row was last updated.",
1377 /// "type": "string",
1378 /// "format": "date-time"
1379 /// }
1380 /// }
1381 ///}
1382 /// ```
1383 /// </details>
1384 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
1385 pub struct GithubInstallation {
1386 ///The GitHub account (org or user) the App is installed on.
1387 pub account_login: ::std::string::String,
1388 ///`Organization` or `User`.
1389 pub account_type: ::std::string::String,
1390 ///When the installation row was first mirrored.
1391 pub created_at: ::chrono::DateTime<::chrono::offset::Utc>,
1392 ///Harmont's internal installation row id.
1393 pub id: i64,
1394 ///GitHub's numeric installation id.
1395 pub installation_id: i64,
1396 ///When the installation row was last updated.
1397 pub updated_at: ::chrono::DateTime<::chrono::offset::Utc>,
1398 }
1399
1400 ///The organization's connected GitHub App installations.
1401 ///
1402 /// <details><summary>JSON schema</summary>
1403 ///
1404 /// ```json
1405 ///{
1406 /// "title": "GithubInstallationList",
1407 /// "description": "The organization's connected GitHub App
1408 /// installations.",
1409 /// "type": "object",
1410 /// "required": [
1411 /// "data"
1412 /// ],
1413 /// "properties": {
1414 /// "data": {
1415 /// "description": "The connected installations.",
1416 /// "type": "array",
1417 /// "items": {
1418 /// "$ref": "#/components/schemas/GithubInstallation"
1419 /// }
1420 /// }
1421 /// }
1422 ///}
1423 /// ```
1424 /// </details>
1425 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
1426 pub struct GithubInstallationList {
1427 ///The connected installations.
1428 pub data: ::std::vec::Vec<GithubInstallation>,
1429 }
1430
1431 ///A repository Harmont mirrors from a connected GitHub installation.
1432 /// `installation_id` is Harmont's internal installation row id (FK), not
1433 /// GitHub's installation id.
1434 ///
1435 /// <details><summary>JSON schema</summary>
1436 ///
1437 /// ```json
1438 ///{
1439 /// "title": "GithubRepo",
1440 /// "description": "A repository Harmont mirrors from a connected GitHub
1441 /// installation. `installation_id` is Harmont's internal installation row
1442 /// id (FK), not GitHub's installation id.",
1443 /// "type": "object",
1444 /// "required": [
1445 /// "clone_url",
1446 /// "default_branch",
1447 /// "full_name",
1448 /// "gh_repo_id",
1449 /// "id",
1450 /// "installation_id",
1451 /// "name",
1452 /// "owner",
1453 /// "private"
1454 /// ],
1455 /// "properties": {
1456 /// "clone_url": {
1457 /// "description": "HTTPS clone URL.",
1458 /// "type": "string"
1459 /// },
1460 /// "default_branch": {
1461 /// "description": "Default branch name.",
1462 /// "type": "string"
1463 /// },
1464 /// "full_name": {
1465 /// "description": "`owner/name` GitHub full name.",
1466 /// "type": "string"
1467 /// },
1468 /// "gh_repo_id": {
1469 /// "description": "GitHub's numeric repo id.",
1470 /// "type": "integer"
1471 /// },
1472 /// "id": {
1473 /// "description": "Harmont's internal repo row id.",
1474 /// "type": "integer"
1475 /// },
1476 /// "installation_id": {
1477 /// "description": "FK onto the internal installation row id.",
1478 /// "type": "integer"
1479 /// },
1480 /// "last_synced_at": {
1481 /// "description": "When the repo was last synced from GitHub.",
1482 /// "type": [
1483 /// "string",
1484 /// "null"
1485 /// ],
1486 /// "format": "date-time"
1487 /// },
1488 /// "name": {
1489 /// "description": "Short repo name.",
1490 /// "type": "string"
1491 /// },
1492 /// "owner": {
1493 /// "description": "GitHub owner login.",
1494 /// "type": "string"
1495 /// },
1496 /// "private": {
1497 /// "description": "Whether the repo is private.",
1498 /// "type": "boolean"
1499 /// }
1500 /// }
1501 ///}
1502 /// ```
1503 /// </details>
1504 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
1505 pub struct GithubRepo {
1506 ///HTTPS clone URL.
1507 pub clone_url: ::std::string::String,
1508 ///Default branch name.
1509 pub default_branch: ::std::string::String,
1510 ///`owner/name` GitHub full name.
1511 pub full_name: ::std::string::String,
1512 ///GitHub's numeric repo id.
1513 pub gh_repo_id: i64,
1514 ///Harmont's internal repo row id.
1515 pub id: i64,
1516 ///FK onto the internal installation row id.
1517 pub installation_id: i64,
1518 ///When the repo was last synced from GitHub.
1519 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1520 pub last_synced_at: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
1521 ///Short repo name.
1522 pub name: ::std::string::String,
1523 ///GitHub owner login.
1524 pub owner: ::std::string::String,
1525 ///Whether the repo is private.
1526 pub private: bool,
1527 }
1528
1529 ///Mirrored repositories for an installation or across an organization.
1530 ///
1531 /// <details><summary>JSON schema</summary>
1532 ///
1533 /// ```json
1534 ///{
1535 /// "title": "GithubRepoList",
1536 /// "description": "Mirrored repositories for an installation or across an
1537 /// organization.",
1538 /// "type": "object",
1539 /// "required": [
1540 /// "data"
1541 /// ],
1542 /// "properties": {
1543 /// "data": {
1544 /// "description": "The mirrored repositories.",
1545 /// "type": "array",
1546 /// "items": {
1547 /// "$ref": "#/components/schemas/GithubRepo"
1548 /// }
1549 /// }
1550 /// }
1551 ///}
1552 /// ```
1553 /// </details>
1554 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
1555 pub struct GithubRepoList {
1556 ///The mirrored repositories.
1557 pub data: ::std::vec::Vec<GithubRepo>,
1558 }
1559
1560 ///One job (DAG node) of a build.
1561 ///
1562 /// <details><summary>JSON schema</summary>
1563 ///
1564 /// ```json
1565 ///{
1566 /// "title": "Job",
1567 /// "description": "One job (DAG node) of a build.",
1568 /// "type": "object",
1569 /// "required": [
1570 /// "created_at",
1571 /// "depends_on",
1572 /// "id",
1573 /// "soft_failed",
1574 /// "state"
1575 /// ],
1576 /// "properties": {
1577 /// "command": {
1578 /// "description": "The shell command the job runs.",
1579 /// "type": [
1580 /// "string",
1581 /// "null"
1582 /// ]
1583 /// },
1584 /// "created_at": {
1585 /// "description": "When the job row was created.",
1586 /// "type": "string",
1587 /// "format": "date-time"
1588 /// },
1589 /// "depends_on": {
1590 /// "description": "Ids of this job's prerequisite jobs (its DAG
1591 /// in-edges), spanning both `depends_on` and `builds_in` dependency kinds.
1592 /// Empty when the job has no prerequisites.",
1593 /// "type": "array",
1594 /// "items": {
1595 /// "type": "string",
1596 /// "format": "uuid"
1597 /// }
1598 /// },
1599 /// "error_code": {
1600 /// "description": "Stable job-level error code, if the job failed.",
1601 /// "type": [
1602 /// "string",
1603 /// "null"
1604 /// ]
1605 /// },
1606 /// "error_message": {
1607 /// "description": "Human-readable job-level error message, if any.",
1608 /// "type": [
1609 /// "string",
1610 /// "null"
1611 /// ]
1612 /// },
1613 /// "exit_code": {
1614 /// "description": "The command's exit status, once finished.",
1615 /// "type": [
1616 /// "integer",
1617 /// "null"
1618 /// ]
1619 /// },
1620 /// "finished_at": {
1621 /// "description": "When the job reached a terminal state.",
1622 /// "type": [
1623 /// "string",
1624 /// "null"
1625 /// ],
1626 /// "format": "date-time"
1627 /// },
1628 /// "id": {
1629 /// "description": "The job's id.",
1630 /// "type": "string",
1631 /// "format": "uuid"
1632 /// },
1633 /// "name": {
1634 /// "description": "Human-readable job name.",
1635 /// "type": [
1636 /// "string",
1637 /// "null"
1638 /// ]
1639 /// },
1640 /// "retry_policy": {
1641 /// "description": "The job's retry policy, if any.",
1642 /// "type": [
1643 /// "object",
1644 /// "null"
1645 /// ],
1646 /// "additionalProperties": true
1647 /// },
1648 /// "soft_fail_policy": {
1649 /// "description": "The job's soft-fail policy, if any.",
1650 /// "type": [
1651 /// "object",
1652 /// "null"
1653 /// ],
1654 /// "additionalProperties": true
1655 /// },
1656 /// "soft_failed": {
1657 /// "description": "Whether the job failed but the build was allowed to
1658 /// continue.",
1659 /// "type": "boolean"
1660 /// },
1661 /// "started_at": {
1662 /// "description": "When the job started running.",
1663 /// "type": [
1664 /// "string",
1665 /// "null"
1666 /// ],
1667 /// "format": "date-time"
1668 /// },
1669 /// "state": {
1670 /// "description": "The job's FSM state.",
1671 /// "type": "string",
1672 /// "enum": [
1673 /// "pending",
1674 /// "scheduled",
1675 /// "assigned",
1676 /// "running",
1677 /// "passed",
1678 /// "failed",
1679 /// "skipped",
1680 /// "canceling",
1681 /// "canceled",
1682 /// "timing_out",
1683 /// "timed_out"
1684 /// ]
1685 /// },
1686 /// "step_key": {
1687 /// "description": "The job's stable key within the build's DAG.",
1688 /// "type": [
1689 /// "string",
1690 /// "null"
1691 /// ]
1692 /// }
1693 /// }
1694 ///}
1695 /// ```
1696 /// </details>
1697 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
1698 pub struct Job {
1699 ///The shell command the job runs.
1700 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1701 pub command: ::std::option::Option<::std::string::String>,
1702 ///When the job row was created.
1703 pub created_at: ::chrono::DateTime<::chrono::offset::Utc>,
1704 ///Ids of this job's prerequisite jobs (its DAG in-edges), spanning
1705 /// both `depends_on` and `builds_in` dependency kinds. Empty when the
1706 /// job has no prerequisites.
1707 pub depends_on: ::std::vec::Vec<::uuid::Uuid>,
1708 ///Stable job-level error code, if the job failed.
1709 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1710 pub error_code: ::std::option::Option<::std::string::String>,
1711 ///Human-readable job-level error message, if any.
1712 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1713 pub error_message: ::std::option::Option<::std::string::String>,
1714 ///The command's exit status, once finished.
1715 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1716 pub exit_code: ::std::option::Option<i64>,
1717 ///When the job reached a terminal state.
1718 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1719 pub finished_at: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
1720 ///The job's id.
1721 pub id: ::uuid::Uuid,
1722 ///Human-readable job name.
1723 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1724 pub name: ::std::option::Option<::std::string::String>,
1725 ///The job's retry policy, if any.
1726 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1727 pub retry_policy:
1728 ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
1729 ///The job's soft-fail policy, if any.
1730 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1731 pub soft_fail_policy:
1732 ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
1733 ///Whether the job failed but the build was allowed to continue.
1734 pub soft_failed: bool,
1735 ///When the job started running.
1736 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1737 pub started_at: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
1738 ///The job's FSM state.
1739 pub state: JobState,
1740 ///The job's stable key within the build's DAG.
1741 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1742 pub step_key: ::std::option::Option<::std::string::String>,
1743 }
1744
1745 ///A build's jobs, in DAG creation order.
1746 ///
1747 /// <details><summary>JSON schema</summary>
1748 ///
1749 /// ```json
1750 ///{
1751 /// "title": "JobList",
1752 /// "description": "A build's jobs, in DAG creation order.",
1753 /// "type": "object",
1754 /// "required": [
1755 /// "data"
1756 /// ],
1757 /// "properties": {
1758 /// "data": {
1759 /// "description": "The build's jobs.",
1760 /// "type": "array",
1761 /// "items": {
1762 /// "$ref": "#/components/schemas/Job"
1763 /// }
1764 /// }
1765 /// }
1766 ///}
1767 /// ```
1768 /// </details>
1769 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
1770 pub struct JobList {
1771 ///The build's jobs.
1772 pub data: ::std::vec::Vec<Job>,
1773 }
1774
1775 ///The job's FSM state.
1776 ///
1777 /// <details><summary>JSON schema</summary>
1778 ///
1779 /// ```json
1780 ///{
1781 /// "description": "The job's FSM state.",
1782 /// "type": "string",
1783 /// "enum": [
1784 /// "pending",
1785 /// "scheduled",
1786 /// "assigned",
1787 /// "running",
1788 /// "passed",
1789 /// "failed",
1790 /// "skipped",
1791 /// "canceling",
1792 /// "canceled",
1793 /// "timing_out",
1794 /// "timed_out"
1795 /// ]
1796 ///}
1797 /// ```
1798 /// </details>
1799 #[derive(
1800 :: serde :: Deserialize,
1801 :: serde :: Serialize,
1802 Clone,
1803 Copy,
1804 Debug,
1805 Eq,
1806 Hash,
1807 Ord,
1808 PartialEq,
1809 PartialOrd,
1810 )]
1811 pub enum JobState {
1812 #[serde(rename = "pending")]
1813 Pending,
1814 #[serde(rename = "scheduled")]
1815 Scheduled,
1816 #[serde(rename = "assigned")]
1817 Assigned,
1818 #[serde(rename = "running")]
1819 Running,
1820 #[serde(rename = "passed")]
1821 Passed,
1822 #[serde(rename = "failed")]
1823 Failed,
1824 #[serde(rename = "skipped")]
1825 Skipped,
1826 #[serde(rename = "canceling")]
1827 Canceling,
1828 #[serde(rename = "canceled")]
1829 Canceled,
1830 #[serde(rename = "timing_out")]
1831 TimingOut,
1832 #[serde(rename = "timed_out")]
1833 TimedOut,
1834 }
1835
1836 impl ::std::fmt::Display for JobState {
1837 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1838 match *self {
1839 Self::Pending => f.write_str("pending"),
1840 Self::Scheduled => f.write_str("scheduled"),
1841 Self::Assigned => f.write_str("assigned"),
1842 Self::Running => f.write_str("running"),
1843 Self::Passed => f.write_str("passed"),
1844 Self::Failed => f.write_str("failed"),
1845 Self::Skipped => f.write_str("skipped"),
1846 Self::Canceling => f.write_str("canceling"),
1847 Self::Canceled => f.write_str("canceled"),
1848 Self::TimingOut => f.write_str("timing_out"),
1849 Self::TimedOut => f.write_str("timed_out"),
1850 }
1851 }
1852 }
1853
1854 impl ::std::str::FromStr for JobState {
1855 type Err = self::error::ConversionError;
1856 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1857 match value {
1858 "pending" => Ok(Self::Pending),
1859 "scheduled" => Ok(Self::Scheduled),
1860 "assigned" => Ok(Self::Assigned),
1861 "running" => Ok(Self::Running),
1862 "passed" => Ok(Self::Passed),
1863 "failed" => Ok(Self::Failed),
1864 "skipped" => Ok(Self::Skipped),
1865 "canceling" => Ok(Self::Canceling),
1866 "canceled" => Ok(Self::Canceled),
1867 "timing_out" => Ok(Self::TimingOut),
1868 "timed_out" => Ok(Self::TimedOut),
1869 _ => Err("invalid value".into()),
1870 }
1871 }
1872 }
1873
1874 impl ::std::convert::TryFrom<&str> for JobState {
1875 type Error = self::error::ConversionError;
1876 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1877 value.parse()
1878 }
1879 }
1880
1881 impl ::std::convert::TryFrom<&::std::string::String> for JobState {
1882 type Error = self::error::ConversionError;
1883 fn try_from(
1884 value: &::std::string::String,
1885 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1886 value.parse()
1887 }
1888 }
1889
1890 impl ::std::convert::TryFrom<::std::string::String> for JobState {
1891 type Error = self::error::ConversionError;
1892 fn try_from(
1893 value: ::std::string::String,
1894 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1895 value.parse()
1896 }
1897 }
1898
1899 ///A build-scoped HMAC token the SSE log stream accepts, plus its expiry.
1900 /// Pass the token as the `token` query parameter when opening the log
1901 /// stream.
1902 ///
1903 /// <details><summary>JSON schema</summary>
1904 ///
1905 /// ```json
1906 ///{
1907 /// "title": "LogTokenResponse",
1908 /// "description": "A build-scoped HMAC token the SSE log stream accepts,
1909 /// plus its expiry. Pass the token as the `token` query parameter when
1910 /// opening the log stream.",
1911 /// "type": "object",
1912 /// "required": [
1913 /// "expires_at",
1914 /// "token"
1915 /// ],
1916 /// "properties": {
1917 /// "expires_at": {
1918 /// "description": "When the token expires (~1 hour out).",
1919 /// "type": "string",
1920 /// "format": "date-time"
1921 /// },
1922 /// "token": {
1923 /// "description": "The opaque, build-scoped log token.",
1924 /// "type": "string"
1925 /// }
1926 /// }
1927 ///}
1928 /// ```
1929 /// </details>
1930 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
1931 pub struct LogTokenResponse {
1932 ///When the token expires (~1 hour out).
1933 pub expires_at: ::chrono::DateTime<::chrono::offset::Utc>,
1934 ///The opaque, build-scoped log token.
1935 pub token: ::std::string::String,
1936 }
1937
1938 ///A Harmont organization the authenticated user is a member of.
1939 ///
1940 /// <details><summary>JSON schema</summary>
1941 ///
1942 /// ```json
1943 ///{
1944 /// "title": "Organization",
1945 /// "description": "A Harmont organization the authenticated user is a
1946 /// member of.",
1947 /// "type": "object",
1948 /// "required": [
1949 /// "created_at",
1950 /// "name",
1951 /// "slug"
1952 /// ],
1953 /// "properties": {
1954 /// "created_at": {
1955 /// "description": "When the organization was created.",
1956 /// "type": "string",
1957 /// "format": "date-time"
1958 /// },
1959 /// "name": {
1960 /// "description": "Display name.",
1961 /// "type": "string"
1962 /// },
1963 /// "slug": {
1964 /// "description": "URL-safe unique slug identifying the
1965 /// organization.",
1966 /// "type": "string"
1967 /// },
1968 /// "url": {
1969 /// "description": "The organization's website, if set.",
1970 /// "type": [
1971 /// "string",
1972 /// "null"
1973 /// ]
1974 /// }
1975 /// }
1976 ///}
1977 /// ```
1978 /// </details>
1979 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
1980 pub struct Organization {
1981 ///When the organization was created.
1982 pub created_at: ::chrono::DateTime<::chrono::offset::Utc>,
1983 ///Display name.
1984 pub name: ::std::string::String,
1985 ///URL-safe unique slug identifying the organization.
1986 pub slug: ::std::string::String,
1987 ///The organization's website, if set.
1988 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1989 pub url: ::std::option::Option<::std::string::String>,
1990 }
1991
1992 ///A page of the current user's organizations, with an opaque cursor.
1993 ///
1994 /// <details><summary>JSON schema</summary>
1995 ///
1996 /// ```json
1997 ///{
1998 /// "title": "OrganizationList",
1999 /// "description": "A page of the current user's organizations, with an
2000 /// opaque cursor.",
2001 /// "type": "object",
2002 /// "required": [
2003 /// "data",
2004 /// "next_cursor"
2005 /// ],
2006 /// "properties": {
2007 /// "data": {
2008 /// "description": "The organizations on this page.",
2009 /// "type": "array",
2010 /// "items": {
2011 /// "$ref": "#/components/schemas/Organization"
2012 /// }
2013 /// },
2014 /// "next_cursor": {
2015 /// "description": "Opaque cursor for the next page. Pass it as the
2016 /// `cursor` query parameter; `null` when there are no more pages.",
2017 /// "type": [
2018 /// "string",
2019 /// "null"
2020 /// ]
2021 /// }
2022 /// }
2023 ///}
2024 /// ```
2025 /// </details>
2026 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
2027 pub struct OrganizationList {
2028 ///The organizations on this page.
2029 pub data: ::std::vec::Vec<Organization>,
2030 ///Opaque cursor for the next page. Pass it as the `cursor` query
2031 /// parameter; `null` when there are no more pages.
2032 pub next_cursor: ::std::option::Option<::std::string::String>,
2033 }
2034
2035 ///A WebAuthn credential registered to the current user.
2036 ///
2037 /// <details><summary>JSON schema</summary>
2038 ///
2039 /// ```json
2040 ///{
2041 /// "title": "Passkey",
2042 /// "description": "A WebAuthn credential registered to the current user.",
2043 /// "type": "object",
2044 /// "required": [
2045 /// "created_at",
2046 /// "uuid"
2047 /// ],
2048 /// "properties": {
2049 /// "aaguid": {
2050 /// "description": "The authenticator's AAGUID (model identifier), if
2051 /// reported.",
2052 /// "type": [
2053 /// "string",
2054 /// "null"
2055 /// ]
2056 /// },
2057 /// "created_at": {
2058 /// "description": "When the passkey was registered.",
2059 /// "type": "string",
2060 /// "format": "date-time"
2061 /// },
2062 /// "last_used_at": {
2063 /// "description": "When the passkey was last used to authenticate, if
2064 /// ever.",
2065 /// "type": [
2066 /// "string",
2067 /// "null"
2068 /// ],
2069 /// "format": "date-time"
2070 /// },
2071 /// "nickname": {
2072 /// "description": "Human label for the passkey.",
2073 /// "type": [
2074 /// "string",
2075 /// "null"
2076 /// ]
2077 /// },
2078 /// "uuid": {
2079 /// "description": "Stable passkey id.",
2080 /// "type": "string",
2081 /// "format": "uuid"
2082 /// }
2083 /// }
2084 ///}
2085 /// ```
2086 /// </details>
2087 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
2088 pub struct Passkey {
2089 ///The authenticator's AAGUID (model identifier), if reported.
2090 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2091 pub aaguid: ::std::option::Option<::std::string::String>,
2092 ///When the passkey was registered.
2093 pub created_at: ::chrono::DateTime<::chrono::offset::Utc>,
2094 ///When the passkey was last used to authenticate, if ever.
2095 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2096 pub last_used_at: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
2097 ///Human label for the passkey.
2098 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2099 pub nickname: ::std::option::Option<::std::string::String>,
2100 ///Stable passkey id.
2101 pub uuid: ::uuid::Uuid,
2102 }
2103
2104 ///The server-side challenge id (correlate it on finalize) and the
2105 /// PublicKeyCredential*Options the browser WebAuthn API consumes.
2106 ///
2107 /// <details><summary>JSON schema</summary>
2108 ///
2109 /// ```json
2110 ///{
2111 /// "title": "PasskeyChallengeResponse",
2112 /// "description": "The server-side challenge id (correlate it on finalize) and the PublicKeyCredential*Options the browser WebAuthn API consumes.",
2113 /// "type": "object",
2114 /// "required": [
2115 /// "challenge_id",
2116 /// "options"
2117 /// ],
2118 /// "properties": {
2119 /// "challenge_id": {
2120 /// "description": "Opaque id of the stored, single-use challenge. Echo
2121 /// it back on finalize.",
2122 /// "type": "string",
2123 /// "format": "uuid"
2124 /// },
2125 /// "options": {
2126 /// "description": "The PublicKeyCredentialCreationOptions /
2127 /// RequestOptions for the browser.",
2128 /// "type": "object",
2129 /// "additionalProperties": true
2130 /// }
2131 /// }
2132 ///}
2133 /// ```
2134 /// </details>
2135 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
2136 pub struct PasskeyChallengeResponse {
2137 ///Opaque id of the stored, single-use challenge. Echo it back on
2138 /// finalize.
2139 pub challenge_id: ::uuid::Uuid,
2140 ///The PublicKeyCredentialCreationOptions / RequestOptions for the
2141 /// browser.
2142 pub options: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
2143 }
2144
2145 ///Every passkey registered to the current user.
2146 ///
2147 /// <details><summary>JSON schema</summary>
2148 ///
2149 /// ```json
2150 ///{
2151 /// "title": "PasskeyListResponse",
2152 /// "description": "Every passkey registered to the current user.",
2153 /// "type": "object",
2154 /// "required": [
2155 /// "passkeys"
2156 /// ],
2157 /// "properties": {
2158 /// "passkeys": {
2159 /// "description": "The user's registered passkeys.",
2160 /// "type": "array",
2161 /// "items": {
2162 /// "$ref": "#/components/schemas/Passkey"
2163 /// }
2164 /// }
2165 /// }
2166 ///}
2167 /// ```
2168 /// </details>
2169 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
2170 pub struct PasskeyListResponse {
2171 ///The user's registered passkeys.
2172 pub passkeys: ::std::vec::Vec<Passkey>,
2173 }
2174
2175 ///Completes passkey login by submitting the assertion for the challenge.
2176 ///
2177 /// <details><summary>JSON schema</summary>
2178 ///
2179 /// ```json
2180 ///{
2181 /// "title": "PasskeyLoginFinalizeRequest",
2182 /// "description": "Completes passkey login by submitting the assertion for
2183 /// the challenge.",
2184 /// "type": "object",
2185 /// "required": [
2186 /// "assertion",
2187 /// "challenge_id"
2188 /// ],
2189 /// "properties": {
2190 /// "assertion": {
2191 /// "description": "The WebAuthn assertion response from
2192 /// navigator.credentials.get.",
2193 /// "type": "object",
2194 /// "additionalProperties": true
2195 /// },
2196 /// "challenge_id": {
2197 /// "description": "The challenge id returned by the login-options
2198 /// call.",
2199 /// "type": "string",
2200 /// "format": "uuid"
2201 /// }
2202 /// }
2203 ///}
2204 /// ```
2205 /// </details>
2206 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
2207 pub struct PasskeyLoginFinalizeRequest {
2208 ///The WebAuthn assertion response from navigator.credentials.get.
2209 pub assertion: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
2210 ///The challenge id returned by the login-options call.
2211 pub challenge_id: ::uuid::Uuid,
2212 }
2213
2214 ///Starts a discoverable-credential (passkey) login. No fields required.
2215 ///
2216 /// <details><summary>JSON schema</summary>
2217 ///
2218 /// ```json
2219 ///{
2220 /// "title": "PasskeyLoginOptionsRequest",
2221 /// "description": "Starts a discoverable-credential (passkey) login. No
2222 /// fields required.",
2223 /// "type": "object"
2224 ///}
2225 /// ```
2226 /// </details>
2227 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
2228 #[serde(transparent)]
2229 pub struct PasskeyLoginOptionsRequest(
2230 pub ::serde_json::Map<::std::string::String, ::serde_json::Value>,
2231 );
2232 impl ::std::ops::Deref for PasskeyLoginOptionsRequest {
2233 type Target = ::serde_json::Map<::std::string::String, ::serde_json::Value>;
2234 fn deref(&self) -> &::serde_json::Map<::std::string::String, ::serde_json::Value> {
2235 &self.0
2236 }
2237 }
2238
2239 impl ::std::convert::From<PasskeyLoginOptionsRequest>
2240 for ::serde_json::Map<::std::string::String, ::serde_json::Value>
2241 {
2242 fn from(value: PasskeyLoginOptionsRequest) -> Self {
2243 value.0
2244 }
2245 }
2246
2247 impl ::std::convert::From<::serde_json::Map<::std::string::String, ::serde_json::Value>>
2248 for PasskeyLoginOptionsRequest
2249 {
2250 fn from(value: ::serde_json::Map<::std::string::String, ::serde_json::Value>) -> Self {
2251 Self(value)
2252 }
2253 }
2254
2255 ///Completes adding a passkey by submitting the attestation for the
2256 /// challenge.
2257 ///
2258 /// <details><summary>JSON schema</summary>
2259 ///
2260 /// ```json
2261 ///{
2262 /// "title": "PasskeyRegisterFinalizeRequest",
2263 /// "description": "Completes adding a passkey by submitting the
2264 /// attestation for the challenge.",
2265 /// "type": "object",
2266 /// "required": [
2267 /// "attestation",
2268 /// "challenge_id"
2269 /// ],
2270 /// "properties": {
2271 /// "attestation": {
2272 /// "description": "The WebAuthn attestation response from
2273 /// navigator.credentials.create.",
2274 /// "type": "object",
2275 /// "additionalProperties": true
2276 /// },
2277 /// "challenge_id": {
2278 /// "description": "The challenge id returned by the register-options
2279 /// call.",
2280 /// "type": "string",
2281 /// "format": "uuid"
2282 /// },
2283 /// "nickname": {
2284 /// "description": "Optional human label for the new passkey.",
2285 /// "type": [
2286 /// "string",
2287 /// "null"
2288 /// ]
2289 /// }
2290 /// }
2291 ///}
2292 /// ```
2293 /// </details>
2294 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
2295 pub struct PasskeyRegisterFinalizeRequest {
2296 ///The WebAuthn attestation response from navigator.credentials.create.
2297 pub attestation: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
2298 ///The challenge id returned by the register-options call.
2299 pub challenge_id: ::uuid::Uuid,
2300 ///Optional human label for the new passkey.
2301 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2302 pub nickname: ::std::option::Option<::std::string::String>,
2303 }
2304
2305 ///WebAuthn credential-creation options for adding a passkey to the current
2306 /// user, plus the server-side challenge id to echo back on finalize.
2307 /// `excludeCredentials` lists the user's already-registered authenticators.
2308 ///
2309 /// <details><summary>JSON schema</summary>
2310 ///
2311 /// ```json
2312 ///{
2313 /// "title": "PasskeyRegisterOptionsResponse",
2314 /// "description": "WebAuthn credential-creation options for adding a
2315 /// passkey to the current user, plus the server-side challenge id to echo
2316 /// back on finalize. `excludeCredentials` lists the user's
2317 /// already-registered authenticators.",
2318 /// "type": "object",
2319 /// "required": [
2320 /// "challenge_id",
2321 /// "options"
2322 /// ],
2323 /// "properties": {
2324 /// "challenge_id": {
2325 /// "description": "Opaque id of the stored, single-use challenge. Echo
2326 /// it back on finalize.",
2327 /// "type": "string",
2328 /// "format": "uuid"
2329 /// },
2330 /// "options": {
2331 /// "description": "The PublicKeyCredentialCreationOptions for the
2332 /// browser.",
2333 /// "type": "object",
2334 /// "additionalProperties": true
2335 /// }
2336 /// }
2337 ///}
2338 /// ```
2339 /// </details>
2340 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
2341 pub struct PasskeyRegisterOptionsResponse {
2342 ///Opaque id of the stored, single-use challenge. Echo it back on
2343 /// finalize.
2344 pub challenge_id: ::uuid::Uuid,
2345 ///The PublicKeyCredentialCreationOptions for the browser.
2346 pub options: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
2347 }
2348
2349 ///Starts passkey sign-up: runs the access gate and emails a verification
2350 /// link.
2351 ///
2352 /// <details><summary>JSON schema</summary>
2353 ///
2354 /// ```json
2355 ///{
2356 /// "title": "PasskeySignupBeginRequest",
2357 /// "description": "Starts passkey sign-up: runs the access gate and emails
2358 /// a verification link.",
2359 /// "examples": [
2360 /// {
2361 /// "email": "alice@harmont.dev",
2362 /// "name": "Alice"
2363 /// }
2364 /// ],
2365 /// "type": "object",
2366 /// "required": [
2367 /// "email",
2368 /// "name"
2369 /// ],
2370 /// "properties": {
2371 /// "email": {
2372 /// "description": "The email to sign up with.",
2373 /// "type": "string"
2374 /// },
2375 /// "name": {
2376 /// "description": "The new user's display name.",
2377 /// "type": "string"
2378 /// }
2379 /// }
2380 ///}
2381 /// ```
2382 /// </details>
2383 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
2384 pub struct PasskeySignupBeginRequest {
2385 ///The email to sign up with.
2386 pub email: ::std::string::String,
2387 ///The new user's display name.
2388 pub name: ::std::string::String,
2389 }
2390
2391 ///Completes passkey sign-up by submitting the attestation for the
2392 /// challenge.
2393 ///
2394 /// <details><summary>JSON schema</summary>
2395 ///
2396 /// ```json
2397 ///{
2398 /// "title": "PasskeySignupFinalizeRequest",
2399 /// "description": "Completes passkey sign-up by submitting the attestation
2400 /// for the challenge.",
2401 /// "type": "object",
2402 /// "required": [
2403 /// "attestation",
2404 /// "challenge_id",
2405 /// "verification_token"
2406 /// ],
2407 /// "properties": {
2408 /// "attestation": {
2409 /// "description": "The WebAuthn attestation response from
2410 /// navigator.credentials.create.",
2411 /// "type": "object",
2412 /// "additionalProperties": true
2413 /// },
2414 /// "challenge_id": {
2415 /// "description": "The challenge id returned by the options call.",
2416 /// "type": "string",
2417 /// "format": "uuid"
2418 /// },
2419 /// "verification_token": {
2420 /// "description": "The raw verification token (consumed here).",
2421 /// "type": "string"
2422 /// }
2423 /// }
2424 ///}
2425 /// ```
2426 /// </details>
2427 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
2428 pub struct PasskeySignupFinalizeRequest {
2429 ///The WebAuthn attestation response from navigator.credentials.create.
2430 pub attestation: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
2431 ///The challenge id returned by the options call.
2432 pub challenge_id: ::uuid::Uuid,
2433 ///The raw verification token (consumed here).
2434 pub verification_token: ::std::string::String,
2435 }
2436
2437 ///Exchanges a verification token for WebAuthn credential-creation options.
2438 ///
2439 /// <details><summary>JSON schema</summary>
2440 ///
2441 /// ```json
2442 ///{
2443 /// "title": "PasskeySignupOptionsRequest",
2444 /// "description": "Exchanges a verification token for WebAuthn
2445 /// credential-creation options.",
2446 /// "type": "object",
2447 /// "required": [
2448 /// "verification_token"
2449 /// ],
2450 /// "properties": {
2451 /// "verification_token": {
2452 /// "description": "The raw token from the verification email.",
2453 /// "type": "string"
2454 /// }
2455 /// }
2456 ///}
2457 /// ```
2458 /// </details>
2459 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
2460 pub struct PasskeySignupOptionsRequest {
2461 ///The raw token from the verification email.
2462 pub verification_token: ::std::string::String,
2463 }
2464
2465 ///`PingResponse`
2466 ///
2467 /// <details><summary>JSON schema</summary>
2468 ///
2469 /// ```json
2470 ///{
2471 /// "type": "object",
2472 /// "required": [
2473 /// "status"
2474 /// ],
2475 /// "properties": {
2476 /// "status": {
2477 /// "examples": [
2478 /// "ok"
2479 /// ],
2480 /// "type": "string"
2481 /// }
2482 /// }
2483 ///}
2484 /// ```
2485 /// </details>
2486 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
2487 pub struct PingResponse {
2488 pub status: ::std::string::String,
2489 }
2490
2491 ///A repeatable CI workflow belonging to an organization.
2492 ///
2493 /// <details><summary>JSON schema</summary>
2494 ///
2495 /// ```json
2496 ///{
2497 /// "title": "Pipeline",
2498 /// "description": "A repeatable CI workflow belonging to an
2499 /// organization.",
2500 /// "type": "object",
2501 /// "required": [
2502 /// "allow_manual",
2503 /// "created_at",
2504 /// "default_branch",
2505 /// "name",
2506 /// "repository",
2507 /// "slug",
2508 /// "visibility"
2509 /// ],
2510 /// "properties": {
2511 /// "allow_manual": {
2512 /// "description": "Whether manual (e.g. `hm run`) builds are
2513 /// permitted.",
2514 /// "type": "boolean"
2515 /// },
2516 /// "created_at": {
2517 /// "description": "When the pipeline was created.",
2518 /// "type": "string",
2519 /// "format": "date-time"
2520 /// },
2521 /// "default_branch": {
2522 /// "description": "The branch built by default.",
2523 /// "type": "string"
2524 /// },
2525 /// "description": {
2526 /// "description": "Optional human description.",
2527 /// "type": [
2528 /// "string",
2529 /// "null"
2530 /// ]
2531 /// },
2532 /// "name": {
2533 /// "description": "Display name.",
2534 /// "type": "string"
2535 /// },
2536 /// "repository": {
2537 /// "description": "The source repository this pipeline builds.",
2538 /// "type": "string"
2539 /// },
2540 /// "slug": {
2541 /// "description": "URL-safe slug, unique within the organization.
2542 /// Derived from the name.",
2543 /// "type": "string"
2544 /// },
2545 /// "visibility": {
2546 /// "description": "Whether the pipeline is private or public.",
2547 /// "type": "string",
2548 /// "enum": [
2549 /// "private",
2550 /// "public"
2551 /// ]
2552 /// }
2553 /// }
2554 ///}
2555 /// ```
2556 /// </details>
2557 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
2558 pub struct Pipeline {
2559 ///Whether manual (e.g. `hm run`) builds are permitted.
2560 pub allow_manual: bool,
2561 ///When the pipeline was created.
2562 pub created_at: ::chrono::DateTime<::chrono::offset::Utc>,
2563 ///The branch built by default.
2564 pub default_branch: ::std::string::String,
2565 ///Optional human description.
2566 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2567 pub description: ::std::option::Option<::std::string::String>,
2568 ///Display name.
2569 pub name: ::std::string::String,
2570 ///The source repository this pipeline builds.
2571 pub repository: ::std::string::String,
2572 ///URL-safe slug, unique within the organization. Derived from the
2573 /// name.
2574 pub slug: ::std::string::String,
2575 ///Whether the pipeline is private or public.
2576 pub visibility: PipelineVisibility,
2577 }
2578
2579 ///A page of an organization's pipelines, with an opaque cursor.
2580 ///
2581 /// <details><summary>JSON schema</summary>
2582 ///
2583 /// ```json
2584 ///{
2585 /// "title": "PipelineList",
2586 /// "description": "A page of an organization's pipelines, with an opaque
2587 /// cursor.",
2588 /// "type": "object",
2589 /// "required": [
2590 /// "data",
2591 /// "next_cursor"
2592 /// ],
2593 /// "properties": {
2594 /// "data": {
2595 /// "description": "The pipelines on this page.",
2596 /// "type": "array",
2597 /// "items": {
2598 /// "$ref": "#/components/schemas/Pipeline"
2599 /// }
2600 /// },
2601 /// "next_cursor": {
2602 /// "description": "Opaque cursor for the next page. Pass it as the
2603 /// `cursor` query parameter; `null` when there are no more pages.",
2604 /// "type": [
2605 /// "string",
2606 /// "null"
2607 /// ]
2608 /// }
2609 /// }
2610 ///}
2611 /// ```
2612 /// </details>
2613 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
2614 pub struct PipelineList {
2615 ///The pipelines on this page.
2616 pub data: ::std::vec::Vec<Pipeline>,
2617 ///Opaque cursor for the next page. Pass it as the `cursor` query
2618 /// parameter; `null` when there are no more pages.
2619 pub next_cursor: ::std::option::Option<::std::string::String>,
2620 }
2621
2622 ///Whether the pipeline is private or public.
2623 ///
2624 /// <details><summary>JSON schema</summary>
2625 ///
2626 /// ```json
2627 ///{
2628 /// "description": "Whether the pipeline is private or public.",
2629 /// "type": "string",
2630 /// "enum": [
2631 /// "private",
2632 /// "public"
2633 /// ]
2634 ///}
2635 /// ```
2636 /// </details>
2637 #[derive(
2638 :: serde :: Deserialize,
2639 :: serde :: Serialize,
2640 Clone,
2641 Copy,
2642 Debug,
2643 Eq,
2644 Hash,
2645 Ord,
2646 PartialEq,
2647 PartialOrd,
2648 )]
2649 pub enum PipelineVisibility {
2650 #[serde(rename = "private")]
2651 Private,
2652 #[serde(rename = "public")]
2653 Public,
2654 }
2655
2656 impl ::std::fmt::Display for PipelineVisibility {
2657 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2658 match *self {
2659 Self::Private => f.write_str("private"),
2660 Self::Public => f.write_str("public"),
2661 }
2662 }
2663 }
2664
2665 impl ::std::str::FromStr for PipelineVisibility {
2666 type Err = self::error::ConversionError;
2667 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2668 match value {
2669 "private" => Ok(Self::Private),
2670 "public" => Ok(Self::Public),
2671 _ => Err("invalid value".into()),
2672 }
2673 }
2674 }
2675
2676 impl ::std::convert::TryFrom<&str> for PipelineVisibility {
2677 type Error = self::error::ConversionError;
2678 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2679 value.parse()
2680 }
2681 }
2682
2683 impl ::std::convert::TryFrom<&::std::string::String> for PipelineVisibility {
2684 type Error = self::error::ConversionError;
2685 fn try_from(
2686 value: &::std::string::String,
2687 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2688 value.parse()
2689 }
2690 }
2691
2692 impl ::std::convert::TryFrom<::std::string::String> for PipelineVisibility {
2693 type Error = self::error::ConversionError;
2694 fn try_from(
2695 value: ::std::string::String,
2696 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2697 value.parse()
2698 }
2699 }
2700
2701 ///Starts magic-link account recovery. Always 204 (never leaks account
2702 /// existence).
2703 ///
2704 /// <details><summary>JSON schema</summary>
2705 ///
2706 /// ```json
2707 ///{
2708 /// "title": "RecoverBeginRequest",
2709 /// "description": "Starts magic-link account recovery. Always 204 (never
2710 /// leaks account existence).",
2711 /// "examples": [
2712 /// {
2713 /// "email": "alice@harmont.dev"
2714 /// }
2715 /// ],
2716 /// "type": "object",
2717 /// "required": [
2718 /// "email"
2719 /// ],
2720 /// "properties": {
2721 /// "email": {
2722 /// "description": "The email to recover access for.",
2723 /// "type": "string"
2724 /// }
2725 /// }
2726 ///}
2727 /// ```
2728 /// </details>
2729 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
2730 pub struct RecoverBeginRequest {
2731 ///The email to recover access for.
2732 pub email: ::std::string::String,
2733 }
2734
2735 ///Completes recovery: consumes the magic-link token + challenge, registers
2736 /// a new passkey, and mints a session token.
2737 ///
2738 /// <details><summary>JSON schema</summary>
2739 ///
2740 /// ```json
2741 ///{
2742 /// "title": "RecoverFinalizeRequest",
2743 /// "description": "Completes recovery: consumes the magic-link token +
2744 /// challenge, registers a new passkey, and mints a session token.",
2745 /// "type": "object",
2746 /// "required": [
2747 /// "attestation",
2748 /// "challenge_id",
2749 /// "magic_link_token"
2750 /// ],
2751 /// "properties": {
2752 /// "attestation": {
2753 /// "description": "The WebAuthn attestation response from
2754 /// navigator.credentials.create.",
2755 /// "type": "object",
2756 /// "additionalProperties": true
2757 /// },
2758 /// "challenge_id": {
2759 /// "description": "The challenge id returned by the recover-options
2760 /// call.",
2761 /// "type": "string",
2762 /// "format": "uuid"
2763 /// },
2764 /// "magic_link_token": {
2765 /// "description": "The raw recovery token (consumed here).",
2766 /// "type": "string"
2767 /// }
2768 /// }
2769 ///}
2770 /// ```
2771 /// </details>
2772 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
2773 pub struct RecoverFinalizeRequest {
2774 ///The WebAuthn attestation response from navigator.credentials.create.
2775 pub attestation: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
2776 ///The challenge id returned by the recover-options call.
2777 pub challenge_id: ::uuid::Uuid,
2778 ///The raw recovery token (consumed here).
2779 pub magic_link_token: ::std::string::String,
2780 }
2781
2782 ///Validates a magic-link token (without consuming it) and returns WebAuthn
2783 /// credential-creation options to enroll a fresh passkey.
2784 ///
2785 /// <details><summary>JSON schema</summary>
2786 ///
2787 /// ```json
2788 ///{
2789 /// "title": "RecoverOptionsRequest",
2790 /// "description": "Validates a magic-link token (without consuming it) and
2791 /// returns WebAuthn credential-creation options to enroll a fresh
2792 /// passkey.",
2793 /// "type": "object",
2794 /// "required": [
2795 /// "magic_link_token"
2796 /// ],
2797 /// "properties": {
2798 /// "magic_link_token": {
2799 /// "description": "The raw token from the recovery email.",
2800 /// "type": "string"
2801 /// }
2802 /// }
2803 ///}
2804 /// ```
2805 /// </details>
2806 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
2807 pub struct RecoverOptionsRequest {
2808 ///The raw token from the recovery email.
2809 pub magic_link_token: ::std::string::String,
2810 }
2811
2812 ///Redeems a coupon for the organization identified by the path. The org is
2813 /// taken from the route (`:org`); the body carries only the coupon code.
2814 ///
2815 /// <details><summary>JSON schema</summary>
2816 ///
2817 /// ```json
2818 ///{
2819 /// "title": "RedeemCouponRequest",
2820 /// "description": "Redeems a coupon for the organization identified by the
2821 /// path. The org is taken from the route (`:org`); the body carries only
2822 /// the coupon code.",
2823 /// "type": "object",
2824 /// "required": [
2825 /// "code"
2826 /// ],
2827 /// "properties": {
2828 /// "code": {
2829 /// "description": "The coupon code to redeem.",
2830 /// "type": "string"
2831 /// }
2832 /// }
2833 ///}
2834 /// ```
2835 /// </details>
2836 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
2837 pub struct RedeemCouponRequest {
2838 ///The coupon code to redeem.
2839 pub code: ::std::string::String,
2840 }
2841
2842 ///The credit granted by the coupon and the organization's resulting
2843 /// balance, both in cents.
2844 ///
2845 /// <details><summary>JSON schema</summary>
2846 ///
2847 /// ```json
2848 ///{
2849 /// "title": "RedeemCouponResponse",
2850 /// "description": "The credit granted by the coupon and the organization's
2851 /// resulting balance, both in cents.",
2852 /// "type": "object",
2853 /// "required": [
2854 /// "balance_cents",
2855 /// "credit_cents"
2856 /// ],
2857 /// "properties": {
2858 /// "balance_cents": {
2859 /// "description": "The organization's balance after the credit, in
2860 /// cents.",
2861 /// "type": "integer"
2862 /// },
2863 /// "credit_cents": {
2864 /// "description": "The credit granted by the coupon, in cents.",
2865 /// "type": "integer"
2866 /// }
2867 /// }
2868 ///}
2869 /// ```
2870 /// </details>
2871 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
2872 pub struct RedeemCouponResponse {
2873 ///The organization's balance after the credit, in cents.
2874 pub balance_cents: i64,
2875 ///The credit granted by the coupon, in cents.
2876 pub credit_cents: i64,
2877 }
2878
2879 ///Acknowledges that a Stripe webhook event verified and was recorded
2880 /// (idempotently). Returned for any verified event — handled or not — so
2881 /// Stripe stops retrying.
2882 ///
2883 /// <details><summary>JSON schema</summary>
2884 ///
2885 /// ```json
2886 ///{
2887 /// "title": "StripeWebhookResponse",
2888 /// "description": "Acknowledges that a Stripe webhook event verified and
2889 /// was recorded (idempotently). Returned for any verified event — handled
2890 /// or not — so Stripe stops retrying.",
2891 /// "type": "object",
2892 /// "required": [
2893 /// "status"
2894 /// ],
2895 /// "properties": {
2896 /// "status": {
2897 /// "description": "Always `\"ok\"` on a verified, recorded event.",
2898 /// "type": "string",
2899 /// "enum": [
2900 /// "ok"
2901 /// ]
2902 /// }
2903 /// }
2904 ///}
2905 /// ```
2906 /// </details>
2907 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
2908 pub struct StripeWebhookResponse {
2909 ///Always `"ok"` on a verified, recorded event.
2910 pub status: StripeWebhookResponseStatus,
2911 }
2912
2913 ///Always `"ok"` on a verified, recorded event.
2914 ///
2915 /// <details><summary>JSON schema</summary>
2916 ///
2917 /// ```json
2918 ///{
2919 /// "description": "Always `\"ok\"` on a verified, recorded event.",
2920 /// "type": "string",
2921 /// "enum": [
2922 /// "ok"
2923 /// ]
2924 ///}
2925 /// ```
2926 /// </details>
2927 #[derive(
2928 :: serde :: Deserialize,
2929 :: serde :: Serialize,
2930 Clone,
2931 Copy,
2932 Debug,
2933 Eq,
2934 Hash,
2935 Ord,
2936 PartialEq,
2937 PartialOrd,
2938 )]
2939 pub enum StripeWebhookResponseStatus {
2940 #[serde(rename = "ok")]
2941 Ok,
2942 }
2943
2944 impl ::std::fmt::Display for StripeWebhookResponseStatus {
2945 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2946 match *self {
2947 Self::Ok => f.write_str("ok"),
2948 }
2949 }
2950 }
2951
2952 impl ::std::str::FromStr for StripeWebhookResponseStatus {
2953 type Err = self::error::ConversionError;
2954 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2955 match value {
2956 "ok" => Ok(Self::Ok),
2957 _ => Err("invalid value".into()),
2958 }
2959 }
2960 }
2961
2962 impl ::std::convert::TryFrom<&str> for StripeWebhookResponseStatus {
2963 type Error = self::error::ConversionError;
2964 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2965 value.parse()
2966 }
2967 }
2968
2969 impl ::std::convert::TryFrom<&::std::string::String> for StripeWebhookResponseStatus {
2970 type Error = self::error::ConversionError;
2971 fn try_from(
2972 value: &::std::string::String,
2973 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2974 value.parse()
2975 }
2976 }
2977
2978 impl ::std::convert::TryFrom<::std::string::String> for StripeWebhookResponseStatus {
2979 type Error = self::error::ConversionError;
2980 fn try_from(
2981 value: ::std::string::String,
2982 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2983 value.parse()
2984 }
2985 }
2986
2987 ///A freshly minted session bearer token.
2988 ///
2989 /// <details><summary>JSON schema</summary>
2990 ///
2991 /// ```json
2992 ///{
2993 /// "title": "TokenResponse",
2994 /// "description": "A freshly minted session bearer token.",
2995 /// "type": "object",
2996 /// "required": [
2997 /// "token"
2998 /// ],
2999 /// "properties": {
3000 /// "token": {
3001 /// "description": "The raw session bearer token. Send it as
3002 /// `Authorization: Bearer <token>`.",
3003 /// "type": "string"
3004 /// }
3005 /// }
3006 ///}
3007 /// ```
3008 /// </details>
3009 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
3010 pub struct TokenResponse {
3011 ///The raw session bearer token. Send it as `Authorization: Bearer
3012 /// <token>`.
3013 pub token: ::std::string::String,
3014 }
3015
3016 ///One append-only ledger entry — a credit (positive) or debit (negative).
3017 ///
3018 /// <details><summary>JSON schema</summary>
3019 ///
3020 /// ```json
3021 ///{
3022 /// "title": "Transaction",
3023 /// "description": "One append-only ledger entry — a credit (positive) or
3024 /// debit (negative).",
3025 /// "type": "object",
3026 /// "required": [
3027 /// "amount_cents",
3028 /// "created_at",
3029 /// "id",
3030 /// "source"
3031 /// ],
3032 /// "properties": {
3033 /// "amount_cents": {
3034 /// "description": "Signed amount in cents: positive for credits,
3035 /// negative for debits.",
3036 /// "type": "integer"
3037 /// },
3038 /// "created_at": {
3039 /// "description": "When the entry was recorded.",
3040 /// "type": "string",
3041 /// "format": "date-time"
3042 /// },
3043 /// "description": {
3044 /// "description": "Optional human-readable note.",
3045 /// "type": [
3046 /// "string",
3047 /// "null"
3048 /// ]
3049 /// },
3050 /// "id": {
3051 /// "description": "The entry's id.",
3052 /// "type": "string",
3053 /// "format": "uuid"
3054 /// },
3055 /// "source": {
3056 /// "description": "What produced the entry.",
3057 /// "type": "string",
3058 /// "enum": [
3059 /// "stripe_topup",
3060 /// "coupon_redemption",
3061 /// "admin_grant",
3062 /// "vm_lease_debit",
3063 /// "refund"
3064 /// ]
3065 /// }
3066 /// }
3067 ///}
3068 /// ```
3069 /// </details>
3070 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
3071 pub struct Transaction {
3072 ///Signed amount in cents: positive for credits, negative for debits.
3073 pub amount_cents: i64,
3074 ///When the entry was recorded.
3075 pub created_at: ::chrono::DateTime<::chrono::offset::Utc>,
3076 ///Optional human-readable note.
3077 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3078 pub description: ::std::option::Option<::std::string::String>,
3079 ///The entry's id.
3080 pub id: ::uuid::Uuid,
3081 ///What produced the entry.
3082 pub source: TransactionSource,
3083 }
3084
3085 ///A page of an organization's ledger entries (newest first), with an
3086 /// opaque cursor.
3087 ///
3088 /// <details><summary>JSON schema</summary>
3089 ///
3090 /// ```json
3091 ///{
3092 /// "title": "TransactionList",
3093 /// "description": "A page of an organization's ledger entries (newest
3094 /// first), with an opaque cursor.",
3095 /// "type": "object",
3096 /// "required": [
3097 /// "data",
3098 /// "next_cursor"
3099 /// ],
3100 /// "properties": {
3101 /// "data": {
3102 /// "description": "The ledger entries on this page, newest first.",
3103 /// "type": "array",
3104 /// "items": {
3105 /// "$ref": "#/components/schemas/Transaction"
3106 /// }
3107 /// },
3108 /// "next_cursor": {
3109 /// "description": "Opaque cursor for the next page. Pass it as the
3110 /// `cursor` query parameter; `null` when there are no more pages.",
3111 /// "type": [
3112 /// "string",
3113 /// "null"
3114 /// ]
3115 /// }
3116 /// }
3117 ///}
3118 /// ```
3119 /// </details>
3120 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
3121 pub struct TransactionList {
3122 ///The ledger entries on this page, newest first.
3123 pub data: ::std::vec::Vec<Transaction>,
3124 ///Opaque cursor for the next page. Pass it as the `cursor` query
3125 /// parameter; `null` when there are no more pages.
3126 pub next_cursor: ::std::option::Option<::std::string::String>,
3127 }
3128
3129 ///What produced the entry.
3130 ///
3131 /// <details><summary>JSON schema</summary>
3132 ///
3133 /// ```json
3134 ///{
3135 /// "description": "What produced the entry.",
3136 /// "type": "string",
3137 /// "enum": [
3138 /// "stripe_topup",
3139 /// "coupon_redemption",
3140 /// "admin_grant",
3141 /// "vm_lease_debit",
3142 /// "refund"
3143 /// ]
3144 ///}
3145 /// ```
3146 /// </details>
3147 #[derive(
3148 :: serde :: Deserialize,
3149 :: serde :: Serialize,
3150 Clone,
3151 Copy,
3152 Debug,
3153 Eq,
3154 Hash,
3155 Ord,
3156 PartialEq,
3157 PartialOrd,
3158 )]
3159 pub enum TransactionSource {
3160 #[serde(rename = "stripe_topup")]
3161 StripeTopup,
3162 #[serde(rename = "coupon_redemption")]
3163 CouponRedemption,
3164 #[serde(rename = "admin_grant")]
3165 AdminGrant,
3166 #[serde(rename = "vm_lease_debit")]
3167 VmLeaseDebit,
3168 #[serde(rename = "refund")]
3169 Refund,
3170 }
3171
3172 impl ::std::fmt::Display for TransactionSource {
3173 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3174 match *self {
3175 Self::StripeTopup => f.write_str("stripe_topup"),
3176 Self::CouponRedemption => f.write_str("coupon_redemption"),
3177 Self::AdminGrant => f.write_str("admin_grant"),
3178 Self::VmLeaseDebit => f.write_str("vm_lease_debit"),
3179 Self::Refund => f.write_str("refund"),
3180 }
3181 }
3182 }
3183
3184 impl ::std::str::FromStr for TransactionSource {
3185 type Err = self::error::ConversionError;
3186 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3187 match value {
3188 "stripe_topup" => Ok(Self::StripeTopup),
3189 "coupon_redemption" => Ok(Self::CouponRedemption),
3190 "admin_grant" => Ok(Self::AdminGrant),
3191 "vm_lease_debit" => Ok(Self::VmLeaseDebit),
3192 "refund" => Ok(Self::Refund),
3193 _ => Err("invalid value".into()),
3194 }
3195 }
3196 }
3197
3198 impl ::std::convert::TryFrom<&str> for TransactionSource {
3199 type Error = self::error::ConversionError;
3200 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3201 value.parse()
3202 }
3203 }
3204
3205 impl ::std::convert::TryFrom<&::std::string::String> for TransactionSource {
3206 type Error = self::error::ConversionError;
3207 fn try_from(
3208 value: &::std::string::String,
3209 ) -> ::std::result::Result<Self, self::error::ConversionError> {
3210 value.parse()
3211 }
3212 }
3213
3214 impl ::std::convert::TryFrom<::std::string::String> for TransactionSource {
3215 type Error = self::error::ConversionError;
3216 fn try_from(
3217 value: ::std::string::String,
3218 ) -> ::std::result::Result<Self, self::error::ConversionError> {
3219 value.parse()
3220 }
3221 }
3222
3223 ///Aggregated VM-lease usage for an organization over the requested `[from,
3224 /// to)` window: resource-seconds per dimension and the total billed cost in
3225 /// cents.
3226 ///
3227 /// <details><summary>JSON schema</summary>
3228 ///
3229 /// ```json
3230 ///{
3231 /// "title": "UsageResponse",
3232 /// "description": "Aggregated VM-lease usage for an organization over the
3233 /// requested `[from, to)` window: resource-seconds per dimension and the
3234 /// total billed cost in cents.",
3235 /// "type": "object",
3236 /// "required": [
3237 /// "cpu_seconds",
3238 /// "disk_gb_seconds",
3239 /// "memory_gb_seconds",
3240 /// "total_cents"
3241 /// ],
3242 /// "properties": {
3243 /// "cpu_seconds": {
3244 /// "description": "Σ (cpu_count × duration_seconds) over leases in the
3245 /// window.",
3246 /// "type": "integer"
3247 /// },
3248 /// "disk_gb_seconds": {
3249 /// "description": "Σ (disk_gb × duration_seconds) over leases in the
3250 /// window.",
3251 /// "type": "integer"
3252 /// },
3253 /// "memory_gb_seconds": {
3254 /// "description": "Σ (memory_gb × duration_seconds) over leases in the
3255 /// window.",
3256 /// "type": "integer"
3257 /// },
3258 /// "total_cents": {
3259 /// "description": "Σ rate-card cost of the leases in the window, in
3260 /// cents.",
3261 /// "type": "integer"
3262 /// }
3263 /// }
3264 ///}
3265 /// ```
3266 /// </details>
3267 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
3268 pub struct UsageResponse {
3269 ///Σ (cpu_count × duration_seconds) over leases in the window.
3270 pub cpu_seconds: i64,
3271 ///Σ (disk_gb × duration_seconds) over leases in the window.
3272 pub disk_gb_seconds: i64,
3273 ///Σ (memory_gb × duration_seconds) over leases in the window.
3274 pub memory_gb_seconds: i64,
3275 ///Σ rate-card cost of the leases in the window, in cents.
3276 pub total_cents: i64,
3277 }
3278
3279 ///The authenticated Harmont user.
3280 ///
3281 /// <details><summary>JSON schema</summary>
3282 ///
3283 /// ```json
3284 ///{
3285 /// "title": "User",
3286 /// "description": "The authenticated Harmont user.",
3287 /// "type": "object",
3288 /// "required": [
3289 /// "email",
3290 /// "uuid"
3291 /// ],
3292 /// "properties": {
3293 /// "email": {
3294 /// "description": "The user's email address.",
3295 /// "type": "string"
3296 /// },
3297 /// "name": {
3298 /// "description": "Display name.",
3299 /// "type": [
3300 /// "string",
3301 /// "null"
3302 /// ]
3303 /// },
3304 /// "uuid": {
3305 /// "description": "Stable user id.",
3306 /// "type": "string",
3307 /// "format": "uuid"
3308 /// }
3309 /// }
3310 ///}
3311 /// ```
3312 /// </details>
3313 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
3314 pub struct User {
3315 ///The user's email address.
3316 pub email: ::std::string::String,
3317 ///Display name.
3318 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3319 pub name: ::std::option::Option<::std::string::String>,
3320 ///Stable user id.
3321 pub uuid: ::uuid::Uuid,
3322 }
3323
3324 ///Updates the current user's editable profile fields.
3325 ///
3326 /// <details><summary>JSON schema</summary>
3327 ///
3328 /// ```json
3329 ///{
3330 /// "title": "UserUpdateRequest",
3331 /// "description": "Updates the current user's editable profile fields.",
3332 /// "examples": [
3333 /// {
3334 /// "name": "Ada Lovelace"
3335 /// }
3336 /// ],
3337 /// "type": "object",
3338 /// "required": [
3339 /// "name"
3340 /// ],
3341 /// "properties": {
3342 /// "name": {
3343 /// "description": "New display name.",
3344 /// "type": "string",
3345 /// "maxLength": 255,
3346 /// "minLength": 1
3347 /// }
3348 /// }
3349 ///}
3350 /// ```
3351 /// </details>
3352 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
3353 pub struct UserUpdateRequest {
3354 ///New display name.
3355 pub name: UserUpdateRequestName,
3356 }
3357
3358 ///New display name.
3359 ///
3360 /// <details><summary>JSON schema</summary>
3361 ///
3362 /// ```json
3363 ///{
3364 /// "description": "New display name.",
3365 /// "type": "string",
3366 /// "maxLength": 255,
3367 /// "minLength": 1
3368 ///}
3369 /// ```
3370 /// </details>
3371 #[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3372 #[serde(transparent)]
3373 pub struct UserUpdateRequestName(::std::string::String);
3374 impl ::std::ops::Deref for UserUpdateRequestName {
3375 type Target = ::std::string::String;
3376 fn deref(&self) -> &::std::string::String {
3377 &self.0
3378 }
3379 }
3380
3381 impl ::std::convert::From<UserUpdateRequestName> for ::std::string::String {
3382 fn from(value: UserUpdateRequestName) -> Self {
3383 value.0
3384 }
3385 }
3386
3387 impl ::std::str::FromStr for UserUpdateRequestName {
3388 type Err = self::error::ConversionError;
3389 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3390 if value.chars().count() > 255usize {
3391 return Err("longer than 255 characters".into());
3392 }
3393 if value.chars().count() < 1usize {
3394 return Err("shorter than 1 characters".into());
3395 }
3396 Ok(Self(value.to_string()))
3397 }
3398 }
3399
3400 impl ::std::convert::TryFrom<&str> for UserUpdateRequestName {
3401 type Error = self::error::ConversionError;
3402 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3403 value.parse()
3404 }
3405 }
3406
3407 impl ::std::convert::TryFrom<&::std::string::String> for UserUpdateRequestName {
3408 type Error = self::error::ConversionError;
3409 fn try_from(
3410 value: &::std::string::String,
3411 ) -> ::std::result::Result<Self, self::error::ConversionError> {
3412 value.parse()
3413 }
3414 }
3415
3416 impl ::std::convert::TryFrom<::std::string::String> for UserUpdateRequestName {
3417 type Error = self::error::ConversionError;
3418 fn try_from(
3419 value: ::std::string::String,
3420 ) -> ::std::result::Result<Self, self::error::ConversionError> {
3421 value.parse()
3422 }
3423 }
3424
3425 impl<'de> ::serde::Deserialize<'de> for UserUpdateRequestName {
3426 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
3427 where
3428 D: ::serde::Deserializer<'de>,
3429 {
3430 ::std::string::String::deserialize(deserializer)?
3431 .parse()
3432 .map_err(|e: self::error::ConversionError| {
3433 <D::Error as ::serde::de::Error>::custom(e.to_string())
3434 })
3435 }
3436 }
3437}
3438
3439#[derive(Clone, Debug)]
3440///Client for Harmont API
3441///
3442///Harmont's user-facing REST authentication API.
3443///
3444///Version: 0
3445pub struct Client {
3446 pub(crate) baseurl: String,
3447 pub(crate) client: reqwest::Client,
3448}
3449
3450impl Client {
3451 /// Create a new client.
3452 ///
3453 /// `baseurl` is the base URL provided to the internal
3454 /// `reqwest::Client`, and should include a scheme and hostname,
3455 /// as well as port and a path stem if applicable.
3456 pub fn new(baseurl: &str) -> Self {
3457 #[cfg(not(target_arch = "wasm32"))]
3458 let client = {
3459 let dur = ::std::time::Duration::from_secs(15u64);
3460 reqwest::ClientBuilder::new()
3461 .connect_timeout(dur)
3462 .timeout(dur)
3463 };
3464 #[cfg(target_arch = "wasm32")]
3465 let client = reqwest::ClientBuilder::new();
3466 Self::new_with_client(baseurl, client.build().unwrap())
3467 }
3468
3469 /// Construct a new client with an existing `reqwest::Client`,
3470 /// allowing more control over its configuration.
3471 ///
3472 /// `baseurl` is the base URL provided to the internal
3473 /// `reqwest::Client`, and should include a scheme and hostname,
3474 /// as well as port and a path stem if applicable.
3475 pub fn new_with_client(baseurl: &str, client: reqwest::Client) -> Self {
3476 Self {
3477 baseurl: baseurl.to_string(),
3478 client,
3479 }
3480 }
3481}
3482
3483impl ClientInfo<()> for Client {
3484 fn api_version() -> &'static str {
3485 "0"
3486 }
3487
3488 fn baseurl(&self) -> &str {
3489 self.baseurl.as_str()
3490 }
3491
3492 fn client(&self) -> &reqwest::Client {
3493 &self.client
3494 }
3495
3496 fn inner(&self) -> &() {
3497 &()
3498 }
3499}
3500
3501impl ClientHooks<()> for &Client {}
3502#[allow(clippy::all)]
3503impl Client {
3504 ///Finalize account recovery
3505 ///
3506 ///Consumes the magic link + challenge, registers a fresh passkey, and
3507 /// returns a session token.
3508 ///
3509 ///Sends a `POST` request to `/api/v0/auth/recover/finalize`
3510 ///
3511 ///Arguments:
3512 /// - `body`: Finalize request
3513 pub async fn recover_finalize<'a>(
3514 &'a self,
3515 body: &'a types::RecoverFinalizeRequest,
3516 ) -> Result<ResponseValue<types::AuthTokenResponse>, Error<types::Error>> {
3517 let url = format!("{}/api/v0/auth/recover/finalize", self.baseurl,);
3518 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
3519 header_map.append(
3520 ::reqwest::header::HeaderName::from_static("api-version"),
3521 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
3522 );
3523 #[allow(unused_mut)]
3524 let mut request = self
3525 .client
3526 .post(url)
3527 .header(
3528 ::reqwest::header::ACCEPT,
3529 ::reqwest::header::HeaderValue::from_static("application/json"),
3530 )
3531 .json(&body)
3532 .headers(header_map)
3533 .build()?;
3534 let info = OperationInfo {
3535 operation_id: "recover_finalize",
3536 };
3537 self.pre(&mut request, &info).await?;
3538 let result = self.exec(request, &info).await;
3539 self.post(&result, &info).await?;
3540 let response = result?;
3541 match response.status().as_u16() {
3542 200u16 => ResponseValue::from_response(response).await,
3543 400u16 => Err(Error::ErrorResponse(
3544 ResponseValue::from_response(response).await?,
3545 )),
3546 _ => Err(Error::UnexpectedResponse(response)),
3547 }
3548 }
3549
3550 ///Disconnect a GitHub installation from the organization
3551 ///
3552 ///Unbinds the installation (by GitHub numeric id) from this organization.
3553 /// Idempotent: a 204 is returned whether or not the installation was bound
3554 /// to this organization.
3555 ///
3556 ///Sends a `DELETE` request to
3557 /// `/api/v0/organizations/{org}/github/installations/{id}`
3558 ///
3559 ///Arguments:
3560 /// - `org`: The organization slug.
3561 /// - `id`: The GitHub numeric installation id.
3562 pub async fn disconnect_github_installation<'a>(
3563 &'a self,
3564 org: &'a str,
3565 id: i64,
3566 ) -> Result<ResponseValue<()>, Error<types::Error>> {
3567 let url = format!(
3568 "{}/api/v0/organizations/{}/github/installations/{}",
3569 self.baseurl,
3570 encode_path(&org.to_string()),
3571 encode_path(&id.to_string()),
3572 );
3573 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
3574 header_map.append(
3575 ::reqwest::header::HeaderName::from_static("api-version"),
3576 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
3577 );
3578 #[allow(unused_mut)]
3579 let mut request = self
3580 .client
3581 .delete(url)
3582 .header(
3583 ::reqwest::header::ACCEPT,
3584 ::reqwest::header::HeaderValue::from_static("application/json"),
3585 )
3586 .headers(header_map)
3587 .build()?;
3588 let info = OperationInfo {
3589 operation_id: "disconnect_github_installation",
3590 };
3591 self.pre(&mut request, &info).await?;
3592 let result = self.exec(request, &info).await;
3593 self.post(&result, &info).await?;
3594 let response = result?;
3595 match response.status().as_u16() {
3596 204u16 => Ok(ResponseValue::empty(response)),
3597 404u16 => Err(Error::ErrorResponse(
3598 ResponseValue::from_response(response).await?,
3599 )),
3600 _ => Err(Error::UnexpectedResponse(response)),
3601 }
3602 }
3603
3604 ///Claim a transferred session token (CLI loopback poll)
3605 ///
3606 ///The CLI polls with the nonce it generated; on a match within the 60s
3607 /// window it receives the raw session token (single-use).
3608 ///
3609 ///Sends a `POST` request to `/api/v0/auth/cli/claim`
3610 ///
3611 ///Arguments:
3612 /// - `body`: Claim request
3613 pub async fn cli_claim<'a>(
3614 &'a self,
3615 body: &'a types::CliClaimRequest,
3616 ) -> Result<ResponseValue<types::CliTokenResponse>, Error<types::Error>> {
3617 let url = format!("{}/api/v0/auth/cli/claim", self.baseurl,);
3618 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
3619 header_map.append(
3620 ::reqwest::header::HeaderName::from_static("api-version"),
3621 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
3622 );
3623 #[allow(unused_mut)]
3624 let mut request = self
3625 .client
3626 .post(url)
3627 .header(
3628 ::reqwest::header::ACCEPT,
3629 ::reqwest::header::HeaderValue::from_static("application/json"),
3630 )
3631 .json(&body)
3632 .headers(header_map)
3633 .build()?;
3634 let info = OperationInfo {
3635 operation_id: "cli_claim",
3636 };
3637 self.pre(&mut request, &info).await?;
3638 let result = self.exec(request, &info).await;
3639 self.post(&result, &info).await?;
3640 let response = result?;
3641 match response.status().as_u16() {
3642 200u16 => ResponseValue::from_response(response).await,
3643 400u16 => Err(Error::ErrorResponse(
3644 ResponseValue::from_response(response).await?,
3645 )),
3646 _ => Err(Error::UnexpectedResponse(response)),
3647 }
3648 }
3649
3650 ///List a build's jobs
3651 ///
3652 ///Returns the build's jobs in DAG creation order.
3653 ///
3654 ///Sends a `GET` request to
3655 /// `/api/v0/organizations/{org}/pipelines/{pipeline}/builds/{number}/jobs`
3656 ///
3657 ///Arguments:
3658 /// - `org`: The organization slug.
3659 /// - `pipeline`: The pipeline slug.
3660 /// - `number`: The build number.
3661 pub async fn list_jobs<'a>(
3662 &'a self,
3663 org: &'a str,
3664 pipeline: &'a str,
3665 number: i64,
3666 ) -> Result<ResponseValue<types::JobList>, Error<types::Error>> {
3667 let url = format!(
3668 "{}/api/v0/organizations/{}/pipelines/{}/builds/{}/jobs",
3669 self.baseurl,
3670 encode_path(&org.to_string()),
3671 encode_path(&pipeline.to_string()),
3672 encode_path(&number.to_string()),
3673 );
3674 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
3675 header_map.append(
3676 ::reqwest::header::HeaderName::from_static("api-version"),
3677 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
3678 );
3679 #[allow(unused_mut)]
3680 let mut request = self
3681 .client
3682 .get(url)
3683 .header(
3684 ::reqwest::header::ACCEPT,
3685 ::reqwest::header::HeaderValue::from_static("application/json"),
3686 )
3687 .headers(header_map)
3688 .build()?;
3689 let info = OperationInfo {
3690 operation_id: "list_jobs",
3691 };
3692 self.pre(&mut request, &info).await?;
3693 let result = self.exec(request, &info).await;
3694 self.post(&result, &info).await?;
3695 let response = result?;
3696 match response.status().as_u16() {
3697 200u16 => ResponseValue::from_response(response).await,
3698 404u16 => Err(Error::ErrorResponse(
3699 ResponseValue::from_response(response).await?,
3700 )),
3701 _ => Err(Error::UnexpectedResponse(response)),
3702 }
3703 }
3704
3705 ///List the current user's passkeys
3706 ///
3707 ///Sends a `GET` request to `/api/v0/user/passkeys`
3708 pub async fn list_passkeys<'a>(
3709 &'a self,
3710 ) -> Result<ResponseValue<types::PasskeyListResponse>, Error<()>> {
3711 let url = format!("{}/api/v0/user/passkeys", self.baseurl,);
3712 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
3713 header_map.append(
3714 ::reqwest::header::HeaderName::from_static("api-version"),
3715 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
3716 );
3717 #[allow(unused_mut)]
3718 let mut request = self
3719 .client
3720 .get(url)
3721 .header(
3722 ::reqwest::header::ACCEPT,
3723 ::reqwest::header::HeaderValue::from_static("application/json"),
3724 )
3725 .headers(header_map)
3726 .build()?;
3727 let info = OperationInfo {
3728 operation_id: "list_passkeys",
3729 };
3730 self.pre(&mut request, &info).await?;
3731 let result = self.exec(request, &info).await;
3732 self.post(&result, &info).await?;
3733 let response = result?;
3734 match response.status().as_u16() {
3735 200u16 => ResponseValue::from_response(response).await,
3736 _ => Err(Error::UnexpectedResponse(response)),
3737 }
3738 }
3739
3740 ///Finalize passkey login
3741 ///
3742 ///Verifies the assertion against the resolved credential, advances the
3743 /// sign-counter, and returns a session token.
3744 ///
3745 ///Sends a `POST` request to `/api/v0/auth/passkey/login/finalize`
3746 ///
3747 ///Arguments:
3748 /// - `body`: Login finalize request
3749 pub async fn passkey_login_finalize<'a>(
3750 &'a self,
3751 body: &'a types::PasskeyLoginFinalizeRequest,
3752 ) -> Result<ResponseValue<types::TokenResponse>, Error<types::Error>> {
3753 let url = format!("{}/api/v0/auth/passkey/login/finalize", self.baseurl,);
3754 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
3755 header_map.append(
3756 ::reqwest::header::HeaderName::from_static("api-version"),
3757 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
3758 );
3759 #[allow(unused_mut)]
3760 let mut request = self
3761 .client
3762 .post(url)
3763 .header(
3764 ::reqwest::header::ACCEPT,
3765 ::reqwest::header::HeaderValue::from_static("application/json"),
3766 )
3767 .json(&body)
3768 .headers(header_map)
3769 .build()?;
3770 let info = OperationInfo {
3771 operation_id: "passkey_login_finalize",
3772 };
3773 self.pre(&mut request, &info).await?;
3774 let result = self.exec(request, &info).await;
3775 self.post(&result, &info).await?;
3776 let response = result?;
3777 match response.status().as_u16() {
3778 200u16 => ResponseValue::from_response(response).await,
3779 400u16 => Err(Error::ErrorResponse(
3780 ResponseValue::from_response(response).await?,
3781 )),
3782 _ => Err(Error::UnexpectedResponse(response)),
3783 }
3784 }
3785
3786 ///Serve a build's source archive (runner-token auth)
3787 ///
3788 ///Streams the gzipped source tarball uploaded for a build to the in-VM
3789 /// sandbox/agent. Authenticated with the build's runner token via
3790 /// `Authorization: Bearer <runner_token>` (NOT a session bearer token); the
3791 /// token is validated against the build's stored hash with a constant-time
3792 /// compare and is NOT consumed.
3793 ///
3794 ///Sends a `GET` request to
3795 /// `/api/v0/internal/builds/{build_uuid}/source.tar.gz`
3796 ///
3797 ///Arguments:
3798 /// - `build_uuid`: The build's external id (UUID).
3799 pub async fn get_build_source<'a>(
3800 &'a self,
3801 build_uuid: &'a str,
3802 ) -> Result<ResponseValue<ByteStream>, Error<types::Error>> {
3803 let url = format!(
3804 "{}/api/v0/internal/builds/{}/source.tar.gz",
3805 self.baseurl,
3806 encode_path(&build_uuid.to_string()),
3807 );
3808 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
3809 header_map.append(
3810 ::reqwest::header::HeaderName::from_static("api-version"),
3811 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
3812 );
3813 #[allow(unused_mut)]
3814 let mut request = self.client.get(url).headers(header_map).build()?;
3815 let info = OperationInfo {
3816 operation_id: "get_build_source",
3817 };
3818 self.pre(&mut request, &info).await?;
3819 let result = self.exec(request, &info).await;
3820 self.post(&result, &info).await?;
3821 let response = result?;
3822 match response.status().as_u16() {
3823 200u16 => Ok(ResponseValue::stream(response)),
3824 401u16 => Err(Error::ErrorResponse(
3825 ResponseValue::from_response(response).await?,
3826 )),
3827 404u16 => Err(Error::ErrorResponse(
3828 ResponseValue::from_response(response).await?,
3829 )),
3830 _ => Err(Error::UnexpectedResponse(response)),
3831 }
3832 }
3833
3834 ///Sign in with GitHub
3835 ///
3836 ///Exchanges a GitHub authorization code for a Harmont session token,
3837 /// creating the user and their personal org on first sign-in.
3838 ///
3839 ///Sends a `POST` request to `/api/v0/auth/github`
3840 ///
3841 ///Arguments:
3842 /// - `body`: GitHub OAuth callback
3843 pub async fn auth_github<'a>(
3844 &'a self,
3845 body: &'a types::AuthGithubRequest,
3846 ) -> Result<ResponseValue<types::AuthTokenResponse>, Error<types::Error>> {
3847 let url = format!("{}/api/v0/auth/github", self.baseurl,);
3848 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
3849 header_map.append(
3850 ::reqwest::header::HeaderName::from_static("api-version"),
3851 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
3852 );
3853 #[allow(unused_mut)]
3854 let mut request = self
3855 .client
3856 .post(url)
3857 .header(
3858 ::reqwest::header::ACCEPT,
3859 ::reqwest::header::HeaderValue::from_static("application/json"),
3860 )
3861 .json(&body)
3862 .headers(header_map)
3863 .build()?;
3864 let info = OperationInfo {
3865 operation_id: "auth_github",
3866 };
3867 self.pre(&mut request, &info).await?;
3868 let result = self.exec(request, &info).await;
3869 self.post(&result, &info).await?;
3870 let response = result?;
3871 match response.status().as_u16() {
3872 200u16 => ResponseValue::from_response(response).await,
3873 403u16 => Err(Error::ErrorResponse(
3874 ResponseValue::from_response(response).await?,
3875 )),
3876 502u16 => Err(Error::ErrorResponse(
3877 ResponseValue::from_response(response).await?,
3878 )),
3879 _ => Err(Error::UnexpectedResponse(response)),
3880 }
3881 }
3882
3883 ///Log out (revoke the current bearer token)
3884 ///
3885 ///Revokes the bearer token used for this request. The token can no longer
3886 /// be used to authenticate. Idempotent.
3887 ///
3888 ///Sends a `POST` request to `/api/v0/auth/logout`
3889 pub async fn logout<'a>(&'a self) -> Result<ResponseValue<()>, Error<()>> {
3890 let url = format!("{}/api/v0/auth/logout", self.baseurl,);
3891 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
3892 header_map.append(
3893 ::reqwest::header::HeaderName::from_static("api-version"),
3894 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
3895 );
3896 #[allow(unused_mut)]
3897 let mut request = self.client.post(url).headers(header_map).build()?;
3898 let info = OperationInfo {
3899 operation_id: "logout",
3900 };
3901 self.pre(&mut request, &info).await?;
3902 let result = self.exec(request, &info).await;
3903 self.post(&result, &info).await?;
3904 let response = result?;
3905 match response.status().as_u16() {
3906 204u16 => Ok(ResponseValue::empty(response)),
3907 _ => Err(Error::UnexpectedResponse(response)),
3908 }
3909 }
3910
3911 ///List repositories for a connected installation
3912 ///
3913 ///Returns the mirrored repositories for one installation, scoped to this
3914 /// organization. An installation bound to another organization (or unknown)
3915 /// yields an empty list.
3916 ///
3917 ///Sends a `GET` request to
3918 /// `/api/v0/organizations/{org}/github/installations/{id}/repos`
3919 ///
3920 ///Arguments:
3921 /// - `org`: The organization slug.
3922 /// - `id`: The GitHub numeric installation id.
3923 pub async fn list_github_installation_repos<'a>(
3924 &'a self,
3925 org: &'a str,
3926 id: i64,
3927 ) -> Result<ResponseValue<types::GithubRepoList>, Error<types::Error>> {
3928 let url = format!(
3929 "{}/api/v0/organizations/{}/github/installations/{}/repos",
3930 self.baseurl,
3931 encode_path(&org.to_string()),
3932 encode_path(&id.to_string()),
3933 );
3934 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
3935 header_map.append(
3936 ::reqwest::header::HeaderName::from_static("api-version"),
3937 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
3938 );
3939 #[allow(unused_mut)]
3940 let mut request = self
3941 .client
3942 .get(url)
3943 .header(
3944 ::reqwest::header::ACCEPT,
3945 ::reqwest::header::HeaderValue::from_static("application/json"),
3946 )
3947 .headers(header_map)
3948 .build()?;
3949 let info = OperationInfo {
3950 operation_id: "list_github_installation_repos",
3951 };
3952 self.pre(&mut request, &info).await?;
3953 let result = self.exec(request, &info).await;
3954 self.post(&result, &info).await?;
3955 let response = result?;
3956 match response.status().as_u16() {
3957 200u16 => ResponseValue::from_response(response).await,
3958 404u16 => Err(Error::ErrorResponse(
3959 ResponseValue::from_response(response).await?,
3960 )),
3961 _ => Err(Error::UnexpectedResponse(response)),
3962 }
3963 }
3964
3965 ///List connected GitHub installations
3966 ///
3967 ///Returns the organization's connected, non-deleted GitHub App
3968 /// installations.
3969 ///
3970 ///Sends a `GET` request to
3971 /// `/api/v0/organizations/{org}/github/installations`
3972 ///
3973 ///Arguments:
3974 /// - `org`: The organization slug.
3975 pub async fn list_github_installations<'a>(
3976 &'a self,
3977 org: &'a str,
3978 ) -> Result<ResponseValue<types::GithubInstallationList>, Error<types::Error>> {
3979 let url = format!(
3980 "{}/api/v0/organizations/{}/github/installations",
3981 self.baseurl,
3982 encode_path(&org.to_string()),
3983 );
3984 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
3985 header_map.append(
3986 ::reqwest::header::HeaderName::from_static("api-version"),
3987 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
3988 );
3989 #[allow(unused_mut)]
3990 let mut request = self
3991 .client
3992 .get(url)
3993 .header(
3994 ::reqwest::header::ACCEPT,
3995 ::reqwest::header::HeaderValue::from_static("application/json"),
3996 )
3997 .headers(header_map)
3998 .build()?;
3999 let info = OperationInfo {
4000 operation_id: "list_github_installations",
4001 };
4002 self.pre(&mut request, &info).await?;
4003 let result = self.exec(request, &info).await;
4004 self.post(&result, &info).await?;
4005 let response = result?;
4006 match response.status().as_u16() {
4007 200u16 => ResponseValue::from_response(response).await,
4008 404u16 => Err(Error::ErrorResponse(
4009 ResponseValue::from_response(response).await?,
4010 )),
4011 _ => Err(Error::UnexpectedResponse(response)),
4012 }
4013 }
4014
4015 ///Connect a GitHub installation to the organization
4016 ///
4017 ///Binds an existing GitHub App installation (by GitHub numeric id) to this
4018 /// organization. The installation must already be mirrored from a prior
4019 /// `installation.created` webhook. Binding an installation that is
4020 /// connected to a different organization yields 409; an unknown
4021 /// installation yields 404.
4022 ///
4023 ///Sends a `POST` request to
4024 /// `/api/v0/organizations/{org}/github/installations`
4025 ///
4026 ///Arguments:
4027 /// - `org`: The organization slug.
4028 /// - `body`: The GitHub installation to connect
4029 pub async fn connect_github_installation<'a>(
4030 &'a self,
4031 org: &'a str,
4032 body: &'a types::ConnectInstallationRequest,
4033 ) -> Result<ResponseValue<types::GithubInstallation>, Error<types::Error>> {
4034 let url = format!(
4035 "{}/api/v0/organizations/{}/github/installations",
4036 self.baseurl,
4037 encode_path(&org.to_string()),
4038 );
4039 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
4040 header_map.append(
4041 ::reqwest::header::HeaderName::from_static("api-version"),
4042 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
4043 );
4044 #[allow(unused_mut)]
4045 let mut request = self
4046 .client
4047 .post(url)
4048 .header(
4049 ::reqwest::header::ACCEPT,
4050 ::reqwest::header::HeaderValue::from_static("application/json"),
4051 )
4052 .json(&body)
4053 .headers(header_map)
4054 .build()?;
4055 let info = OperationInfo {
4056 operation_id: "connect_github_installation",
4057 };
4058 self.pre(&mut request, &info).await?;
4059 let result = self.exec(request, &info).await;
4060 self.post(&result, &info).await?;
4061 let response = result?;
4062 match response.status().as_u16() {
4063 201u16 => ResponseValue::from_response(response).await,
4064 404u16 => Err(Error::ErrorResponse(
4065 ResponseValue::from_response(response).await?,
4066 )),
4067 409u16 => Err(Error::ErrorResponse(
4068 ResponseValue::from_response(response).await?,
4069 )),
4070 422u16 => Err(Error::ErrorResponse(
4071 ResponseValue::from_response(response).await?,
4072 )),
4073 _ => Err(Error::UnexpectedResponse(response)),
4074 }
4075 }
4076
4077 ///Get passkey sign-up creation options
4078 ///
4079 ///Validates the verification token and returns WebAuthn
4080 /// credential-creation options plus the server-side challenge id to echo
4081 /// back on finalize.
4082 ///
4083 ///Sends a `POST` request to `/api/v0/auth/passkey/signup/options`
4084 ///
4085 ///Arguments:
4086 /// - `body`: Options request
4087 pub async fn passkey_signup_options<'a>(
4088 &'a self,
4089 body: &'a types::PasskeySignupOptionsRequest,
4090 ) -> Result<ResponseValue<types::PasskeyChallengeResponse>, Error<types::Error>> {
4091 let url = format!("{}/api/v0/auth/passkey/signup/options", self.baseurl,);
4092 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
4093 header_map.append(
4094 ::reqwest::header::HeaderName::from_static("api-version"),
4095 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
4096 );
4097 #[allow(unused_mut)]
4098 let mut request = self
4099 .client
4100 .post(url)
4101 .header(
4102 ::reqwest::header::ACCEPT,
4103 ::reqwest::header::HeaderValue::from_static("application/json"),
4104 )
4105 .json(&body)
4106 .headers(header_map)
4107 .build()?;
4108 let info = OperationInfo {
4109 operation_id: "passkey_signup_options",
4110 };
4111 self.pre(&mut request, &info).await?;
4112 let result = self.exec(request, &info).await;
4113 self.post(&result, &info).await?;
4114 let response = result?;
4115 match response.status().as_u16() {
4116 200u16 => ResponseValue::from_response(response).await,
4117 400u16 => Err(Error::ErrorResponse(
4118 ResponseValue::from_response(response).await?,
4119 )),
4120 _ => Err(Error::UnexpectedResponse(response)),
4121 }
4122 }
4123
4124 ///Get options to add a passkey
4125 ///
4126 ///Returns WebAuthn credential-creation options for the current user,
4127 /// excluding their already-registered credentials, plus the challenge id.
4128 ///
4129 ///Sends a `POST` request to `/api/v0/auth/passkey/register/options`
4130 pub async fn passkey_register_options<'a>(
4131 &'a self,
4132 ) -> Result<ResponseValue<types::PasskeyRegisterOptionsResponse>, Error<types::Error>> {
4133 let url = format!("{}/api/v0/auth/passkey/register/options", self.baseurl,);
4134 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
4135 header_map.append(
4136 ::reqwest::header::HeaderName::from_static("api-version"),
4137 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
4138 );
4139 #[allow(unused_mut)]
4140 let mut request = self
4141 .client
4142 .post(url)
4143 .header(
4144 ::reqwest::header::ACCEPT,
4145 ::reqwest::header::HeaderValue::from_static("application/json"),
4146 )
4147 .headers(header_map)
4148 .build()?;
4149 let info = OperationInfo {
4150 operation_id: "passkey_register_options",
4151 };
4152 self.pre(&mut request, &info).await?;
4153 let result = self.exec(request, &info).await;
4154 self.post(&result, &info).await?;
4155 let response = result?;
4156 match response.status().as_u16() {
4157 200u16 => ResponseValue::from_response(response).await,
4158 401u16 => Err(Error::ErrorResponse(
4159 ResponseValue::from_response(response).await?,
4160 )),
4161 _ => Err(Error::UnexpectedResponse(response)),
4162 }
4163 }
4164
4165 ///List the current user's API keys
4166 ///
4167 ///Sends a `GET` request to `/api/v0/user/api-tokens`
4168 pub async fn list_api_tokens<'a>(
4169 &'a self,
4170 ) -> Result<ResponseValue<types::ApiTokenListResponse>, Error<()>> {
4171 let url = format!("{}/api/v0/user/api-tokens", self.baseurl,);
4172 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
4173 header_map.append(
4174 ::reqwest::header::HeaderName::from_static("api-version"),
4175 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
4176 );
4177 #[allow(unused_mut)]
4178 let mut request = self
4179 .client
4180 .get(url)
4181 .header(
4182 ::reqwest::header::ACCEPT,
4183 ::reqwest::header::HeaderValue::from_static("application/json"),
4184 )
4185 .headers(header_map)
4186 .build()?;
4187 let info = OperationInfo {
4188 operation_id: "list_api_tokens",
4189 };
4190 self.pre(&mut request, &info).await?;
4191 let result = self.exec(request, &info).await;
4192 self.post(&result, &info).await?;
4193 let response = result?;
4194 match response.status().as_u16() {
4195 200u16 => ResponseValue::from_response(response).await,
4196 _ => Err(Error::UnexpectedResponse(response)),
4197 }
4198 }
4199
4200 ///Create a personal API key
4201 ///
4202 ///Returns the raw secret in the response body. It is shown only once and
4203 /// cannot be retrieved later.
4204 ///
4205 ///Sends a `POST` request to `/api/v0/user/api-tokens`
4206 ///
4207 ///Arguments:
4208 /// - `body`: Create request
4209 pub async fn create_api_token<'a>(
4210 &'a self,
4211 body: &'a types::ApiTokenCreateRequest,
4212 ) -> Result<ResponseValue<types::ApiTokenCreateResponse>, Error<()>> {
4213 let url = format!("{}/api/v0/user/api-tokens", self.baseurl,);
4214 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
4215 header_map.append(
4216 ::reqwest::header::HeaderName::from_static("api-version"),
4217 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
4218 );
4219 #[allow(unused_mut)]
4220 let mut request = self
4221 .client
4222 .post(url)
4223 .header(
4224 ::reqwest::header::ACCEPT,
4225 ::reqwest::header::HeaderValue::from_static("application/json"),
4226 )
4227 .json(&body)
4228 .headers(header_map)
4229 .build()?;
4230 let info = OperationInfo {
4231 operation_id: "create_api_token",
4232 };
4233 self.pre(&mut request, &info).await?;
4234 let result = self.exec(request, &info).await;
4235 self.post(&result, &info).await?;
4236 let response = result?;
4237 match response.status().as_u16() {
4238 201u16 => ResponseValue::from_response(response).await,
4239 _ => Err(Error::UnexpectedResponse(response)),
4240 }
4241 }
4242
4243 ///Finalize passkey sign-up
4244 ///
4245 ///Verifies the attestation, consumes the verification token, creates the
4246 /// user + passkey, and returns a session token.
4247 ///
4248 ///Sends a `POST` request to `/api/v0/auth/passkey/signup/finalize`
4249 ///
4250 ///Arguments:
4251 /// - `body`: Finalize request
4252 pub async fn passkey_signup_finalize<'a>(
4253 &'a self,
4254 body: &'a types::PasskeySignupFinalizeRequest,
4255 ) -> Result<ResponseValue<types::AuthTokenResponse>, Error<types::Error>> {
4256 let url = format!("{}/api/v0/auth/passkey/signup/finalize", self.baseurl,);
4257 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
4258 header_map.append(
4259 ::reqwest::header::HeaderName::from_static("api-version"),
4260 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
4261 );
4262 #[allow(unused_mut)]
4263 let mut request = self
4264 .client
4265 .post(url)
4266 .header(
4267 ::reqwest::header::ACCEPT,
4268 ::reqwest::header::HeaderValue::from_static("application/json"),
4269 )
4270 .json(&body)
4271 .headers(header_map)
4272 .build()?;
4273 let info = OperationInfo {
4274 operation_id: "passkey_signup_finalize",
4275 };
4276 self.pre(&mut request, &info).await?;
4277 let result = self.exec(request, &info).await;
4278 self.post(&result, &info).await?;
4279 let response = result?;
4280 match response.status().as_u16() {
4281 200u16 => ResponseValue::from_response(response).await,
4282 400u16 => Err(Error::ErrorResponse(
4283 ResponseValue::from_response(response).await?,
4284 )),
4285 409u16 => Err(Error::ErrorResponse(
4286 ResponseValue::from_response(response).await?,
4287 )),
4288 _ => Err(Error::UnexpectedResponse(response)),
4289 }
4290 }
4291
4292 ///Hand a session token to a locally-running CLI (loopback)
4293 ///
4294 ///Mints a fresh session token for the current user and parks it under the
4295 /// CLI-supplied nonce for 60 seconds. The CLI claims it via the claim
4296 /// endpoint.
4297 ///
4298 ///Sends a `POST` request to `/api/v0/auth/cli/transfer`
4299 ///
4300 ///Arguments:
4301 /// - `body`: Transfer request
4302 pub async fn cli_transfer<'a>(
4303 &'a self,
4304 body: &'a types::CliTransferRequest,
4305 ) -> Result<ResponseValue<()>, Error<()>> {
4306 let url = format!("{}/api/v0/auth/cli/transfer", self.baseurl,);
4307 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
4308 header_map.append(
4309 ::reqwest::header::HeaderName::from_static("api-version"),
4310 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
4311 );
4312 #[allow(unused_mut)]
4313 let mut request = self
4314 .client
4315 .post(url)
4316 .json(&body)
4317 .headers(header_map)
4318 .build()?;
4319 let info = OperationInfo {
4320 operation_id: "cli_transfer",
4321 };
4322 self.pre(&mut request, &info).await?;
4323 let result = self.exec(request, &info).await;
4324 self.post(&result, &info).await?;
4325 let response = result?;
4326 match response.status().as_u16() {
4327 204u16 => Ok(ResponseValue::empty(response)),
4328 _ => Err(Error::UnexpectedResponse(response)),
4329 }
4330 }
4331
4332 ///List an organization's ledger entries
4333 ///
4334 ///Returns the organization's ledger entries, newest first,
4335 /// cursor-paginated.
4336 ///
4337 ///Sends a `GET` request to `/api/v0/billing/transactions/{org}`
4338 ///
4339 ///Arguments:
4340 /// - `org`: The organization slug.
4341 /// - `cursor`: Opaque cursor from a previous page's `next_cursor`.
4342 /// - `limit`: Page size (1–100, default 50).
4343 pub async fn list_billing_transactions<'a>(
4344 &'a self,
4345 org: &'a str,
4346 cursor: Option<&'a str>,
4347 limit: Option<i64>,
4348 ) -> Result<ResponseValue<types::TransactionList>, Error<types::Error>> {
4349 let url = format!(
4350 "{}/api/v0/billing/transactions/{}",
4351 self.baseurl,
4352 encode_path(&org.to_string()),
4353 );
4354 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
4355 header_map.append(
4356 ::reqwest::header::HeaderName::from_static("api-version"),
4357 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
4358 );
4359 #[allow(unused_mut)]
4360 let mut request = self
4361 .client
4362 .get(url)
4363 .header(
4364 ::reqwest::header::ACCEPT,
4365 ::reqwest::header::HeaderValue::from_static("application/json"),
4366 )
4367 .query(&progenitor_client::QueryParam::new("cursor", &cursor))
4368 .query(&progenitor_client::QueryParam::new("limit", &limit))
4369 .headers(header_map)
4370 .build()?;
4371 let info = OperationInfo {
4372 operation_id: "list_billing_transactions",
4373 };
4374 self.pre(&mut request, &info).await?;
4375 let result = self.exec(request, &info).await;
4376 self.post(&result, &info).await?;
4377 let response = result?;
4378 match response.status().as_u16() {
4379 200u16 => ResponseValue::from_response(response).await,
4380 404u16 => Err(Error::ErrorResponse(
4381 ResponseValue::from_response(response).await?,
4382 )),
4383 _ => Err(Error::UnexpectedResponse(response)),
4384 }
4385 }
4386
4387 ///List a pipeline's builds
4388 ///
4389 ///Returns the pipeline's builds, newest first, paginated.
4390 ///
4391 ///Sends a `GET` request to
4392 /// `/api/v0/organizations/{org}/pipelines/{pipeline}/builds`
4393 ///
4394 ///Arguments:
4395 /// - `org`: The organization slug.
4396 /// - `pipeline`: The pipeline slug.
4397 /// - `cursor`: Opaque cursor from a previous page's `next_cursor`.
4398 /// - `limit`: Page size (1–100, default 50).
4399 pub async fn list_builds<'a>(
4400 &'a self,
4401 org: &'a str,
4402 pipeline: &'a str,
4403 cursor: Option<&'a str>,
4404 limit: Option<i64>,
4405 ) -> Result<ResponseValue<types::BuildList>, Error<types::Error>> {
4406 let url = format!(
4407 "{}/api/v0/organizations/{}/pipelines/{}/builds",
4408 self.baseurl,
4409 encode_path(&org.to_string()),
4410 encode_path(&pipeline.to_string()),
4411 );
4412 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
4413 header_map.append(
4414 ::reqwest::header::HeaderName::from_static("api-version"),
4415 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
4416 );
4417 #[allow(unused_mut)]
4418 let mut request = self
4419 .client
4420 .get(url)
4421 .header(
4422 ::reqwest::header::ACCEPT,
4423 ::reqwest::header::HeaderValue::from_static("application/json"),
4424 )
4425 .query(&progenitor_client::QueryParam::new("cursor", &cursor))
4426 .query(&progenitor_client::QueryParam::new("limit", &limit))
4427 .headers(header_map)
4428 .build()?;
4429 let info = OperationInfo {
4430 operation_id: "list_builds",
4431 };
4432 self.pre(&mut request, &info).await?;
4433 let result = self.exec(request, &info).await;
4434 self.post(&result, &info).await?;
4435 let response = result?;
4436 match response.status().as_u16() {
4437 200u16 => ResponseValue::from_response(response).await,
4438 404u16 => Err(Error::ErrorResponse(
4439 ResponseValue::from_response(response).await?,
4440 )),
4441 _ => Err(Error::UnexpectedResponse(response)),
4442 }
4443 }
4444
4445 ///Create a build
4446 ///
4447 ///Creates a build for the pipeline and starts execution in-process. When
4448 /// `pipeline_ir` is supplied the IR is materialised directly; when it is
4449 /// absent the engine renders the pipeline's IR in a sandbox VM first
4450 /// (rendering never happens on the API host). A manual build against a
4451 /// pipeline that disallows manual builds yields 403; an IR that fails to
4452 /// render/parse/plan yields 422 (the build row is created with its error
4453 /// fields set).
4454 ///
4455 ///Sends a `POST` request to
4456 /// `/api/v0/organizations/{org}/pipelines/{pipeline}/builds`
4457 ///
4458 ///Arguments:
4459 /// - `org`: The organization slug.
4460 /// - `pipeline`: The pipeline slug.
4461 /// - `body`: Build attributes
4462 pub async fn create_build<'a>(
4463 &'a self,
4464 org: &'a str,
4465 pipeline: &'a str,
4466 body: &'a types::CreateBuildRequest,
4467 ) -> Result<ResponseValue<types::Build>, Error<types::Error>> {
4468 let url = format!(
4469 "{}/api/v0/organizations/{}/pipelines/{}/builds",
4470 self.baseurl,
4471 encode_path(&org.to_string()),
4472 encode_path(&pipeline.to_string()),
4473 );
4474 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
4475 header_map.append(
4476 ::reqwest::header::HeaderName::from_static("api-version"),
4477 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
4478 );
4479 #[allow(unused_mut)]
4480 let mut request = self
4481 .client
4482 .post(url)
4483 .header(
4484 ::reqwest::header::ACCEPT,
4485 ::reqwest::header::HeaderValue::from_static("application/json"),
4486 )
4487 .json(&body)
4488 .headers(header_map)
4489 .build()?;
4490 let info = OperationInfo {
4491 operation_id: "create_build",
4492 };
4493 self.pre(&mut request, &info).await?;
4494 let result = self.exec(request, &info).await;
4495 self.post(&result, &info).await?;
4496 let response = result?;
4497 match response.status().as_u16() {
4498 201u16 => ResponseValue::from_response(response).await,
4499 403u16 => Err(Error::ErrorResponse(
4500 ResponseValue::from_response(response).await?,
4501 )),
4502 404u16 => Err(Error::ErrorResponse(
4503 ResponseValue::from_response(response).await?,
4504 )),
4505 422u16 => Err(Error::ErrorResponse(
4506 ResponseValue::from_response(response).await?,
4507 )),
4508 _ => Err(Error::UnexpectedResponse(response)),
4509 }
4510 }
4511
4512 ///Redeem a CLI paste code for a session token
4513 ///
4514 ///The CLI submits the paste code the user typed in; on a match within the
4515 /// 5m window it receives the raw session token (single-use).
4516 ///
4517 ///Sends a `POST` request to `/api/v0/auth/cli/redeem`
4518 ///
4519 ///Arguments:
4520 /// - `body`: Redeem request
4521 pub async fn cli_redeem<'a>(
4522 &'a self,
4523 body: &'a types::CliRedeemRequest,
4524 ) -> Result<ResponseValue<types::CliTokenResponse>, Error<types::Error>> {
4525 let url = format!("{}/api/v0/auth/cli/redeem", self.baseurl,);
4526 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
4527 header_map.append(
4528 ::reqwest::header::HeaderName::from_static("api-version"),
4529 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
4530 );
4531 #[allow(unused_mut)]
4532 let mut request = self
4533 .client
4534 .post(url)
4535 .header(
4536 ::reqwest::header::ACCEPT,
4537 ::reqwest::header::HeaderValue::from_static("application/json"),
4538 )
4539 .json(&body)
4540 .headers(header_map)
4541 .build()?;
4542 let info = OperationInfo {
4543 operation_id: "cli_redeem",
4544 };
4545 self.pre(&mut request, &info).await?;
4546 let result = self.exec(request, &info).await;
4547 self.post(&result, &info).await?;
4548 let response = result?;
4549 match response.status().as_u16() {
4550 200u16 => ResponseValue::from_response(response).await,
4551 400u16 => Err(Error::ErrorResponse(
4552 ResponseValue::from_response(response).await?,
4553 )),
4554 _ => Err(Error::UnexpectedResponse(response)),
4555 }
4556 }
4557
4558 ///Mint a build-scoped log token
4559 ///
4560 ///Returns a short-lived (~1 hour) HMAC token the SSE log stream accepts,
4561 /// scoped to this build. Pass it as the stream's `token` query parameter.
4562 ///
4563 ///Sends a `GET` request to
4564 /// `/api/v0/organizations/{org}/pipelines/{pipeline}/builds/{number}/
4565 /// log-token`
4566 ///
4567 ///Arguments:
4568 /// - `org`: The organization slug.
4569 /// - `pipeline`: The pipeline slug.
4570 /// - `number`: The build number.
4571 pub async fn get_build_log_token<'a>(
4572 &'a self,
4573 org: &'a str,
4574 pipeline: &'a str,
4575 number: i64,
4576 ) -> Result<ResponseValue<types::LogTokenResponse>, Error<types::Error>> {
4577 let url = format!(
4578 "{}/api/v0/organizations/{}/pipelines/{}/builds/{}/log-token",
4579 self.baseurl,
4580 encode_path(&org.to_string()),
4581 encode_path(&pipeline.to_string()),
4582 encode_path(&number.to_string()),
4583 );
4584 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
4585 header_map.append(
4586 ::reqwest::header::HeaderName::from_static("api-version"),
4587 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
4588 );
4589 #[allow(unused_mut)]
4590 let mut request = self
4591 .client
4592 .get(url)
4593 .header(
4594 ::reqwest::header::ACCEPT,
4595 ::reqwest::header::HeaderValue::from_static("application/json"),
4596 )
4597 .headers(header_map)
4598 .build()?;
4599 let info = OperationInfo {
4600 operation_id: "get_build_log_token",
4601 };
4602 self.pre(&mut request, &info).await?;
4603 let result = self.exec(request, &info).await;
4604 self.post(&result, &info).await?;
4605 let response = result?;
4606 match response.status().as_u16() {
4607 200u16 => ResponseValue::from_response(response).await,
4608 404u16 => Err(Error::ErrorResponse(
4609 ResponseValue::from_response(response).await?,
4610 )),
4611 _ => Err(Error::UnexpectedResponse(response)),
4612 }
4613 }
4614
4615 ///Get a job
4616 ///
4617 ///Returns a single job within the build. A `job_id` that belongs to
4618 /// another build is reported as 404.
4619 ///
4620 ///Sends a `GET` request to
4621 /// `/api/v0/organizations/{org}/pipelines/{pipeline}/builds/{number}/jobs/
4622 /// {job_id}`
4623 ///
4624 ///Arguments:
4625 /// - `org`: The organization slug.
4626 /// - `pipeline`: The pipeline slug.
4627 /// - `number`: The build number.
4628 /// - `job_id`: The job id.
4629 pub async fn get_job<'a>(
4630 &'a self,
4631 org: &'a str,
4632 pipeline: &'a str,
4633 number: i64,
4634 job_id: &'a str,
4635 ) -> Result<ResponseValue<types::Job>, Error<types::Error>> {
4636 let url = format!(
4637 "{}/api/v0/organizations/{}/pipelines/{}/builds/{}/jobs/{}",
4638 self.baseurl,
4639 encode_path(&org.to_string()),
4640 encode_path(&pipeline.to_string()),
4641 encode_path(&number.to_string()),
4642 encode_path(&job_id.to_string()),
4643 );
4644 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
4645 header_map.append(
4646 ::reqwest::header::HeaderName::from_static("api-version"),
4647 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
4648 );
4649 #[allow(unused_mut)]
4650 let mut request = self
4651 .client
4652 .get(url)
4653 .header(
4654 ::reqwest::header::ACCEPT,
4655 ::reqwest::header::HeaderValue::from_static("application/json"),
4656 )
4657 .headers(header_map)
4658 .build()?;
4659 let info = OperationInfo {
4660 operation_id: "get_job",
4661 };
4662 self.pre(&mut request, &info).await?;
4663 let result = self.exec(request, &info).await;
4664 self.post(&result, &info).await?;
4665 let response = result?;
4666 match response.status().as_u16() {
4667 200u16 => ResponseValue::from_response(response).await,
4668 404u16 => Err(Error::ErrorResponse(
4669 ResponseValue::from_response(response).await?,
4670 )),
4671 _ => Err(Error::UnexpectedResponse(response)),
4672 }
4673 }
4674
4675 ///Sync a connected installation's repositories
4676 ///
4677 ///Triggers a live sync: lists the installation's repositories from GitHub
4678 /// and reconciles the mirror. Returns the installation. The installation
4679 /// must be connected to this organization.
4680 ///
4681 ///Sends a `POST` request to
4682 /// `/api/v0/organizations/{org}/github/installations/{id}/sync`
4683 ///
4684 ///Arguments:
4685 /// - `org`: The organization slug.
4686 /// - `id`: The GitHub numeric installation id.
4687 pub async fn sync_github_installation<'a>(
4688 &'a self,
4689 org: &'a str,
4690 id: i64,
4691 ) -> Result<ResponseValue<types::GithubInstallation>, Error<types::Error>> {
4692 let url = format!(
4693 "{}/api/v0/organizations/{}/github/installations/{}/sync",
4694 self.baseurl,
4695 encode_path(&org.to_string()),
4696 encode_path(&id.to_string()),
4697 );
4698 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
4699 header_map.append(
4700 ::reqwest::header::HeaderName::from_static("api-version"),
4701 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
4702 );
4703 #[allow(unused_mut)]
4704 let mut request = self
4705 .client
4706 .post(url)
4707 .header(
4708 ::reqwest::header::ACCEPT,
4709 ::reqwest::header::HeaderValue::from_static("application/json"),
4710 )
4711 .headers(header_map)
4712 .build()?;
4713 let info = OperationInfo {
4714 operation_id: "sync_github_installation",
4715 };
4716 self.pre(&mut request, &info).await?;
4717 let result = self.exec(request, &info).await;
4718 self.post(&result, &info).await?;
4719 let response = result?;
4720 match response.status().as_u16() {
4721 200u16 => ResponseValue::from_response(response).await,
4722 404u16 => Err(Error::ErrorResponse(
4723 ResponseValue::from_response(response).await?,
4724 )),
4725 503u16 => Err(Error::ErrorResponse(
4726 ResponseValue::from_response(response).await?,
4727 )),
4728 _ => Err(Error::UnexpectedResponse(response)),
4729 }
4730 }
4731
4732 ///Begin passkey sign-up
4733 ///
4734 ///Runs the access gate and emails a verification link. Always returns 204
4735 /// on the allowed path (never reveals whether the email already has an
4736 /// account).
4737 ///
4738 ///Sends a `POST` request to `/api/v0/auth/passkey/signup/begin`
4739 ///
4740 ///Arguments:
4741 /// - `body`: Sign-up request
4742 pub async fn passkey_signup_begin<'a>(
4743 &'a self,
4744 body: &'a types::PasskeySignupBeginRequest,
4745 ) -> Result<ResponseValue<()>, Error<types::Error>> {
4746 let url = format!("{}/api/v0/auth/passkey/signup/begin", self.baseurl,);
4747 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
4748 header_map.append(
4749 ::reqwest::header::HeaderName::from_static("api-version"),
4750 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
4751 );
4752 #[allow(unused_mut)]
4753 let mut request = self
4754 .client
4755 .post(url)
4756 .header(
4757 ::reqwest::header::ACCEPT,
4758 ::reqwest::header::HeaderValue::from_static("application/json"),
4759 )
4760 .json(&body)
4761 .headers(header_map)
4762 .build()?;
4763 let info = OperationInfo {
4764 operation_id: "passkey_signup_begin",
4765 };
4766 self.pre(&mut request, &info).await?;
4767 let result = self.exec(request, &info).await;
4768 self.post(&result, &info).await?;
4769 let response = result?;
4770 match response.status().as_u16() {
4771 204u16 => Ok(ResponseValue::empty(response)),
4772 403u16 => Err(Error::ErrorResponse(
4773 ResponseValue::from_response(response).await?,
4774 )),
4775 _ => Err(Error::UnexpectedResponse(response)),
4776 }
4777 }
4778
4779 ///Sign in with Google
4780 ///
4781 ///Exchanges a Google authorization code for a Harmont session token,
4782 /// creating the user and their personal org on first sign-in.
4783 ///
4784 ///Sends a `POST` request to `/api/v0/auth/google`
4785 ///
4786 ///Arguments:
4787 /// - `body`: Google OAuth callback
4788 pub async fn auth_google<'a>(
4789 &'a self,
4790 body: &'a types::AuthGoogleRequest,
4791 ) -> Result<ResponseValue<types::AuthTokenResponse>, Error<types::Error>> {
4792 let url = format!("{}/api/v0/auth/google", self.baseurl,);
4793 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
4794 header_map.append(
4795 ::reqwest::header::HeaderName::from_static("api-version"),
4796 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
4797 );
4798 #[allow(unused_mut)]
4799 let mut request = self
4800 .client
4801 .post(url)
4802 .header(
4803 ::reqwest::header::ACCEPT,
4804 ::reqwest::header::HeaderValue::from_static("application/json"),
4805 )
4806 .json(&body)
4807 .headers(header_map)
4808 .build()?;
4809 let info = OperationInfo {
4810 operation_id: "auth_google",
4811 };
4812 self.pre(&mut request, &info).await?;
4813 let result = self.exec(request, &info).await;
4814 self.post(&result, &info).await?;
4815 let response = result?;
4816 match response.status().as_u16() {
4817 200u16 => ResponseValue::from_response(response).await,
4818 403u16 => Err(Error::ErrorResponse(
4819 ResponseValue::from_response(response).await?,
4820 )),
4821 502u16 => Err(Error::ErrorResponse(
4822 ResponseValue::from_response(response).await?,
4823 )),
4824 _ => Err(Error::UnexpectedResponse(response)),
4825 }
4826 }
4827
4828 ///Mint a human-typeable CLI paste code
4829 ///
4830 ///Mints a fresh session token for the current user and a short paste code
4831 /// (valid 5 minutes) the user re-types into the CLI to redeem it.
4832 ///
4833 ///Sends a `POST` request to `/api/v0/auth/cli/code`
4834 pub async fn cli_code<'a>(
4835 &'a self,
4836 ) -> Result<ResponseValue<types::CliCodeResponse>, Error<()>> {
4837 let url = format!("{}/api/v0/auth/cli/code", self.baseurl,);
4838 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
4839 header_map.append(
4840 ::reqwest::header::HeaderName::from_static("api-version"),
4841 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
4842 );
4843 #[allow(unused_mut)]
4844 let mut request = self
4845 .client
4846 .post(url)
4847 .header(
4848 ::reqwest::header::ACCEPT,
4849 ::reqwest::header::HeaderValue::from_static("application/json"),
4850 )
4851 .headers(header_map)
4852 .build()?;
4853 let info = OperationInfo {
4854 operation_id: "cli_code",
4855 };
4856 self.pre(&mut request, &info).await?;
4857 let result = self.exec(request, &info).await;
4858 self.post(&result, &info).await?;
4859 let response = result?;
4860 match response.status().as_u16() {
4861 200u16 => ResponseValue::from_response(response).await,
4862 _ => Err(Error::UnexpectedResponse(response)),
4863 }
4864 }
4865
4866 ///Cancel a build
4867 ///
4868 ///Cancels an in-flight build in-process (transitions non-terminal jobs and
4869 /// tears down their sandboxes). Idempotent: cancelling an already-terminal
4870 /// build is a no-op. Returns the reloaded build with its updated state.
4871 ///
4872 ///Sends a `PUT` request to
4873 /// `/api/v0/organizations/{org}/pipelines/{pipeline}/builds/{number}/
4874 /// cancel`
4875 ///
4876 ///Arguments:
4877 /// - `org`: The organization slug.
4878 /// - `pipeline`: The pipeline slug.
4879 /// - `number`: The build number.
4880 pub async fn cancel_build<'a>(
4881 &'a self,
4882 org: &'a str,
4883 pipeline: &'a str,
4884 number: i64,
4885 ) -> Result<ResponseValue<types::Build>, Error<types::Error>> {
4886 let url = format!(
4887 "{}/api/v0/organizations/{}/pipelines/{}/builds/{}/cancel",
4888 self.baseurl,
4889 encode_path(&org.to_string()),
4890 encode_path(&pipeline.to_string()),
4891 encode_path(&number.to_string()),
4892 );
4893 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
4894 header_map.append(
4895 ::reqwest::header::HeaderName::from_static("api-version"),
4896 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
4897 );
4898 #[allow(unused_mut)]
4899 let mut request = self
4900 .client
4901 .put(url)
4902 .header(
4903 ::reqwest::header::ACCEPT,
4904 ::reqwest::header::HeaderValue::from_static("application/json"),
4905 )
4906 .headers(header_map)
4907 .build()?;
4908 let info = OperationInfo {
4909 operation_id: "cancel_build",
4910 };
4911 self.pre(&mut request, &info).await?;
4912 let result = self.exec(request, &info).await;
4913 self.post(&result, &info).await?;
4914 let response = result?;
4915 match response.status().as_u16() {
4916 200u16 => ResponseValue::from_response(response).await,
4917 404u16 => Err(Error::ErrorResponse(
4918 ResponseValue::from_response(response).await?,
4919 )),
4920 _ => Err(Error::UnexpectedResponse(response)),
4921 }
4922 }
4923
4924 ///List the current user's organizations
4925 ///
4926 ///Returns the organizations the authenticated user is a member of,
4927 /// paginated.
4928 ///
4929 ///Sends a `GET` request to `/api/v0/organizations`
4930 ///
4931 ///Arguments:
4932 /// - `cursor`: Opaque cursor from a previous page's `next_cursor`.
4933 /// - `limit`: Page size (1–100, default 50).
4934 pub async fn list_organizations<'a>(
4935 &'a self,
4936 cursor: Option<&'a str>,
4937 limit: Option<i64>,
4938 ) -> Result<ResponseValue<types::OrganizationList>, Error<()>> {
4939 let url = format!("{}/api/v0/organizations", self.baseurl,);
4940 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
4941 header_map.append(
4942 ::reqwest::header::HeaderName::from_static("api-version"),
4943 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
4944 );
4945 #[allow(unused_mut)]
4946 let mut request = self
4947 .client
4948 .get(url)
4949 .header(
4950 ::reqwest::header::ACCEPT,
4951 ::reqwest::header::HeaderValue::from_static("application/json"),
4952 )
4953 .query(&progenitor_client::QueryParam::new("cursor", &cursor))
4954 .query(&progenitor_client::QueryParam::new("limit", &limit))
4955 .headers(header_map)
4956 .build()?;
4957 let info = OperationInfo {
4958 operation_id: "list_organizations",
4959 };
4960 self.pre(&mut request, &info).await?;
4961 let result = self.exec(request, &info).await;
4962 self.post(&result, &info).await?;
4963 let response = result?;
4964 match response.status().as_u16() {
4965 200u16 => ResponseValue::from_response(response).await,
4966 _ => Err(Error::UnexpectedResponse(response)),
4967 }
4968 }
4969
4970 ///Start a Stripe Checkout Session for a credit top-up
4971 ///
4972 ///Creates a Stripe Checkout Session crediting the organization identified
4973 /// by the path (`:org`) and returns the hosted checkout URL to redirect the
4974 /// customer to. The body carries only the top-up `amount_cents` (a positive
4975 /// integer within supported bounds). The credit itself is posted
4976 /// asynchronously when Stripe fires the matching webhook.
4977 ///
4978 ///Sends a `POST` request to `/api/v0/billing/checkout/{org}`
4979 ///
4980 ///Arguments:
4981 /// - `org`: The organization slug.
4982 /// - `body`: The top-up amount
4983 pub async fn create_checkout<'a>(
4984 &'a self,
4985 org: &'a str,
4986 body: &'a types::CheckoutRequest,
4987 ) -> Result<ResponseValue<types::CheckoutResponse>, Error<types::Error>> {
4988 let url = format!(
4989 "{}/api/v0/billing/checkout/{}",
4990 self.baseurl,
4991 encode_path(&org.to_string()),
4992 );
4993 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
4994 header_map.append(
4995 ::reqwest::header::HeaderName::from_static("api-version"),
4996 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
4997 );
4998 #[allow(unused_mut)]
4999 let mut request = self
5000 .client
5001 .post(url)
5002 .header(
5003 ::reqwest::header::ACCEPT,
5004 ::reqwest::header::HeaderValue::from_static("application/json"),
5005 )
5006 .json(&body)
5007 .headers(header_map)
5008 .build()?;
5009 let info = OperationInfo {
5010 operation_id: "create_checkout",
5011 };
5012 self.pre(&mut request, &info).await?;
5013 let result = self.exec(request, &info).await;
5014 self.post(&result, &info).await?;
5015 let response = result?;
5016 match response.status().as_u16() {
5017 200u16 => ResponseValue::from_response(response).await,
5018 404u16 => Err(Error::ErrorResponse(
5019 ResponseValue::from_response(response).await?,
5020 )),
5021 422u16 => Err(Error::ErrorResponse(
5022 ResponseValue::from_response(response).await?,
5023 )),
5024 502u16 => Err(Error::ErrorResponse(
5025 ResponseValue::from_response(response).await?,
5026 )),
5027 503u16 => Err(Error::ErrorResponse(
5028 ResponseValue::from_response(response).await?,
5029 )),
5030 _ => Err(Error::UnexpectedResponse(response)),
5031 }
5032 }
5033
5034 ///Get recovery passkey-creation options
5035 ///
5036 ///Validates the magic-link token (without consuming it) and returns
5037 /// WebAuthn credential-creation options plus the challenge id to echo back
5038 /// on finalize.
5039 ///
5040 ///Sends a `POST` request to `/api/v0/auth/recover/options`
5041 ///
5042 ///Arguments:
5043 /// - `body`: Options request
5044 pub async fn recover_options<'a>(
5045 &'a self,
5046 body: &'a types::RecoverOptionsRequest,
5047 ) -> Result<ResponseValue<types::PasskeyChallengeResponse>, Error<types::Error>> {
5048 let url = format!("{}/api/v0/auth/recover/options", self.baseurl,);
5049 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
5050 header_map.append(
5051 ::reqwest::header::HeaderName::from_static("api-version"),
5052 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
5053 );
5054 #[allow(unused_mut)]
5055 let mut request = self
5056 .client
5057 .post(url)
5058 .header(
5059 ::reqwest::header::ACCEPT,
5060 ::reqwest::header::HeaderValue::from_static("application/json"),
5061 )
5062 .json(&body)
5063 .headers(header_map)
5064 .build()?;
5065 let info = OperationInfo {
5066 operation_id: "recover_options",
5067 };
5068 self.pre(&mut request, &info).await?;
5069 let result = self.exec(request, &info).await;
5070 self.post(&result, &info).await?;
5071 let response = result?;
5072 match response.status().as_u16() {
5073 200u16 => ResponseValue::from_response(response).await,
5074 400u16 => Err(Error::ErrorResponse(
5075 ResponseValue::from_response(response).await?,
5076 )),
5077 _ => Err(Error::UnexpectedResponse(response)),
5078 }
5079 }
5080
5081 ///Receive a Stripe webhook event
5082 ///
5083 ///Receives a Stripe webhook event and, for `checkout.session.completed`,
5084 /// posts the matching credit to the organization's ledger and marks the
5085 /// checkout session complete. **Not** bearer-authenticated: the request is
5086 /// authenticated by Stripe's `Stripe-Signature` header, verified against
5087 /// the raw request body and the endpoint's webhook signing secret. Credit
5088 /// posting is idempotent — replaying the same event id posts the credit
5089 /// only once. Returns 200 for any verified event (handled or not) so Stripe
5090 /// stops retrying; a signature failure returns 400.
5091 ///
5092 ///Sends a `POST` request to `/api/v0/stripe/webhook`
5093 pub async fn stripe_webhook<'a>(
5094 &'a self,
5095 ) -> Result<ResponseValue<types::StripeWebhookResponse>, Error<types::Error>> {
5096 let url = format!("{}/api/v0/stripe/webhook", self.baseurl,);
5097 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
5098 header_map.append(
5099 ::reqwest::header::HeaderName::from_static("api-version"),
5100 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
5101 );
5102 #[allow(unused_mut)]
5103 let mut request = self
5104 .client
5105 .post(url)
5106 .header(
5107 ::reqwest::header::ACCEPT,
5108 ::reqwest::header::HeaderValue::from_static("application/json"),
5109 )
5110 .headers(header_map)
5111 .build()?;
5112 let info = OperationInfo {
5113 operation_id: "stripe_webhook",
5114 };
5115 self.pre(&mut request, &info).await?;
5116 let result = self.exec(request, &info).await;
5117 self.post(&result, &info).await?;
5118 let response = result?;
5119 match response.status().as_u16() {
5120 200u16 => ResponseValue::from_response(response).await,
5121 400u16 => Err(Error::ErrorResponse(
5122 ResponseValue::from_response(response).await?,
5123 )),
5124 _ => Err(Error::UnexpectedResponse(response)),
5125 }
5126 }
5127
5128 ///Get the current authenticated user
5129 ///
5130 ///Returns the bearer-authenticated user and their personal-organization
5131 /// slug.
5132 ///
5133 ///Sends a `GET` request to `/api/v0/user`
5134 pub async fn get_current_user<'a>(
5135 &'a self,
5136 ) -> Result<ResponseValue<types::CurrentUserResponse>, Error<()>> {
5137 let url = format!("{}/api/v0/user", self.baseurl,);
5138 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
5139 header_map.append(
5140 ::reqwest::header::HeaderName::from_static("api-version"),
5141 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
5142 );
5143 #[allow(unused_mut)]
5144 let mut request = self
5145 .client
5146 .get(url)
5147 .header(
5148 ::reqwest::header::ACCEPT,
5149 ::reqwest::header::HeaderValue::from_static("application/json"),
5150 )
5151 .headers(header_map)
5152 .build()?;
5153 let info = OperationInfo {
5154 operation_id: "get_current_user",
5155 };
5156 self.pre(&mut request, &info).await?;
5157 let result = self.exec(request, &info).await;
5158 self.post(&result, &info).await?;
5159 let response = result?;
5160 match response.status().as_u16() {
5161 200u16 => ResponseValue::from_response(response).await,
5162 _ => Err(Error::UnexpectedResponse(response)),
5163 }
5164 }
5165
5166 ///Delete the current user's account
5167 ///
5168 ///Sends a `DELETE` request to `/api/v0/user`
5169 pub async fn delete_current_user<'a>(
5170 &'a self,
5171 ) -> Result<ResponseValue<()>, Error<types::Error>> {
5172 let url = format!("{}/api/v0/user", self.baseurl,);
5173 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
5174 header_map.append(
5175 ::reqwest::header::HeaderName::from_static("api-version"),
5176 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
5177 );
5178 #[allow(unused_mut)]
5179 let mut request = self
5180 .client
5181 .delete(url)
5182 .header(
5183 ::reqwest::header::ACCEPT,
5184 ::reqwest::header::HeaderValue::from_static("application/json"),
5185 )
5186 .headers(header_map)
5187 .build()?;
5188 let info = OperationInfo {
5189 operation_id: "delete_current_user",
5190 };
5191 self.pre(&mut request, &info).await?;
5192 let result = self.exec(request, &info).await;
5193 self.post(&result, &info).await?;
5194 let response = result?;
5195 match response.status().as_u16() {
5196 204u16 => Ok(ResponseValue::empty(response)),
5197 409u16 => Err(Error::ErrorResponse(
5198 ResponseValue::from_response(response).await?,
5199 )),
5200 _ => Err(Error::UnexpectedResponse(response)),
5201 }
5202 }
5203
5204 ///Update the current user's display name
5205 ///
5206 ///Sends a `PATCH` request to `/api/v0/user`
5207 ///
5208 ///Arguments:
5209 /// - `body`: Profile update
5210 pub async fn update_current_user<'a>(
5211 &'a self,
5212 body: &'a types::UserUpdateRequest,
5213 ) -> Result<ResponseValue<types::CurrentUserResponse>, Error<types::Error>> {
5214 let url = format!("{}/api/v0/user", self.baseurl,);
5215 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
5216 header_map.append(
5217 ::reqwest::header::HeaderName::from_static("api-version"),
5218 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
5219 );
5220 #[allow(unused_mut)]
5221 let mut request = self
5222 .client
5223 .patch(url)
5224 .header(
5225 ::reqwest::header::ACCEPT,
5226 ::reqwest::header::HeaderValue::from_static("application/json"),
5227 )
5228 .json(&body)
5229 .headers(header_map)
5230 .build()?;
5231 let info = OperationInfo {
5232 operation_id: "update_current_user",
5233 };
5234 self.pre(&mut request, &info).await?;
5235 let result = self.exec(request, &info).await;
5236 self.post(&result, &info).await?;
5237 let response = result?;
5238 match response.status().as_u16() {
5239 200u16 => ResponseValue::from_response(response).await,
5240 422u16 => Err(Error::ErrorResponse(
5241 ResponseValue::from_response(response).await?,
5242 )),
5243 _ => Err(Error::UnexpectedResponse(response)),
5244 }
5245 }
5246
5247 ///List an organization's pipelines
5248 ///
5249 ///Returns the organization's non-archived pipelines, paginated. A slug the
5250 /// user cannot access is reported as 404.
5251 ///
5252 ///Sends a `GET` request to `/api/v0/organizations/{org}/pipelines`
5253 ///
5254 ///Arguments:
5255 /// - `org`: The organization slug.
5256 /// - `cursor`: Opaque cursor from a previous page's `next_cursor`.
5257 /// - `limit`: Page size (1–100, default 50).
5258 pub async fn list_pipelines<'a>(
5259 &'a self,
5260 org: &'a str,
5261 cursor: Option<&'a str>,
5262 limit: Option<i64>,
5263 ) -> Result<ResponseValue<types::PipelineList>, Error<types::Error>> {
5264 let url = format!(
5265 "{}/api/v0/organizations/{}/pipelines",
5266 self.baseurl,
5267 encode_path(&org.to_string()),
5268 );
5269 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
5270 header_map.append(
5271 ::reqwest::header::HeaderName::from_static("api-version"),
5272 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
5273 );
5274 #[allow(unused_mut)]
5275 let mut request = self
5276 .client
5277 .get(url)
5278 .header(
5279 ::reqwest::header::ACCEPT,
5280 ::reqwest::header::HeaderValue::from_static("application/json"),
5281 )
5282 .query(&progenitor_client::QueryParam::new("cursor", &cursor))
5283 .query(&progenitor_client::QueryParam::new("limit", &limit))
5284 .headers(header_map)
5285 .build()?;
5286 let info = OperationInfo {
5287 operation_id: "list_pipelines",
5288 };
5289 self.pre(&mut request, &info).await?;
5290 let result = self.exec(request, &info).await;
5291 self.post(&result, &info).await?;
5292 let response = result?;
5293 match response.status().as_u16() {
5294 200u16 => ResponseValue::from_response(response).await,
5295 404u16 => Err(Error::ErrorResponse(
5296 ResponseValue::from_response(response).await?,
5297 )),
5298 _ => Err(Error::UnexpectedResponse(response)),
5299 }
5300 }
5301
5302 ///Create a pipeline
5303 ///
5304 ///Creates a pipeline in the organization. The slug is derived from the
5305 /// name; a colliding slug within the organization yields 422.
5306 ///
5307 ///Sends a `POST` request to `/api/v0/organizations/{org}/pipelines`
5308 ///
5309 ///Arguments:
5310 /// - `org`: The organization slug.
5311 /// - `body`: Pipeline attributes
5312 pub async fn create_pipeline<'a>(
5313 &'a self,
5314 org: &'a str,
5315 body: &'a types::CreatePipelineRequest,
5316 ) -> Result<ResponseValue<types::Pipeline>, Error<types::Error>> {
5317 let url = format!(
5318 "{}/api/v0/organizations/{}/pipelines",
5319 self.baseurl,
5320 encode_path(&org.to_string()),
5321 );
5322 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
5323 header_map.append(
5324 ::reqwest::header::HeaderName::from_static("api-version"),
5325 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
5326 );
5327 #[allow(unused_mut)]
5328 let mut request = self
5329 .client
5330 .post(url)
5331 .header(
5332 ::reqwest::header::ACCEPT,
5333 ::reqwest::header::HeaderValue::from_static("application/json"),
5334 )
5335 .json(&body)
5336 .headers(header_map)
5337 .build()?;
5338 let info = OperationInfo {
5339 operation_id: "create_pipeline",
5340 };
5341 self.pre(&mut request, &info).await?;
5342 let result = self.exec(request, &info).await;
5343 self.post(&result, &info).await?;
5344 let response = result?;
5345 match response.status().as_u16() {
5346 201u16 => ResponseValue::from_response(response).await,
5347 404u16 => Err(Error::ErrorResponse(
5348 ResponseValue::from_response(response).await?,
5349 )),
5350 422u16 => Err(Error::ErrorResponse(
5351 ResponseValue::from_response(response).await?,
5352 )),
5353 _ => Err(Error::UnexpectedResponse(response)),
5354 }
5355 }
5356
5357 ///Liveness probe
5358 ///
5359 ///Returns `{"status": "ok"}` if the API is up. No auth required.
5360 ///
5361 ///Sends a `GET` request to `/api/v0/ping`
5362 pub async fn ping<'a>(&'a self) -> Result<ResponseValue<types::PingResponse>, Error<()>> {
5363 let url = format!("{}/api/v0/ping", self.baseurl,);
5364 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
5365 header_map.append(
5366 ::reqwest::header::HeaderName::from_static("api-version"),
5367 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
5368 );
5369 #[allow(unused_mut)]
5370 let mut request = self
5371 .client
5372 .get(url)
5373 .header(
5374 ::reqwest::header::ACCEPT,
5375 ::reqwest::header::HeaderValue::from_static("application/json"),
5376 )
5377 .headers(header_map)
5378 .build()?;
5379 let info = OperationInfo {
5380 operation_id: "ping",
5381 };
5382 self.pre(&mut request, &info).await?;
5383 let result = self.exec(request, &info).await;
5384 self.post(&result, &info).await?;
5385 let response = result?;
5386 match response.status().as_u16() {
5387 200u16 => ResponseValue::from_response(response).await,
5388 _ => Err(Error::UnexpectedResponse(response)),
5389 }
5390 }
5391
5392 ///Delete one of the current user's passkeys
5393 ///
5394 ///Removes the passkey. Refused with 409 `passkey_last_credential` when it
5395 /// would leave the account with no passkeys. A passkey belonging to another
5396 /// user is 404.
5397 ///
5398 ///Sends a `DELETE` request to `/api/v0/user/passkeys/{uuid}`
5399 ///
5400 ///Arguments:
5401 /// - `uuid`: The passkey id.
5402 pub async fn delete_passkey<'a>(
5403 &'a self,
5404 uuid: &'a str,
5405 ) -> Result<ResponseValue<()>, Error<types::Error>> {
5406 let url = format!(
5407 "{}/api/v0/user/passkeys/{}",
5408 self.baseurl,
5409 encode_path(&uuid.to_string()),
5410 );
5411 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
5412 header_map.append(
5413 ::reqwest::header::HeaderName::from_static("api-version"),
5414 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
5415 );
5416 #[allow(unused_mut)]
5417 let mut request = self
5418 .client
5419 .delete(url)
5420 .header(
5421 ::reqwest::header::ACCEPT,
5422 ::reqwest::header::HeaderValue::from_static("application/json"),
5423 )
5424 .headers(header_map)
5425 .build()?;
5426 let info = OperationInfo {
5427 operation_id: "delete_passkey",
5428 };
5429 self.pre(&mut request, &info).await?;
5430 let result = self.exec(request, &info).await;
5431 self.post(&result, &info).await?;
5432 let response = result?;
5433 match response.status().as_u16() {
5434 204u16 => Ok(ResponseValue::empty(response)),
5435 404u16 => Err(Error::ErrorResponse(
5436 ResponseValue::from_response(response).await?,
5437 )),
5438 409u16 => Err(Error::ErrorResponse(
5439 ResponseValue::from_response(response).await?,
5440 )),
5441 _ => Err(Error::UnexpectedResponse(response)),
5442 }
5443 }
5444
5445 ///Get an organization
5446 ///
5447 ///Returns the organization identified by the path slug. A slug that does
5448 /// not exist or that the user is not a member of is reported as 404.
5449 ///
5450 ///Sends a `GET` request to `/api/v0/organizations/{org}`
5451 ///
5452 ///Arguments:
5453 /// - `org`: The organization slug.
5454 pub async fn get_organization<'a>(
5455 &'a self,
5456 org: &'a str,
5457 ) -> Result<ResponseValue<types::Organization>, Error<types::Error>> {
5458 let url = format!(
5459 "{}/api/v0/organizations/{}",
5460 self.baseurl,
5461 encode_path(&org.to_string()),
5462 );
5463 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
5464 header_map.append(
5465 ::reqwest::header::HeaderName::from_static("api-version"),
5466 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
5467 );
5468 #[allow(unused_mut)]
5469 let mut request = self
5470 .client
5471 .get(url)
5472 .header(
5473 ::reqwest::header::ACCEPT,
5474 ::reqwest::header::HeaderValue::from_static("application/json"),
5475 )
5476 .headers(header_map)
5477 .build()?;
5478 let info = OperationInfo {
5479 operation_id: "get_organization",
5480 };
5481 self.pre(&mut request, &info).await?;
5482 let result = self.exec(request, &info).await;
5483 self.post(&result, &info).await?;
5484 let response = result?;
5485 match response.status().as_u16() {
5486 200u16 => ResponseValue::from_response(response).await,
5487 404u16 => Err(Error::ErrorResponse(
5488 ResponseValue::from_response(response).await?,
5489 )),
5490 _ => Err(Error::UnexpectedResponse(response)),
5491 }
5492 }
5493
5494 ///Begin account recovery
5495 ///
5496 ///Emails a magic-link to the address if it maps to an account. Always
5497 /// returns 204 (never reveals whether the email has an account).
5498 ///
5499 ///Sends a `POST` request to `/api/v0/auth/recover/begin`
5500 ///
5501 ///Arguments:
5502 /// - `body`: Recovery request
5503 pub async fn recover_begin<'a>(
5504 &'a self,
5505 body: &'a types::RecoverBeginRequest,
5506 ) -> Result<ResponseValue<()>, Error<()>> {
5507 let url = format!("{}/api/v0/auth/recover/begin", self.baseurl,);
5508 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
5509 header_map.append(
5510 ::reqwest::header::HeaderName::from_static("api-version"),
5511 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
5512 );
5513 #[allow(unused_mut)]
5514 let mut request = self
5515 .client
5516 .post(url)
5517 .json(&body)
5518 .headers(header_map)
5519 .build()?;
5520 let info = OperationInfo {
5521 operation_id: "recover_begin",
5522 };
5523 self.pre(&mut request, &info).await?;
5524 let result = self.exec(request, &info).await;
5525 self.post(&result, &info).await?;
5526 let response = result?;
5527 match response.status().as_u16() {
5528 204u16 => Ok(ResponseValue::empty(response)),
5529 _ => Err(Error::UnexpectedResponse(response)),
5530 }
5531 }
5532
5533 ///Get a build
5534 ///
5535 ///Returns the build identified by its pipeline-scoped number. An unknown
5536 /// number (or one in another pipeline) is reported as 404.
5537 ///
5538 ///Sends a `GET` request to
5539 /// `/api/v0/organizations/{org}/pipelines/{pipeline}/builds/{number}`
5540 ///
5541 ///Arguments:
5542 /// - `org`: The organization slug.
5543 /// - `pipeline`: The pipeline slug.
5544 /// - `number`: The build number.
5545 pub async fn get_build<'a>(
5546 &'a self,
5547 org: &'a str,
5548 pipeline: &'a str,
5549 number: i64,
5550 ) -> Result<ResponseValue<types::Build>, Error<types::Error>> {
5551 let url = format!(
5552 "{}/api/v0/organizations/{}/pipelines/{}/builds/{}",
5553 self.baseurl,
5554 encode_path(&org.to_string()),
5555 encode_path(&pipeline.to_string()),
5556 encode_path(&number.to_string()),
5557 );
5558 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
5559 header_map.append(
5560 ::reqwest::header::HeaderName::from_static("api-version"),
5561 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
5562 );
5563 #[allow(unused_mut)]
5564 let mut request = self
5565 .client
5566 .get(url)
5567 .header(
5568 ::reqwest::header::ACCEPT,
5569 ::reqwest::header::HeaderValue::from_static("application/json"),
5570 )
5571 .headers(header_map)
5572 .build()?;
5573 let info = OperationInfo {
5574 operation_id: "get_build",
5575 };
5576 self.pre(&mut request, &info).await?;
5577 let result = self.exec(request, &info).await;
5578 self.post(&result, &info).await?;
5579 let response = result?;
5580 match response.status().as_u16() {
5581 200u16 => ResponseValue::from_response(response).await,
5582 404u16 => Err(Error::ErrorResponse(
5583 ResponseValue::from_response(response).await?,
5584 )),
5585 _ => Err(Error::UnexpectedResponse(response)),
5586 }
5587 }
5588
5589 ///Get an organization's VM usage
5590 ///
5591 ///Aggregates the organization's VM-lease usage over the half-open window
5592 /// `[from, to)` (both ISO-8601 timestamps): resource-seconds per dimension
5593 /// and the total billed cost in cents. Both `from` and `to` are required.
5594 ///
5595 ///Sends a `GET` request to `/api/v0/billing/usage/{org}`
5596 ///
5597 ///Arguments:
5598 /// - `org`: The organization slug.
5599 /// - `from`: Window start (inclusive), ISO-8601.
5600 /// - `to`: Window end (exclusive), ISO-8601.
5601 pub async fn get_billing_usage<'a>(
5602 &'a self,
5603 org: &'a str,
5604 from: &'a str,
5605 to: &'a str,
5606 ) -> Result<ResponseValue<types::UsageResponse>, Error<types::Error>> {
5607 let url = format!(
5608 "{}/api/v0/billing/usage/{}",
5609 self.baseurl,
5610 encode_path(&org.to_string()),
5611 );
5612 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
5613 header_map.append(
5614 ::reqwest::header::HeaderName::from_static("api-version"),
5615 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
5616 );
5617 #[allow(unused_mut)]
5618 let mut request = self
5619 .client
5620 .get(url)
5621 .header(
5622 ::reqwest::header::ACCEPT,
5623 ::reqwest::header::HeaderValue::from_static("application/json"),
5624 )
5625 .query(&progenitor_client::QueryParam::new("from", &from))
5626 .query(&progenitor_client::QueryParam::new("to", &to))
5627 .headers(header_map)
5628 .build()?;
5629 let info = OperationInfo {
5630 operation_id: "get_billing_usage",
5631 };
5632 self.pre(&mut request, &info).await?;
5633 let result = self.exec(request, &info).await;
5634 self.post(&result, &info).await?;
5635 let response = result?;
5636 match response.status().as_u16() {
5637 200u16 => ResponseValue::from_response(response).await,
5638 404u16 => Err(Error::ErrorResponse(
5639 ResponseValue::from_response(response).await?,
5640 )),
5641 422u16 => Err(Error::ErrorResponse(
5642 ResponseValue::from_response(response).await?,
5643 )),
5644 _ => Err(Error::UnexpectedResponse(response)),
5645 }
5646 }
5647
5648 ///Get a pipeline
5649 ///
5650 ///Returns the pipeline identified by the path slug within the
5651 /// organization. An unknown slug (or one in another organization) is
5652 /// reported as 404.
5653 ///
5654 ///Sends a `GET` request to
5655 /// `/api/v0/organizations/{org}/pipelines/{pipeline}`
5656 ///
5657 ///Arguments:
5658 /// - `org`: The organization slug.
5659 /// - `pipeline`: The pipeline slug.
5660 pub async fn get_pipeline<'a>(
5661 &'a self,
5662 org: &'a str,
5663 pipeline: &'a str,
5664 ) -> Result<ResponseValue<types::Pipeline>, Error<types::Error>> {
5665 let url = format!(
5666 "{}/api/v0/organizations/{}/pipelines/{}",
5667 self.baseurl,
5668 encode_path(&org.to_string()),
5669 encode_path(&pipeline.to_string()),
5670 );
5671 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
5672 header_map.append(
5673 ::reqwest::header::HeaderName::from_static("api-version"),
5674 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
5675 );
5676 #[allow(unused_mut)]
5677 let mut request = self
5678 .client
5679 .get(url)
5680 .header(
5681 ::reqwest::header::ACCEPT,
5682 ::reqwest::header::HeaderValue::from_static("application/json"),
5683 )
5684 .headers(header_map)
5685 .build()?;
5686 let info = OperationInfo {
5687 operation_id: "get_pipeline",
5688 };
5689 self.pre(&mut request, &info).await?;
5690 let result = self.exec(request, &info).await;
5691 self.post(&result, &info).await?;
5692 let response = result?;
5693 match response.status().as_u16() {
5694 200u16 => ResponseValue::from_response(response).await,
5695 404u16 => Err(Error::ErrorResponse(
5696 ResponseValue::from_response(response).await?,
5697 )),
5698 _ => Err(Error::UnexpectedResponse(response)),
5699 }
5700 }
5701
5702 ///Finalize adding a passkey
5703 ///
5704 ///Verifies the attestation against the register challenge and stores the
5705 /// new passkey for the current user.
5706 ///
5707 ///Sends a `POST` request to `/api/v0/auth/passkey/register/finalize`
5708 ///
5709 ///Arguments:
5710 /// - `body`: Finalize request
5711 pub async fn passkey_register_finalize<'a>(
5712 &'a self,
5713 body: &'a types::PasskeyRegisterFinalizeRequest,
5714 ) -> Result<ResponseValue<types::Passkey>, Error<types::Error>> {
5715 let url = format!("{}/api/v0/auth/passkey/register/finalize", self.baseurl,);
5716 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
5717 header_map.append(
5718 ::reqwest::header::HeaderName::from_static("api-version"),
5719 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
5720 );
5721 #[allow(unused_mut)]
5722 let mut request = self
5723 .client
5724 .post(url)
5725 .header(
5726 ::reqwest::header::ACCEPT,
5727 ::reqwest::header::HeaderValue::from_static("application/json"),
5728 )
5729 .json(&body)
5730 .headers(header_map)
5731 .build()?;
5732 let info = OperationInfo {
5733 operation_id: "passkey_register_finalize",
5734 };
5735 self.pre(&mut request, &info).await?;
5736 let result = self.exec(request, &info).await;
5737 self.post(&result, &info).await?;
5738 let response = result?;
5739 match response.status().as_u16() {
5740 200u16 => ResponseValue::from_response(response).await,
5741 400u16 => Err(Error::ErrorResponse(
5742 ResponseValue::from_response(response).await?,
5743 )),
5744 401u16 => Err(Error::ErrorResponse(
5745 ResponseValue::from_response(response).await?,
5746 )),
5747 409u16 => Err(Error::ErrorResponse(
5748 ResponseValue::from_response(response).await?,
5749 )),
5750 _ => Err(Error::UnexpectedResponse(response)),
5751 }
5752 }
5753
5754 ///Revoke one of the current user's API keys
5755 ///
5756 ///Sends a `DELETE` request to `/api/v0/user/api-tokens/{id}`
5757 ///
5758 ///Arguments:
5759 /// - `id`: The API key id.
5760 pub async fn revoke_api_token<'a>(
5761 &'a self,
5762 id: &'a str,
5763 ) -> Result<ResponseValue<()>, Error<types::Error>> {
5764 let url = format!(
5765 "{}/api/v0/user/api-tokens/{}",
5766 self.baseurl,
5767 encode_path(&id.to_string()),
5768 );
5769 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
5770 header_map.append(
5771 ::reqwest::header::HeaderName::from_static("api-version"),
5772 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
5773 );
5774 #[allow(unused_mut)]
5775 let mut request = self
5776 .client
5777 .delete(url)
5778 .header(
5779 ::reqwest::header::ACCEPT,
5780 ::reqwest::header::HeaderValue::from_static("application/json"),
5781 )
5782 .headers(header_map)
5783 .build()?;
5784 let info = OperationInfo {
5785 operation_id: "revoke_api_token",
5786 };
5787 self.pre(&mut request, &info).await?;
5788 let result = self.exec(request, &info).await;
5789 self.post(&result, &info).await?;
5790 let response = result?;
5791 match response.status().as_u16() {
5792 204u16 => Ok(ResponseValue::empty(response)),
5793 404u16 => Err(Error::ErrorResponse(
5794 ResponseValue::from_response(response).await?,
5795 )),
5796 _ => Err(Error::UnexpectedResponse(response)),
5797 }
5798 }
5799
5800 ///Get an organization's balance
5801 ///
5802 ///Returns the organization's current balance in cents — the sum of every
5803 /// ledger entry (credits positive, debits negative). May be negative.
5804 ///
5805 ///Sends a `GET` request to `/api/v0/billing/balance/{org}`
5806 ///
5807 ///Arguments:
5808 /// - `org`: The organization slug.
5809 pub async fn get_billing_balance<'a>(
5810 &'a self,
5811 org: &'a str,
5812 ) -> Result<ResponseValue<types::BalanceResponse>, Error<types::Error>> {
5813 let url = format!(
5814 "{}/api/v0/billing/balance/{}",
5815 self.baseurl,
5816 encode_path(&org.to_string()),
5817 );
5818 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
5819 header_map.append(
5820 ::reqwest::header::HeaderName::from_static("api-version"),
5821 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
5822 );
5823 #[allow(unused_mut)]
5824 let mut request = self
5825 .client
5826 .get(url)
5827 .header(
5828 ::reqwest::header::ACCEPT,
5829 ::reqwest::header::HeaderValue::from_static("application/json"),
5830 )
5831 .headers(header_map)
5832 .build()?;
5833 let info = OperationInfo {
5834 operation_id: "get_billing_balance",
5835 };
5836 self.pre(&mut request, &info).await?;
5837 let result = self.exec(request, &info).await;
5838 self.post(&result, &info).await?;
5839 let response = result?;
5840 match response.status().as_u16() {
5841 200u16 => ResponseValue::from_response(response).await,
5842 404u16 => Err(Error::ErrorResponse(
5843 ResponseValue::from_response(response).await?,
5844 )),
5845 _ => Err(Error::UnexpectedResponse(response)),
5846 }
5847 }
5848
5849 ///Get passkey login options
5850 ///
5851 ///Starts a discoverable-credential login: returns WebAuthn request options
5852 /// with an empty allow-list plus the server-side challenge id.
5853 ///
5854 ///Sends a `POST` request to `/api/v0/auth/passkey/login/options`
5855 ///
5856 ///Arguments:
5857 /// - `body`: Login options request
5858 pub async fn passkey_login_options<'a>(
5859 &'a self,
5860 body: &'a types::PasskeyLoginOptionsRequest,
5861 ) -> Result<ResponseValue<types::PasskeyChallengeResponse>, Error<()>> {
5862 let url = format!("{}/api/v0/auth/passkey/login/options", self.baseurl,);
5863 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
5864 header_map.append(
5865 ::reqwest::header::HeaderName::from_static("api-version"),
5866 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
5867 );
5868 #[allow(unused_mut)]
5869 let mut request = self
5870 .client
5871 .post(url)
5872 .header(
5873 ::reqwest::header::ACCEPT,
5874 ::reqwest::header::HeaderValue::from_static("application/json"),
5875 )
5876 .json(&body)
5877 .headers(header_map)
5878 .build()?;
5879 let info = OperationInfo {
5880 operation_id: "passkey_login_options",
5881 };
5882 self.pre(&mut request, &info).await?;
5883 let result = self.exec(request, &info).await;
5884 self.post(&result, &info).await?;
5885 let response = result?;
5886 match response.status().as_u16() {
5887 200u16 => ResponseValue::from_response(response).await,
5888 _ => Err(Error::UnexpectedResponse(response)),
5889 }
5890 }
5891
5892 ///Redeem a coupon for an organization
5893 ///
5894 ///Redeems a coupon code for the organization identified by the path,
5895 /// crediting the org and returning the credit and resulting balance. The
5896 /// org is taken from the route; the body carries only the coupon `code`.
5897 /// Idempotent per org: a second redemption of the same coupon returns `409
5898 /// coupon_already_claimed`.
5899 ///
5900 ///Sends a `POST` request to `/api/v0/billing/coupon/redeem/{org}`
5901 ///
5902 ///Arguments:
5903 /// - `org`: The organization slug.
5904 /// - `body`: The coupon to redeem
5905 pub async fn redeem_coupon<'a>(
5906 &'a self,
5907 org: &'a str,
5908 body: &'a types::RedeemCouponRequest,
5909 ) -> Result<ResponseValue<types::RedeemCouponResponse>, Error<types::Error>> {
5910 let url = format!(
5911 "{}/api/v0/billing/coupon/redeem/{}",
5912 self.baseurl,
5913 encode_path(&org.to_string()),
5914 );
5915 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
5916 header_map.append(
5917 ::reqwest::header::HeaderName::from_static("api-version"),
5918 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
5919 );
5920 #[allow(unused_mut)]
5921 let mut request = self
5922 .client
5923 .post(url)
5924 .header(
5925 ::reqwest::header::ACCEPT,
5926 ::reqwest::header::HeaderValue::from_static("application/json"),
5927 )
5928 .json(&body)
5929 .headers(header_map)
5930 .build()?;
5931 let info = OperationInfo {
5932 operation_id: "redeem_coupon",
5933 };
5934 self.pre(&mut request, &info).await?;
5935 let result = self.exec(request, &info).await;
5936 self.post(&result, &info).await?;
5937 let response = result?;
5938 match response.status().as_u16() {
5939 200u16 => ResponseValue::from_response(response).await,
5940 404u16 => Err(Error::ErrorResponse(
5941 ResponseValue::from_response(response).await?,
5942 )),
5943 409u16 => Err(Error::ErrorResponse(
5944 ResponseValue::from_response(response).await?,
5945 )),
5946 422u16 => Err(Error::ErrorResponse(
5947 ResponseValue::from_response(response).await?,
5948 )),
5949 _ => Err(Error::UnexpectedResponse(response)),
5950 }
5951 }
5952
5953 ///Request access to Harmont
5954 ///
5955 ///Records an access request (a sign-up attempt) and notifies the Harmont
5956 /// team. Rate-limited per client IP.
5957 ///
5958 ///Sends a `POST` request to `/api/v0/auth/access-request`
5959 ///
5960 ///Arguments:
5961 /// - `body`: Access request
5962 pub async fn access_request<'a>(
5963 &'a self,
5964 body: &'a types::AccessRequestRequest,
5965 ) -> Result<ResponseValue<()>, Error<types::Error>> {
5966 let url = format!("{}/api/v0/auth/access-request", self.baseurl,);
5967 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
5968 header_map.append(
5969 ::reqwest::header::HeaderName::from_static("api-version"),
5970 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
5971 );
5972 #[allow(unused_mut)]
5973 let mut request = self
5974 .client
5975 .post(url)
5976 .header(
5977 ::reqwest::header::ACCEPT,
5978 ::reqwest::header::HeaderValue::from_static("application/json"),
5979 )
5980 .json(&body)
5981 .headers(header_map)
5982 .build()?;
5983 let info = OperationInfo {
5984 operation_id: "access_request",
5985 };
5986 self.pre(&mut request, &info).await?;
5987 let result = self.exec(request, &info).await;
5988 self.post(&result, &info).await?;
5989 let response = result?;
5990 match response.status().as_u16() {
5991 204u16 => Ok(ResponseValue::empty(response)),
5992 400u16 => Err(Error::ErrorResponse(
5993 ResponseValue::from_response(response).await?,
5994 )),
5995 429u16 => Err(Error::ErrorResponse(
5996 ResponseValue::from_response(response).await?,
5997 )),
5998 _ => Err(Error::UnexpectedResponse(response)),
5999 }
6000 }
6001}
6002
6003/// Items consumers will typically use such as the Client.
6004pub mod prelude {
6005 #[allow(unused_imports)]
6006 pub use super::Client;
6007}