Skip to main content

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        #[cynic(rename = "PLAN_NON_PERSISTENT")]
1697        PlanNonPersistent,
1698    }
1699
1700    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1701    pub struct AppAliasConnection {
1702        pub page_info: PageInfo,
1703        pub edges: Vec<Option<AppAliasEdge>>,
1704    }
1705
1706    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1707    pub struct AppAliasEdge {
1708        pub node: Option<AppAlias>,
1709    }
1710
1711    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1712    pub struct AppAlias {
1713        pub name: String,
1714        pub hostname: String,
1715    }
1716
1717    #[derive(cynic::QueryVariables, Debug, Clone)]
1718    pub struct DeleteAppVars {
1719        pub app_id: cynic::Id,
1720    }
1721
1722    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1723    pub struct DeleteAppPayload {
1724        pub success: bool,
1725    }
1726
1727    #[derive(cynic::QueryFragment, Debug)]
1728    #[cynic(graphql_type = "Mutation", variables = "DeleteAppVars")]
1729    pub struct DeleteApp {
1730        #[arguments(input: { id: $app_id })]
1731        pub delete_app: Option<DeleteAppPayload>,
1732    }
1733
1734    #[derive(cynic::Enum, Clone, Copy, Debug)]
1735    pub enum DeployAppVersionsSortBy {
1736        Newest,
1737        Oldest,
1738    }
1739
1740    #[derive(cynic::QueryVariables, Debug, Clone)]
1741    pub struct GetDeployAppVersionsVars {
1742        pub owner: String,
1743        pub name: String,
1744
1745        pub offset: Option<i32>,
1746        pub before: Option<String>,
1747        pub after: Option<String>,
1748        pub first: Option<i32>,
1749        pub last: Option<i32>,
1750        pub sort_by: Option<DeployAppVersionsSortBy>,
1751    }
1752
1753    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1754    #[cynic(graphql_type = "Query", variables = "GetDeployAppVersionsVars")]
1755    pub struct GetDeployAppVersions {
1756        #[arguments(owner: $owner, name: $name)]
1757        pub get_deploy_app: Option<DeployAppVersions>,
1758    }
1759
1760    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1761    #[cynic(graphql_type = "DeployApp", variables = "GetDeployAppVersionsVars")]
1762    pub struct DeployAppVersions {
1763        #[arguments(
1764            first: $first,
1765            last: $last,
1766            before: $before,
1767            after: $after,
1768            offset: $offset,
1769            sortBy: $sort_by
1770        )]
1771        pub versions: DeployAppVersionConnection,
1772    }
1773
1774    #[derive(cynic::QueryVariables, Debug, Clone)]
1775    pub struct GetDeployAppVersionsByIdVars {
1776        pub id: cynic::Id,
1777
1778        pub offset: Option<i32>,
1779        pub before: Option<String>,
1780        pub after: Option<String>,
1781        pub first: Option<i32>,
1782        pub last: Option<i32>,
1783        pub sort_by: Option<DeployAppVersionsSortBy>,
1784    }
1785
1786    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1787    #[cynic(graphql_type = "DeployApp", variables = "GetDeployAppVersionsByIdVars")]
1788    pub struct DeployAppVersionsById {
1789        #[arguments(
1790            first: $first,
1791            last: $last,
1792            before: $before,
1793            after: $after,
1794            offset: $offset,
1795            sortBy: $sort_by
1796        )]
1797        pub versions: DeployAppVersionConnection,
1798    }
1799
1800    #[derive(cynic::QueryFragment, Debug, Clone)]
1801    #[cynic(graphql_type = "Query", variables = "GetDeployAppVersionsByIdVars")]
1802    pub struct GetDeployAppVersionsById {
1803        #[arguments(id: $id)]
1804        pub node: Option<NodeDeployAppVersions>,
1805    }
1806
1807    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1808    #[cynic(graphql_type = "DeployApp")]
1809    pub struct SparseDeployApp {
1810        pub id: cynic::Id,
1811    }
1812
1813    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1814    pub struct DeployAppVersion {
1815        pub id: cynic::Id,
1816        pub created_at: DateTime,
1817        pub updated_at: DateTime,
1818        pub version: String,
1819        pub description: Option<String>,
1820        pub yaml_config: String,
1821        pub user_yaml_config: String,
1822        pub config: String,
1823        pub json_config: String,
1824        pub url: String,
1825        pub disabled_at: Option<DateTime>,
1826        pub disabled_reason: Option<String>,
1827
1828        pub app: Option<SparseDeployApp>,
1829    }
1830
1831    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1832    pub struct DeployAppVersionConnection {
1833        pub page_info: PageInfo,
1834        pub edges: Vec<Option<DeployAppVersionEdge>>,
1835    }
1836
1837    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1838    pub struct DeployAppVersionEdge {
1839        pub node: Option<DeployAppVersion>,
1840        pub cursor: String,
1841    }
1842
1843    #[derive(cynic::QueryFragment, Debug)]
1844    pub struct DeployAppConnection {
1845        pub page_info: PageInfo,
1846        pub edges: Vec<Option<DeployAppEdge>>,
1847    }
1848
1849    #[derive(cynic::QueryFragment, Debug)]
1850    pub struct DeployAppEdge {
1851        pub node: Option<DeployApp>,
1852        pub cursor: String,
1853    }
1854
1855    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1856    pub struct PageInfo {
1857        pub has_next_page: bool,
1858        pub end_cursor: Option<String>,
1859    }
1860
1861    #[derive(cynic::QueryVariables, Debug)]
1862    pub struct GetNamespaceVars {
1863        pub name: String,
1864    }
1865
1866    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1867    pub struct MarkAppVersionAsActivePayload {
1868        pub app: DeployApp,
1869    }
1870
1871    #[derive(cynic::InputObject, Debug)]
1872    pub struct MarkAppVersionAsActiveInput {
1873        pub app_version: cynic::Id,
1874    }
1875
1876    #[derive(cynic::QueryVariables, Debug)]
1877    pub struct MarkAppVersionAsActiveVars {
1878        pub input: MarkAppVersionAsActiveInput,
1879    }
1880
1881    #[derive(cynic::QueryFragment, Debug)]
1882    #[cynic(graphql_type = "Mutation", variables = "MarkAppVersionAsActiveVars")]
1883    pub struct MarkAppVersionAsActive {
1884        #[arguments(input: $input)]
1885        pub mark_app_version_as_active: Option<MarkAppVersionAsActivePayload>,
1886    }
1887
1888    #[derive(cynic::QueryFragment, Debug)]
1889    #[cynic(graphql_type = "Query", variables = "GetNamespaceVars")]
1890    pub struct GetNamespace {
1891        #[arguments(name: $name)]
1892        pub get_namespace: Option<Namespace>,
1893    }
1894
1895    #[derive(cynic::QueryVariables, Debug)]
1896    pub struct GetNamespaceAppsVars {
1897        pub name: String,
1898        pub after: Option<String>,
1899        pub sort: Option<DeployAppsSortBy>,
1900    }
1901
1902    #[derive(cynic::QueryFragment, Debug)]
1903    #[cynic(graphql_type = "Query", variables = "GetNamespaceAppsVars")]
1904    pub struct GetNamespaceApps {
1905        #[arguments(name: $name)]
1906        pub get_namespace: Option<NamespaceWithApps>,
1907    }
1908
1909    #[derive(cynic::QueryFragment, Debug)]
1910    #[cynic(graphql_type = "Namespace")]
1911    #[cynic(variables = "GetNamespaceAppsVars")]
1912    pub struct NamespaceWithApps {
1913        pub id: cynic::Id,
1914        pub name: String,
1915        #[arguments(after: $after, sortBy: $sort)]
1916        pub apps: DeployAppConnection,
1917    }
1918
1919    #[derive(cynic::QueryVariables, Debug)]
1920    pub struct RedeployActiveAppVariables {
1921        pub id: cynic::Id,
1922    }
1923
1924    #[derive(cynic::QueryFragment, Debug)]
1925    #[cynic(graphql_type = "Mutation", variables = "RedeployActiveAppVariables")]
1926    pub struct RedeployActiveApp {
1927        #[arguments(input: { id: $id })]
1928        pub redeploy_active_version: Option<RedeployActiveVersionPayload>,
1929    }
1930
1931    #[derive(cynic::QueryFragment, Debug)]
1932    pub struct RedeployActiveVersionPayload {
1933        pub app: DeployApp,
1934    }
1935
1936    #[derive(cynic::QueryVariables, Debug)]
1937    pub struct GetAppDeploymentsVariables {
1938        pub after: Option<String>,
1939        pub first: Option<i32>,
1940        pub name: String,
1941        pub offset: Option<i32>,
1942        pub owner: String,
1943    }
1944
1945    #[derive(cynic::QueryFragment, Debug)]
1946    #[cynic(graphql_type = "Query", variables = "GetAppDeploymentsVariables")]
1947    pub struct GetAppDeployments {
1948        #[arguments(owner: $owner, name: $name)]
1949        pub get_deploy_app: Option<DeployAppDeployments>,
1950    }
1951
1952    #[derive(cynic::QueryFragment, Debug)]
1953    #[cynic(graphql_type = "DeployApp", variables = "GetAppDeploymentsVariables")]
1954    pub struct DeployAppDeployments {
1955        // FIXME: add $offset, $after, currently causes an error from the backend
1956        // #[arguments(first: $first, after: $after, offset: $offset)]
1957        pub deployments: Option<DeploymentConnection>,
1958    }
1959
1960    #[derive(cynic::QueryFragment, Debug)]
1961    pub struct DeploymentConnection {
1962        pub page_info: PageInfo,
1963        pub edges: Vec<Option<DeploymentEdge>>,
1964    }
1965
1966    #[derive(cynic::QueryFragment, Debug)]
1967    pub struct DeploymentEdge {
1968        pub node: Option<Deployment>,
1969    }
1970
1971    #[allow(clippy::large_enum_variant)]
1972    #[derive(cynic::InlineFragments, Debug, Clone, Serialize)]
1973    pub enum Deployment {
1974        AutobuildRepository(AutobuildRepository),
1975        NakedDeployment(NakedDeployment),
1976        #[cynic(fallback)]
1977        Other,
1978    }
1979
1980    #[derive(cynic::QueryFragment, serde::Serialize, Debug, Clone)]
1981    pub struct NakedDeployment {
1982        pub id: cynic::Id,
1983        pub created_at: DateTime,
1984        pub updated_at: DateTime,
1985        pub app_version: Option<DeployAppVersion>,
1986    }
1987
1988    #[derive(cynic::QueryFragment, serde::Serialize, Debug, Clone)]
1989    pub struct AutobuildRepository {
1990        pub id: cynic::Id,
1991        pub build_id: Uuid,
1992        pub created_at: DateTime,
1993        pub updated_at: DateTime,
1994        pub status: StatusEnum,
1995        pub log_url: Option<String>,
1996        pub repo_url: String,
1997    }
1998
1999    #[derive(cynic::Enum, Clone, Copy, Debug)]
2000    pub enum StatusEnum {
2001        Success,
2002        Working,
2003        Failed,
2004        Queued,
2005        Timeout,
2006        InternalError,
2007        Cancelled,
2008        Running,
2009    }
2010
2011    impl StatusEnum {
2012        pub fn as_str(&self) -> &'static str {
2013            match self {
2014                Self::Success => "success",
2015                Self::Working => "working",
2016                Self::Failed => "failed",
2017                Self::Queued => "queued",
2018                Self::Timeout => "timeout",
2019                Self::InternalError => "internal_error",
2020                Self::Cancelled => "cancelled",
2021                Self::Running => "running",
2022            }
2023        }
2024    }
2025
2026    #[derive(cynic::QueryVariables, Debug)]
2027    pub struct AutobuildConfigForZipUploadVariables<'a> {
2028        pub upload_url: &'a str,
2029    }
2030
2031    #[derive(cynic::QueryFragment, Debug)]
2032    #[cynic(
2033        graphql_type = "Mutation",
2034        variables = "AutobuildConfigForZipUploadVariables"
2035    )]
2036    pub struct AutobuildConfigForZipUpload {
2037        #[arguments(input: { uploadUrl: $upload_url })]
2038        pub autobuild_config_for_zip_upload: Option<AutobuildConfigForZipUploadPayload>,
2039    }
2040
2041    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2042    pub struct AutobuildConfigForZipUploadPayload {
2043        pub build_config: Option<BuildConfig>,
2044    }
2045
2046    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2047    pub struct BuildConfig {
2048        pub build_cmd: Option<String>,
2049        pub install_cmd: Option<String>,
2050        pub start_cmd: Option<String>,
2051        pub setup_db: bool,
2052        pub preset_name: String,
2053        pub app_name: String,
2054        pub completion_time_in_seconds: i32,
2055        pub branch: Option<String>,
2056    }
2057
2058    #[derive(cynic::InputObject, Debug, Clone)]
2059    pub struct WordpressDeploymentExtraData {
2060        pub site_name: String,
2061        pub admin_username: String,
2062        pub admin_password: String,
2063        pub admin_email: String,
2064        pub language: Option<String>,
2065    }
2066
2067    #[derive(cynic::InputObject, Debug, Clone)]
2068    pub struct AutobuildDeploymentExtraData {
2069        pub wordpress: Option<WordpressDeploymentExtraData>,
2070    }
2071
2072    #[derive(cynic::InputObject, Debug, Clone)]
2073    pub struct JobDefinitionInput {
2074        pub name: Option<String>,
2075        pub package: Option<String>,
2076        pub command: String,
2077        pub cli_args: Option<Vec<Option<String>>>,
2078        pub env: Option<Vec<Option<String>>>,
2079        pub timeout: Option<String>,
2080    }
2081
2082    #[derive(cynic::QueryVariables, Debug, Clone)]
2083    pub struct DeployViaAutobuildVars {
2084        pub repo_url: Option<String>,
2085        pub upload_url: Option<String>,
2086        pub app_name: Option<String>,
2087        pub app_id: Option<cynic::Id>,
2088        pub owner: Option<String>,
2089        pub build_cmd: Option<String>,
2090        pub install_cmd: Option<String>,
2091        pub enable_database: Option<bool>,
2092        pub secrets: Option<Vec<SecretInput>>,
2093        pub extra_data: Option<AutobuildDeploymentExtraData>,
2094        pub params: Option<AutobuildDeploymentExtraData>,
2095        pub managed: Option<bool>,
2096        pub kind: Option<String>,
2097        pub wait_for_screenshot_generation: Option<bool>,
2098        pub region: Option<String>,
2099        pub branch: Option<String>,
2100        pub allow_existing_app: Option<bool>,
2101        pub jobs: Option<Vec<JobDefinitionInput>>,
2102        pub domains: Option<Vec<Option<String>>>,
2103        pub client_mutation_id: Option<String>,
2104    }
2105
2106    #[derive(cynic::QueryFragment, Debug)]
2107    #[cynic(graphql_type = "Mutation", variables = "DeployViaAutobuildVars")]
2108    pub struct DeployViaAutobuild {
2109        #[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 })]
2110        pub deploy_via_autobuild: Option<DeployViaAutobuildPayload>,
2111    }
2112
2113    #[derive(cynic::QueryFragment, Debug)]
2114    pub struct DeployViaAutobuildPayload {
2115        pub success: bool,
2116        pub build_id: Uuid,
2117    }
2118
2119    #[derive(cynic::Scalar, Debug, Clone)]
2120    #[cynic(graphql_type = "UUID")]
2121    pub struct Uuid(pub String);
2122
2123    #[derive(cynic::QueryVariables, Debug)]
2124    pub struct PublishDeployAppVars {
2125        pub config: String,
2126        pub name: cynic::Id,
2127        pub owner: Option<cynic::Id>,
2128        pub make_default: Option<bool>,
2129    }
2130
2131    #[derive(cynic::QueryFragment, Debug)]
2132    #[cynic(graphql_type = "Mutation", variables = "PublishDeployAppVars")]
2133    pub struct PublishDeployApp {
2134        #[arguments(input: { config: { yamlConfig: $config }, name: $name, owner: $owner, makeDefault: $make_default })]
2135        pub publish_deploy_app: Option<PublishDeployAppPayload>,
2136    }
2137
2138    #[derive(cynic::QueryFragment, Debug)]
2139    pub struct PublishDeployAppPayload {
2140        pub deploy_app_version: DeployAppVersion,
2141    }
2142
2143    #[derive(cynic::QueryVariables, Debug)]
2144    pub struct GenerateDeployTokenVars {
2145        pub app_version_id: String,
2146    }
2147
2148    #[derive(cynic::QueryFragment, Debug)]
2149    #[cynic(graphql_type = "Mutation", variables = "GenerateDeployTokenVars")]
2150    pub struct GenerateDeployToken {
2151        #[arguments(input: { deployConfigVersionId: $app_version_id })]
2152        pub generate_deploy_token: Option<GenerateDeployTokenPayload>,
2153    }
2154
2155    #[derive(cynic::QueryFragment, Debug)]
2156    pub struct GenerateDeployTokenPayload {
2157        pub token: String,
2158    }
2159
2160    #[derive(cynic::Enum, Clone, Copy, Debug, PartialEq)]
2161    pub enum LogStream {
2162        Stdout,
2163        Stderr,
2164        Runtime,
2165    }
2166
2167    #[derive(cynic::QueryVariables, Debug, Clone)]
2168    pub struct GetDeployAppLogsVars {
2169        pub name: String,
2170        pub owner: String,
2171        /// The tag associated with a particular app version. Uses the active
2172        /// version if not provided.
2173        pub version: Option<String>,
2174        /// The lower bound for log messages, in nanoseconds since the Unix
2175        /// epoch.
2176        pub starting_from: f64,
2177        /// The upper bound for log messages, in nanoseconds since the Unix
2178        /// epoch.
2179        pub until: Option<f64>,
2180        pub first: Option<i32>,
2181
2182        pub request_id: Option<String>,
2183
2184        pub instance_ids: Option<Vec<String>>,
2185
2186        pub streams: Option<Vec<LogStream>>,
2187    }
2188
2189    #[derive(cynic::QueryFragment, Debug)]
2190    #[cynic(graphql_type = "Query", variables = "GetDeployAppLogsVars")]
2191    pub struct GetDeployAppLogs {
2192        #[arguments(name: $name, owner: $owner, version: $version)]
2193        pub get_deploy_app_version: Option<DeployAppVersionLogs>,
2194    }
2195
2196    #[derive(cynic::QueryFragment, Debug)]
2197    #[cynic(graphql_type = "DeployAppVersion", variables = "GetDeployAppLogsVars")]
2198    pub struct DeployAppVersionLogs {
2199        #[arguments(startingFrom: $starting_from, until: $until, first: $first, instanceIds: $instance_ids, requestId: $request_id, streams: $streams)]
2200        pub logs: LogConnection,
2201    }
2202
2203    #[derive(cynic::QueryFragment, Debug, Clone)]
2204    pub struct LogConnection {
2205        pub edges: Vec<Option<LogEdge>>,
2206    }
2207
2208    #[derive(cynic::QueryFragment, Debug, Clone)]
2209    pub struct LogEdge {
2210        pub node: Option<Log>,
2211    }
2212
2213    #[derive(cynic::QueryFragment, Debug, Clone, serde::Serialize, PartialEq)]
2214    pub struct Log {
2215        pub message: String,
2216        /// When the message was recorded, in nanoseconds since the Unix epoch.
2217        pub timestamp: f64,
2218        pub stream: Option<LogStream>,
2219        pub instance_id: String,
2220    }
2221
2222    #[derive(cynic::Enum, Clone, Copy, Debug, PartialEq, Eq)]
2223    pub enum AutoBuildDeployAppLogKind {
2224        Log,
2225        PreparingToDeployStatus,
2226        FetchingPlanStatus,
2227        BuildStatus,
2228        DeployStatus,
2229        Complete,
2230        Failed,
2231    }
2232
2233    #[derive(cynic::QueryVariables, Debug)]
2234    pub struct AutobuildDeploymentSubscriptionVariables {
2235        pub build_id: Uuid,
2236    }
2237
2238    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2239    #[cynic(
2240        graphql_type = "Subscription",
2241        variables = "AutobuildDeploymentSubscriptionVariables"
2242    )]
2243    pub struct AutobuildDeploymentSubscription {
2244        #[arguments(buildId: $build_id)]
2245        pub autobuild_deployment: Option<AutobuildLog>,
2246    }
2247
2248    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2249    pub struct AutobuildLog {
2250        pub kind: AutoBuildDeployAppLogKind,
2251        pub message: Option<String>,
2252        pub app_version: Option<DeployAppVersion>,
2253        pub timestamp: String,
2254        pub datetime: DateTime,
2255        pub stream: Option<LogStream>,
2256    }
2257
2258    #[derive(cynic::QueryVariables, Debug)]
2259    pub struct GenerateDeployConfigTokenVars {
2260        pub input: String,
2261    }
2262    #[derive(cynic::QueryFragment, Debug)]
2263    #[cynic(graphql_type = "Mutation", variables = "GenerateDeployConfigTokenVars")]
2264    pub struct GenerateDeployConfigToken {
2265        #[arguments(input: { config: $input })]
2266        pub generate_deploy_config_token: Option<GenerateDeployConfigTokenPayload>,
2267    }
2268
2269    #[derive(cynic::QueryFragment, Debug)]
2270    pub struct GenerateDeployConfigTokenPayload {
2271        pub token: String,
2272    }
2273
2274    #[derive(cynic::QueryVariables, Debug)]
2275    pub struct GenerateSshTokenVariables {
2276        pub app_id: Option<cynic::Id>,
2277    }
2278
2279    #[derive(cynic::QueryFragment, Debug)]
2280    #[cynic(graphql_type = "Mutation", variables = "GenerateSshTokenVariables")]
2281    pub struct GenerateSshToken {
2282        #[arguments(input: { appId: $app_id })]
2283        pub generate_ssh_token: Option<GenerateSshTokenPayload>,
2284    }
2285
2286    #[derive(cynic::QueryFragment, Debug)]
2287    pub struct GenerateSshTokenPayload {
2288        pub token: String,
2289    }
2290
2291    #[derive(cynic::QueryVariables, Debug)]
2292    pub struct GetNodeVars {
2293        pub id: cynic::Id,
2294    }
2295
2296    #[derive(cynic::QueryFragment, Debug)]
2297    #[cynic(graphql_type = "Query", variables = "GetNodeVars")]
2298    pub struct GetNode {
2299        #[arguments(id: $id)]
2300        pub node: Option<Node>,
2301    }
2302
2303    #[derive(cynic::QueryVariables, Debug, Clone)]
2304    pub struct GetCronJobByIdVars {
2305        pub id: cynic::Id,
2306    }
2307
2308    #[derive(cynic::QueryFragment, Debug, Clone)]
2309    #[cynic(graphql_type = "Query", variables = "GetCronJobByIdVars")]
2310    pub struct GetCronJobById {
2311        #[arguments(id: $id)]
2312        #[cynic(rename = "node")]
2313        pub cron_job: Option<NodeCronJob>,
2314    }
2315
2316    #[derive(cynic::InlineFragments, Debug, Clone)]
2317    #[cynic(graphql_type = "Node")]
2318    pub enum NodeCronJob {
2319        CronJob(Box<CronJob>),
2320        #[cynic(fallback)]
2321        Unknown,
2322    }
2323
2324    impl NodeCronJob {
2325        pub fn into_cron_job(self) -> Option<CronJob> {
2326            match self {
2327                Self::CronJob(cron_job) => Some(*cron_job),
2328                Self::Unknown => None,
2329            }
2330        }
2331    }
2332
2333    #[derive(cynic::QueryVariables, Debug)]
2334    pub struct GetDeployAppByIdVars {
2335        pub app_id: cynic::Id,
2336    }
2337
2338    #[derive(cynic::QueryFragment, Debug)]
2339    #[cynic(graphql_type = "Query", variables = "GetDeployAppByIdVars")]
2340    pub struct GetDeployAppById {
2341        #[arguments(id: $app_id)]
2342        #[cynic(rename = "node")]
2343        pub app: Option<Node>,
2344    }
2345
2346    #[derive(cynic::QueryVariables, Debug)]
2347    pub struct GetDeployAppAndVersionByIdVars {
2348        pub app_id: cynic::Id,
2349        pub version_id: cynic::Id,
2350    }
2351
2352    #[derive(cynic::QueryFragment, Debug)]
2353    #[cynic(graphql_type = "Query", variables = "GetDeployAppAndVersionByIdVars")]
2354    pub struct GetDeployAppAndVersionById {
2355        #[arguments(id: $app_id)]
2356        #[cynic(rename = "node")]
2357        pub app: Option<Node>,
2358        #[arguments(id: $version_id)]
2359        #[cynic(rename = "node")]
2360        pub version: Option<Node>,
2361    }
2362
2363    #[derive(cynic::QueryVariables, Debug)]
2364    pub struct GetDeployAppVersionByIdVars {
2365        pub version_id: cynic::Id,
2366    }
2367
2368    #[derive(cynic::QueryFragment, Debug)]
2369    #[cynic(graphql_type = "Query", variables = "GetDeployAppVersionByIdVars")]
2370    pub struct GetDeployAppVersionById {
2371        #[arguments(id: $version_id)]
2372        #[cynic(rename = "node")]
2373        pub version: Option<Node>,
2374    }
2375
2376    #[derive(cynic::QueryVariables, Debug)]
2377    pub struct DeleteAppSecretVariables {
2378        pub id: cynic::Id,
2379    }
2380
2381    #[derive(cynic::QueryFragment, Debug)]
2382    #[cynic(graphql_type = "Mutation", variables = "DeleteAppSecretVariables")]
2383    pub struct DeleteAppSecret {
2384        #[arguments(input: { id: $id })]
2385        pub delete_app_secret: Option<DeleteAppSecretPayload>,
2386    }
2387
2388    #[derive(cynic::QueryFragment, Debug)]
2389    pub struct DeleteAppSecretPayload {
2390        pub success: bool,
2391    }
2392    #[derive(cynic::QueryVariables, Debug, Clone)]
2393    pub struct GetAllAppSecretsVariables {
2394        pub after: Option<String>,
2395        pub app_id: cynic::Id,
2396        pub before: Option<String>,
2397        pub first: Option<i32>,
2398        pub last: Option<i32>,
2399        pub offset: Option<i32>,
2400        pub names: Option<Vec<String>>,
2401    }
2402
2403    #[derive(cynic::QueryFragment, Debug)]
2404    #[cynic(graphql_type = "Query", variables = "GetAllAppSecretsVariables")]
2405    pub struct GetAllAppSecrets {
2406        #[arguments(appId: $app_id, after: $after, before: $before, first: $first, last: $last, offset: $offset, names: $names)]
2407        pub get_app_secrets: Option<SecretConnection>,
2408    }
2409
2410    #[derive(cynic::QueryFragment, Debug)]
2411    pub struct SecretConnection {
2412        pub edges: Vec<Option<SecretEdge>>,
2413        pub page_info: PageInfo,
2414        pub total_count: Option<i32>,
2415    }
2416
2417    #[derive(cynic::QueryFragment, Debug)]
2418    pub struct SecretEdge {
2419        pub cursor: String,
2420        pub node: Option<Secret>,
2421    }
2422
2423    #[derive(cynic::QueryVariables, Debug)]
2424    pub struct GetAppSecretVariables {
2425        pub app_id: cynic::Id,
2426        pub secret_name: String,
2427    }
2428
2429    #[derive(cynic::QueryFragment, Debug)]
2430    #[cynic(graphql_type = "Query", variables = "GetAppSecretVariables")]
2431    pub struct GetAppSecret {
2432        #[arguments(appId: $app_id, secretName: $secret_name)]
2433        pub get_app_secret: Option<Secret>,
2434    }
2435
2436    #[derive(cynic::QueryVariables, Debug)]
2437    pub struct GetAppSecretValueVariables {
2438        pub id: cynic::Id,
2439    }
2440
2441    #[derive(cynic::QueryFragment, Debug)]
2442    #[cynic(graphql_type = "Query", variables = "GetAppSecretValueVariables")]
2443    pub struct GetAppSecretValue {
2444        #[arguments(id: $id)]
2445        pub get_secret_value: Option<String>,
2446    }
2447
2448    #[derive(cynic::QueryVariables, Debug)]
2449    pub struct UpsertAppSecretVariables<'a> {
2450        pub app_id: cynic::Id,
2451        pub name: &'a str,
2452        pub value: &'a str,
2453    }
2454
2455    #[derive(cynic::QueryFragment, Debug)]
2456    #[cynic(graphql_type = "Mutation", variables = "UpsertAppSecretVariables")]
2457    pub struct UpsertAppSecret {
2458        #[arguments(input: { appId: $app_id, name: $name, value: $value })]
2459        pub upsert_app_secret: Option<UpsertAppSecretPayload>,
2460    }
2461
2462    #[derive(cynic::QueryFragment, Debug)]
2463    pub struct UpsertAppSecretPayload {
2464        pub secret: Secret,
2465        pub success: bool,
2466    }
2467
2468    #[derive(cynic::QueryVariables, Debug)]
2469    pub struct UpsertAppSecretsVariables {
2470        pub app_id: cynic::Id,
2471        pub secrets: Option<Vec<SecretInput>>,
2472    }
2473
2474    #[derive(cynic::QueryFragment, Debug)]
2475    #[cynic(graphql_type = "Mutation", variables = "UpsertAppSecretsVariables")]
2476    pub struct UpsertAppSecrets {
2477        #[arguments(input: { appId: $app_id, secrets: $secrets })]
2478        pub upsert_app_secrets: Option<UpsertAppSecretsPayload>,
2479    }
2480
2481    #[derive(cynic::QueryFragment, Debug)]
2482    pub struct UpsertAppSecretsPayload {
2483        pub secrets: Vec<Option<Secret>>,
2484        pub success: bool,
2485    }
2486
2487    #[derive(cynic::InputObject, Debug, Clone)]
2488    pub struct SecretInput {
2489        pub name: String,
2490        pub value: String,
2491    }
2492    #[derive(cynic::QueryFragment, Debug, Serialize)]
2493    pub struct Secret {
2494        #[serde(skip_serializing)]
2495        pub id: cynic::Id,
2496        pub name: String,
2497        pub created_at: DateTime,
2498        pub updated_at: DateTime,
2499    }
2500
2501    #[derive(cynic::QueryVariables, Debug, Clone)]
2502    pub struct GetAllAppRegionsVariables {
2503        pub after: Option<String>,
2504        pub before: Option<String>,
2505        pub first: Option<i32>,
2506        pub last: Option<i32>,
2507        pub offset: Option<i32>,
2508    }
2509
2510    #[derive(cynic::QueryFragment, Debug)]
2511    #[cynic(graphql_type = "Query", variables = "GetAllAppRegionsVariables")]
2512    pub struct GetAllAppRegions {
2513        #[arguments(after: $after, offset: $offset, before: $before, first: $first, last: $last)]
2514        pub get_app_regions: AppRegionConnection,
2515    }
2516
2517    #[derive(cynic::QueryFragment, Debug)]
2518    pub struct AppRegionConnection {
2519        pub edges: Vec<Option<AppRegionEdge>>,
2520        pub page_info: PageInfo,
2521        pub total_count: Option<i32>,
2522    }
2523
2524    #[derive(cynic::QueryFragment, Debug)]
2525    pub struct AppRegionEdge {
2526        pub cursor: String,
2527        pub node: Option<AppRegion>,
2528    }
2529
2530    #[derive(cynic::QueryFragment, Debug, Serialize)]
2531    pub struct AppRegion {
2532        pub city: String,
2533        pub country: String,
2534        pub id: cynic::Id,
2535        pub name: String,
2536    }
2537
2538    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2539    #[cynic(graphql_type = "TXTRecord")]
2540    pub struct TxtRecord {
2541        pub id: cynic::Id,
2542        pub created_at: DateTime,
2543        pub updated_at: DateTime,
2544        pub deleted_at: Option<DateTime>,
2545        pub name: Option<String>,
2546        pub text: String,
2547        pub ttl: Option<i32>,
2548        pub data: String,
2549
2550        pub domain: DnsDomain,
2551    }
2552
2553    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2554    #[cynic(graphql_type = "SSHFPRecord")]
2555    pub struct SshfpRecord {
2556        pub id: cynic::Id,
2557        pub created_at: DateTime,
2558        pub updated_at: DateTime,
2559        pub deleted_at: Option<DateTime>,
2560        pub name: Option<String>,
2561        pub text: String,
2562        pub ttl: Option<i32>,
2563        #[cynic(rename = "type")]
2564        pub type_: DnsmanagerSshFingerprintRecordTypeChoices,
2565        pub algorithm: DnsmanagerSshFingerprintRecordAlgorithmChoices,
2566        pub fingerprint: String,
2567
2568        pub domain: DnsDomain,
2569    }
2570
2571    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2572    #[cynic(graphql_type = "SRVRecord")]
2573    pub struct SrvRecord {
2574        pub id: cynic::Id,
2575        pub created_at: DateTime,
2576        pub updated_at: DateTime,
2577        pub deleted_at: Option<DateTime>,
2578        pub name: Option<String>,
2579        pub text: String,
2580        pub ttl: Option<i32>,
2581        pub service: String,
2582        pub protocol: String,
2583        pub priority: i32,
2584        pub weight: i32,
2585        pub port: i32,
2586        pub target: String,
2587
2588        pub domain: DnsDomain,
2589    }
2590
2591    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2592    #[cynic(graphql_type = "SOARecord")]
2593    pub struct SoaRecord {
2594        pub id: cynic::Id,
2595        pub created_at: DateTime,
2596        pub updated_at: DateTime,
2597        pub deleted_at: Option<DateTime>,
2598        pub name: Option<String>,
2599        pub text: String,
2600        pub ttl: Option<i32>,
2601        pub mname: String,
2602        pub rname: String,
2603        pub serial: BigInt,
2604        pub refresh: BigInt,
2605        pub retry: BigInt,
2606        pub expire: BigInt,
2607        pub minimum: BigInt,
2608
2609        pub domain: DnsDomain,
2610    }
2611
2612    #[derive(cynic::Enum, Debug, Clone, Copy)]
2613    pub enum DNSRecordsSortBy {
2614        Newest,
2615        Oldest,
2616    }
2617
2618    #[derive(cynic::QueryVariables, Debug, Clone)]
2619    pub struct GetAllDnsRecordsVariables {
2620        pub after: Option<String>,
2621        pub updated_after: Option<DateTime>,
2622        pub sort_by: Option<DNSRecordsSortBy>,
2623        pub first: Option<i32>,
2624    }
2625
2626    #[derive(cynic::QueryFragment, Debug)]
2627    #[cynic(graphql_type = "Query", variables = "GetAllDnsRecordsVariables")]
2628    pub struct GetAllDnsRecords {
2629        #[arguments(
2630            first: $first,
2631            after: $after,
2632            updatedAfter: $updated_after,
2633            sortBy: $sort_by
2634        )]
2635        #[cynic(rename = "getAllDNSRecords")]
2636        pub get_all_dnsrecords: DnsRecordConnection,
2637    }
2638
2639    #[derive(cynic::QueryVariables, Debug, Clone)]
2640    pub struct GetAllDomainsVariables {
2641        pub after: Option<String>,
2642        pub first: Option<i32>,
2643        pub namespace: Option<String>,
2644    }
2645
2646    #[derive(cynic::QueryFragment, Debug)]
2647    #[cynic(graphql_type = "Query", variables = "GetAllDomainsVariables")]
2648    pub struct GetAllDomains {
2649        #[arguments(
2650            first: $first,
2651            after: $after,
2652            namespace: $namespace,
2653        )]
2654        #[cynic(rename = "getAllDomains")]
2655        pub get_all_domains: DnsDomainConnection,
2656    }
2657
2658    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2659    #[cynic(graphql_type = "PTRRecord")]
2660    pub struct PtrRecord {
2661        pub id: cynic::Id,
2662        pub created_at: DateTime,
2663        pub updated_at: DateTime,
2664        pub deleted_at: Option<DateTime>,
2665        pub name: Option<String>,
2666        pub text: String,
2667        pub ttl: Option<i32>,
2668        pub ptrdname: String,
2669
2670        pub domain: DnsDomain,
2671    }
2672
2673    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2674    #[cynic(graphql_type = "NSRecord")]
2675    pub struct NsRecord {
2676        pub id: cynic::Id,
2677        pub created_at: DateTime,
2678        pub updated_at: DateTime,
2679        pub deleted_at: Option<DateTime>,
2680        pub name: Option<String>,
2681        pub text: String,
2682        pub ttl: Option<i32>,
2683        pub nsdname: String,
2684
2685        pub domain: DnsDomain,
2686    }
2687
2688    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2689    #[cynic(graphql_type = "MXRecord")]
2690    pub struct MxRecord {
2691        pub id: cynic::Id,
2692        pub created_at: DateTime,
2693        pub updated_at: DateTime,
2694        pub deleted_at: Option<DateTime>,
2695        pub name: Option<String>,
2696        pub text: String,
2697        pub ttl: Option<i32>,
2698        pub preference: i32,
2699        pub exchange: String,
2700
2701        pub domain: DnsDomain,
2702    }
2703
2704    #[derive(cynic::QueryFragment, Debug)]
2705    #[cynic(graphql_type = "DNSRecordConnection")]
2706    pub struct DnsRecordConnection {
2707        pub page_info: PageInfo,
2708        pub edges: Vec<Option<DnsRecordEdge>>,
2709    }
2710
2711    #[derive(cynic::QueryFragment, Debug)]
2712    #[cynic(graphql_type = "DNSRecordEdge")]
2713    pub struct DnsRecordEdge {
2714        pub node: Option<DnsRecord>,
2715    }
2716
2717    #[derive(cynic::QueryFragment, Debug)]
2718    #[cynic(graphql_type = "DNSDomainConnection")]
2719    pub struct DnsDomainConnection {
2720        pub page_info: PageInfo,
2721        pub edges: Vec<Option<DnsDomainEdge>>,
2722    }
2723
2724    #[derive(cynic::QueryFragment, Debug)]
2725    #[cynic(graphql_type = "DNSDomainEdge")]
2726    pub struct DnsDomainEdge {
2727        pub node: Option<DnsDomain>,
2728    }
2729
2730    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2731    #[cynic(graphql_type = "DNAMERecord")]
2732    pub struct DNameRecord {
2733        pub id: cynic::Id,
2734        pub created_at: DateTime,
2735        pub updated_at: DateTime,
2736        pub deleted_at: Option<DateTime>,
2737        pub name: Option<String>,
2738        pub text: String,
2739        pub ttl: Option<i32>,
2740        pub d_name: String,
2741
2742        pub domain: DnsDomain,
2743    }
2744
2745    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2746    #[cynic(graphql_type = "CNAMERecord")]
2747    pub struct CNameRecord {
2748        pub id: cynic::Id,
2749        pub created_at: DateTime,
2750        pub updated_at: DateTime,
2751        pub deleted_at: Option<DateTime>,
2752        pub name: Option<String>,
2753        pub text: String,
2754        pub ttl: Option<i32>,
2755        pub c_name: String,
2756
2757        pub domain: DnsDomain,
2758    }
2759
2760    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2761    #[cynic(graphql_type = "CAARecord")]
2762    pub struct CaaRecord {
2763        pub id: cynic::Id,
2764        pub created_at: DateTime,
2765        pub updated_at: DateTime,
2766        pub deleted_at: Option<DateTime>,
2767        pub name: Option<String>,
2768        pub text: String,
2769        pub ttl: Option<i32>,
2770        pub value: String,
2771        pub flags: i32,
2772        pub tag: DnsmanagerCertificationAuthorityAuthorizationRecordTagChoices,
2773
2774        pub domain: DnsDomain,
2775    }
2776
2777    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2778    #[cynic(graphql_type = "ARecord")]
2779    pub struct ARecord {
2780        pub id: cynic::Id,
2781        pub created_at: DateTime,
2782        pub updated_at: DateTime,
2783        pub deleted_at: Option<DateTime>,
2784        pub name: Option<String>,
2785        pub text: String,
2786        pub ttl: Option<i32>,
2787        pub address: String,
2788        pub domain: DnsDomain,
2789    }
2790
2791    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2792    #[cynic(graphql_type = "AAAARecord")]
2793    pub struct AaaaRecord {
2794        pub id: cynic::Id,
2795        pub created_at: DateTime,
2796        pub updated_at: DateTime,
2797        pub deleted_at: Option<DateTime>,
2798        pub name: Option<String>,
2799        pub text: String,
2800        pub ttl: Option<i32>,
2801        pub address: String,
2802        pub domain: DnsDomain,
2803    }
2804
2805    #[derive(cynic::InlineFragments, Debug, Clone, Serialize)]
2806    #[cynic(graphql_type = "DNSRecord")]
2807    pub enum DnsRecord {
2808        A(ARecord),
2809        AAAA(AaaaRecord),
2810        CName(CNameRecord),
2811        Txt(TxtRecord),
2812        Mx(MxRecord),
2813        Ns(NsRecord),
2814        CAA(CaaRecord),
2815        DName(DNameRecord),
2816        Ptr(PtrRecord),
2817        Soa(SoaRecord),
2818        Srv(SrvRecord),
2819        Sshfp(SshfpRecord),
2820        #[cynic(fallback)]
2821        Unknown,
2822    }
2823
2824    impl DnsRecord {
2825        pub fn id(&self) -> &str {
2826            match self {
2827                DnsRecord::A(record) => record.id.inner(),
2828                DnsRecord::AAAA(record) => record.id.inner(),
2829                DnsRecord::CName(record) => record.id.inner(),
2830                DnsRecord::Txt(record) => record.id.inner(),
2831                DnsRecord::Mx(record) => record.id.inner(),
2832                DnsRecord::Ns(record) => record.id.inner(),
2833                DnsRecord::CAA(record) => record.id.inner(),
2834                DnsRecord::DName(record) => record.id.inner(),
2835                DnsRecord::Ptr(record) => record.id.inner(),
2836                DnsRecord::Soa(record) => record.id.inner(),
2837                DnsRecord::Srv(record) => record.id.inner(),
2838                DnsRecord::Sshfp(record) => record.id.inner(),
2839                DnsRecord::Unknown => "",
2840            }
2841        }
2842        pub fn name(&self) -> Option<&str> {
2843            match self {
2844                DnsRecord::A(record) => record.name.as_deref(),
2845                DnsRecord::AAAA(record) => record.name.as_deref(),
2846                DnsRecord::CName(record) => record.name.as_deref(),
2847                DnsRecord::Txt(record) => record.name.as_deref(),
2848                DnsRecord::Mx(record) => record.name.as_deref(),
2849                DnsRecord::Ns(record) => record.name.as_deref(),
2850                DnsRecord::CAA(record) => record.name.as_deref(),
2851                DnsRecord::DName(record) => record.name.as_deref(),
2852                DnsRecord::Ptr(record) => record.name.as_deref(),
2853                DnsRecord::Soa(record) => record.name.as_deref(),
2854                DnsRecord::Srv(record) => record.name.as_deref(),
2855                DnsRecord::Sshfp(record) => record.name.as_deref(),
2856                DnsRecord::Unknown => None,
2857            }
2858        }
2859        pub fn ttl(&self) -> Option<i32> {
2860            match self {
2861                DnsRecord::A(record) => record.ttl,
2862                DnsRecord::AAAA(record) => record.ttl,
2863                DnsRecord::CName(record) => record.ttl,
2864                DnsRecord::Txt(record) => record.ttl,
2865                DnsRecord::Mx(record) => record.ttl,
2866                DnsRecord::Ns(record) => record.ttl,
2867                DnsRecord::CAA(record) => record.ttl,
2868                DnsRecord::DName(record) => record.ttl,
2869                DnsRecord::Ptr(record) => record.ttl,
2870                DnsRecord::Soa(record) => record.ttl,
2871                DnsRecord::Srv(record) => record.ttl,
2872                DnsRecord::Sshfp(record) => record.ttl,
2873                DnsRecord::Unknown => None,
2874            }
2875        }
2876
2877        pub fn text(&self) -> &str {
2878            match self {
2879                DnsRecord::A(record) => record.text.as_str(),
2880                DnsRecord::AAAA(record) => record.text.as_str(),
2881                DnsRecord::CName(record) => record.text.as_str(),
2882                DnsRecord::Txt(record) => record.text.as_str(),
2883                DnsRecord::Mx(record) => record.text.as_str(),
2884                DnsRecord::Ns(record) => record.text.as_str(),
2885                DnsRecord::CAA(record) => record.text.as_str(),
2886                DnsRecord::DName(record) => record.text.as_str(),
2887                DnsRecord::Ptr(record) => record.text.as_str(),
2888                DnsRecord::Soa(record) => record.text.as_str(),
2889                DnsRecord::Srv(record) => record.text.as_str(),
2890                DnsRecord::Sshfp(record) => record.text.as_str(),
2891                DnsRecord::Unknown => "",
2892            }
2893        }
2894        pub fn record_type(&self) -> &str {
2895            match self {
2896                DnsRecord::A(_) => "A",
2897                DnsRecord::AAAA(_) => "AAAA",
2898                DnsRecord::CName(_) => "CNAME",
2899                DnsRecord::Txt(_) => "TXT",
2900                DnsRecord::Mx(_) => "MX",
2901                DnsRecord::Ns(_) => "NS",
2902                DnsRecord::CAA(_) => "CAA",
2903                DnsRecord::DName(_) => "DNAME",
2904                DnsRecord::Ptr(_) => "PTR",
2905                DnsRecord::Soa(_) => "SOA",
2906                DnsRecord::Srv(_) => "SRV",
2907                DnsRecord::Sshfp(_) => "SSHFP",
2908                DnsRecord::Unknown => "",
2909            }
2910        }
2911
2912        pub fn domain(&self) -> Option<&DnsDomain> {
2913            match self {
2914                DnsRecord::A(record) => Some(&record.domain),
2915                DnsRecord::AAAA(record) => Some(&record.domain),
2916                DnsRecord::CName(record) => Some(&record.domain),
2917                DnsRecord::Txt(record) => Some(&record.domain),
2918                DnsRecord::Mx(record) => Some(&record.domain),
2919                DnsRecord::Ns(record) => Some(&record.domain),
2920                DnsRecord::CAA(record) => Some(&record.domain),
2921                DnsRecord::DName(record) => Some(&record.domain),
2922                DnsRecord::Ptr(record) => Some(&record.domain),
2923                DnsRecord::Soa(record) => Some(&record.domain),
2924                DnsRecord::Srv(record) => Some(&record.domain),
2925                DnsRecord::Sshfp(record) => Some(&record.domain),
2926                DnsRecord::Unknown => None,
2927            }
2928        }
2929
2930        pub fn created_at(&self) -> Option<&DateTime> {
2931            match self {
2932                DnsRecord::A(record) => Some(&record.created_at),
2933                DnsRecord::AAAA(record) => Some(&record.created_at),
2934                DnsRecord::CName(record) => Some(&record.created_at),
2935                DnsRecord::Txt(record) => Some(&record.created_at),
2936                DnsRecord::Mx(record) => Some(&record.created_at),
2937                DnsRecord::Ns(record) => Some(&record.created_at),
2938                DnsRecord::CAA(record) => Some(&record.created_at),
2939                DnsRecord::DName(record) => Some(&record.created_at),
2940                DnsRecord::Ptr(record) => Some(&record.created_at),
2941                DnsRecord::Soa(record) => Some(&record.created_at),
2942                DnsRecord::Srv(record) => Some(&record.created_at),
2943                DnsRecord::Sshfp(record) => Some(&record.created_at),
2944                DnsRecord::Unknown => None,
2945            }
2946        }
2947
2948        pub fn updated_at(&self) -> Option<&DateTime> {
2949            match self {
2950                Self::A(record) => Some(&record.updated_at),
2951                Self::AAAA(record) => Some(&record.updated_at),
2952                Self::CName(record) => Some(&record.updated_at),
2953                Self::Txt(record) => Some(&record.updated_at),
2954                Self::Mx(record) => Some(&record.updated_at),
2955                Self::Ns(record) => Some(&record.updated_at),
2956                Self::CAA(record) => Some(&record.updated_at),
2957                Self::DName(record) => Some(&record.updated_at),
2958                Self::Ptr(record) => Some(&record.updated_at),
2959                Self::Soa(record) => Some(&record.updated_at),
2960                Self::Srv(record) => Some(&record.updated_at),
2961                Self::Sshfp(record) => Some(&record.updated_at),
2962                Self::Unknown => None,
2963            }
2964        }
2965
2966        pub fn deleted_at(&self) -> Option<&DateTime> {
2967            match self {
2968                Self::A(record) => record.deleted_at.as_ref(),
2969                Self::AAAA(record) => record.deleted_at.as_ref(),
2970                Self::CName(record) => record.deleted_at.as_ref(),
2971                Self::Txt(record) => record.deleted_at.as_ref(),
2972                Self::Mx(record) => record.deleted_at.as_ref(),
2973                Self::Ns(record) => record.deleted_at.as_ref(),
2974                Self::CAA(record) => record.deleted_at.as_ref(),
2975                Self::DName(record) => record.deleted_at.as_ref(),
2976                Self::Ptr(record) => record.deleted_at.as_ref(),
2977                Self::Soa(record) => record.deleted_at.as_ref(),
2978                Self::Srv(record) => record.deleted_at.as_ref(),
2979                Self::Sshfp(record) => record.deleted_at.as_ref(),
2980                Self::Unknown => None,
2981            }
2982        }
2983    }
2984
2985    #[derive(cynic::Enum, Clone, Copy, Debug)]
2986    pub enum DnsmanagerCertificationAuthorityAuthorizationRecordTagChoices {
2987        Issue,
2988        Issuewild,
2989        Iodef,
2990    }
2991
2992    impl DnsmanagerCertificationAuthorityAuthorizationRecordTagChoices {
2993        pub fn as_str(self) -> &'static str {
2994            match self {
2995                Self::Issue => "issue",
2996                Self::Issuewild => "issuewild",
2997                Self::Iodef => "iodef",
2998            }
2999        }
3000    }
3001
3002    #[derive(cynic::Enum, Clone, Copy, Debug)]
3003    pub enum DnsmanagerSshFingerprintRecordAlgorithmChoices {
3004        #[cynic(rename = "A_1")]
3005        A1,
3006        #[cynic(rename = "A_2")]
3007        A2,
3008        #[cynic(rename = "A_3")]
3009        A3,
3010        #[cynic(rename = "A_4")]
3011        A4,
3012    }
3013
3014    #[derive(cynic::Enum, Clone, Copy, Debug)]
3015    pub enum DnsmanagerSshFingerprintRecordTypeChoices {
3016        #[cynic(rename = "A_1")]
3017        A1,
3018        #[cynic(rename = "A_2")]
3019        A2,
3020    }
3021
3022    #[derive(cynic::QueryVariables, Debug)]
3023    pub struct GetDomainVars {
3024        pub domain: String,
3025    }
3026
3027    #[derive(cynic::QueryFragment, Debug)]
3028    #[cynic(graphql_type = "Query", variables = "GetDomainVars")]
3029    pub struct GetDomain {
3030        #[arguments(name: $domain)]
3031        pub get_domain: Option<DnsDomain>,
3032    }
3033
3034    #[derive(cynic::QueryFragment, Debug)]
3035    #[cynic(graphql_type = "Query", variables = "GetDomainVars")]
3036    pub struct GetDomainWithZoneFile {
3037        #[arguments(name: $domain)]
3038        pub get_domain: Option<DnsDomainWithZoneFile>,
3039    }
3040
3041    #[derive(cynic::QueryFragment, Debug)]
3042    #[cynic(graphql_type = "Query", variables = "GetDomainVars")]
3043    pub struct GetDomainWithRecords {
3044        #[arguments(name: $domain)]
3045        pub get_domain: Option<DnsDomainWithRecords>,
3046    }
3047
3048    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
3049    #[cynic(graphql_type = "DNSDomain")]
3050    pub struct DnsDomain {
3051        pub id: cynic::Id,
3052        pub name: String,
3053        pub slug: String,
3054        pub owner: Owner,
3055    }
3056
3057    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
3058    #[cynic(graphql_type = "DNSDomain")]
3059    pub struct DnsDomainWithZoneFile {
3060        pub id: cynic::Id,
3061        pub name: String,
3062        pub slug: String,
3063        pub zone_file: String,
3064    }
3065
3066    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
3067    #[cynic(graphql_type = "DNSDomain")]
3068    pub struct DnsDomainWithRecords {
3069        pub id: cynic::Id,
3070        pub name: String,
3071        pub slug: String,
3072        pub records: Option<Vec<Option<DnsRecord>>>,
3073    }
3074
3075    #[derive(cynic::QueryVariables, Debug)]
3076    pub struct PurgeCacheForAppVersionVars {
3077        pub id: cynic::Id,
3078    }
3079
3080    #[derive(cynic::QueryFragment, Debug)]
3081    pub struct PurgeCacheForAppVersionPayload {
3082        pub app_version: DeployAppVersion,
3083    }
3084
3085    #[derive(cynic::QueryFragment, Debug)]
3086    #[cynic(graphql_type = "Mutation", variables = "PurgeCacheForAppVersionVars")]
3087    pub struct PurgeCacheForAppVersion {
3088        #[arguments(input: {id: $id})]
3089        pub purge_cache_for_app_version: Option<PurgeCacheForAppVersionPayload>,
3090    }
3091
3092    #[derive(cynic::QueryVariables, Debug)]
3093    pub struct ConfigureAppCdnCacheVars {
3094        pub app: cynic::Id,
3095        pub enabled: Option<bool>,
3096    }
3097
3098    #[derive(cynic::QueryVariables, Debug)]
3099    pub struct PurgeAppCdnCacheVars {
3100        pub app: cynic::Id,
3101    }
3102
3103    #[derive(cynic::QueryFragment, Debug)]
3104    pub struct AppCdnCacheMutationPayload {
3105        pub success: bool,
3106    }
3107
3108    #[derive(cynic::QueryFragment, Debug)]
3109    #[cynic(graphql_type = "Mutation", variables = "ConfigureAppCdnCacheVars")]
3110    pub struct ConfigureAppCdnCache {
3111        #[arguments(app: $app, config: {enabled: $enabled})]
3112        pub configure_app_cdn_cache: AppCdnCacheMutationPayload,
3113    }
3114
3115    #[derive(cynic::QueryFragment, Debug)]
3116    #[cynic(graphql_type = "Mutation", variables = "PurgeAppCdnCacheVars")]
3117    pub struct PurgeAppCdnCache {
3118        #[arguments(app: $app)]
3119        pub purge_app_cdn_cache: AppCdnCacheMutationPayload,
3120    }
3121
3122    #[derive(cynic::QueryVariables, Debug)]
3123    pub struct GetAppCdnCacheStatusVars {
3124        pub app: cynic::Id,
3125    }
3126
3127    #[derive(cynic::QueryFragment, Debug)]
3128    #[cynic(graphql_type = "Query", variables = "GetAppCdnCacheStatusVars")]
3129    pub struct GetAppCdnCacheStatus {
3130        #[arguments(id: $app)]
3131        #[cynic(rename = "node")]
3132        pub app: Option<NodeAppCdnCacheStatus>,
3133    }
3134
3135    #[derive(cynic::InlineFragments, Debug)]
3136    #[cynic(graphql_type = "Node")]
3137    pub enum NodeAppCdnCacheStatus {
3138        DeployApp(Box<AppCdnCacheStatus>),
3139        #[cynic(fallback)]
3140        Unknown,
3141    }
3142
3143    impl NodeAppCdnCacheStatus {
3144        pub fn into_app(self) -> Option<AppCdnCacheStatus> {
3145            match self {
3146                Self::DeployApp(app) => Some(*app),
3147                Self::Unknown => None,
3148            }
3149        }
3150    }
3151
3152    #[derive(cynic::QueryFragment, Debug)]
3153    #[cynic(graphql_type = "DeployApp")]
3154    pub struct AppCdnCacheStatus {
3155        pub cdn_cache_enabled: bool,
3156        pub cdn_cache_purged_at: Option<DateTime>,
3157    }
3158
3159    #[derive(cynic::QueryVariables, Debug)]
3160    pub struct GetAppCdnCacheMetricsVars {
3161        pub app: cynic::Id,
3162        pub start_at: DateTime,
3163        pub end_at: DateTime,
3164        pub grouped_by: MetricGrouping,
3165    }
3166
3167    #[derive(cynic::QueryFragment, Debug)]
3168    #[cynic(graphql_type = "Query", variables = "GetAppCdnCacheMetricsVars")]
3169    pub struct GetAppCdnCacheMetrics {
3170        #[arguments(id: $app)]
3171        #[cynic(rename = "node")]
3172        pub app: Option<NodeAppCdnCacheMetrics>,
3173    }
3174
3175    #[derive(cynic::InlineFragments, Debug)]
3176    #[cynic(graphql_type = "Node", variables = "GetAppCdnCacheMetricsVars")]
3177    pub enum NodeAppCdnCacheMetrics {
3178        DeployApp(Box<AppCdnCacheMetrics>),
3179        #[cynic(fallback)]
3180        Unknown,
3181    }
3182
3183    impl NodeAppCdnCacheMetrics {
3184        pub fn into_app(self) -> Option<AppCdnCacheMetrics> {
3185            match self {
3186                Self::DeployApp(app) => Some(*app),
3187                Self::Unknown => None,
3188            }
3189        }
3190    }
3191
3192    #[derive(cynic::QueryFragment, Debug)]
3193    #[cynic(graphql_type = "DeployApp", variables = "GetAppCdnCacheMetricsVars")]
3194    pub struct AppCdnCacheMetrics {
3195        #[arguments(startAt: $start_at, endAt: $end_at, groupedBy: $grouped_by)]
3196        pub grouped_metrics: UsageMetrics,
3197    }
3198
3199    #[derive(cynic::QueryFragment, Debug)]
3200    pub struct UsageMetrics {
3201        pub totals: MetricsTotals,
3202    }
3203
3204    #[derive(cynic::QueryFragment, Debug)]
3205    pub struct MetricsTotals {
3206        pub requests: RequestMetrics,
3207    }
3208
3209    #[derive(cynic::QueryFragment, Debug)]
3210    pub struct RequestMetrics {
3211        pub total_requests: BigInt,
3212        pub cached_requests: BigInt,
3213        pub data_served_bytes: BigInt,
3214        pub data_cached_bytes: BigInt,
3215    }
3216
3217    #[derive(cynic::Enum, Clone, Copy, Debug)]
3218    pub enum MetricGrouping {
3219        #[cynic(rename = "BY_15_MINUTES")]
3220        By15Minutes,
3221        #[cynic(rename = "BY_5_MINUTES")]
3222        By5Minutes,
3223        #[cynic(rename = "BY_HOUR")]
3224        ByHour,
3225        #[cynic(rename = "BY_DAY")]
3226        ByDay,
3227        #[cynic(rename = "BY_WEEK")]
3228        ByWeek,
3229    }
3230
3231    #[derive(cynic::Scalar, Debug, Clone)]
3232    #[cynic(graphql_type = "URL")]
3233    pub struct Url(pub String);
3234
3235    #[derive(cynic::Scalar, Debug, Clone)]
3236    pub struct BigInt(pub i64);
3237
3238    #[derive(cynic::Enum, Clone, Copy, Debug, PartialEq, Eq)]
3239    pub enum ProgrammingLanguage {
3240        Python,
3241        Javascript,
3242    }
3243
3244    /// A library that exposes bindings to a Wasmer package.
3245    #[derive(Debug, Clone)]
3246    pub struct Bindings {
3247        /// A unique ID specifying this set of bindings.
3248        pub id: String,
3249        /// The URL which can be used to download the files that were generated
3250        /// (typically as a `*.tar.gz` file).
3251        pub url: String,
3252        /// The programming language these bindings are written in.
3253        pub language: ProgrammingLanguage,
3254        /// The generator used to generate these bindings.
3255        pub generator: BindingsGenerator,
3256    }
3257
3258    #[derive(cynic::QueryVariables, Debug, Clone)]
3259    pub struct GetBindingsQueryVariables<'a> {
3260        pub name: &'a str,
3261        pub version: Option<&'a str>,
3262    }
3263
3264    #[derive(cynic::QueryFragment, Debug, Clone)]
3265    #[cynic(graphql_type = "Query", variables = "GetBindingsQueryVariables")]
3266    pub struct GetBindingsQuery {
3267        #[arguments(name: $name, version: $version)]
3268        #[cynic(rename = "getPackageVersion")]
3269        pub package_version: Option<PackageBindingsVersion>,
3270    }
3271
3272    #[derive(cynic::QueryFragment, Debug, Clone)]
3273    #[cynic(graphql_type = "PackageVersion")]
3274    pub struct PackageBindingsVersion {
3275        pub bindings: Vec<Option<PackageVersionLanguageBinding>>,
3276    }
3277
3278    #[derive(cynic::QueryFragment, Debug, Clone)]
3279    pub struct BindingsGenerator {
3280        pub package_version: PackageVersion,
3281        pub command_name: String,
3282    }
3283
3284    #[derive(cynic::QueryFragment, Debug, Clone)]
3285    pub struct PackageVersionLanguageBinding {
3286        pub id: cynic::Id,
3287        pub language: ProgrammingLanguage,
3288        pub url: String,
3289        pub generator: BindingsGenerator,
3290        pub __typename: String,
3291    }
3292
3293    #[derive(cynic::QueryVariables, Debug)]
3294    pub struct PackageVersionReadySubscriptionVariables {
3295        pub package_version_id: cynic::Id,
3296    }
3297
3298    #[derive(cynic::QueryFragment, Debug)]
3299    #[cynic(
3300        graphql_type = "Subscription",
3301        variables = "PackageVersionReadySubscriptionVariables"
3302    )]
3303    pub struct PackageVersionReadySubscription {
3304        #[arguments(packageVersionId: $package_version_id)]
3305        pub package_version_ready: PackageVersionReadyResponse,
3306    }
3307
3308    #[derive(cynic::QueryFragment, Debug)]
3309    pub struct PackageVersionReadyResponse {
3310        pub state: PackageVersionState,
3311        pub success: bool,
3312    }
3313
3314    #[derive(cynic::Enum, Clone, Copy, Debug)]
3315    pub enum PackageVersionState {
3316        WebcGenerated,
3317        BindingsGenerated,
3318        NativeExesGenerated,
3319    }
3320
3321    #[derive(cynic::InlineFragments, Debug, Clone)]
3322    #[cynic(graphql_type = "Node", variables = "GetDeployAppVersionsByIdVars")]
3323    pub enum NodeDeployAppVersions {
3324        DeployApp(Box<DeployAppVersionsById>),
3325        #[cynic(fallback)]
3326        Unknown,
3327    }
3328
3329    impl NodeDeployAppVersions {
3330        pub fn into_app(self) -> Option<DeployAppVersionsById> {
3331            match self {
3332                Self::DeployApp(v) => Some(*v),
3333                _ => None,
3334            }
3335        }
3336    }
3337
3338    #[derive(cynic::InlineFragments, Debug)]
3339    pub enum Node {
3340        DeployApp(Box<DeployApp>),
3341        DeployAppVersion(Box<DeployAppVersion>),
3342        AutobuildRepository(Box<AutobuildRepository>),
3343        #[cynic(fallback)]
3344        Unknown,
3345    }
3346
3347    impl Node {
3348        pub fn into_deploy_app(self) -> Option<DeployApp> {
3349            match self {
3350                Node::DeployApp(app) => Some(*app),
3351                _ => None,
3352            }
3353        }
3354
3355        pub fn into_deploy_app_version(self) -> Option<DeployAppVersion> {
3356            match self {
3357                Node::DeployAppVersion(version) => Some(*version),
3358                _ => None,
3359            }
3360        }
3361    }
3362}
3363
3364#[allow(non_snake_case, non_camel_case_types)]
3365mod schema {
3366    cynic::use_schema!(r#"schema.graphql"#);
3367}