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