wasmer_backend_api/
types.rs

1pub use queries::*;
2
3pub use cynic::Id;
4
5#[derive(serde::Serialize, serde::Deserialize, Clone, Debug)]
6pub struct Paginated<T> {
7    pub items: Vec<T>,
8    pub next_cursor: Option<String>,
9}
10
11#[cynic::schema_for_derives(file = r#"schema.graphql"#, module = "schema")]
12mod queries {
13    use serde::Serialize;
14    use time::OffsetDateTime;
15
16    use super::schema;
17
18    #[derive(cynic::Scalar, Debug, Clone, PartialEq, Eq)]
19    pub struct DateTime(pub String);
20
21    impl TryFrom<OffsetDateTime> for DateTime {
22        type Error = time::error::Format;
23
24        fn try_from(value: OffsetDateTime) -> Result<Self, Self::Error> {
25            value
26                .format(&time::format_description::well_known::Rfc3339)
27                .map(Self)
28        }
29    }
30
31    impl TryFrom<DateTime> for OffsetDateTime {
32        type Error = time::error::Parse;
33
34        fn try_from(value: DateTime) -> Result<Self, Self::Error> {
35            OffsetDateTime::parse(&value.0, &time::format_description::well_known::Rfc3339)
36        }
37    }
38
39    #[derive(cynic::Scalar, Debug, Clone)]
40    pub struct JSONString(pub String);
41
42    #[derive(cynic::Scalar, Debug, Clone)]
43    pub struct GenericScalar(pub serde_json::Value);
44
45    #[derive(cynic::Enum, Clone, Copy, Debug)]
46    pub enum GrapheneRole {
47        Owner,
48        Admin,
49        Editor,
50        Viewer,
51    }
52
53    #[derive(cynic::QueryVariables, Debug)]
54    pub struct ViewerCanVariables<'a> {
55        pub action: OwnerAction,
56        pub owner_name: &'a str,
57    }
58
59    #[derive(cynic::QueryFragment, Debug)]
60    #[cynic(graphql_type = "Query", variables = "ViewerCanVariables")]
61    pub struct ViewerCan {
62        #[arguments(action: $action, ownerName: $owner_name)]
63        pub viewer_can: bool,
64    }
65
66    #[derive(cynic::Enum, Clone, Copy, Debug)]
67    pub enum OwnerAction {
68        DeployApp,
69        PublishPackage,
70    }
71
72    #[derive(cynic::QueryVariables, Debug)]
73    pub struct RevokeTokenVariables {
74        pub token: String,
75    }
76
77    #[derive(cynic::QueryFragment, Debug)]
78    #[cynic(graphql_type = "Mutation", variables = "RevokeTokenVariables")]
79    pub struct RevokeToken {
80        #[arguments(input: { token: $token })]
81        pub revoke_api_token: Option<RevokeAPITokenPayload>,
82    }
83
84    #[derive(cynic::QueryFragment, Debug)]
85    pub struct RevokeAPITokenPayload {
86        pub success: Option<bool>,
87    }
88
89    #[derive(cynic::QueryVariables, Debug)]
90    pub struct CreateNewNonceVariables {
91        pub callback_url: String,
92        pub name: String,
93    }
94
95    #[derive(cynic::QueryFragment, Debug)]
96    #[cynic(graphql_type = "Mutation", variables = "CreateNewNonceVariables")]
97    pub struct CreateNewNonce {
98        #[arguments(input: { callbackUrl: $callback_url, name: $name })]
99        pub new_nonce: Option<NewNoncePayload>,
100    }
101
102    #[derive(cynic::QueryFragment, Debug)]
103    pub struct NewNoncePayload {
104        pub client_mutation_id: Option<String>,
105        pub nonce: Nonce,
106    }
107
108    #[derive(cynic::QueryFragment, Debug)]
109    pub struct Nonce {
110        pub auth_url: String,
111        pub callback_url: String,
112        pub created_at: DateTime,
113        pub expired: bool,
114        pub id: cynic::Id,
115        pub is_validated: bool,
116        pub name: String,
117        pub secret: String,
118    }
119
120    #[derive(cynic::QueryFragment, Debug)]
121    #[cynic(graphql_type = "Query")]
122    pub struct GetCurrentUser {
123        pub viewer: Option<User>,
124    }
125
126    #[derive(cynic::QueryVariables, Debug)]
127    pub struct GetCurrentUserWithNamespacesVars {
128        pub namespace_role: Option<GrapheneRole>,
129    }
130
131    #[derive(cynic::QueryFragment, Debug)]
132    #[cynic(graphql_type = "Query", variables = "GetCurrentUserWithNamespacesVars")]
133    pub struct GetCurrentUserWithNamespaces {
134        pub viewer: Option<UserWithNamespaces>,
135    }
136
137    #[derive(cynic::QueryFragment, Debug, serde::Serialize)]
138    pub struct User {
139        pub id: cynic::Id,
140        pub username: String,
141    }
142
143    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
144    pub struct Package {
145        pub id: cynic::Id,
146        pub package_name: String,
147        pub namespace: Option<String>,
148        pub last_version: Option<PackageVersion>,
149        pub private: bool,
150    }
151
152    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
153    pub struct PackageDistribution {
154        pub pirita_sha256_hash: Option<String>,
155        pub pirita_download_url: Option<String>,
156        pub download_url: Option<String>,
157        pub size: Option<i32>,
158        pub pirita_size: Option<i32>,
159        pub webc_version: Option<WebcVersion>,
160        pub webc_manifest: Option<JSONString>,
161    }
162
163    #[derive(cynic::Enum, Clone, Copy, Debug)]
164    pub enum WebcVersion {
165        V2,
166        V3,
167    }
168
169    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
170    pub struct WebcImage {
171        pub created_at: DateTime,
172        pub updated_at: DateTime,
173        pub webc_url: String,
174        pub webc_sha256: String,
175        pub file_size: BigInt,
176        pub manifest: JSONString,
177        pub version: Option<WebcVersion>,
178    }
179
180    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
181    pub struct PackageWebc {
182        pub id: cynic::Id,
183        pub created_at: DateTime,
184        pub updated_at: DateTime,
185        pub tag: String,
186        pub is_archived: bool,
187        pub webc_url: String,
188        pub webc: Option<WebcImage>,
189        pub webc_v3: Option<WebcImage>,
190    }
191
192    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
193    pub struct PackageVersion {
194        pub id: cynic::Id,
195        pub version: String,
196        pub created_at: DateTime,
197        pub distribution: PackageDistribution,
198    }
199
200    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
201    #[cynic(graphql_type = "PackageVersion")]
202    pub struct PackageVersionWithPackage {
203        pub id: cynic::Id,
204        pub version: String,
205        pub created_at: DateTime,
206        pub description: String,
207        pub license: Option<String>,
208        pub homepage: Option<String>,
209        pub repository: Option<String>,
210        pub pirita_manifest: Option<JSONString>,
211        pub package: Package,
212
213        #[arguments(version: "V3")]
214        #[cynic(rename = "distribution")]
215        pub distribution_v3: PackageDistribution,
216
217        #[arguments(version: "V2")]
218        #[cynic(rename = "distribution")]
219        pub distribution_v2: PackageDistribution,
220    }
221
222    #[derive(cynic::QueryVariables, Debug)]
223    pub struct GetAppTemplateFromSlugVariables {
224        pub slug: String,
225    }
226
227    #[derive(cynic::QueryFragment, Debug)]
228    #[cynic(graphql_type = "Query", variables = "GetAppTemplateFromSlugVariables")]
229    pub struct GetAppTemplateFromSlug {
230        #[arguments(slug: $slug)]
231        pub get_app_template: Option<AppTemplate>,
232    }
233
234    #[derive(cynic::Enum, Clone, Copy, Debug)]
235    pub enum AppTemplatesSortBy {
236        Newest,
237        Oldest,
238        Popular,
239    }
240
241    #[derive(cynic::QueryVariables, Debug, Clone)]
242    pub struct GetAppTemplatesFromFrameworkVars {
243        pub framework_slug: String,
244        pub first: i32,
245        pub after: Option<String>,
246        pub sort_by: Option<AppTemplatesSortBy>,
247    }
248
249    #[derive(cynic::QueryFragment, Debug)]
250    #[cynic(graphql_type = "Query", variables = "GetAppTemplatesFromFrameworkVars")]
251    pub struct GetAppTemplatesFromFramework {
252        #[arguments(
253            frameworkSlug: $framework_slug,
254            first: $first,
255            after: $after,
256            sortBy: $sort_by
257        )]
258        pub get_app_templates: Option<AppTemplateConnection>,
259    }
260
261    #[derive(cynic::QueryVariables, Debug, Clone)]
262    pub struct GetAppTemplatesFromLanguageVars {
263        pub language_slug: String,
264        pub first: i32,
265        pub after: Option<String>,
266        pub sort_by: Option<AppTemplatesSortBy>,
267    }
268
269    #[derive(cynic::QueryFragment, Debug)]
270    #[cynic(graphql_type = "Query", variables = "GetAppTemplatesFromLanguageVars")]
271    pub struct GetAppTemplatesFromLanguage {
272        #[arguments(
273            languageSlug: $language_slug,
274            first: $first,
275            after: $after,
276            sortBy: $sort_by
277        )]
278        pub get_app_templates: Option<AppTemplateConnection>,
279    }
280
281    #[derive(cynic::QueryVariables, Debug, Clone)]
282    pub struct GetAppTemplatesVars {
283        pub category_slug: String,
284        pub first: i32,
285        pub after: Option<String>,
286        pub sort_by: Option<AppTemplatesSortBy>,
287    }
288
289    #[derive(cynic::QueryFragment, Debug)]
290    #[cynic(graphql_type = "Query", variables = "GetAppTemplatesVars")]
291    pub struct GetAppTemplates {
292        #[arguments(
293            categorySlug: $category_slug,
294            first: $first,
295            after: $after,
296            sortBy: $sort_by
297        )]
298        pub get_app_templates: Option<AppTemplateConnection>,
299    }
300
301    #[derive(cynic::QueryFragment, Debug)]
302    pub struct AppTemplateConnection {
303        pub edges: Vec<Option<AppTemplateEdge>>,
304        pub page_info: PageInfo,
305    }
306
307    #[derive(cynic::QueryFragment, Debug)]
308    pub struct AppTemplateEdge {
309        pub node: Option<AppTemplate>,
310        pub cursor: String,
311    }
312
313    #[derive(serde::Serialize, cynic::QueryFragment, PartialEq, Eq, Debug, Clone)]
314    pub struct AppTemplate {
315        #[serde(rename = "demoUrl")]
316        pub demo_url: String,
317        pub language: Option<String>,
318        pub name: String,
319        pub framework: String,
320        #[serde(rename = "createdAt")]
321        pub created_at: DateTime,
322        pub description: String,
323        pub id: cynic::Id,
324        #[serde(rename = "isPublic")]
325        pub is_public: bool,
326        #[serde(rename = "repoLicense")]
327        pub repo_license: String,
328        pub readme: String,
329        #[serde(rename = "repoUrl")]
330        pub repo_url: String,
331        pub slug: String,
332        #[serde(rename = "updatedAt")]
333        pub updated_at: DateTime,
334        #[serde(rename = "useCases")]
335        pub use_cases: Jsonstring,
336        #[serde(rename = "branch")]
337        pub branch: Option<String>,
338        #[serde(rename = "rootDir")]
339        pub root_dir: Option<String>,
340    }
341
342    #[derive(cynic::QueryVariables, Debug, Clone)]
343    pub struct GetTemplateFrameworksVars {
344        pub after: Option<String>,
345        pub first: Option<i32>,
346    }
347
348    #[derive(cynic::QueryFragment, Debug)]
349    #[cynic(graphql_type = "Query", variables = "GetTemplateFrameworksVars")]
350    pub struct GetTemplateFrameworks {
351        #[arguments(after: $after, first: $first)]
352        pub get_template_frameworks: Option<TemplateFrameworkConnection>,
353    }
354
355    #[derive(cynic::QueryFragment, Debug)]
356    pub struct TemplateFrameworkConnection {
357        pub edges: Vec<Option<TemplateFrameworkEdge>>,
358        pub page_info: PageInfo,
359        pub total_count: Option<i32>,
360    }
361
362    #[derive(cynic::QueryFragment, Debug)]
363    pub struct TemplateFrameworkEdge {
364        pub cursor: String,
365        pub node: Option<TemplateFramework>,
366    }
367
368    #[derive(serde::Serialize, cynic::QueryFragment, PartialEq, Eq, Debug)]
369    pub struct TemplateFramework {
370        #[serde(rename = "createdAt")]
371        pub created_at: DateTime,
372        pub id: cynic::Id,
373        pub name: String,
374        pub slug: String,
375        #[serde(rename = "updatedAt")]
376        pub updated_at: DateTime,
377    }
378
379    #[derive(cynic::QueryVariables, Debug, Clone)]
380    pub struct GetTemplateLanguagesVars {
381        pub after: Option<String>,
382        pub first: Option<i32>,
383    }
384
385    #[derive(cynic::QueryFragment, Debug)]
386    #[cynic(graphql_type = "Query", variables = "GetTemplateLanguagesVars")]
387    pub struct GetTemplateLanguages {
388        #[arguments(after: $after, first: $first)]
389        pub get_template_languages: Option<TemplateLanguageConnection>,
390    }
391
392    #[derive(cynic::QueryFragment, Debug)]
393    pub struct TemplateLanguageConnection {
394        pub edges: Vec<Option<TemplateLanguageEdge>>,
395        pub page_info: PageInfo,
396        pub total_count: Option<i32>,
397    }
398
399    #[derive(cynic::QueryFragment, Debug)]
400    pub struct TemplateLanguageEdge {
401        pub cursor: String,
402        pub node: Option<TemplateLanguage>,
403    }
404
405    #[derive(serde::Serialize, cynic::QueryFragment, PartialEq, Eq, Debug)]
406    pub struct TemplateLanguage {
407        #[serde(rename = "createdAt")]
408        pub created_at: DateTime,
409        pub id: cynic::Id,
410        pub name: String,
411        pub slug: String,
412        #[serde(rename = "updatedAt")]
413        pub updated_at: DateTime,
414    }
415
416    #[derive(cynic::Scalar, Debug, Clone, PartialEq, Eq)]
417    #[cynic(graphql_type = "JSONString")]
418    pub struct Jsonstring(pub String);
419
420    #[derive(cynic::QueryVariables, Debug)]
421    pub struct GetPackageReleaseVars {
422        pub hash: String,
423    }
424
425    #[derive(cynic::QueryFragment, Debug)]
426    #[cynic(graphql_type = "Query", variables = "GetPackageReleaseVars")]
427    pub struct GetPackageRelease {
428        #[arguments(hash: $hash)]
429        pub get_package_release: Option<PackageWebc>,
430    }
431
432    #[derive(cynic::QueryVariables, Debug)]
433    pub struct GetPackageVars {
434        pub name: String,
435    }
436
437    #[derive(cynic::QueryFragment, Debug)]
438    #[cynic(graphql_type = "Query", variables = "GetPackageVars")]
439    pub struct GetPackage {
440        #[arguments(name: $name)]
441        pub get_package: Option<Package>,
442    }
443
444    #[derive(cynic::QueryFragment, Debug)]
445    #[cynic(graphql_type = "Query", variables = "GetPackageVars")]
446    pub struct GetPackageVersionNumbers {
447        #[arguments(name: $name)]
448        pub get_package: Option<PackageVersionNumbers>,
449    }
450
451    #[derive(cynic::QueryFragment, Debug)]
452    #[cynic(graphql_type = "Package")]
453    pub struct PackageVersionNumbers {
454        pub versions: Option<Vec<Option<PackageVersionNumber>>>,
455    }
456
457    #[derive(cynic::QueryFragment, Debug)]
458    #[cynic(graphql_type = "PackageVersion")]
459    pub struct PackageVersionNumber {
460        pub version: String,
461    }
462
463    #[derive(cynic::QueryVariables, Debug)]
464    pub struct GetPackageVersionVars {
465        pub name: String,
466        pub version: String,
467    }
468
469    #[derive(cynic::QueryFragment, Debug)]
470    #[cynic(graphql_type = "Query", variables = "GetPackageVersionVars")]
471    pub struct GetPackageVersion {
472        #[arguments(name: $name, version: $version)]
473        pub get_package_version: Option<PackageVersionWithPackage>,
474    }
475
476    #[derive(cynic::Enum, Clone, Copy, Debug)]
477    pub enum PackageVersionSortBy {
478        Newest,
479        Oldest,
480    }
481
482    #[derive(cynic::QueryVariables, Debug)]
483    pub struct PushPackageReleaseVariables<'a> {
484        pub name: Option<&'a str>,
485        pub namespace: &'a str,
486        pub private: Option<bool>,
487        pub signed_url: &'a str,
488    }
489
490    #[derive(cynic::QueryFragment, Debug)]
491    #[cynic(graphql_type = "Mutation", variables = "PushPackageReleaseVariables")]
492    pub struct PushPackageRelease {
493        #[arguments(input: { name: $name, namespace: $namespace, private: $private, signedUrl: $signed_url })]
494        pub push_package_release: Option<PushPackageReleasePayload>,
495    }
496
497    #[derive(cynic::QueryFragment, Debug)]
498    pub struct PushPackageReleasePayload {
499        pub package_webc: Option<PackageWebc>,
500        pub success: bool,
501    }
502
503    #[derive(cynic::QueryVariables, Debug)]
504    pub struct TagPackageReleaseVariables<'a> {
505        pub description: Option<&'a str>,
506        pub homepage: Option<&'a str>,
507        pub license: Option<&'a str>,
508        pub license_file: Option<&'a str>,
509        pub manifest: Option<&'a str>,
510        pub name: &'a str,
511        pub namespace: Option<&'a str>,
512        pub package_release_id: &'a cynic::Id,
513        pub private: Option<bool>,
514        pub readme: Option<&'a str>,
515        pub repository: Option<&'a str>,
516        pub version: &'a str,
517    }
518
519    #[derive(cynic::QueryFragment, Debug)]
520    #[cynic(graphql_type = "Mutation", variables = "TagPackageReleaseVariables")]
521    pub struct TagPackageRelease {
522        #[arguments(input: { description: $description, homepage: $homepage, license: $license, licenseFile: $license_file, manifest: $manifest, name: $name, namespace: $namespace, packageReleaseId: $package_release_id, private: $private, readme: $readme, repository: $repository, version: $version })]
523        pub tag_package_release: Option<TagPackageReleasePayload>,
524    }
525
526    #[derive(cynic::QueryFragment, Debug)]
527    pub struct TagPackageReleasePayload {
528        pub success: bool,
529        pub package_version: Option<PackageVersion>,
530    }
531
532    #[derive(cynic::InputObject, Debug)]
533    pub struct InputSignature<'a> {
534        pub public_key_key_id: &'a str,
535        pub data: &'a str,
536    }
537
538    #[derive(cynic::QueryVariables, Debug, Clone, Default)]
539    pub struct AllPackageVersionsVars {
540        pub offset: Option<i32>,
541        pub before: Option<String>,
542        pub after: Option<String>,
543        pub first: Option<i32>,
544        pub last: Option<i32>,
545
546        pub created_after: Option<DateTime>,
547        pub updated_after: Option<DateTime>,
548        pub sort_by: Option<PackageVersionSortBy>,
549    }
550
551    #[derive(cynic::QueryFragment, Debug)]
552    #[cynic(graphql_type = "Query", variables = "AllPackageVersionsVars")]
553    pub struct GetAllPackageVersions {
554        #[arguments(
555            first: $first,
556            last: $last,
557            after: $after,
558            before: $before,
559            offset: $offset,
560            updatedAfter: $updated_after,
561            createdAfter: $created_after,
562            sortBy: $sort_by,
563        )]
564        pub all_package_versions: PackageVersionConnection,
565    }
566
567    #[derive(cynic::QueryVariables, Debug, Clone, Default)]
568    pub struct AllPackageReleasesVars {
569        pub offset: Option<i32>,
570        pub before: Option<String>,
571        pub after: Option<String>,
572        pub first: Option<i32>,
573        pub last: Option<i32>,
574
575        pub created_after: Option<DateTime>,
576        pub updated_after: Option<DateTime>,
577        pub sort_by: Option<PackageVersionSortBy>,
578    }
579
580    #[derive(cynic::QueryFragment, Debug)]
581    #[cynic(graphql_type = "Query", variables = "AllPackageReleasesVars")]
582    pub struct GetAllPackageReleases {
583        #[arguments(
584            first: $first,
585            last: $last,
586            after: $after,
587            before: $before,
588            offset: $offset,
589            updatedAfter: $updated_after,
590            createdAfter: $created_after,
591            sortBy: $sort_by,
592        )]
593        pub all_package_releases: PackageWebcConnection,
594    }
595
596    impl GetAllPackageReleases {
597        pub fn into_packages(self) -> Vec<PackageWebc> {
598            self.all_package_releases
599                .edges
600                .into_iter()
601                .flatten()
602                .filter_map(|x| x.node)
603                .collect()
604        }
605    }
606
607    #[derive(cynic::QueryVariables, Debug)]
608    pub struct GetSignedUrlForPackageUploadVariables<'a> {
609        pub expires_after_seconds: Option<i32>,
610        pub filename: Option<&'a str>,
611        pub name: Option<&'a str>,
612        pub version: Option<&'a str>,
613        pub method: Option<&'a str>,
614    }
615
616    #[derive(cynic::QueryFragment, Debug)]
617    #[cynic(
618        graphql_type = "Query",
619        variables = "GetSignedUrlForPackageUploadVariables"
620    )]
621    pub struct GetSignedUrlForPackageUpload {
622        #[arguments(name: $name, version: $version, filename: $filename, expiresAfterSeconds: $expires_after_seconds, method: $method)]
623        pub get_signed_url_for_package_upload: Option<SignedUrl>,
624    }
625
626    #[derive(cynic::QueryFragment, Debug)]
627    pub struct SignedUrl {
628        pub url: String,
629    }
630
631    #[derive(cynic::QueryVariables, Debug)]
632    pub struct GenerateUploadUrlVariables<'a> {
633        pub expires_after_seconds: Option<i32>,
634        pub filename: &'a str,
635        pub name: Option<&'a str>,
636        pub version: Option<&'a str>,
637        pub method: Option<&'a str>,
638    }
639
640    #[derive(cynic::QueryFragment, Debug)]
641    #[cynic(graphql_type = "Mutation", variables = "GenerateUploadUrlVariables")]
642    pub struct GenerateUploadUrl {
643        #[arguments(input: { expiresAfterSeconds: $expires_after_seconds, filename: $filename, name: $name, version: $version, method: $method })]
644        pub generate_upload_url: Option<GenerateUploadUrlPayload>,
645    }
646
647    #[derive(cynic::QueryFragment, Debug)]
648    pub struct GenerateUploadUrlPayload {
649        #[cynic(rename = "signedUrl")]
650        pub signed_url: SignedUrl,
651        pub method: String,
652    }
653
654    #[derive(cynic::QueryFragment, Debug)]
655    pub struct PackageWebcConnection {
656        pub page_info: PageInfo,
657        pub edges: Vec<Option<PackageWebcEdge>>,
658    }
659
660    #[derive(cynic::QueryFragment, Debug)]
661    pub struct PackageWebcEdge {
662        pub node: Option<PackageWebc>,
663    }
664
665    #[derive(cynic::QueryFragment, Debug)]
666    pub struct PackageVersionConnection {
667        pub page_info: PageInfo,
668        pub edges: Vec<Option<PackageVersionEdge>>,
669    }
670
671    #[derive(cynic::QueryFragment, Debug)]
672    pub struct PackageVersionEdge {
673        pub node: Option<PackageVersionWithPackage>,
674        pub cursor: String,
675    }
676
677    #[derive(cynic::Enum, Clone, Copy, Debug)]
678    pub enum SearchOrderSort {
679        Asc,
680        Desc,
681    }
682
683    #[derive(cynic::Enum, Clone, Copy, Debug)]
684    pub enum SearchPublishDate {
685        LastDay,
686        LastWeek,
687        LastMonth,
688        LastYear,
689    }
690
691    #[derive(cynic::Enum, Clone, Copy, Debug)]
692    pub enum PackageOrderBy {
693        Alphabetically,
694        Size,
695        TotalDownloads,
696        PublishedDate,
697        CreatedDate,
698        TotalLikes,
699    }
700
701    #[derive(cynic::Enum, Clone, Copy, Debug)]
702    pub enum CountComparison {
703        Equal,
704        GreaterThan,
705        LessThan,
706        GreaterThanOrEqual,
707        LessThanOrEqual,
708    }
709
710    #[derive(cynic::InputObject, Debug, Clone)]
711    pub struct CountFilter {
712        pub count: Option<i32>,
713        pub comparison: Option<CountComparison>,
714    }
715
716    /// Filters for [`search_packages`](crate::query::search_packages).
717    #[derive(cynic::InputObject, Debug, Clone, Default)]
718    pub struct PackagesFilter {
719        pub count: Option<i32>,
720        pub sort_by: Option<SearchOrderSort>,
721        pub curated: Option<bool>,
722        pub publish_date: Option<SearchPublishDate>,
723        pub has_bindings: Option<bool>,
724        pub is_standalone: Option<bool>,
725        pub has_commands: Option<bool>,
726        pub with_interfaces: Option<Vec<Option<String>>>,
727        pub deployable: Option<bool>,
728        pub license: Option<String>,
729        pub created_after: Option<DateTime>,
730        pub created_before: Option<DateTime>,
731        pub last_published_after: Option<DateTime>,
732        pub last_published_before: Option<DateTime>,
733        pub size: Option<CountFilter>,
734        pub downloads: Option<CountFilter>,
735        pub likes: Option<CountFilter>,
736        pub owner: Option<String>,
737        pub published_by: Option<String>,
738        pub order_by: Option<PackageOrderBy>,
739    }
740
741    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
742    #[cynic(graphql_type = "PackageVersion")]
743    pub struct SearchPackageVersion {
744        pub id: cynic::Id,
745        pub version: String,
746        pub created_at: DateTime,
747        pub package: Package,
748    }
749
750    #[derive(cynic::InlineFragments, Debug, Clone)]
751    #[cynic(graphql_type = "SearchResult")]
752    pub enum SearchResult {
753        PackageVersion(Box<SearchPackageVersion>),
754        #[cynic(fallback)]
755        Unknown,
756    }
757
758    impl SearchResult {
759        /// Extract the package version from a search result, if it is one.
760        pub fn into_package_version(self) -> Option<SearchPackageVersion> {
761            match self {
762                SearchResult::PackageVersion(v) => Some(*v),
763                SearchResult::Unknown => None,
764            }
765        }
766    }
767
768    #[derive(cynic::QueryFragment, Debug)]
769    pub struct SearchEdge {
770        pub node: Option<SearchResult>,
771        pub cursor: String,
772    }
773
774    #[derive(cynic::QueryFragment, Debug)]
775    pub struct SearchConnection {
776        pub page_info: PageInfo,
777        pub edges: Vec<Option<SearchEdge>>,
778        pub total_count: Option<i32>,
779    }
780
781    #[derive(cynic::QueryVariables, Debug, Default)]
782    pub struct SearchPackagesVars {
783        pub query: String,
784        pub packages: Option<PackagesFilter>,
785        pub first: Option<i32>,
786        pub after: Option<String>,
787    }
788
789    #[derive(cynic::QueryFragment, Debug)]
790    #[cynic(graphql_type = "Query", variables = "SearchPackagesVars")]
791    pub struct SearchPackages {
792        #[arguments(query: $query, packages: $packages, first: $first, after: $after)]
793        pub search: SearchConnection,
794    }
795
796    #[derive(cynic::QueryVariables, Debug)]
797    pub struct GetPackageAndAppVars {
798        pub package: String,
799        pub app_owner: String,
800        pub app_name: String,
801    }
802
803    #[derive(cynic::QueryFragment, Debug)]
804    #[cynic(graphql_type = "Query", variables = "GetPackageAndAppVars")]
805    pub struct GetPackageAndApp {
806        #[arguments(name: $package)]
807        pub get_package: Option<Package>,
808        #[arguments(owner: $app_owner, name: $app_name)]
809        pub get_deploy_app: Option<DeployApp>,
810    }
811
812    #[derive(cynic::QueryVariables, Debug)]
813    pub struct GetCurrentUserWithAppsVars {
814        pub first: Option<i32>,
815        pub after: Option<String>,
816        pub sort: Option<DeployAppsSortBy>,
817    }
818
819    #[derive(cynic::QueryFragment, Debug)]
820    #[cynic(graphql_type = "Query", variables = "GetCurrentUserWithAppsVars")]
821    pub struct GetCurrentUserWithApps {
822        pub viewer: Option<UserWithApps>,
823    }
824
825    #[derive(cynic::QueryFragment, Debug)]
826    #[cynic(graphql_type = "User")]
827    #[cynic(variables = "GetCurrentUserWithAppsVars")]
828    pub struct UserWithApps {
829        pub id: cynic::Id,
830        pub username: String,
831        #[arguments(after: $after, sortBy: $sort, first: $first)]
832        pub apps: DeployAppConnection,
833    }
834
835    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
836    pub struct Owner {
837        pub global_name: String,
838    }
839
840    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
841    #[cynic(graphql_type = "User", variables = "GetCurrentUserWithNamespacesVars")]
842    pub struct UserWithNamespaces {
843        pub id: cynic::Id,
844        pub username: String,
845        #[arguments(role: $namespace_role)]
846        pub namespaces: NamespaceConnection,
847    }
848
849    #[derive(cynic::QueryVariables, Debug)]
850    pub struct GetUserAppsVars {
851        pub username: String,
852    }
853
854    #[derive(cynic::QueryFragment, Debug)]
855    #[cynic(graphql_type = "Query", variables = "GetUserAppsVars")]
856    pub struct GetUserApps {
857        #[arguments(username: $username)]
858        pub get_user: Option<User>,
859    }
860
861    #[derive(cynic::QueryVariables, Debug)]
862    pub struct GetDeployAppVars {
863        pub name: String,
864        pub owner: String,
865    }
866
867    #[derive(cynic::QueryFragment, Debug)]
868    #[cynic(graphql_type = "Query", variables = "GetDeployAppVars")]
869    pub struct GetDeployApp {
870        #[arguments(owner: $owner, name: $name)]
871        pub get_deploy_app: Option<DeployApp>,
872    }
873
874    #[derive(cynic::QueryFragment, Debug)]
875    #[cynic(graphql_type = "Query", variables = "GetDeployAppVars")]
876    pub struct GetDeployAppS3Credentials {
877        #[arguments(owner: $owner, name: $name)]
878        pub get_deploy_app: Option<AppWithS3Credentials>,
879    }
880
881    #[derive(cynic::QueryFragment, Debug)]
882    #[cynic(graphql_type = "DeployApp", variables = "GetDeployAppVars")]
883    pub struct AppWithS3Credentials {
884        pub s3_credentials: Option<S3Credentials>,
885    }
886
887    #[derive(cynic::QueryFragment, Debug)]
888    pub struct S3Credentials {
889        pub access_key: String,
890        pub secret_key: String,
891        pub endpoint: String,
892    }
893
894    #[derive(cynic::QueryVariables, Debug, Clone)]
895    pub(crate) struct GetDeployAppVolumesVars {
896        pub owner: String,
897        pub name: String,
898        pub after: Option<String>,
899    }
900
901    #[derive(cynic::QueryFragment, Debug)]
902    #[cynic(graphql_type = "Query", variables = "GetDeployAppVolumesVars")]
903    pub(crate) struct GetDeployAppVolumes {
904        #[arguments(owner: $owner, name: $name)]
905        pub get_deploy_app: Option<AppWithVolumes>,
906    }
907
908    #[derive(cynic::QueryFragment, Debug)]
909    #[cynic(graphql_type = "DeployApp", variables = "GetDeployAppVolumesVars")]
910    pub(crate) struct AppWithVolumes {
911        #[arguments(first: 100, after: $after)]
912        pub volumes: AppVolumeConnection,
913    }
914
915    #[derive(cynic::QueryFragment, Debug)]
916    pub(crate) struct AppVolumeConnection {
917        pub page_info: PageInfo,
918        pub edges: Vec<AppVolumeEdge>,
919    }
920
921    #[derive(cynic::QueryFragment, Debug)]
922    pub(crate) struct AppVolumeEdge {
923        pub node: AppVolume,
924    }
925
926    /// A persistent `DeployApp.volumes` node, including its S3 state and (if S3
927    /// is enabled) credentials. `s3` is `None` unless the volume has S3 enabled.
928    #[derive(cynic::QueryFragment, Debug)]
929    pub struct AppVolume {
930        pub id: cynic::Id,
931        pub volume_id: String,
932        pub mount_path: String,
933        pub s3_enabled: bool,
934        pub s3: Option<S3>,
935    }
936
937    #[derive(cynic::QueryFragment, Debug)]
938    pub struct S3 {
939        pub access_key: String,
940        pub secret_key: String,
941        pub endpoint: String,
942    }
943
944    #[derive(cynic::QueryVariables, Debug)]
945    pub struct UpdateVolumeVariables {
946        pub id: cynic::Id,
947        pub s3_enabled: Option<bool>,
948    }
949
950    #[derive(cynic::QueryFragment, Debug)]
951    #[cynic(graphql_type = "Mutation", variables = "UpdateVolumeVariables")]
952    pub struct UpdateVolume {
953        #[arguments(input: { id: $id, s3Enabled: $s3_enabled })]
954        pub update_volume: UpdateVolumePayload,
955    }
956
957    #[derive(cynic::QueryFragment, Debug)]
958    pub struct UpdateVolumePayload {
959        pub success: bool,
960    }
961
962    #[derive(cynic::QueryVariables, Debug)]
963    pub struct RotateS3CredentialsVariables {
964        pub id: cynic::Id,
965    }
966
967    #[derive(cynic::QueryFragment, Debug)]
968    #[cynic(graphql_type = "Mutation", variables = "RotateS3CredentialsVariables")]
969    pub struct RotateS3Credentials {
970        #[arguments(input: { id: $id })]
971        pub rotate_s3_credentials: RotateS3CredentialsPayload,
972    }
973
974    #[derive(cynic::QueryFragment, Debug)]
975    pub struct RotateS3CredentialsPayload {
976        pub access_key: String,
977        pub secret_key: String,
978        pub endpoint: String,
979        pub success: bool,
980    }
981
982    #[derive(cynic::QueryVariables, Debug, Clone)]
983    pub struct PaginationVars {
984        pub offset: Option<i32>,
985        pub before: Option<String>,
986        pub after: Option<String>,
987        pub first: Option<i32>,
988        pub last: Option<i32>,
989    }
990
991    #[derive(cynic::Enum, Clone, Copy, Debug)]
992    pub enum DeployAppsSortBy {
993        Newest,
994        Oldest,
995        MostActive,
996    }
997
998    #[derive(cynic::QueryVariables, Debug, Clone, Default)]
999    pub struct GetDeployAppsVars {
1000        pub offset: Option<i32>,
1001        pub before: Option<String>,
1002        pub after: Option<String>,
1003        pub first: Option<i32>,
1004        pub last: Option<i32>,
1005
1006        pub updated_after: Option<DateTime>,
1007        pub sort_by: Option<DeployAppsSortBy>,
1008    }
1009
1010    #[derive(cynic::QueryFragment, Debug)]
1011    #[cynic(graphql_type = "Query", variables = "GetDeployAppsVars")]
1012    pub struct GetDeployApps {
1013        #[arguments(
1014            first: $first,
1015            last: $last,
1016            after: $after,
1017            before: $before,
1018            offset: $offset,
1019            updatedAfter: $updated_after,
1020            sortBy: $sort_by,
1021        )]
1022        pub get_deploy_apps: Option<DeployAppConnection>,
1023    }
1024
1025    #[derive(cynic::QueryVariables, Debug)]
1026    pub struct GetDeployAppByAliasVars {
1027        pub alias: String,
1028    }
1029
1030    #[derive(cynic::QueryFragment, Debug)]
1031    #[cynic(graphql_type = "Query", variables = "GetDeployAppByAliasVars")]
1032    pub struct GetDeployAppByAlias {
1033        #[arguments(alias: $alias)]
1034        pub get_app_by_global_alias: Option<DeployApp>,
1035    }
1036
1037    #[derive(cynic::QueryVariables, Debug)]
1038    pub struct GetDeployAppAndVersionVars {
1039        pub name: String,
1040        pub owner: String,
1041        pub version: String,
1042    }
1043
1044    #[derive(cynic::QueryFragment, Debug)]
1045    #[cynic(graphql_type = "Query", variables = "GetDeployAppAndVersionVars")]
1046    pub struct GetDeployAppAndVersion {
1047        #[arguments(owner: $owner, name: $name)]
1048        pub get_deploy_app: Option<DeployApp>,
1049        #[arguments(owner: $owner, name: $name, version: $version)]
1050        pub get_deploy_app_version: Option<DeployAppVersion>,
1051    }
1052
1053    #[derive(cynic::QueryVariables, Debug)]
1054    pub struct GetDeployAppVersionVars {
1055        pub name: String,
1056        pub owner: String,
1057        pub version: String,
1058    }
1059
1060    #[derive(cynic::QueryFragment, Debug)]
1061    #[cynic(graphql_type = "Query", variables = "GetDeployAppVersionVars")]
1062    pub struct GetDeployAppVersion {
1063        #[arguments(owner: $owner, name: $name, version: $version)]
1064        pub get_deploy_app_version: Option<DeployAppVersion>,
1065    }
1066
1067    #[derive(cynic::QueryVariables, Debug)]
1068    pub(crate) struct GetAppVolumesVars {
1069        pub name: String,
1070        pub owner: String,
1071    }
1072
1073    #[derive(cynic::QueryFragment, Debug)]
1074    #[cynic(graphql_type = "Query", variables = "GetAppVolumesVars")]
1075    pub(crate) struct GetAppVolumes {
1076        #[arguments(owner: $owner, name: $name)]
1077        pub get_deploy_app: Option<AppVolumes>,
1078    }
1079
1080    #[derive(cynic::QueryFragment, Debug)]
1081    #[cynic(graphql_type = "DeployApp")]
1082    pub(crate) struct AppVolumes {
1083        pub active_version: Option<AppVersionVolumes>,
1084    }
1085
1086    #[derive(cynic::QueryFragment, Debug)]
1087    #[cynic(graphql_type = "DeployAppVersion")]
1088    pub(crate) struct AppVersionVolumes {
1089        pub volumes: Option<Vec<Option<AppVersionVolume>>>,
1090    }
1091
1092    #[derive(serde::Serialize, cynic::QueryFragment, Debug)]
1093    pub struct AppVersionVolume {
1094        pub name: String,
1095        pub size: Option<BigInt>,
1096        pub used_size: Option<BigInt>,
1097        pub mount_paths: Vec<AppVersionVolumeMountPath>,
1098    }
1099
1100    #[derive(serde::Serialize, cynic::QueryFragment, Debug)]
1101    pub struct AppVersionVolumeMountPath {
1102        pub path: String,
1103    }
1104
1105    #[derive(cynic::QueryVariables, Debug)]
1106    pub(crate) struct GetAppDatabasesVars {
1107        pub name: String,
1108        pub owner: String,
1109        pub after: Option<String>,
1110    }
1111
1112    #[derive(cynic::QueryFragment, Debug)]
1113    #[cynic(graphql_type = "Query", variables = "GetAppDatabasesVars")]
1114    pub(crate) struct GetAppDatabases {
1115        #[arguments(owner: $owner, name: $name)]
1116        pub get_deploy_app: Option<AppDatabases>,
1117    }
1118
1119    #[derive(cynic::QueryFragment, Debug)]
1120    pub(crate) struct AppDatabaseConnection {
1121        pub page_info: PageInfo,
1122        pub edges: Vec<Option<AppDatabaseEdge>>,
1123    }
1124
1125    #[derive(cynic::QueryFragment, Debug)]
1126    #[cynic(graphql_type = "DeployApp")]
1127    pub(crate) struct AppDatabases {
1128        pub databases: AppDatabaseConnection,
1129    }
1130
1131    #[derive(cynic::QueryFragment, Debug)]
1132    pub(crate) struct AppDatabaseEdge {
1133        pub node: Option<AppDatabase>,
1134    }
1135
1136    #[derive(serde::Serialize, cynic::QueryFragment, Debug)]
1137    pub struct AppDatabase {
1138        pub id: cynic::Id,
1139        pub name: String,
1140        pub created_at: DateTime,
1141        pub updated_at: DateTime,
1142        pub deleted_at: Option<DateTime>,
1143        pub username: String,
1144        pub db_explorer_url: Option<String>,
1145        pub host: String,
1146        pub port: String,
1147        pub password: Option<String>,
1148    }
1149
1150    #[derive(cynic::QueryFragment, Debug)]
1151    pub struct RegisterDomainPayload {
1152        pub success: bool,
1153        pub domain: Option<DnsDomain>,
1154    }
1155
1156    #[derive(cynic::QueryVariables, Debug)]
1157    pub struct RegisterDomainVars {
1158        pub name: String,
1159        pub namespace: Option<String>,
1160        pub import_records: Option<bool>,
1161    }
1162
1163    #[derive(cynic::QueryFragment, Debug)]
1164    #[cynic(graphql_type = "Mutation", variables = "RegisterDomainVars")]
1165    pub struct RegisterDomain {
1166        #[arguments(input: {name: $name, importRecords: $import_records, namespace: $namespace})]
1167        pub register_domain: Option<RegisterDomainPayload>,
1168    }
1169
1170    #[derive(cynic::QueryVariables, Debug)]
1171    pub struct UpsertDomainFromZoneFileVars {
1172        pub zone_file: String,
1173        pub delete_missing_records: Option<bool>,
1174    }
1175
1176    #[derive(cynic::QueryFragment, Debug)]
1177    #[cynic(graphql_type = "Mutation", variables = "UpsertDomainFromZoneFileVars")]
1178    pub struct UpsertDomainFromZoneFile {
1179        #[arguments(input: {zoneFile: $zone_file, deleteMissingRecords: $delete_missing_records})]
1180        pub upsert_domain_from_zone_file: Option<UpsertDomainFromZoneFilePayload>,
1181    }
1182
1183    #[derive(cynic::QueryFragment, Debug)]
1184    pub struct UpsertDomainFromZoneFilePayload {
1185        pub success: bool,
1186        pub domain: DnsDomain,
1187    }
1188
1189    #[derive(cynic::QueryVariables, Debug)]
1190    pub struct CreateNamespaceVars {
1191        pub input: CreateNamespaceInput,
1192    }
1193
1194    #[derive(cynic::QueryFragment, Debug)]
1195    #[cynic(graphql_type = "Mutation", variables = "CreateNamespaceVars")]
1196    pub struct CreateNamespace {
1197        #[arguments(input: $input)]
1198        pub create_namespace: Option<CreateNamespacePayload>,
1199    }
1200
1201    #[derive(cynic::QueryFragment, Debug)]
1202    pub struct CreateNamespacePayload {
1203        pub namespace: Namespace,
1204    }
1205
1206    #[derive(cynic::InputObject, Debug)]
1207    pub struct CreateNamespaceInput {
1208        pub name: String,
1209        pub display_name: Option<String>,
1210        pub description: Option<String>,
1211        pub avatar: Option<String>,
1212        pub client_mutation_id: Option<String>,
1213    }
1214
1215    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1216    pub struct NamespaceEdge {
1217        pub node: Option<Namespace>,
1218    }
1219
1220    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1221    pub struct NamespaceConnection {
1222        pub edges: Vec<Option<NamespaceEdge>>,
1223    }
1224
1225    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1226    pub struct Namespace {
1227        pub id: cynic::Id,
1228        pub name: String,
1229        pub global_name: String,
1230    }
1231
1232    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1233    pub struct DeployApp {
1234        pub id: cynic::Id,
1235        pub name: String,
1236        pub created_at: DateTime,
1237        pub updated_at: DateTime,
1238        pub description: Option<String>,
1239        pub active_version: Option<DeployAppVersion>,
1240        pub admin_url: String,
1241        pub owner: Owner,
1242        pub url: String,
1243        pub permalink: String,
1244        pub deleted: bool,
1245        pub aliases: AppAliasConnection,
1246        pub s3_url: Option<Url>,
1247        pub will_perish_at: Option<DateTime>,
1248        pub perish_reason: Option<DeployDeployAppPerishReasonChoices>,
1249    }
1250
1251    #[derive(cynic::Enum, Clone, Copy, Debug, PartialEq, Eq)]
1252    pub enum CronJobKind {
1253        #[cynic(rename = "FETCH")]
1254        Fetch,
1255        #[cynic(rename = "EXECUTE")]
1256        Execute,
1257    }
1258
1259    #[derive(cynic::Enum, Clone, Copy, Debug)]
1260    pub enum CronJobSource {
1261        #[cynic(rename = "CONFIG")]
1262        Config,
1263        #[cynic(rename = "API")]
1264        Api,
1265        #[cynic(rename = "PROVISIONED")]
1266        Provisioned,
1267    }
1268
1269    #[derive(cynic::Enum, Clone, Copy, Debug)]
1270    pub enum CronJobInvocationStatus {
1271        #[cynic(rename = "PENDING")]
1272        Pending,
1273        #[cynic(rename = "RUNNING")]
1274        Running,
1275        #[cynic(rename = "SUCCESS")]
1276        Success,
1277        #[cynic(rename = "FAILURE")]
1278        Failure,
1279    }
1280
1281    #[derive(cynic::QueryVariables, Debug, Clone)]
1282    pub struct GetAppCronJobsVars {
1283        pub owner: String,
1284        pub name: String,
1285        pub after: Option<String>,
1286        pub first: Option<i32>,
1287    }
1288
1289    #[derive(cynic::QueryFragment, Debug, Clone)]
1290    #[cynic(graphql_type = "Query", variables = "GetAppCronJobsVars")]
1291    pub struct GetAppCronJobs {
1292        #[arguments(owner: $owner, name: $name)]
1293        pub get_deploy_app: Option<DeployAppCronJobs>,
1294    }
1295
1296    #[derive(cynic::QueryFragment, Debug, Clone)]
1297    #[cynic(graphql_type = "DeployApp", variables = "GetAppCronJobsVars")]
1298    pub struct DeployAppCronJobs {
1299        #[arguments(first: $first, after: $after)]
1300        pub cron_jobs: CronJobConnection,
1301    }
1302
1303    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1304    pub struct CronJobConnection {
1305        pub page_info: PageInfo,
1306        pub edges: Vec<Option<CronJobEdge>>,
1307    }
1308
1309    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1310    pub struct CronJobEdge {
1311        pub cursor: String,
1312        pub node: Option<CronJob>,
1313    }
1314
1315    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1316    pub struct CronJob {
1317        pub id: cynic::Id,
1318        pub name: String,
1319        pub schedule: String,
1320        pub kind: CronJobKind,
1321        pub source: CronJobSource,
1322        pub enabled: bool,
1323        pub is_managed: bool,
1324        pub timeout: Option<String>,
1325        pub max_schedule_drift: Option<String>,
1326        pub max_retries: Option<i32>,
1327        pub created_at: DateTime,
1328        pub updated_at: DateTime,
1329        pub target: CronJobTarget,
1330    }
1331
1332    #[derive(cynic::QueryVariables, Debug, Clone)]
1333    pub struct ToggleCronJobVars {
1334        pub cron_job_id: cynic::Id,
1335        pub enabled: bool,
1336    }
1337
1338    #[derive(cynic::QueryFragment, Debug, Clone)]
1339    #[cynic(graphql_type = "Mutation", variables = "ToggleCronJobVars")]
1340    pub struct ToggleCronJob {
1341        #[arguments(input: { cronJobId: $cron_job_id, enabled: $enabled })]
1342        pub toggle_cron_job: Option<ToggleCronJobPayload>,
1343    }
1344
1345    #[derive(cynic::QueryFragment, Debug, Clone)]
1346    pub struct ToggleCronJobPayload {
1347        pub cron_job: CronJob,
1348    }
1349
1350    #[derive(cynic::InlineFragments, Debug, Clone, Serialize)]
1351    #[cynic(graphql_type = "CronJobTarget")]
1352    pub enum CronJobTarget {
1353        FetchCronJobTarget(FetchCronJobTarget),
1354        ExecuteCronJobTarget(ExecuteCronJobTarget),
1355        #[cynic(fallback)]
1356        Unknown,
1357    }
1358
1359    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1360    pub struct FetchCronJobTarget {
1361        pub body: Option<String>,
1362        pub headers: GenericScalar,
1363        pub method: String,
1364        pub path: String,
1365        pub expect_body_includes: Option<String>,
1366        pub expect_body_regex: Option<String>,
1367        pub expect_status_codes: Option<GenericScalar>,
1368    }
1369
1370    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1371    pub struct ExecuteCronJobTarget {
1372        pub package_name: Option<String>,
1373        pub command: Option<String>,
1374        pub cli_args: GenericScalar,
1375        pub env: GenericScalar,
1376    }
1377
1378    #[derive(cynic::QueryVariables, Debug, Clone)]
1379    pub struct GetCronJobInvocationsVars {
1380        pub owner: String,
1381        pub name: String,
1382        pub cron_after: Option<String>,
1383        pub cron_first: Option<i32>,
1384        pub invocation_start: Option<DateTime>,
1385        pub invocation_end: Option<DateTime>,
1386        pub invocation_after: Option<String>,
1387        pub invocation_first: Option<i32>,
1388    }
1389
1390    #[derive(cynic::QueryVariables, Debug, Clone)]
1391    pub struct GetCronJobInvocationsByIdVars {
1392        pub id: cynic::Id,
1393        pub invocation_start: Option<DateTime>,
1394        pub invocation_end: Option<DateTime>,
1395        pub invocation_after: Option<String>,
1396        pub invocation_first: Option<i32>,
1397    }
1398
1399    #[derive(cynic::QueryVariables, Debug, Clone)]
1400    pub struct GetCronJobInvocationLogsVars {
1401        pub owner: String,
1402        pub name: String,
1403        pub cron_after: Option<String>,
1404        pub cron_first: Option<i32>,
1405        pub invocation_start: Option<DateTime>,
1406        pub invocation_end: Option<DateTime>,
1407        pub invocation_after: Option<String>,
1408        pub invocation_first: Option<i32>,
1409        pub log_first: Option<i32>,
1410    }
1411
1412    #[derive(cynic::QueryVariables, Debug, Clone)]
1413    pub struct GetCronJobInvocationLogsByIdVars {
1414        pub id: cynic::Id,
1415        pub invocation_start: Option<DateTime>,
1416        pub invocation_end: Option<DateTime>,
1417        pub invocation_after: Option<String>,
1418        pub invocation_first: Option<i32>,
1419        pub log_first: Option<i32>,
1420    }
1421
1422    #[derive(cynic::QueryFragment, Debug, Clone)]
1423    #[cynic(graphql_type = "Query", variables = "GetCronJobInvocationsByIdVars")]
1424    pub struct GetCronJobInvocationsById {
1425        #[arguments(id: $id)]
1426        #[cynic(rename = "node")]
1427        pub cron_job: Option<NodeCronJobWithInvocations>,
1428    }
1429
1430    #[derive(cynic::QueryFragment, Debug, Clone)]
1431    #[cynic(graphql_type = "Query", variables = "GetCronJobInvocationLogsVars")]
1432    pub struct GetCronJobInvocationLogs {
1433        #[arguments(owner: $owner, name: $name)]
1434        pub get_deploy_app: Option<DeployAppCronJobInvocationLogs>,
1435    }
1436
1437    #[derive(cynic::QueryFragment, Debug, Clone)]
1438    #[cynic(graphql_type = "Query", variables = "GetCronJobInvocationLogsByIdVars")]
1439    pub struct GetCronJobInvocationLogsById {
1440        #[arguments(id: $id)]
1441        #[cynic(rename = "node")]
1442        pub cron_job: Option<NodeCronJobWithInvocationLogs>,
1443    }
1444
1445    #[derive(cynic::InlineFragments, Debug, Clone)]
1446    #[cynic(graphql_type = "Node", variables = "GetCronJobInvocationsByIdVars")]
1447    pub enum NodeCronJobWithInvocations {
1448        CronJob(CronJobWithInvocationsById),
1449        #[cynic(fallback)]
1450        Unknown,
1451    }
1452
1453    impl NodeCronJobWithInvocations {
1454        pub fn into_cron_job(self) -> Option<CronJobWithInvocationsById> {
1455            match self {
1456                Self::CronJob(cron_job) => Some(cron_job),
1457                Self::Unknown => None,
1458            }
1459        }
1460    }
1461
1462    #[derive(cynic::InlineFragments, Debug, Clone)]
1463    #[cynic(graphql_type = "Node", variables = "GetCronJobInvocationLogsByIdVars")]
1464    pub enum NodeCronJobWithInvocationLogs {
1465        CronJob(CronJobWithInvocationLogsById),
1466        #[cynic(fallback)]
1467        Unknown,
1468    }
1469
1470    impl NodeCronJobWithInvocationLogs {
1471        pub fn into_cron_job(self) -> Option<CronJobWithInvocationLogsById> {
1472            match self {
1473                Self::CronJob(cron_job) => Some(cron_job),
1474                Self::Unknown => None,
1475            }
1476        }
1477    }
1478
1479    #[derive(cynic::QueryFragment, Debug, Clone)]
1480    #[cynic(graphql_type = "Query", variables = "GetCronJobInvocationsVars")]
1481    pub struct GetCronJobInvocations {
1482        #[arguments(owner: $owner, name: $name)]
1483        pub get_deploy_app: Option<DeployAppCronJobInvocations>,
1484    }
1485
1486    #[derive(cynic::QueryFragment, Debug, Clone)]
1487    #[cynic(graphql_type = "DeployApp", variables = "GetCronJobInvocationsVars")]
1488    pub struct DeployAppCronJobInvocations {
1489        #[arguments(first: $cron_first, after: $cron_after)]
1490        pub cron_jobs: CronJobConnectionForInvocations,
1491    }
1492
1493    #[derive(cynic::QueryFragment, Debug, Clone)]
1494    #[cynic(graphql_type = "DeployApp", variables = "GetCronJobInvocationLogsVars")]
1495    pub struct DeployAppCronJobInvocationLogs {
1496        #[arguments(first: $cron_first, after: $cron_after)]
1497        pub cron_jobs: CronJobConnectionForInvocationLogs,
1498    }
1499
1500    #[derive(cynic::QueryFragment, Debug, Clone)]
1501    #[cynic(
1502        graphql_type = "CronJobConnection",
1503        variables = "GetCronJobInvocationsVars"
1504    )]
1505    pub struct CronJobConnectionForInvocations {
1506        pub page_info: PageInfo,
1507        pub nodes: Vec<CronJobWithInvocations>,
1508    }
1509
1510    #[derive(cynic::QueryFragment, Debug, Clone)]
1511    #[cynic(
1512        graphql_type = "CronJobConnection",
1513        variables = "GetCronJobInvocationLogsVars"
1514    )]
1515    pub struct CronJobConnectionForInvocationLogs {
1516        pub page_info: PageInfo,
1517        pub nodes: Vec<CronJobWithInvocationLogs>,
1518    }
1519
1520    #[derive(cynic::QueryFragment, Debug, Clone)]
1521    #[cynic(graphql_type = "CronJob", variables = "GetCronJobInvocationsVars")]
1522    pub struct CronJobWithInvocations {
1523        pub id: cynic::Id,
1524        pub name: String,
1525        #[arguments(first: $invocation_first, after: $invocation_after, start: $invocation_start, end: $invocation_end)]
1526        pub invocations: CronJobInvocationConnection,
1527    }
1528
1529    #[derive(cynic::QueryFragment, Debug, Clone)]
1530    #[cynic(graphql_type = "CronJob", variables = "GetCronJobInvocationsByIdVars")]
1531    pub struct CronJobWithInvocationsById {
1532        pub id: cynic::Id,
1533        pub name: String,
1534        #[arguments(first: $invocation_first, after: $invocation_after, start: $invocation_start, end: $invocation_end)]
1535        pub invocations: CronJobInvocationConnection,
1536    }
1537
1538    #[derive(cynic::QueryFragment, Debug, Clone)]
1539    #[cynic(graphql_type = "CronJob", variables = "GetCronJobInvocationLogsVars")]
1540    pub struct CronJobWithInvocationLogs {
1541        pub id: cynic::Id,
1542        pub name: String,
1543        #[arguments(first: $invocation_first, after: $invocation_after, start: $invocation_start, end: $invocation_end)]
1544        pub invocations: CronJobInvocationLogsConnection,
1545    }
1546
1547    #[derive(cynic::QueryFragment, Debug, Clone)]
1548    #[cynic(
1549        graphql_type = "CronJob",
1550        variables = "GetCronJobInvocationLogsByIdVars"
1551    )]
1552    pub struct CronJobWithInvocationLogsById {
1553        pub id: cynic::Id,
1554        pub name: String,
1555        #[arguments(first: $invocation_first, after: $invocation_after, start: $invocation_start, end: $invocation_end)]
1556        pub invocations: CronJobInvocationLogsConnectionById,
1557    }
1558
1559    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1560    pub struct CronJobInvocationConnection {
1561        pub page_info: PageInfo,
1562        pub edges: Vec<Option<CronJobInvocationEdge>>,
1563    }
1564
1565    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1566    pub struct CronJobInvocationEdge {
1567        pub cursor: String,
1568        pub node: Option<CronJobInvocation>,
1569    }
1570
1571    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1572    pub struct CronJobInvocation {
1573        pub id: cynic::Id,
1574        pub edge_job_id: String,
1575        pub status: Option<CronJobInvocationStatus>,
1576        pub scheduled_at: Option<DateTime>,
1577        pub started_at: Option<DateTime>,
1578        pub finished_at: Option<DateTime>,
1579        pub duration_ms: Option<i32>,
1580        pub retry_attempts: Option<i32>,
1581        pub error_summary: Option<String>,
1582        pub result: Option<CronJobInvocationResult>,
1583    }
1584
1585    #[derive(cynic::QueryFragment, Debug, Clone)]
1586    #[cynic(
1587        graphql_type = "CronJobInvocationConnection",
1588        variables = "GetCronJobInvocationLogsVars"
1589    )]
1590    pub struct CronJobInvocationLogsConnection {
1591        pub page_info: PageInfo,
1592        pub edges: Vec<Option<CronJobInvocationLogsEdge>>,
1593    }
1594
1595    #[derive(cynic::QueryFragment, Debug, Clone)]
1596    #[cynic(
1597        graphql_type = "CronJobInvocationEdge",
1598        variables = "GetCronJobInvocationLogsVars"
1599    )]
1600    pub struct CronJobInvocationLogsEdge {
1601        pub node: Option<CronJobInvocationWithLogs>,
1602    }
1603
1604    #[derive(cynic::QueryFragment, Debug, Clone)]
1605    #[cynic(
1606        graphql_type = "CronJobInvocationConnection",
1607        variables = "GetCronJobInvocationLogsByIdVars"
1608    )]
1609    pub struct CronJobInvocationLogsConnectionById {
1610        pub page_info: PageInfo,
1611        pub edges: Vec<Option<CronJobInvocationLogsEdgeById>>,
1612    }
1613
1614    #[derive(cynic::QueryFragment, Debug, Clone)]
1615    #[cynic(
1616        graphql_type = "CronJobInvocationEdge",
1617        variables = "GetCronJobInvocationLogsByIdVars"
1618    )]
1619    pub struct CronJobInvocationLogsEdgeById {
1620        pub node: Option<CronJobInvocationWithLogsById>,
1621    }
1622
1623    #[derive(cynic::QueryFragment, Debug, Clone)]
1624    #[cynic(
1625        graphql_type = "CronJobInvocation",
1626        variables = "GetCronJobInvocationLogsVars"
1627    )]
1628    pub struct CronJobInvocationWithLogs {
1629        pub id: cynic::Id,
1630        pub edge_job_id: String,
1631        #[arguments(first: $log_first)]
1632        pub logs: CronJobLogConnection,
1633    }
1634
1635    #[derive(cynic::QueryFragment, Debug, Clone)]
1636    #[cynic(
1637        graphql_type = "CronJobInvocation",
1638        variables = "GetCronJobInvocationLogsByIdVars"
1639    )]
1640    pub struct CronJobInvocationWithLogsById {
1641        pub id: cynic::Id,
1642        pub edge_job_id: String,
1643        #[arguments(first: $log_first)]
1644        pub logs: CronJobLogConnection,
1645    }
1646
1647    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1648    #[cynic(graphql_type = "LogConnection")]
1649    pub struct CronJobLogConnection {
1650        pub edges: Vec<Option<CronJobLogEdge>>,
1651    }
1652
1653    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1654    #[cynic(graphql_type = "LogEdge")]
1655    pub struct CronJobLogEdge {
1656        pub node: Option<CronJobLog>,
1657    }
1658
1659    #[derive(cynic::QueryFragment, Debug, Clone, Serialize, PartialEq)]
1660    #[cynic(graphql_type = "Log")]
1661    pub struct CronJobLog {
1662        pub message: String,
1663        pub datetime: DateTime,
1664        pub stream: Option<LogStream>,
1665    }
1666
1667    #[derive(cynic::InlineFragments, Debug, Clone, Serialize)]
1668    #[cynic(graphql_type = "CronJobInvocationResult")]
1669    pub enum CronJobInvocationResult {
1670        ExecuteCronJobInvocationResult(ExecuteCronJobInvocationResult),
1671        FetchCronJobInvocationResult(FetchCronJobInvocationResult),
1672        #[cynic(fallback)]
1673        Unknown,
1674    }
1675
1676    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1677    pub struct ExecuteCronJobInvocationResult {
1678        pub exit_code: Option<i32>,
1679        pub instance_id: Option<String>,
1680    }
1681
1682    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1683    pub struct FetchCronJobInvocationResult {
1684        pub status_code: Option<i32>,
1685        pub request_id: Option<String>,
1686    }
1687
1688    #[derive(cynic::Enum, Clone, Copy, Debug)]
1689    pub enum DeployDeployAppPerishReasonChoices {
1690        #[cynic(rename = "USER_PENDING_VERIFICATION")]
1691        UserPendingVerification,
1692        #[cynic(rename = "USER_REQUESTED")]
1693        UserRequested,
1694        #[cynic(rename = "APP_UNCLAIMED")]
1695        AppUnclaimed,
1696    }
1697
1698    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1699    pub struct AppAliasConnection {
1700        pub page_info: PageInfo,
1701        pub edges: Vec<Option<AppAliasEdge>>,
1702    }
1703
1704    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1705    pub struct AppAliasEdge {
1706        pub node: Option<AppAlias>,
1707    }
1708
1709    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1710    pub struct AppAlias {
1711        pub name: String,
1712        pub hostname: String,
1713    }
1714
1715    #[derive(cynic::QueryVariables, Debug, Clone)]
1716    pub struct DeleteAppVars {
1717        pub app_id: cynic::Id,
1718    }
1719
1720    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1721    pub struct DeleteAppPayload {
1722        pub success: bool,
1723    }
1724
1725    #[derive(cynic::QueryFragment, Debug)]
1726    #[cynic(graphql_type = "Mutation", variables = "DeleteAppVars")]
1727    pub struct DeleteApp {
1728        #[arguments(input: { id: $app_id })]
1729        pub delete_app: Option<DeleteAppPayload>,
1730    }
1731
1732    #[derive(cynic::Enum, Clone, Copy, Debug)]
1733    pub enum DeployAppVersionsSortBy {
1734        Newest,
1735        Oldest,
1736    }
1737
1738    #[derive(cynic::QueryVariables, Debug, Clone)]
1739    pub struct GetDeployAppVersionsVars {
1740        pub owner: String,
1741        pub name: String,
1742
1743        pub offset: Option<i32>,
1744        pub before: Option<String>,
1745        pub after: Option<String>,
1746        pub first: Option<i32>,
1747        pub last: Option<i32>,
1748        pub sort_by: Option<DeployAppVersionsSortBy>,
1749    }
1750
1751    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1752    #[cynic(graphql_type = "Query", variables = "GetDeployAppVersionsVars")]
1753    pub struct GetDeployAppVersions {
1754        #[arguments(owner: $owner, name: $name)]
1755        pub get_deploy_app: Option<DeployAppVersions>,
1756    }
1757
1758    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1759    #[cynic(graphql_type = "DeployApp", variables = "GetDeployAppVersionsVars")]
1760    pub struct DeployAppVersions {
1761        #[arguments(
1762            first: $first,
1763            last: $last,
1764            before: $before,
1765            after: $after,
1766            offset: $offset,
1767            sortBy: $sort_by
1768        )]
1769        pub versions: DeployAppVersionConnection,
1770    }
1771
1772    #[derive(cynic::QueryVariables, Debug, Clone)]
1773    pub struct GetDeployAppVersionsByIdVars {
1774        pub id: cynic::Id,
1775
1776        pub offset: Option<i32>,
1777        pub before: Option<String>,
1778        pub after: Option<String>,
1779        pub first: Option<i32>,
1780        pub last: Option<i32>,
1781        pub sort_by: Option<DeployAppVersionsSortBy>,
1782    }
1783
1784    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1785    #[cynic(graphql_type = "DeployApp", variables = "GetDeployAppVersionsByIdVars")]
1786    pub struct DeployAppVersionsById {
1787        #[arguments(
1788            first: $first,
1789            last: $last,
1790            before: $before,
1791            after: $after,
1792            offset: $offset,
1793            sortBy: $sort_by
1794        )]
1795        pub versions: DeployAppVersionConnection,
1796    }
1797
1798    #[derive(cynic::QueryFragment, Debug, Clone)]
1799    #[cynic(graphql_type = "Query", variables = "GetDeployAppVersionsByIdVars")]
1800    pub struct GetDeployAppVersionsById {
1801        #[arguments(id: $id)]
1802        pub node: Option<NodeDeployAppVersions>,
1803    }
1804
1805    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1806    #[cynic(graphql_type = "DeployApp")]
1807    pub struct SparseDeployApp {
1808        pub id: cynic::Id,
1809    }
1810
1811    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1812    pub struct DeployAppVersion {
1813        pub id: cynic::Id,
1814        pub created_at: DateTime,
1815        pub updated_at: DateTime,
1816        pub version: String,
1817        pub description: Option<String>,
1818        pub yaml_config: String,
1819        pub user_yaml_config: String,
1820        pub config: String,
1821        pub json_config: String,
1822        pub url: String,
1823        pub disabled_at: Option<DateTime>,
1824        pub disabled_reason: Option<String>,
1825
1826        pub app: Option<SparseDeployApp>,
1827    }
1828
1829    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1830    pub struct DeployAppVersionConnection {
1831        pub page_info: PageInfo,
1832        pub edges: Vec<Option<DeployAppVersionEdge>>,
1833    }
1834
1835    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1836    pub struct DeployAppVersionEdge {
1837        pub node: Option<DeployAppVersion>,
1838        pub cursor: String,
1839    }
1840
1841    #[derive(cynic::QueryFragment, Debug)]
1842    pub struct DeployAppConnection {
1843        pub page_info: PageInfo,
1844        pub edges: Vec<Option<DeployAppEdge>>,
1845    }
1846
1847    #[derive(cynic::QueryFragment, Debug)]
1848    pub struct DeployAppEdge {
1849        pub node: Option<DeployApp>,
1850        pub cursor: String,
1851    }
1852
1853    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1854    pub struct PageInfo {
1855        pub has_next_page: bool,
1856        pub end_cursor: Option<String>,
1857    }
1858
1859    #[derive(cynic::QueryVariables, Debug)]
1860    pub struct GetNamespaceVars {
1861        pub name: String,
1862    }
1863
1864    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1865    pub struct MarkAppVersionAsActivePayload {
1866        pub app: DeployApp,
1867    }
1868
1869    #[derive(cynic::InputObject, Debug)]
1870    pub struct MarkAppVersionAsActiveInput {
1871        pub app_version: cynic::Id,
1872    }
1873
1874    #[derive(cynic::QueryVariables, Debug)]
1875    pub struct MarkAppVersionAsActiveVars {
1876        pub input: MarkAppVersionAsActiveInput,
1877    }
1878
1879    #[derive(cynic::QueryFragment, Debug)]
1880    #[cynic(graphql_type = "Mutation", variables = "MarkAppVersionAsActiveVars")]
1881    pub struct MarkAppVersionAsActive {
1882        #[arguments(input: $input)]
1883        pub mark_app_version_as_active: Option<MarkAppVersionAsActivePayload>,
1884    }
1885
1886    #[derive(cynic::QueryFragment, Debug)]
1887    #[cynic(graphql_type = "Query", variables = "GetNamespaceVars")]
1888    pub struct GetNamespace {
1889        #[arguments(name: $name)]
1890        pub get_namespace: Option<Namespace>,
1891    }
1892
1893    #[derive(cynic::QueryVariables, Debug)]
1894    pub struct GetNamespaceAppsVars {
1895        pub name: String,
1896        pub after: Option<String>,
1897        pub sort: Option<DeployAppsSortBy>,
1898    }
1899
1900    #[derive(cynic::QueryFragment, Debug)]
1901    #[cynic(graphql_type = "Query", variables = "GetNamespaceAppsVars")]
1902    pub struct GetNamespaceApps {
1903        #[arguments(name: $name)]
1904        pub get_namespace: Option<NamespaceWithApps>,
1905    }
1906
1907    #[derive(cynic::QueryFragment, Debug)]
1908    #[cynic(graphql_type = "Namespace")]
1909    #[cynic(variables = "GetNamespaceAppsVars")]
1910    pub struct NamespaceWithApps {
1911        pub id: cynic::Id,
1912        pub name: String,
1913        #[arguments(after: $after, sortBy: $sort)]
1914        pub apps: DeployAppConnection,
1915    }
1916
1917    #[derive(cynic::QueryVariables, Debug)]
1918    pub struct RedeployActiveAppVariables {
1919        pub id: cynic::Id,
1920    }
1921
1922    #[derive(cynic::QueryFragment, Debug)]
1923    #[cynic(graphql_type = "Mutation", variables = "RedeployActiveAppVariables")]
1924    pub struct RedeployActiveApp {
1925        #[arguments(input: { id: $id })]
1926        pub redeploy_active_version: Option<RedeployActiveVersionPayload>,
1927    }
1928
1929    #[derive(cynic::QueryFragment, Debug)]
1930    pub struct RedeployActiveVersionPayload {
1931        pub app: DeployApp,
1932    }
1933
1934    #[derive(cynic::QueryVariables, Debug)]
1935    pub struct GetAppDeploymentsVariables {
1936        pub after: Option<String>,
1937        pub first: Option<i32>,
1938        pub name: String,
1939        pub offset: Option<i32>,
1940        pub owner: String,
1941    }
1942
1943    #[derive(cynic::QueryFragment, Debug)]
1944    #[cynic(graphql_type = "Query", variables = "GetAppDeploymentsVariables")]
1945    pub struct GetAppDeployments {
1946        #[arguments(owner: $owner, name: $name)]
1947        pub get_deploy_app: Option<DeployAppDeployments>,
1948    }
1949
1950    #[derive(cynic::QueryFragment, Debug)]
1951    #[cynic(graphql_type = "DeployApp", variables = "GetAppDeploymentsVariables")]
1952    pub struct DeployAppDeployments {
1953        // FIXME: add $offset, $after, currently causes an error from the backend
1954        // #[arguments(first: $first, after: $after, offset: $offset)]
1955        pub deployments: Option<DeploymentConnection>,
1956    }
1957
1958    #[derive(cynic::QueryFragment, Debug)]
1959    pub struct DeploymentConnection {
1960        pub page_info: PageInfo,
1961        pub edges: Vec<Option<DeploymentEdge>>,
1962    }
1963
1964    #[derive(cynic::QueryFragment, Debug)]
1965    pub struct DeploymentEdge {
1966        pub node: Option<Deployment>,
1967    }
1968
1969    #[allow(clippy::large_enum_variant)]
1970    #[derive(cynic::InlineFragments, Debug, Clone, Serialize)]
1971    pub enum Deployment {
1972        AutobuildRepository(AutobuildRepository),
1973        NakedDeployment(NakedDeployment),
1974        #[cynic(fallback)]
1975        Other,
1976    }
1977
1978    #[derive(cynic::QueryFragment, serde::Serialize, Debug, Clone)]
1979    pub struct NakedDeployment {
1980        pub id: cynic::Id,
1981        pub created_at: DateTime,
1982        pub updated_at: DateTime,
1983        pub app_version: Option<DeployAppVersion>,
1984    }
1985
1986    #[derive(cynic::QueryFragment, serde::Serialize, Debug, Clone)]
1987    pub struct AutobuildRepository {
1988        pub id: cynic::Id,
1989        pub build_id: Uuid,
1990        pub created_at: DateTime,
1991        pub updated_at: DateTime,
1992        pub status: StatusEnum,
1993        pub log_url: Option<String>,
1994        pub repo_url: String,
1995    }
1996
1997    #[derive(cynic::Enum, Clone, Copy, Debug)]
1998    pub enum StatusEnum {
1999        Success,
2000        Working,
2001        Failed,
2002        Queued,
2003        Timeout,
2004        InternalError,
2005        Cancelled,
2006        Running,
2007    }
2008
2009    impl StatusEnum {
2010        pub fn as_str(&self) -> &'static str {
2011            match self {
2012                Self::Success => "success",
2013                Self::Working => "working",
2014                Self::Failed => "failed",
2015                Self::Queued => "queued",
2016                Self::Timeout => "timeout",
2017                Self::InternalError => "internal_error",
2018                Self::Cancelled => "cancelled",
2019                Self::Running => "running",
2020            }
2021        }
2022    }
2023
2024    #[derive(cynic::QueryVariables, Debug)]
2025    pub struct AutobuildConfigForZipUploadVariables<'a> {
2026        pub upload_url: &'a str,
2027    }
2028
2029    #[derive(cynic::QueryFragment, Debug)]
2030    #[cynic(
2031        graphql_type = "Mutation",
2032        variables = "AutobuildConfigForZipUploadVariables"
2033    )]
2034    pub struct AutobuildConfigForZipUpload {
2035        #[arguments(input: { uploadUrl: $upload_url })]
2036        pub autobuild_config_for_zip_upload: Option<AutobuildConfigForZipUploadPayload>,
2037    }
2038
2039    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2040    pub struct AutobuildConfigForZipUploadPayload {
2041        pub build_config: Option<BuildConfig>,
2042    }
2043
2044    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2045    pub struct BuildConfig {
2046        pub build_cmd: Option<String>,
2047        pub install_cmd: Option<String>,
2048        pub start_cmd: Option<String>,
2049        pub setup_db: bool,
2050        pub preset_name: String,
2051        pub app_name: String,
2052        pub completion_time_in_seconds: i32,
2053        pub branch: Option<String>,
2054    }
2055
2056    #[derive(cynic::InputObject, Debug, Clone)]
2057    pub struct WordpressDeploymentExtraData {
2058        pub site_name: String,
2059        pub admin_username: String,
2060        pub admin_password: String,
2061        pub admin_email: String,
2062        pub language: Option<String>,
2063    }
2064
2065    #[derive(cynic::InputObject, Debug, Clone)]
2066    pub struct AutobuildDeploymentExtraData {
2067        pub wordpress: Option<WordpressDeploymentExtraData>,
2068    }
2069
2070    #[derive(cynic::InputObject, Debug, Clone)]
2071    pub struct JobDefinitionInput {
2072        pub name: Option<String>,
2073        pub package: Option<String>,
2074        pub command: String,
2075        pub cli_args: Option<Vec<Option<String>>>,
2076        pub env: Option<Vec<Option<String>>>,
2077        pub timeout: Option<String>,
2078    }
2079
2080    #[derive(cynic::QueryVariables, Debug, Clone)]
2081    pub struct DeployViaAutobuildVars {
2082        pub repo_url: Option<String>,
2083        pub upload_url: Option<String>,
2084        pub app_name: Option<String>,
2085        pub app_id: Option<cynic::Id>,
2086        pub owner: Option<String>,
2087        pub build_cmd: Option<String>,
2088        pub install_cmd: Option<String>,
2089        pub enable_database: Option<bool>,
2090        pub secrets: Option<Vec<SecretInput>>,
2091        pub extra_data: Option<AutobuildDeploymentExtraData>,
2092        pub params: Option<AutobuildDeploymentExtraData>,
2093        pub managed: Option<bool>,
2094        pub kind: Option<String>,
2095        pub wait_for_screenshot_generation: Option<bool>,
2096        pub region: Option<String>,
2097        pub branch: Option<String>,
2098        pub allow_existing_app: Option<bool>,
2099        pub jobs: Option<Vec<JobDefinitionInput>>,
2100        pub domains: Option<Vec<Option<String>>>,
2101        pub client_mutation_id: Option<String>,
2102    }
2103
2104    #[derive(cynic::QueryFragment, Debug)]
2105    #[cynic(graphql_type = "Mutation", variables = "DeployViaAutobuildVars")]
2106    pub struct DeployViaAutobuild {
2107        #[arguments(input: { repoUrl: $repo_url, uploadUrl: $upload_url, appName: $app_name, appId: $app_id, owner: $owner, buildCmd: $build_cmd, installCmd: $install_cmd, enableDatabase: $enable_database, secrets: $secrets, extraData: $extra_data, params: $params, managed: $managed, kind: $kind, waitForScreenshotGeneration: $wait_for_screenshot_generation, region: $region, branch: $branch, allowExistingApp: $allow_existing_app, jobs: $jobs, domains: $domains, clientMutationId: $client_mutation_id })]
2108        pub deploy_via_autobuild: Option<DeployViaAutobuildPayload>,
2109    }
2110
2111    #[derive(cynic::QueryFragment, Debug)]
2112    pub struct DeployViaAutobuildPayload {
2113        pub success: bool,
2114        pub build_id: Uuid,
2115    }
2116
2117    #[derive(cynic::Scalar, Debug, Clone)]
2118    #[cynic(graphql_type = "UUID")]
2119    pub struct Uuid(pub String);
2120
2121    #[derive(cynic::QueryVariables, Debug)]
2122    pub struct PublishDeployAppVars {
2123        pub config: String,
2124        pub name: cynic::Id,
2125        pub owner: Option<cynic::Id>,
2126        pub make_default: Option<bool>,
2127    }
2128
2129    #[derive(cynic::QueryFragment, Debug)]
2130    #[cynic(graphql_type = "Mutation", variables = "PublishDeployAppVars")]
2131    pub struct PublishDeployApp {
2132        #[arguments(input: { config: { yamlConfig: $config }, name: $name, owner: $owner, makeDefault: $make_default })]
2133        pub publish_deploy_app: Option<PublishDeployAppPayload>,
2134    }
2135
2136    #[derive(cynic::QueryFragment, Debug)]
2137    pub struct PublishDeployAppPayload {
2138        pub deploy_app_version: DeployAppVersion,
2139    }
2140
2141    #[derive(cynic::QueryVariables, Debug)]
2142    pub struct GenerateDeployTokenVars {
2143        pub app_version_id: String,
2144    }
2145
2146    #[derive(cynic::QueryFragment, Debug)]
2147    #[cynic(graphql_type = "Mutation", variables = "GenerateDeployTokenVars")]
2148    pub struct GenerateDeployToken {
2149        #[arguments(input: { deployConfigVersionId: $app_version_id })]
2150        pub generate_deploy_token: Option<GenerateDeployTokenPayload>,
2151    }
2152
2153    #[derive(cynic::QueryFragment, Debug)]
2154    pub struct GenerateDeployTokenPayload {
2155        pub token: String,
2156    }
2157
2158    #[derive(cynic::Enum, Clone, Copy, Debug, PartialEq)]
2159    pub enum LogStream {
2160        Stdout,
2161        Stderr,
2162        Runtime,
2163    }
2164
2165    #[derive(cynic::QueryVariables, Debug, Clone)]
2166    pub struct GetDeployAppLogsVars {
2167        pub name: String,
2168        pub owner: String,
2169        /// The tag associated with a particular app version. Uses the active
2170        /// version if not provided.
2171        pub version: Option<String>,
2172        /// The lower bound for log messages, in nanoseconds since the Unix
2173        /// epoch.
2174        pub starting_from: f64,
2175        /// The upper bound for log messages, in nanoseconds since the Unix
2176        /// epoch.
2177        pub until: Option<f64>,
2178        pub first: Option<i32>,
2179
2180        pub request_id: Option<String>,
2181
2182        pub instance_ids: Option<Vec<String>>,
2183
2184        pub streams: Option<Vec<LogStream>>,
2185    }
2186
2187    #[derive(cynic::QueryFragment, Debug)]
2188    #[cynic(graphql_type = "Query", variables = "GetDeployAppLogsVars")]
2189    pub struct GetDeployAppLogs {
2190        #[arguments(name: $name, owner: $owner, version: $version)]
2191        pub get_deploy_app_version: Option<DeployAppVersionLogs>,
2192    }
2193
2194    #[derive(cynic::QueryFragment, Debug)]
2195    #[cynic(graphql_type = "DeployAppVersion", variables = "GetDeployAppLogsVars")]
2196    pub struct DeployAppVersionLogs {
2197        #[arguments(startingFrom: $starting_from, until: $until, first: $first, instanceIds: $instance_ids, requestId: $request_id, streams: $streams)]
2198        pub logs: LogConnection,
2199    }
2200
2201    #[derive(cynic::QueryFragment, Debug, Clone)]
2202    pub struct LogConnection {
2203        pub edges: Vec<Option<LogEdge>>,
2204    }
2205
2206    #[derive(cynic::QueryFragment, Debug, Clone)]
2207    pub struct LogEdge {
2208        pub node: Option<Log>,
2209    }
2210
2211    #[derive(cynic::QueryFragment, Debug, Clone, serde::Serialize, PartialEq)]
2212    pub struct Log {
2213        pub message: String,
2214        /// When the message was recorded, in nanoseconds since the Unix epoch.
2215        pub timestamp: f64,
2216        pub stream: Option<LogStream>,
2217        pub instance_id: String,
2218    }
2219
2220    #[derive(cynic::Enum, Clone, Copy, Debug, PartialEq, Eq)]
2221    pub enum AutoBuildDeployAppLogKind {
2222        Log,
2223        PreparingToDeployStatus,
2224        FetchingPlanStatus,
2225        BuildStatus,
2226        DeployStatus,
2227        Complete,
2228        Failed,
2229    }
2230
2231    #[derive(cynic::QueryVariables, Debug)]
2232    pub struct AutobuildDeploymentSubscriptionVariables {
2233        pub build_id: Uuid,
2234    }
2235
2236    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2237    #[cynic(
2238        graphql_type = "Subscription",
2239        variables = "AutobuildDeploymentSubscriptionVariables"
2240    )]
2241    pub struct AutobuildDeploymentSubscription {
2242        #[arguments(buildId: $build_id)]
2243        pub autobuild_deployment: Option<AutobuildLog>,
2244    }
2245
2246    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2247    pub struct AutobuildLog {
2248        pub kind: AutoBuildDeployAppLogKind,
2249        pub message: Option<String>,
2250        pub app_version: Option<DeployAppVersion>,
2251        pub timestamp: String,
2252        pub datetime: DateTime,
2253        pub stream: Option<LogStream>,
2254    }
2255
2256    #[derive(cynic::QueryVariables, Debug)]
2257    pub struct GenerateDeployConfigTokenVars {
2258        pub input: String,
2259    }
2260    #[derive(cynic::QueryFragment, Debug)]
2261    #[cynic(graphql_type = "Mutation", variables = "GenerateDeployConfigTokenVars")]
2262    pub struct GenerateDeployConfigToken {
2263        #[arguments(input: { config: $input })]
2264        pub generate_deploy_config_token: Option<GenerateDeployConfigTokenPayload>,
2265    }
2266
2267    #[derive(cynic::QueryFragment, Debug)]
2268    pub struct GenerateDeployConfigTokenPayload {
2269        pub token: String,
2270    }
2271
2272    #[derive(cynic::QueryVariables, Debug)]
2273    pub struct GenerateSshTokenVariables {
2274        pub app_id: Option<cynic::Id>,
2275    }
2276
2277    #[derive(cynic::QueryFragment, Debug)]
2278    #[cynic(graphql_type = "Mutation", variables = "GenerateSshTokenVariables")]
2279    pub struct GenerateSshToken {
2280        #[arguments(input: { appId: $app_id })]
2281        pub generate_ssh_token: Option<GenerateSshTokenPayload>,
2282    }
2283
2284    #[derive(cynic::QueryFragment, Debug)]
2285    pub struct GenerateSshTokenPayload {
2286        pub token: String,
2287    }
2288
2289    #[derive(cynic::QueryVariables, Debug)]
2290    pub struct GetNodeVars {
2291        pub id: cynic::Id,
2292    }
2293
2294    #[derive(cynic::QueryFragment, Debug)]
2295    #[cynic(graphql_type = "Query", variables = "GetNodeVars")]
2296    pub struct GetNode {
2297        #[arguments(id: $id)]
2298        pub node: Option<Node>,
2299    }
2300
2301    #[derive(cynic::QueryVariables, Debug, Clone)]
2302    pub struct GetCronJobByIdVars {
2303        pub id: cynic::Id,
2304    }
2305
2306    #[derive(cynic::QueryFragment, Debug, Clone)]
2307    #[cynic(graphql_type = "Query", variables = "GetCronJobByIdVars")]
2308    pub struct GetCronJobById {
2309        #[arguments(id: $id)]
2310        #[cynic(rename = "node")]
2311        pub cron_job: Option<NodeCronJob>,
2312    }
2313
2314    #[derive(cynic::InlineFragments, Debug, Clone)]
2315    #[cynic(graphql_type = "Node")]
2316    pub enum NodeCronJob {
2317        CronJob(Box<CronJob>),
2318        #[cynic(fallback)]
2319        Unknown,
2320    }
2321
2322    impl NodeCronJob {
2323        pub fn into_cron_job(self) -> Option<CronJob> {
2324            match self {
2325                Self::CronJob(cron_job) => Some(*cron_job),
2326                Self::Unknown => None,
2327            }
2328        }
2329    }
2330
2331    #[derive(cynic::QueryVariables, Debug)]
2332    pub struct GetDeployAppByIdVars {
2333        pub app_id: cynic::Id,
2334    }
2335
2336    #[derive(cynic::QueryFragment, Debug)]
2337    #[cynic(graphql_type = "Query", variables = "GetDeployAppByIdVars")]
2338    pub struct GetDeployAppById {
2339        #[arguments(id: $app_id)]
2340        #[cynic(rename = "node")]
2341        pub app: Option<Node>,
2342    }
2343
2344    #[derive(cynic::QueryVariables, Debug)]
2345    pub struct GetDeployAppAndVersionByIdVars {
2346        pub app_id: cynic::Id,
2347        pub version_id: cynic::Id,
2348    }
2349
2350    #[derive(cynic::QueryFragment, Debug)]
2351    #[cynic(graphql_type = "Query", variables = "GetDeployAppAndVersionByIdVars")]
2352    pub struct GetDeployAppAndVersionById {
2353        #[arguments(id: $app_id)]
2354        #[cynic(rename = "node")]
2355        pub app: Option<Node>,
2356        #[arguments(id: $version_id)]
2357        #[cynic(rename = "node")]
2358        pub version: Option<Node>,
2359    }
2360
2361    #[derive(cynic::QueryVariables, Debug)]
2362    pub struct GetDeployAppVersionByIdVars {
2363        pub version_id: cynic::Id,
2364    }
2365
2366    #[derive(cynic::QueryFragment, Debug)]
2367    #[cynic(graphql_type = "Query", variables = "GetDeployAppVersionByIdVars")]
2368    pub struct GetDeployAppVersionById {
2369        #[arguments(id: $version_id)]
2370        #[cynic(rename = "node")]
2371        pub version: Option<Node>,
2372    }
2373
2374    #[derive(cynic::QueryVariables, Debug)]
2375    pub struct DeleteAppSecretVariables {
2376        pub id: cynic::Id,
2377    }
2378
2379    #[derive(cynic::QueryFragment, Debug)]
2380    #[cynic(graphql_type = "Mutation", variables = "DeleteAppSecretVariables")]
2381    pub struct DeleteAppSecret {
2382        #[arguments(input: { id: $id })]
2383        pub delete_app_secret: Option<DeleteAppSecretPayload>,
2384    }
2385
2386    #[derive(cynic::QueryFragment, Debug)]
2387    pub struct DeleteAppSecretPayload {
2388        pub success: bool,
2389    }
2390    #[derive(cynic::QueryVariables, Debug, Clone)]
2391    pub struct GetAllAppSecretsVariables {
2392        pub after: Option<String>,
2393        pub app_id: cynic::Id,
2394        pub before: Option<String>,
2395        pub first: Option<i32>,
2396        pub last: Option<i32>,
2397        pub offset: Option<i32>,
2398        pub names: Option<Vec<String>>,
2399    }
2400
2401    #[derive(cynic::QueryFragment, Debug)]
2402    #[cynic(graphql_type = "Query", variables = "GetAllAppSecretsVariables")]
2403    pub struct GetAllAppSecrets {
2404        #[arguments(appId: $app_id, after: $after, before: $before, first: $first, last: $last, offset: $offset, names: $names)]
2405        pub get_app_secrets: Option<SecretConnection>,
2406    }
2407
2408    #[derive(cynic::QueryFragment, Debug)]
2409    pub struct SecretConnection {
2410        pub edges: Vec<Option<SecretEdge>>,
2411        pub page_info: PageInfo,
2412        pub total_count: Option<i32>,
2413    }
2414
2415    #[derive(cynic::QueryFragment, Debug)]
2416    pub struct SecretEdge {
2417        pub cursor: String,
2418        pub node: Option<Secret>,
2419    }
2420
2421    #[derive(cynic::QueryVariables, Debug)]
2422    pub struct GetAppSecretVariables {
2423        pub app_id: cynic::Id,
2424        pub secret_name: String,
2425    }
2426
2427    #[derive(cynic::QueryFragment, Debug)]
2428    #[cynic(graphql_type = "Query", variables = "GetAppSecretVariables")]
2429    pub struct GetAppSecret {
2430        #[arguments(appId: $app_id, secretName: $secret_name)]
2431        pub get_app_secret: Option<Secret>,
2432    }
2433
2434    #[derive(cynic::QueryVariables, Debug)]
2435    pub struct GetAppSecretValueVariables {
2436        pub id: cynic::Id,
2437    }
2438
2439    #[derive(cynic::QueryFragment, Debug)]
2440    #[cynic(graphql_type = "Query", variables = "GetAppSecretValueVariables")]
2441    pub struct GetAppSecretValue {
2442        #[arguments(id: $id)]
2443        pub get_secret_value: Option<String>,
2444    }
2445
2446    #[derive(cynic::QueryVariables, Debug)]
2447    pub struct UpsertAppSecretVariables<'a> {
2448        pub app_id: cynic::Id,
2449        pub name: &'a str,
2450        pub value: &'a str,
2451    }
2452
2453    #[derive(cynic::QueryFragment, Debug)]
2454    #[cynic(graphql_type = "Mutation", variables = "UpsertAppSecretVariables")]
2455    pub struct UpsertAppSecret {
2456        #[arguments(input: { appId: $app_id, name: $name, value: $value })]
2457        pub upsert_app_secret: Option<UpsertAppSecretPayload>,
2458    }
2459
2460    #[derive(cynic::QueryFragment, Debug)]
2461    pub struct UpsertAppSecretPayload {
2462        pub secret: Secret,
2463        pub success: bool,
2464    }
2465
2466    #[derive(cynic::QueryVariables, Debug)]
2467    pub struct UpsertAppSecretsVariables {
2468        pub app_id: cynic::Id,
2469        pub secrets: Option<Vec<SecretInput>>,
2470    }
2471
2472    #[derive(cynic::QueryFragment, Debug)]
2473    #[cynic(graphql_type = "Mutation", variables = "UpsertAppSecretsVariables")]
2474    pub struct UpsertAppSecrets {
2475        #[arguments(input: { appId: $app_id, secrets: $secrets })]
2476        pub upsert_app_secrets: Option<UpsertAppSecretsPayload>,
2477    }
2478
2479    #[derive(cynic::QueryFragment, Debug)]
2480    pub struct UpsertAppSecretsPayload {
2481        pub secrets: Vec<Option<Secret>>,
2482        pub success: bool,
2483    }
2484
2485    #[derive(cynic::InputObject, Debug, Clone)]
2486    pub struct SecretInput {
2487        pub name: String,
2488        pub value: String,
2489    }
2490    #[derive(cynic::QueryFragment, Debug, Serialize)]
2491    pub struct Secret {
2492        #[serde(skip_serializing)]
2493        pub id: cynic::Id,
2494        pub name: String,
2495        pub created_at: DateTime,
2496        pub updated_at: DateTime,
2497    }
2498
2499    #[derive(cynic::QueryVariables, Debug, Clone)]
2500    pub struct GetAllAppRegionsVariables {
2501        pub after: Option<String>,
2502        pub before: Option<String>,
2503        pub first: Option<i32>,
2504        pub last: Option<i32>,
2505        pub offset: Option<i32>,
2506    }
2507
2508    #[derive(cynic::QueryFragment, Debug)]
2509    #[cynic(graphql_type = "Query", variables = "GetAllAppRegionsVariables")]
2510    pub struct GetAllAppRegions {
2511        #[arguments(after: $after, offset: $offset, before: $before, first: $first, last: $last)]
2512        pub get_app_regions: AppRegionConnection,
2513    }
2514
2515    #[derive(cynic::QueryFragment, Debug)]
2516    pub struct AppRegionConnection {
2517        pub edges: Vec<Option<AppRegionEdge>>,
2518        pub page_info: PageInfo,
2519        pub total_count: Option<i32>,
2520    }
2521
2522    #[derive(cynic::QueryFragment, Debug)]
2523    pub struct AppRegionEdge {
2524        pub cursor: String,
2525        pub node: Option<AppRegion>,
2526    }
2527
2528    #[derive(cynic::QueryFragment, Debug, Serialize)]
2529    pub struct AppRegion {
2530        pub city: String,
2531        pub country: String,
2532        pub id: cynic::Id,
2533        pub name: String,
2534    }
2535
2536    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2537    #[cynic(graphql_type = "TXTRecord")]
2538    pub struct TxtRecord {
2539        pub id: cynic::Id,
2540        pub created_at: DateTime,
2541        pub updated_at: DateTime,
2542        pub deleted_at: Option<DateTime>,
2543        pub name: Option<String>,
2544        pub text: String,
2545        pub ttl: Option<i32>,
2546        pub data: String,
2547
2548        pub domain: DnsDomain,
2549    }
2550
2551    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2552    #[cynic(graphql_type = "SSHFPRecord")]
2553    pub struct SshfpRecord {
2554        pub id: cynic::Id,
2555        pub created_at: DateTime,
2556        pub updated_at: DateTime,
2557        pub deleted_at: Option<DateTime>,
2558        pub name: Option<String>,
2559        pub text: String,
2560        pub ttl: Option<i32>,
2561        #[cynic(rename = "type")]
2562        pub type_: DnsmanagerSshFingerprintRecordTypeChoices,
2563        pub algorithm: DnsmanagerSshFingerprintRecordAlgorithmChoices,
2564        pub fingerprint: String,
2565
2566        pub domain: DnsDomain,
2567    }
2568
2569    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2570    #[cynic(graphql_type = "SRVRecord")]
2571    pub struct SrvRecord {
2572        pub id: cynic::Id,
2573        pub created_at: DateTime,
2574        pub updated_at: DateTime,
2575        pub deleted_at: Option<DateTime>,
2576        pub name: Option<String>,
2577        pub text: String,
2578        pub ttl: Option<i32>,
2579        pub service: String,
2580        pub protocol: String,
2581        pub priority: i32,
2582        pub weight: i32,
2583        pub port: i32,
2584        pub target: String,
2585
2586        pub domain: DnsDomain,
2587    }
2588
2589    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2590    #[cynic(graphql_type = "SOARecord")]
2591    pub struct SoaRecord {
2592        pub id: cynic::Id,
2593        pub created_at: DateTime,
2594        pub updated_at: DateTime,
2595        pub deleted_at: Option<DateTime>,
2596        pub name: Option<String>,
2597        pub text: String,
2598        pub ttl: Option<i32>,
2599        pub mname: String,
2600        pub rname: String,
2601        pub serial: BigInt,
2602        pub refresh: BigInt,
2603        pub retry: BigInt,
2604        pub expire: BigInt,
2605        pub minimum: BigInt,
2606
2607        pub domain: DnsDomain,
2608    }
2609
2610    #[derive(cynic::Enum, Debug, Clone, Copy)]
2611    pub enum DNSRecordsSortBy {
2612        Newest,
2613        Oldest,
2614    }
2615
2616    #[derive(cynic::QueryVariables, Debug, Clone)]
2617    pub struct GetAllDnsRecordsVariables {
2618        pub after: Option<String>,
2619        pub updated_after: Option<DateTime>,
2620        pub sort_by: Option<DNSRecordsSortBy>,
2621        pub first: Option<i32>,
2622    }
2623
2624    #[derive(cynic::QueryFragment, Debug)]
2625    #[cynic(graphql_type = "Query", variables = "GetAllDnsRecordsVariables")]
2626    pub struct GetAllDnsRecords {
2627        #[arguments(
2628            first: $first,
2629            after: $after,
2630            updatedAfter: $updated_after,
2631            sortBy: $sort_by
2632        )]
2633        #[cynic(rename = "getAllDNSRecords")]
2634        pub get_all_dnsrecords: DnsRecordConnection,
2635    }
2636
2637    #[derive(cynic::QueryVariables, Debug, Clone)]
2638    pub struct GetAllDomainsVariables {
2639        pub after: Option<String>,
2640        pub first: Option<i32>,
2641        pub namespace: Option<String>,
2642    }
2643
2644    #[derive(cynic::QueryFragment, Debug)]
2645    #[cynic(graphql_type = "Query", variables = "GetAllDomainsVariables")]
2646    pub struct GetAllDomains {
2647        #[arguments(
2648            first: $first,
2649            after: $after,
2650            namespace: $namespace,
2651        )]
2652        #[cynic(rename = "getAllDomains")]
2653        pub get_all_domains: DnsDomainConnection,
2654    }
2655
2656    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2657    #[cynic(graphql_type = "PTRRecord")]
2658    pub struct PtrRecord {
2659        pub id: cynic::Id,
2660        pub created_at: DateTime,
2661        pub updated_at: DateTime,
2662        pub deleted_at: Option<DateTime>,
2663        pub name: Option<String>,
2664        pub text: String,
2665        pub ttl: Option<i32>,
2666        pub ptrdname: String,
2667
2668        pub domain: DnsDomain,
2669    }
2670
2671    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2672    #[cynic(graphql_type = "NSRecord")]
2673    pub struct NsRecord {
2674        pub id: cynic::Id,
2675        pub created_at: DateTime,
2676        pub updated_at: DateTime,
2677        pub deleted_at: Option<DateTime>,
2678        pub name: Option<String>,
2679        pub text: String,
2680        pub ttl: Option<i32>,
2681        pub nsdname: String,
2682
2683        pub domain: DnsDomain,
2684    }
2685
2686    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2687    #[cynic(graphql_type = "MXRecord")]
2688    pub struct MxRecord {
2689        pub id: cynic::Id,
2690        pub created_at: DateTime,
2691        pub updated_at: DateTime,
2692        pub deleted_at: Option<DateTime>,
2693        pub name: Option<String>,
2694        pub text: String,
2695        pub ttl: Option<i32>,
2696        pub preference: i32,
2697        pub exchange: String,
2698
2699        pub domain: DnsDomain,
2700    }
2701
2702    #[derive(cynic::QueryFragment, Debug)]
2703    #[cynic(graphql_type = "DNSRecordConnection")]
2704    pub struct DnsRecordConnection {
2705        pub page_info: PageInfo,
2706        pub edges: Vec<Option<DnsRecordEdge>>,
2707    }
2708
2709    #[derive(cynic::QueryFragment, Debug)]
2710    #[cynic(graphql_type = "DNSRecordEdge")]
2711    pub struct DnsRecordEdge {
2712        pub node: Option<DnsRecord>,
2713    }
2714
2715    #[derive(cynic::QueryFragment, Debug)]
2716    #[cynic(graphql_type = "DNSDomainConnection")]
2717    pub struct DnsDomainConnection {
2718        pub page_info: PageInfo,
2719        pub edges: Vec<Option<DnsDomainEdge>>,
2720    }
2721
2722    #[derive(cynic::QueryFragment, Debug)]
2723    #[cynic(graphql_type = "DNSDomainEdge")]
2724    pub struct DnsDomainEdge {
2725        pub node: Option<DnsDomain>,
2726    }
2727
2728    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2729    #[cynic(graphql_type = "DNAMERecord")]
2730    pub struct DNameRecord {
2731        pub id: cynic::Id,
2732        pub created_at: DateTime,
2733        pub updated_at: DateTime,
2734        pub deleted_at: Option<DateTime>,
2735        pub name: Option<String>,
2736        pub text: String,
2737        pub ttl: Option<i32>,
2738        pub d_name: String,
2739
2740        pub domain: DnsDomain,
2741    }
2742
2743    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2744    #[cynic(graphql_type = "CNAMERecord")]
2745    pub struct CNameRecord {
2746        pub id: cynic::Id,
2747        pub created_at: DateTime,
2748        pub updated_at: DateTime,
2749        pub deleted_at: Option<DateTime>,
2750        pub name: Option<String>,
2751        pub text: String,
2752        pub ttl: Option<i32>,
2753        pub c_name: String,
2754
2755        pub domain: DnsDomain,
2756    }
2757
2758    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2759    #[cynic(graphql_type = "CAARecord")]
2760    pub struct CaaRecord {
2761        pub id: cynic::Id,
2762        pub created_at: DateTime,
2763        pub updated_at: DateTime,
2764        pub deleted_at: Option<DateTime>,
2765        pub name: Option<String>,
2766        pub text: String,
2767        pub ttl: Option<i32>,
2768        pub value: String,
2769        pub flags: i32,
2770        pub tag: DnsmanagerCertificationAuthorityAuthorizationRecordTagChoices,
2771
2772        pub domain: DnsDomain,
2773    }
2774
2775    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2776    #[cynic(graphql_type = "ARecord")]
2777    pub struct ARecord {
2778        pub id: cynic::Id,
2779        pub created_at: DateTime,
2780        pub updated_at: DateTime,
2781        pub deleted_at: Option<DateTime>,
2782        pub name: Option<String>,
2783        pub text: String,
2784        pub ttl: Option<i32>,
2785        pub address: String,
2786        pub domain: DnsDomain,
2787    }
2788
2789    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2790    #[cynic(graphql_type = "AAAARecord")]
2791    pub struct AaaaRecord {
2792        pub id: cynic::Id,
2793        pub created_at: DateTime,
2794        pub updated_at: DateTime,
2795        pub deleted_at: Option<DateTime>,
2796        pub name: Option<String>,
2797        pub text: String,
2798        pub ttl: Option<i32>,
2799        pub address: String,
2800        pub domain: DnsDomain,
2801    }
2802
2803    #[derive(cynic::InlineFragments, Debug, Clone, Serialize)]
2804    #[cynic(graphql_type = "DNSRecord")]
2805    pub enum DnsRecord {
2806        A(ARecord),
2807        AAAA(AaaaRecord),
2808        CName(CNameRecord),
2809        Txt(TxtRecord),
2810        Mx(MxRecord),
2811        Ns(NsRecord),
2812        CAA(CaaRecord),
2813        DName(DNameRecord),
2814        Ptr(PtrRecord),
2815        Soa(SoaRecord),
2816        Srv(SrvRecord),
2817        Sshfp(SshfpRecord),
2818        #[cynic(fallback)]
2819        Unknown,
2820    }
2821
2822    impl DnsRecord {
2823        pub fn id(&self) -> &str {
2824            match self {
2825                DnsRecord::A(record) => record.id.inner(),
2826                DnsRecord::AAAA(record) => record.id.inner(),
2827                DnsRecord::CName(record) => record.id.inner(),
2828                DnsRecord::Txt(record) => record.id.inner(),
2829                DnsRecord::Mx(record) => record.id.inner(),
2830                DnsRecord::Ns(record) => record.id.inner(),
2831                DnsRecord::CAA(record) => record.id.inner(),
2832                DnsRecord::DName(record) => record.id.inner(),
2833                DnsRecord::Ptr(record) => record.id.inner(),
2834                DnsRecord::Soa(record) => record.id.inner(),
2835                DnsRecord::Srv(record) => record.id.inner(),
2836                DnsRecord::Sshfp(record) => record.id.inner(),
2837                DnsRecord::Unknown => "",
2838            }
2839        }
2840        pub fn name(&self) -> Option<&str> {
2841            match self {
2842                DnsRecord::A(record) => record.name.as_deref(),
2843                DnsRecord::AAAA(record) => record.name.as_deref(),
2844                DnsRecord::CName(record) => record.name.as_deref(),
2845                DnsRecord::Txt(record) => record.name.as_deref(),
2846                DnsRecord::Mx(record) => record.name.as_deref(),
2847                DnsRecord::Ns(record) => record.name.as_deref(),
2848                DnsRecord::CAA(record) => record.name.as_deref(),
2849                DnsRecord::DName(record) => record.name.as_deref(),
2850                DnsRecord::Ptr(record) => record.name.as_deref(),
2851                DnsRecord::Soa(record) => record.name.as_deref(),
2852                DnsRecord::Srv(record) => record.name.as_deref(),
2853                DnsRecord::Sshfp(record) => record.name.as_deref(),
2854                DnsRecord::Unknown => None,
2855            }
2856        }
2857        pub fn ttl(&self) -> Option<i32> {
2858            match self {
2859                DnsRecord::A(record) => record.ttl,
2860                DnsRecord::AAAA(record) => record.ttl,
2861                DnsRecord::CName(record) => record.ttl,
2862                DnsRecord::Txt(record) => record.ttl,
2863                DnsRecord::Mx(record) => record.ttl,
2864                DnsRecord::Ns(record) => record.ttl,
2865                DnsRecord::CAA(record) => record.ttl,
2866                DnsRecord::DName(record) => record.ttl,
2867                DnsRecord::Ptr(record) => record.ttl,
2868                DnsRecord::Soa(record) => record.ttl,
2869                DnsRecord::Srv(record) => record.ttl,
2870                DnsRecord::Sshfp(record) => record.ttl,
2871                DnsRecord::Unknown => None,
2872            }
2873        }
2874
2875        pub fn text(&self) -> &str {
2876            match self {
2877                DnsRecord::A(record) => record.text.as_str(),
2878                DnsRecord::AAAA(record) => record.text.as_str(),
2879                DnsRecord::CName(record) => record.text.as_str(),
2880                DnsRecord::Txt(record) => record.text.as_str(),
2881                DnsRecord::Mx(record) => record.text.as_str(),
2882                DnsRecord::Ns(record) => record.text.as_str(),
2883                DnsRecord::CAA(record) => record.text.as_str(),
2884                DnsRecord::DName(record) => record.text.as_str(),
2885                DnsRecord::Ptr(record) => record.text.as_str(),
2886                DnsRecord::Soa(record) => record.text.as_str(),
2887                DnsRecord::Srv(record) => record.text.as_str(),
2888                DnsRecord::Sshfp(record) => record.text.as_str(),
2889                DnsRecord::Unknown => "",
2890            }
2891        }
2892        pub fn record_type(&self) -> &str {
2893            match self {
2894                DnsRecord::A(_) => "A",
2895                DnsRecord::AAAA(_) => "AAAA",
2896                DnsRecord::CName(_) => "CNAME",
2897                DnsRecord::Txt(_) => "TXT",
2898                DnsRecord::Mx(_) => "MX",
2899                DnsRecord::Ns(_) => "NS",
2900                DnsRecord::CAA(_) => "CAA",
2901                DnsRecord::DName(_) => "DNAME",
2902                DnsRecord::Ptr(_) => "PTR",
2903                DnsRecord::Soa(_) => "SOA",
2904                DnsRecord::Srv(_) => "SRV",
2905                DnsRecord::Sshfp(_) => "SSHFP",
2906                DnsRecord::Unknown => "",
2907            }
2908        }
2909
2910        pub fn domain(&self) -> Option<&DnsDomain> {
2911            match self {
2912                DnsRecord::A(record) => Some(&record.domain),
2913                DnsRecord::AAAA(record) => Some(&record.domain),
2914                DnsRecord::CName(record) => Some(&record.domain),
2915                DnsRecord::Txt(record) => Some(&record.domain),
2916                DnsRecord::Mx(record) => Some(&record.domain),
2917                DnsRecord::Ns(record) => Some(&record.domain),
2918                DnsRecord::CAA(record) => Some(&record.domain),
2919                DnsRecord::DName(record) => Some(&record.domain),
2920                DnsRecord::Ptr(record) => Some(&record.domain),
2921                DnsRecord::Soa(record) => Some(&record.domain),
2922                DnsRecord::Srv(record) => Some(&record.domain),
2923                DnsRecord::Sshfp(record) => Some(&record.domain),
2924                DnsRecord::Unknown => None,
2925            }
2926        }
2927
2928        pub fn created_at(&self) -> Option<&DateTime> {
2929            match self {
2930                DnsRecord::A(record) => Some(&record.created_at),
2931                DnsRecord::AAAA(record) => Some(&record.created_at),
2932                DnsRecord::CName(record) => Some(&record.created_at),
2933                DnsRecord::Txt(record) => Some(&record.created_at),
2934                DnsRecord::Mx(record) => Some(&record.created_at),
2935                DnsRecord::Ns(record) => Some(&record.created_at),
2936                DnsRecord::CAA(record) => Some(&record.created_at),
2937                DnsRecord::DName(record) => Some(&record.created_at),
2938                DnsRecord::Ptr(record) => Some(&record.created_at),
2939                DnsRecord::Soa(record) => Some(&record.created_at),
2940                DnsRecord::Srv(record) => Some(&record.created_at),
2941                DnsRecord::Sshfp(record) => Some(&record.created_at),
2942                DnsRecord::Unknown => None,
2943            }
2944        }
2945
2946        pub fn updated_at(&self) -> Option<&DateTime> {
2947            match self {
2948                Self::A(record) => Some(&record.updated_at),
2949                Self::AAAA(record) => Some(&record.updated_at),
2950                Self::CName(record) => Some(&record.updated_at),
2951                Self::Txt(record) => Some(&record.updated_at),
2952                Self::Mx(record) => Some(&record.updated_at),
2953                Self::Ns(record) => Some(&record.updated_at),
2954                Self::CAA(record) => Some(&record.updated_at),
2955                Self::DName(record) => Some(&record.updated_at),
2956                Self::Ptr(record) => Some(&record.updated_at),
2957                Self::Soa(record) => Some(&record.updated_at),
2958                Self::Srv(record) => Some(&record.updated_at),
2959                Self::Sshfp(record) => Some(&record.updated_at),
2960                Self::Unknown => None,
2961            }
2962        }
2963
2964        pub fn deleted_at(&self) -> Option<&DateTime> {
2965            match self {
2966                Self::A(record) => record.deleted_at.as_ref(),
2967                Self::AAAA(record) => record.deleted_at.as_ref(),
2968                Self::CName(record) => record.deleted_at.as_ref(),
2969                Self::Txt(record) => record.deleted_at.as_ref(),
2970                Self::Mx(record) => record.deleted_at.as_ref(),
2971                Self::Ns(record) => record.deleted_at.as_ref(),
2972                Self::CAA(record) => record.deleted_at.as_ref(),
2973                Self::DName(record) => record.deleted_at.as_ref(),
2974                Self::Ptr(record) => record.deleted_at.as_ref(),
2975                Self::Soa(record) => record.deleted_at.as_ref(),
2976                Self::Srv(record) => record.deleted_at.as_ref(),
2977                Self::Sshfp(record) => record.deleted_at.as_ref(),
2978                Self::Unknown => None,
2979            }
2980        }
2981    }
2982
2983    #[derive(cynic::Enum, Clone, Copy, Debug)]
2984    pub enum DnsmanagerCertificationAuthorityAuthorizationRecordTagChoices {
2985        Issue,
2986        Issuewild,
2987        Iodef,
2988    }
2989
2990    impl DnsmanagerCertificationAuthorityAuthorizationRecordTagChoices {
2991        pub fn as_str(self) -> &'static str {
2992            match self {
2993                Self::Issue => "issue",
2994                Self::Issuewild => "issuewild",
2995                Self::Iodef => "iodef",
2996            }
2997        }
2998    }
2999
3000    #[derive(cynic::Enum, Clone, Copy, Debug)]
3001    pub enum DnsmanagerSshFingerprintRecordAlgorithmChoices {
3002        #[cynic(rename = "A_1")]
3003        A1,
3004        #[cynic(rename = "A_2")]
3005        A2,
3006        #[cynic(rename = "A_3")]
3007        A3,
3008        #[cynic(rename = "A_4")]
3009        A4,
3010    }
3011
3012    #[derive(cynic::Enum, Clone, Copy, Debug)]
3013    pub enum DnsmanagerSshFingerprintRecordTypeChoices {
3014        #[cynic(rename = "A_1")]
3015        A1,
3016        #[cynic(rename = "A_2")]
3017        A2,
3018    }
3019
3020    #[derive(cynic::QueryVariables, Debug)]
3021    pub struct GetDomainVars {
3022        pub domain: String,
3023    }
3024
3025    #[derive(cynic::QueryFragment, Debug)]
3026    #[cynic(graphql_type = "Query", variables = "GetDomainVars")]
3027    pub struct GetDomain {
3028        #[arguments(name: $domain)]
3029        pub get_domain: Option<DnsDomain>,
3030    }
3031
3032    #[derive(cynic::QueryFragment, Debug)]
3033    #[cynic(graphql_type = "Query", variables = "GetDomainVars")]
3034    pub struct GetDomainWithZoneFile {
3035        #[arguments(name: $domain)]
3036        pub get_domain: Option<DnsDomainWithZoneFile>,
3037    }
3038
3039    #[derive(cynic::QueryFragment, Debug)]
3040    #[cynic(graphql_type = "Query", variables = "GetDomainVars")]
3041    pub struct GetDomainWithRecords {
3042        #[arguments(name: $domain)]
3043        pub get_domain: Option<DnsDomainWithRecords>,
3044    }
3045
3046    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
3047    #[cynic(graphql_type = "DNSDomain")]
3048    pub struct DnsDomain {
3049        pub id: cynic::Id,
3050        pub name: String,
3051        pub slug: String,
3052        pub owner: Owner,
3053    }
3054
3055    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
3056    #[cynic(graphql_type = "DNSDomain")]
3057    pub struct DnsDomainWithZoneFile {
3058        pub id: cynic::Id,
3059        pub name: String,
3060        pub slug: String,
3061        pub zone_file: String,
3062    }
3063
3064    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
3065    #[cynic(graphql_type = "DNSDomain")]
3066    pub struct DnsDomainWithRecords {
3067        pub id: cynic::Id,
3068        pub name: String,
3069        pub slug: String,
3070        pub records: Option<Vec<Option<DnsRecord>>>,
3071    }
3072
3073    #[derive(cynic::QueryVariables, Debug)]
3074    pub struct PurgeCacheForAppVersionVars {
3075        pub id: cynic::Id,
3076    }
3077
3078    #[derive(cynic::QueryFragment, Debug)]
3079    pub struct PurgeCacheForAppVersionPayload {
3080        pub app_version: DeployAppVersion,
3081    }
3082
3083    #[derive(cynic::QueryFragment, Debug)]
3084    #[cynic(graphql_type = "Mutation", variables = "PurgeCacheForAppVersionVars")]
3085    pub struct PurgeCacheForAppVersion {
3086        #[arguments(input: {id: $id})]
3087        pub purge_cache_for_app_version: Option<PurgeCacheForAppVersionPayload>,
3088    }
3089
3090    #[derive(cynic::QueryVariables, Debug)]
3091    pub struct ConfigureAppCdnCacheVars {
3092        pub app: cynic::Id,
3093        pub enabled: Option<bool>,
3094    }
3095
3096    #[derive(cynic::QueryVariables, Debug)]
3097    pub struct PurgeAppCdnCacheVars {
3098        pub app: cynic::Id,
3099    }
3100
3101    #[derive(cynic::QueryFragment, Debug)]
3102    pub struct AppCdnCacheMutationPayload {
3103        pub success: bool,
3104    }
3105
3106    #[derive(cynic::QueryFragment, Debug)]
3107    #[cynic(graphql_type = "Mutation", variables = "ConfigureAppCdnCacheVars")]
3108    pub struct ConfigureAppCdnCache {
3109        #[arguments(app: $app, config: {enabled: $enabled})]
3110        pub configure_app_cdn_cache: AppCdnCacheMutationPayload,
3111    }
3112
3113    #[derive(cynic::QueryFragment, Debug)]
3114    #[cynic(graphql_type = "Mutation", variables = "PurgeAppCdnCacheVars")]
3115    pub struct PurgeAppCdnCache {
3116        #[arguments(app: $app)]
3117        pub purge_app_cdn_cache: AppCdnCacheMutationPayload,
3118    }
3119
3120    #[derive(cynic::QueryVariables, Debug)]
3121    pub struct GetAppCdnCacheStatusVars {
3122        pub app: cynic::Id,
3123    }
3124
3125    #[derive(cynic::QueryFragment, Debug)]
3126    #[cynic(graphql_type = "Query", variables = "GetAppCdnCacheStatusVars")]
3127    pub struct GetAppCdnCacheStatus {
3128        #[arguments(id: $app)]
3129        #[cynic(rename = "node")]
3130        pub app: Option<NodeAppCdnCacheStatus>,
3131    }
3132
3133    #[derive(cynic::InlineFragments, Debug)]
3134    #[cynic(graphql_type = "Node")]
3135    pub enum NodeAppCdnCacheStatus {
3136        DeployApp(Box<AppCdnCacheStatus>),
3137        #[cynic(fallback)]
3138        Unknown,
3139    }
3140
3141    impl NodeAppCdnCacheStatus {
3142        pub fn into_app(self) -> Option<AppCdnCacheStatus> {
3143            match self {
3144                Self::DeployApp(app) => Some(*app),
3145                Self::Unknown => None,
3146            }
3147        }
3148    }
3149
3150    #[derive(cynic::QueryFragment, Debug)]
3151    #[cynic(graphql_type = "DeployApp")]
3152    pub struct AppCdnCacheStatus {
3153        pub cdn_cache_enabled: bool,
3154        pub cdn_cache_purged_at: Option<DateTime>,
3155    }
3156
3157    #[derive(cynic::QueryVariables, Debug)]
3158    pub struct GetAppCdnCacheMetricsVars {
3159        pub app: cynic::Id,
3160        pub start_at: DateTime,
3161        pub end_at: DateTime,
3162        pub grouped_by: MetricGrouping,
3163    }
3164
3165    #[derive(cynic::QueryFragment, Debug)]
3166    #[cynic(graphql_type = "Query", variables = "GetAppCdnCacheMetricsVars")]
3167    pub struct GetAppCdnCacheMetrics {
3168        #[arguments(id: $app)]
3169        #[cynic(rename = "node")]
3170        pub app: Option<NodeAppCdnCacheMetrics>,
3171    }
3172
3173    #[derive(cynic::InlineFragments, Debug)]
3174    #[cynic(graphql_type = "Node", variables = "GetAppCdnCacheMetricsVars")]
3175    pub enum NodeAppCdnCacheMetrics {
3176        DeployApp(Box<AppCdnCacheMetrics>),
3177        #[cynic(fallback)]
3178        Unknown,
3179    }
3180
3181    impl NodeAppCdnCacheMetrics {
3182        pub fn into_app(self) -> Option<AppCdnCacheMetrics> {
3183            match self {
3184                Self::DeployApp(app) => Some(*app),
3185                Self::Unknown => None,
3186            }
3187        }
3188    }
3189
3190    #[derive(cynic::QueryFragment, Debug)]
3191    #[cynic(graphql_type = "DeployApp", variables = "GetAppCdnCacheMetricsVars")]
3192    pub struct AppCdnCacheMetrics {
3193        #[arguments(startAt: $start_at, endAt: $end_at, groupedBy: $grouped_by)]
3194        pub grouped_metrics: UsageMetrics,
3195    }
3196
3197    #[derive(cynic::QueryFragment, Debug)]
3198    pub struct UsageMetrics {
3199        pub totals: MetricsTotals,
3200    }
3201
3202    #[derive(cynic::QueryFragment, Debug)]
3203    pub struct MetricsTotals {
3204        pub requests: RequestMetrics,
3205    }
3206
3207    #[derive(cynic::QueryFragment, Debug)]
3208    pub struct RequestMetrics {
3209        pub total_requests: BigInt,
3210        pub cached_requests: BigInt,
3211        pub data_served_bytes: BigInt,
3212        pub data_cached_bytes: BigInt,
3213    }
3214
3215    #[derive(cynic::Enum, Clone, Copy, Debug)]
3216    pub enum MetricGrouping {
3217        #[cynic(rename = "BY_15_MINUTES")]
3218        By15Minutes,
3219        #[cynic(rename = "BY_5_MINUTES")]
3220        By5Minutes,
3221        #[cynic(rename = "BY_HOUR")]
3222        ByHour,
3223        #[cynic(rename = "BY_DAY")]
3224        ByDay,
3225        #[cynic(rename = "BY_WEEK")]
3226        ByWeek,
3227    }
3228
3229    #[derive(cynic::Scalar, Debug, Clone)]
3230    #[cynic(graphql_type = "URL")]
3231    pub struct Url(pub String);
3232
3233    #[derive(cynic::Scalar, Debug, Clone)]
3234    pub struct BigInt(pub i64);
3235
3236    #[derive(cynic::Enum, Clone, Copy, Debug, PartialEq, Eq)]
3237    pub enum ProgrammingLanguage {
3238        Python,
3239        Javascript,
3240    }
3241
3242    /// A library that exposes bindings to a Wasmer package.
3243    #[derive(Debug, Clone)]
3244    pub struct Bindings {
3245        /// A unique ID specifying this set of bindings.
3246        pub id: String,
3247        /// The URL which can be used to download the files that were generated
3248        /// (typically as a `*.tar.gz` file).
3249        pub url: String,
3250        /// The programming language these bindings are written in.
3251        pub language: ProgrammingLanguage,
3252        /// The generator used to generate these bindings.
3253        pub generator: BindingsGenerator,
3254    }
3255
3256    #[derive(cynic::QueryVariables, Debug, Clone)]
3257    pub struct GetBindingsQueryVariables<'a> {
3258        pub name: &'a str,
3259        pub version: Option<&'a str>,
3260    }
3261
3262    #[derive(cynic::QueryFragment, Debug, Clone)]
3263    #[cynic(graphql_type = "Query", variables = "GetBindingsQueryVariables")]
3264    pub struct GetBindingsQuery {
3265        #[arguments(name: $name, version: $version)]
3266        #[cynic(rename = "getPackageVersion")]
3267        pub package_version: Option<PackageBindingsVersion>,
3268    }
3269
3270    #[derive(cynic::QueryFragment, Debug, Clone)]
3271    #[cynic(graphql_type = "PackageVersion")]
3272    pub struct PackageBindingsVersion {
3273        pub bindings: Vec<Option<PackageVersionLanguageBinding>>,
3274    }
3275
3276    #[derive(cynic::QueryFragment, Debug, Clone)]
3277    pub struct BindingsGenerator {
3278        pub package_version: PackageVersion,
3279        pub command_name: String,
3280    }
3281
3282    #[derive(cynic::QueryFragment, Debug, Clone)]
3283    pub struct PackageVersionLanguageBinding {
3284        pub id: cynic::Id,
3285        pub language: ProgrammingLanguage,
3286        pub url: String,
3287        pub generator: BindingsGenerator,
3288        pub __typename: String,
3289    }
3290
3291    #[derive(cynic::QueryVariables, Debug)]
3292    pub struct PackageVersionReadySubscriptionVariables {
3293        pub package_version_id: cynic::Id,
3294    }
3295
3296    #[derive(cynic::QueryFragment, Debug)]
3297    #[cynic(
3298        graphql_type = "Subscription",
3299        variables = "PackageVersionReadySubscriptionVariables"
3300    )]
3301    pub struct PackageVersionReadySubscription {
3302        #[arguments(packageVersionId: $package_version_id)]
3303        pub package_version_ready: PackageVersionReadyResponse,
3304    }
3305
3306    #[derive(cynic::QueryFragment, Debug)]
3307    pub struct PackageVersionReadyResponse {
3308        pub state: PackageVersionState,
3309        pub success: bool,
3310    }
3311
3312    #[derive(cynic::Enum, Clone, Copy, Debug)]
3313    pub enum PackageVersionState {
3314        WebcGenerated,
3315        BindingsGenerated,
3316        NativeExesGenerated,
3317    }
3318
3319    #[derive(cynic::InlineFragments, Debug, Clone)]
3320    #[cynic(graphql_type = "Node", variables = "GetDeployAppVersionsByIdVars")]
3321    pub enum NodeDeployAppVersions {
3322        DeployApp(Box<DeployAppVersionsById>),
3323        #[cynic(fallback)]
3324        Unknown,
3325    }
3326
3327    impl NodeDeployAppVersions {
3328        pub fn into_app(self) -> Option<DeployAppVersionsById> {
3329            match self {
3330                Self::DeployApp(v) => Some(*v),
3331                _ => None,
3332            }
3333        }
3334    }
3335
3336    #[derive(cynic::InlineFragments, Debug)]
3337    pub enum Node {
3338        DeployApp(Box<DeployApp>),
3339        DeployAppVersion(Box<DeployAppVersion>),
3340        AutobuildRepository(Box<AutobuildRepository>),
3341        #[cynic(fallback)]
3342        Unknown,
3343    }
3344
3345    impl Node {
3346        pub fn into_deploy_app(self) -> Option<DeployApp> {
3347            match self {
3348                Node::DeployApp(app) => Some(*app),
3349                _ => None,
3350            }
3351        }
3352
3353        pub fn into_deploy_app_version(self) -> Option<DeployAppVersion> {
3354            match self {
3355                Node::DeployAppVersion(version) => Some(*version),
3356                _ => None,
3357            }
3358        }
3359    }
3360}
3361
3362#[allow(non_snake_case, non_camel_case_types)]
3363mod schema {
3364    cynic::use_schema!(r#"schema.graphql"#);
3365}