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::Enum, Clone, Copy, Debug)]
43    pub enum GrapheneRole {
44        Owner,
45        Admin,
46        Editor,
47        Viewer,
48    }
49
50    #[derive(cynic::QueryVariables, Debug)]
51    pub struct ViewerCanVariables<'a> {
52        pub action: OwnerAction,
53        pub owner_name: &'a str,
54    }
55
56    #[derive(cynic::QueryFragment, Debug)]
57    #[cynic(graphql_type = "Query", variables = "ViewerCanVariables")]
58    pub struct ViewerCan {
59        #[arguments(action: $action, ownerName: $owner_name)]
60        pub viewer_can: bool,
61    }
62
63    #[derive(cynic::Enum, Clone, Copy, Debug)]
64    pub enum OwnerAction {
65        DeployApp,
66        PublishPackage,
67    }
68
69    #[derive(cynic::QueryVariables, Debug)]
70    pub struct RevokeTokenVariables {
71        pub token: String,
72    }
73
74    #[derive(cynic::QueryFragment, Debug)]
75    #[cynic(graphql_type = "Mutation", variables = "RevokeTokenVariables")]
76    pub struct RevokeToken {
77        #[arguments(input: { token: $token })]
78        pub revoke_api_token: Option<RevokeAPITokenPayload>,
79    }
80
81    #[derive(cynic::QueryFragment, Debug)]
82    pub struct RevokeAPITokenPayload {
83        pub success: Option<bool>,
84    }
85
86    #[derive(cynic::QueryVariables, Debug)]
87    pub struct CreateNewNonceVariables {
88        pub callback_url: String,
89        pub name: String,
90    }
91
92    #[derive(cynic::QueryFragment, Debug)]
93    #[cynic(graphql_type = "Mutation", variables = "CreateNewNonceVariables")]
94    pub struct CreateNewNonce {
95        #[arguments(input: { callbackUrl: $callback_url, name: $name })]
96        pub new_nonce: Option<NewNoncePayload>,
97    }
98
99    #[derive(cynic::QueryFragment, Debug)]
100    pub struct NewNoncePayload {
101        pub client_mutation_id: Option<String>,
102        pub nonce: Nonce,
103    }
104
105    #[derive(cynic::QueryFragment, Debug)]
106    pub struct Nonce {
107        pub auth_url: String,
108        pub callback_url: String,
109        pub created_at: DateTime,
110        pub expired: bool,
111        pub id: cynic::Id,
112        pub is_validated: bool,
113        pub name: String,
114        pub secret: String,
115    }
116
117    #[derive(cynic::QueryFragment, Debug)]
118    #[cynic(graphql_type = "Query")]
119    pub struct GetCurrentUser {
120        pub viewer: Option<User>,
121    }
122
123    #[derive(cynic::QueryVariables, Debug)]
124    pub struct GetCurrentUserWithNamespacesVars {
125        pub namespace_role: Option<GrapheneRole>,
126    }
127
128    #[derive(cynic::QueryFragment, Debug)]
129    #[cynic(graphql_type = "Query", variables = "GetCurrentUserWithNamespacesVars")]
130    pub struct GetCurrentUserWithNamespaces {
131        pub viewer: Option<UserWithNamespaces>,
132    }
133
134    #[derive(cynic::QueryFragment, Debug, serde::Serialize)]
135    pub struct User {
136        pub id: cynic::Id,
137        pub username: String,
138    }
139
140    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
141    pub struct Package {
142        pub id: cynic::Id,
143        pub package_name: String,
144        pub namespace: Option<String>,
145        pub last_version: Option<PackageVersion>,
146        pub private: bool,
147    }
148
149    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
150    pub struct PackageDistribution {
151        pub pirita_sha256_hash: Option<String>,
152        pub pirita_download_url: Option<String>,
153        pub download_url: Option<String>,
154        pub size: Option<i32>,
155        pub pirita_size: Option<i32>,
156        pub webc_version: Option<WebcVersion>,
157        pub webc_manifest: Option<JSONString>,
158    }
159
160    #[derive(cynic::Enum, Clone, Copy, Debug)]
161    pub enum WebcVersion {
162        V2,
163        V3,
164    }
165
166    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
167    pub struct WebcImage {
168        pub created_at: DateTime,
169        pub updated_at: DateTime,
170        pub webc_url: String,
171        pub webc_sha256: String,
172        pub file_size: BigInt,
173        pub manifest: JSONString,
174        pub version: Option<WebcVersion>,
175    }
176
177    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
178    pub struct PackageWebc {
179        pub id: cynic::Id,
180        pub created_at: DateTime,
181        pub updated_at: DateTime,
182        pub tag: String,
183        pub is_archived: bool,
184        pub webc_url: String,
185        pub webc: Option<WebcImage>,
186        pub webc_v3: Option<WebcImage>,
187    }
188
189    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
190    pub struct PackageVersion {
191        pub id: cynic::Id,
192        pub version: String,
193        pub created_at: DateTime,
194        pub distribution: PackageDistribution,
195    }
196
197    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
198    #[cynic(graphql_type = "PackageVersion")]
199    pub struct PackageVersionWithPackage {
200        pub id: cynic::Id,
201        pub version: String,
202        pub created_at: DateTime,
203        pub pirita_manifest: Option<JSONString>,
204        pub package: Package,
205
206        #[arguments(version: "V3")]
207        #[cynic(rename = "distribution")]
208        pub distribution_v3: PackageDistribution,
209
210        #[arguments(version: "V2")]
211        #[cynic(rename = "distribution")]
212        pub distribution_v2: PackageDistribution,
213    }
214
215    #[derive(cynic::QueryVariables, Debug)]
216    pub struct GetAppTemplateFromSlugVariables {
217        pub slug: String,
218    }
219
220    #[derive(cynic::QueryFragment, Debug)]
221    #[cynic(graphql_type = "Query", variables = "GetAppTemplateFromSlugVariables")]
222    pub struct GetAppTemplateFromSlug {
223        #[arguments(slug: $slug)]
224        pub get_app_template: Option<AppTemplate>,
225    }
226
227    #[derive(cynic::Enum, Clone, Copy, Debug)]
228    pub enum AppTemplatesSortBy {
229        Newest,
230        Oldest,
231        Popular,
232    }
233
234    #[derive(cynic::QueryVariables, Debug, Clone)]
235    pub struct GetAppTemplatesFromFrameworkVars {
236        pub framework_slug: String,
237        pub first: i32,
238        pub after: Option<String>,
239        pub sort_by: Option<AppTemplatesSortBy>,
240    }
241
242    #[derive(cynic::QueryFragment, Debug)]
243    #[cynic(graphql_type = "Query", variables = "GetAppTemplatesFromFrameworkVars")]
244    pub struct GetAppTemplatesFromFramework {
245        #[arguments(
246            frameworkSlug: $framework_slug,
247            first: $first,
248            after: $after,
249            sortBy: $sort_by
250        )]
251        pub get_app_templates: Option<AppTemplateConnection>,
252    }
253
254    #[derive(cynic::QueryVariables, Debug, Clone)]
255    pub struct GetAppTemplatesFromLanguageVars {
256        pub language_slug: String,
257        pub first: i32,
258        pub after: Option<String>,
259        pub sort_by: Option<AppTemplatesSortBy>,
260    }
261
262    #[derive(cynic::QueryFragment, Debug)]
263    #[cynic(graphql_type = "Query", variables = "GetAppTemplatesFromLanguageVars")]
264    pub struct GetAppTemplatesFromLanguage {
265        #[arguments(
266            languageSlug: $language_slug,
267            first: $first,
268            after: $after,
269            sortBy: $sort_by
270        )]
271        pub get_app_templates: Option<AppTemplateConnection>,
272    }
273
274    #[derive(cynic::QueryVariables, Debug, Clone)]
275    pub struct GetAppTemplatesVars {
276        pub category_slug: String,
277        pub first: i32,
278        pub after: Option<String>,
279        pub sort_by: Option<AppTemplatesSortBy>,
280    }
281
282    #[derive(cynic::QueryFragment, Debug)]
283    #[cynic(graphql_type = "Query", variables = "GetAppTemplatesVars")]
284    pub struct GetAppTemplates {
285        #[arguments(
286            categorySlug: $category_slug,
287            first: $first,
288            after: $after,
289            sortBy: $sort_by
290        )]
291        pub get_app_templates: Option<AppTemplateConnection>,
292    }
293
294    #[derive(cynic::QueryFragment, Debug)]
295    pub struct AppTemplateConnection {
296        pub edges: Vec<Option<AppTemplateEdge>>,
297        pub page_info: PageInfo,
298    }
299
300    #[derive(cynic::QueryFragment, Debug)]
301    pub struct AppTemplateEdge {
302        pub node: Option<AppTemplate>,
303        pub cursor: String,
304    }
305
306    #[derive(serde::Serialize, cynic::QueryFragment, PartialEq, Eq, Debug, Clone)]
307    pub struct AppTemplate {
308        #[serde(rename = "demoUrl")]
309        pub demo_url: String,
310        pub language: String,
311        pub name: String,
312        pub framework: String,
313        #[serde(rename = "createdAt")]
314        pub created_at: DateTime,
315        pub description: String,
316        pub id: cynic::Id,
317        #[serde(rename = "isPublic")]
318        pub is_public: bool,
319        #[serde(rename = "repoLicense")]
320        pub repo_license: String,
321        pub readme: String,
322        #[serde(rename = "repoUrl")]
323        pub repo_url: String,
324        pub slug: String,
325        #[serde(rename = "updatedAt")]
326        pub updated_at: DateTime,
327        #[serde(rename = "useCases")]
328        pub use_cases: Jsonstring,
329        #[serde(rename = "branch")]
330        pub branch: Option<String>,
331        #[serde(rename = "rootDir")]
332        pub root_dir: Option<String>,
333    }
334
335    #[derive(cynic::QueryVariables, Debug, Clone)]
336    pub struct GetTemplateFrameworksVars {
337        pub after: Option<String>,
338        pub first: Option<i32>,
339    }
340
341    #[derive(cynic::QueryFragment, Debug)]
342    #[cynic(graphql_type = "Query", variables = "GetTemplateFrameworksVars")]
343    pub struct GetTemplateFrameworks {
344        #[arguments(after: $after, first: $first)]
345        pub get_template_frameworks: Option<TemplateFrameworkConnection>,
346    }
347
348    #[derive(cynic::QueryFragment, Debug)]
349    pub struct TemplateFrameworkConnection {
350        pub edges: Vec<Option<TemplateFrameworkEdge>>,
351        pub page_info: PageInfo,
352        pub total_count: Option<i32>,
353    }
354
355    #[derive(cynic::QueryFragment, Debug)]
356    pub struct TemplateFrameworkEdge {
357        pub cursor: String,
358        pub node: Option<TemplateFramework>,
359    }
360
361    #[derive(serde::Serialize, cynic::QueryFragment, PartialEq, Eq, Debug)]
362    pub struct TemplateFramework {
363        #[serde(rename = "createdAt")]
364        pub created_at: DateTime,
365        pub id: cynic::Id,
366        pub name: String,
367        pub slug: String,
368        #[serde(rename = "updatedAt")]
369        pub updated_at: DateTime,
370    }
371
372    #[derive(cynic::QueryVariables, Debug, Clone)]
373    pub struct GetTemplateLanguagesVars {
374        pub after: Option<String>,
375        pub first: Option<i32>,
376    }
377
378    #[derive(cynic::QueryFragment, Debug)]
379    #[cynic(graphql_type = "Query", variables = "GetTemplateLanguagesVars")]
380    pub struct GetTemplateLanguages {
381        #[arguments(after: $after, first: $first)]
382        pub get_template_languages: Option<TemplateLanguageConnection>,
383    }
384
385    #[derive(cynic::QueryFragment, Debug)]
386    pub struct TemplateLanguageConnection {
387        pub edges: Vec<Option<TemplateLanguageEdge>>,
388        pub page_info: PageInfo,
389        pub total_count: Option<i32>,
390    }
391
392    #[derive(cynic::QueryFragment, Debug)]
393    pub struct TemplateLanguageEdge {
394        pub cursor: String,
395        pub node: Option<TemplateLanguage>,
396    }
397
398    #[derive(serde::Serialize, cynic::QueryFragment, PartialEq, Eq, Debug)]
399    pub struct TemplateLanguage {
400        #[serde(rename = "createdAt")]
401        pub created_at: DateTime,
402        pub id: cynic::Id,
403        pub name: String,
404        pub slug: String,
405        #[serde(rename = "updatedAt")]
406        pub updated_at: DateTime,
407    }
408
409    #[derive(cynic::Scalar, Debug, Clone, PartialEq, Eq)]
410    #[cynic(graphql_type = "JSONString")]
411    pub struct Jsonstring(pub String);
412
413    #[derive(cynic::QueryVariables, Debug)]
414    pub struct GetPackageReleaseVars {
415        pub hash: String,
416    }
417
418    #[derive(cynic::QueryFragment, Debug)]
419    #[cynic(graphql_type = "Query", variables = "GetPackageReleaseVars")]
420    pub struct GetPackageRelease {
421        #[arguments(hash: $hash)]
422        pub get_package_release: Option<PackageWebc>,
423    }
424
425    #[derive(cynic::QueryVariables, Debug)]
426    pub struct GetPackageVars {
427        pub name: String,
428    }
429
430    #[derive(cynic::QueryFragment, Debug)]
431    #[cynic(graphql_type = "Query", variables = "GetPackageVars")]
432    pub struct GetPackage {
433        #[arguments(name: $name)]
434        pub get_package: Option<Package>,
435    }
436
437    #[derive(cynic::QueryVariables, Debug)]
438    pub struct GetPackageVersionVars {
439        pub name: String,
440        pub version: String,
441    }
442
443    #[derive(cynic::QueryFragment, Debug)]
444    #[cynic(graphql_type = "Query", variables = "GetPackageVersionVars")]
445    pub struct GetPackageVersion {
446        #[arguments(name: $name, version: $version)]
447        pub get_package_version: Option<PackageVersionWithPackage>,
448    }
449
450    #[derive(cynic::Enum, Clone, Copy, Debug)]
451    pub enum PackageVersionSortBy {
452        Newest,
453        Oldest,
454    }
455
456    #[derive(cynic::QueryVariables, Debug)]
457    pub struct PushPackageReleaseVariables<'a> {
458        pub name: Option<&'a str>,
459        pub namespace: &'a str,
460        pub private: Option<bool>,
461        pub signed_url: &'a str,
462    }
463
464    #[derive(cynic::QueryFragment, Debug)]
465    #[cynic(graphql_type = "Mutation", variables = "PushPackageReleaseVariables")]
466    pub struct PushPackageRelease {
467        #[arguments(input: { name: $name, namespace: $namespace, private: $private, signedUrl: $signed_url })]
468        pub push_package_release: Option<PushPackageReleasePayload>,
469    }
470
471    #[derive(cynic::QueryFragment, Debug)]
472    pub struct PushPackageReleasePayload {
473        pub package_webc: Option<PackageWebc>,
474        pub success: bool,
475    }
476
477    #[derive(cynic::QueryVariables, Debug)]
478    pub struct TagPackageReleaseVariables<'a> {
479        pub description: Option<&'a str>,
480        pub homepage: Option<&'a str>,
481        pub license: Option<&'a str>,
482        pub license_file: Option<&'a str>,
483        pub manifest: Option<&'a str>,
484        pub name: &'a str,
485        pub namespace: Option<&'a str>,
486        pub package_release_id: &'a cynic::Id,
487        pub private: Option<bool>,
488        pub readme: Option<&'a str>,
489        pub repository: Option<&'a str>,
490        pub version: &'a str,
491    }
492
493    #[derive(cynic::QueryFragment, Debug)]
494    #[cynic(graphql_type = "Mutation", variables = "TagPackageReleaseVariables")]
495    pub struct TagPackageRelease {
496        #[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 })]
497        pub tag_package_release: Option<TagPackageReleasePayload>,
498    }
499
500    #[derive(cynic::QueryFragment, Debug)]
501    pub struct TagPackageReleasePayload {
502        pub success: bool,
503        pub package_version: Option<PackageVersion>,
504    }
505
506    #[derive(cynic::InputObject, Debug)]
507    pub struct InputSignature<'a> {
508        pub public_key_key_id: &'a str,
509        pub data: &'a str,
510    }
511
512    #[derive(cynic::QueryVariables, Debug, Clone, Default)]
513    pub struct AllPackageVersionsVars {
514        pub offset: Option<i32>,
515        pub before: Option<String>,
516        pub after: Option<String>,
517        pub first: Option<i32>,
518        pub last: Option<i32>,
519
520        pub created_after: Option<DateTime>,
521        pub updated_after: Option<DateTime>,
522        pub sort_by: Option<PackageVersionSortBy>,
523    }
524
525    #[derive(cynic::QueryFragment, Debug)]
526    #[cynic(graphql_type = "Query", variables = "AllPackageVersionsVars")]
527    pub struct GetAllPackageVersions {
528        #[arguments(
529            first: $first,
530            last: $last,
531            after: $after,
532            before: $before,
533            offset: $offset,
534            updatedAfter: $updated_after,
535            createdAfter: $created_after,
536            sortBy: $sort_by,
537        )]
538        pub all_package_versions: PackageVersionConnection,
539    }
540
541    #[derive(cynic::QueryVariables, Debug, Clone, Default)]
542    pub struct AllPackageReleasesVars {
543        pub offset: Option<i32>,
544        pub before: Option<String>,
545        pub after: Option<String>,
546        pub first: Option<i32>,
547        pub last: Option<i32>,
548
549        pub created_after: Option<DateTime>,
550        pub updated_after: Option<DateTime>,
551        pub sort_by: Option<PackageVersionSortBy>,
552    }
553
554    #[derive(cynic::QueryFragment, Debug)]
555    #[cynic(graphql_type = "Query", variables = "AllPackageReleasesVars")]
556    pub struct GetAllPackageReleases {
557        #[arguments(
558            first: $first,
559            last: $last,
560            after: $after,
561            before: $before,
562            offset: $offset,
563            updatedAfter: $updated_after,
564            createdAfter: $created_after,
565            sortBy: $sort_by,
566        )]
567        pub all_package_releases: PackageWebcConnection,
568    }
569
570    impl GetAllPackageReleases {
571        pub fn into_packages(self) -> Vec<PackageWebc> {
572            self.all_package_releases
573                .edges
574                .into_iter()
575                .flatten()
576                .filter_map(|x| x.node)
577                .collect()
578        }
579    }
580
581    #[derive(cynic::QueryVariables, Debug)]
582    pub struct GetSignedUrlForPackageUploadVariables<'a> {
583        pub expires_after_seconds: Option<i32>,
584        pub filename: Option<&'a str>,
585        pub name: Option<&'a str>,
586        pub version: Option<&'a str>,
587        pub method: Option<&'a str>,
588    }
589
590    #[derive(cynic::QueryFragment, Debug)]
591    #[cynic(
592        graphql_type = "Query",
593        variables = "GetSignedUrlForPackageUploadVariables"
594    )]
595    pub struct GetSignedUrlForPackageUpload {
596        #[arguments(name: $name, version: $version, filename: $filename, expiresAfterSeconds: $expires_after_seconds, method: $method)]
597        pub get_signed_url_for_package_upload: Option<SignedUrl>,
598    }
599
600    #[derive(cynic::QueryFragment, Debug)]
601    pub struct SignedUrl {
602        pub url: String,
603    }
604
605    #[derive(cynic::QueryVariables, Debug)]
606    pub struct GenerateUploadUrlVariables<'a> {
607        pub expires_after_seconds: Option<i32>,
608        pub filename: &'a str,
609        pub name: Option<&'a str>,
610        pub version: Option<&'a str>,
611        pub method: Option<&'a str>,
612    }
613
614    #[derive(cynic::QueryFragment, Debug)]
615    #[cynic(graphql_type = "Mutation", variables = "GenerateUploadUrlVariables")]
616    pub struct GenerateUploadUrl {
617        #[arguments(input: { expiresAfterSeconds: $expires_after_seconds, filename: $filename, name: $name, version: $version, method: $method })]
618        pub generate_upload_url: Option<GenerateUploadUrlPayload>,
619    }
620
621    #[derive(cynic::QueryFragment, Debug)]
622    pub struct GenerateUploadUrlPayload {
623        #[cynic(rename = "signedUrl")]
624        pub signed_url: SignedUrl,
625        pub method: String,
626    }
627
628    #[derive(cynic::QueryFragment, Debug)]
629    pub struct PackageWebcConnection {
630        pub page_info: PageInfo,
631        pub edges: Vec<Option<PackageWebcEdge>>,
632    }
633
634    #[derive(cynic::QueryFragment, Debug)]
635    pub struct PackageWebcEdge {
636        pub node: Option<PackageWebc>,
637    }
638
639    #[derive(cynic::QueryFragment, Debug)]
640    pub struct PackageVersionConnection {
641        pub page_info: PageInfo,
642        pub edges: Vec<Option<PackageVersionEdge>>,
643    }
644
645    #[derive(cynic::QueryFragment, Debug)]
646    pub struct PackageVersionEdge {
647        pub node: Option<PackageVersionWithPackage>,
648        pub cursor: String,
649    }
650
651    #[derive(cynic::QueryVariables, Debug)]
652    pub struct GetPackageAndAppVars {
653        pub package: String,
654        pub app_owner: String,
655        pub app_name: String,
656    }
657
658    #[derive(cynic::QueryFragment, Debug)]
659    #[cynic(graphql_type = "Query", variables = "GetPackageAndAppVars")]
660    pub struct GetPackageAndApp {
661        #[arguments(name: $package)]
662        pub get_package: Option<Package>,
663        #[arguments(owner: $app_owner, name: $app_name)]
664        pub get_deploy_app: Option<DeployApp>,
665    }
666
667    #[derive(cynic::QueryVariables, Debug)]
668    pub struct GetCurrentUserWithAppsVars {
669        pub first: Option<i32>,
670        pub after: Option<String>,
671        pub sort: Option<DeployAppsSortBy>,
672    }
673
674    #[derive(cynic::QueryFragment, Debug)]
675    #[cynic(graphql_type = "Query", variables = "GetCurrentUserWithAppsVars")]
676    pub struct GetCurrentUserWithApps {
677        pub viewer: Option<UserWithApps>,
678    }
679
680    #[derive(cynic::QueryFragment, Debug)]
681    #[cynic(graphql_type = "User")]
682    #[cynic(variables = "GetCurrentUserWithAppsVars")]
683    pub struct UserWithApps {
684        pub id: cynic::Id,
685        pub username: String,
686        #[arguments(after: $after, sortBy: $sort, first: $first)]
687        pub apps: DeployAppConnection,
688    }
689
690    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
691    pub struct Owner {
692        pub global_name: String,
693    }
694
695    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
696    #[cynic(graphql_type = "User", variables = "GetCurrentUserWithNamespacesVars")]
697    pub struct UserWithNamespaces {
698        pub id: cynic::Id,
699        pub username: String,
700        #[arguments(role: $namespace_role)]
701        pub namespaces: NamespaceConnection,
702    }
703
704    #[derive(cynic::QueryVariables, Debug)]
705    pub struct GetUserAppsVars {
706        pub username: String,
707    }
708
709    #[derive(cynic::QueryFragment, Debug)]
710    #[cynic(graphql_type = "Query", variables = "GetUserAppsVars")]
711    pub struct GetUserApps {
712        #[arguments(username: $username)]
713        pub get_user: Option<User>,
714    }
715
716    #[derive(cynic::QueryVariables, Debug)]
717    pub struct GetDeployAppVars {
718        pub name: String,
719        pub owner: String,
720    }
721
722    #[derive(cynic::QueryFragment, Debug)]
723    #[cynic(graphql_type = "Query", variables = "GetDeployAppVars")]
724    pub struct GetDeployApp {
725        #[arguments(owner: $owner, name: $name)]
726        pub get_deploy_app: Option<DeployApp>,
727    }
728
729    #[derive(cynic::QueryFragment, Debug)]
730    #[cynic(graphql_type = "Query", variables = "GetDeployAppVars")]
731    pub struct GetDeployAppS3Credentials {
732        #[arguments(owner: $owner, name: $name)]
733        pub get_deploy_app: Option<AppWithS3Credentials>,
734    }
735
736    #[derive(cynic::QueryFragment, Debug)]
737    #[cynic(graphql_type = "DeployApp", variables = "GetDeployAppVars")]
738    pub struct AppWithS3Credentials {
739        pub s3_credentials: Option<S3Credentials>,
740    }
741
742    #[derive(cynic::QueryFragment, Debug)]
743    pub struct S3Credentials {
744        pub access_key: String,
745        pub secret_key: String,
746        pub endpoint: String,
747    }
748
749    #[derive(cynic::QueryVariables, Debug)]
750    pub struct RotateS3SecretsForAppVariables {
751        pub id: cynic::Id,
752    }
753
754    #[derive(cynic::QueryFragment, Debug)]
755    #[cynic(
756        graphql_type = "Mutation",
757        variables = "RotateS3SecretsForAppVariables"
758    )]
759    pub struct RotateS3SecretsForApp {
760        #[arguments(input: { id: $id })]
761        pub rotate_s3_secrets_for_app: Option<RotateS3SecretsForAppPayload>,
762    }
763
764    #[derive(cynic::QueryFragment, Debug)]
765    pub struct RotateS3SecretsForAppPayload {
766        pub client_mutation_id: Option<String>,
767    }
768
769    #[derive(cynic::QueryVariables, Debug, Clone)]
770    pub struct PaginationVars {
771        pub offset: Option<i32>,
772        pub before: Option<String>,
773        pub after: Option<String>,
774        pub first: Option<i32>,
775        pub last: Option<i32>,
776    }
777
778    #[derive(cynic::Enum, Clone, Copy, Debug)]
779    pub enum DeployAppsSortBy {
780        Newest,
781        Oldest,
782        MostActive,
783    }
784
785    #[derive(cynic::QueryVariables, Debug, Clone, Default)]
786    pub struct GetDeployAppsVars {
787        pub offset: Option<i32>,
788        pub before: Option<String>,
789        pub after: Option<String>,
790        pub first: Option<i32>,
791        pub last: Option<i32>,
792
793        pub updated_after: Option<DateTime>,
794        pub sort_by: Option<DeployAppsSortBy>,
795    }
796
797    #[derive(cynic::QueryFragment, Debug)]
798    #[cynic(graphql_type = "Query", variables = "GetDeployAppsVars")]
799    pub struct GetDeployApps {
800        #[arguments(
801            first: $first,
802            last: $last,
803            after: $after,
804            before: $before,
805            offset: $offset,
806            updatedAfter: $updated_after,
807            sortBy: $sort_by,
808        )]
809        pub get_deploy_apps: Option<DeployAppConnection>,
810    }
811
812    #[derive(cynic::QueryVariables, Debug)]
813    pub struct GetDeployAppByAliasVars {
814        pub alias: String,
815    }
816
817    #[derive(cynic::QueryFragment, Debug)]
818    #[cynic(graphql_type = "Query", variables = "GetDeployAppByAliasVars")]
819    pub struct GetDeployAppByAlias {
820        #[arguments(alias: $alias)]
821        pub get_app_by_global_alias: Option<DeployApp>,
822    }
823
824    #[derive(cynic::QueryVariables, Debug)]
825    pub struct GetDeployAppAndVersionVars {
826        pub name: String,
827        pub owner: String,
828        pub version: String,
829    }
830
831    #[derive(cynic::QueryFragment, Debug)]
832    #[cynic(graphql_type = "Query", variables = "GetDeployAppAndVersionVars")]
833    pub struct GetDeployAppAndVersion {
834        #[arguments(owner: $owner, name: $name)]
835        pub get_deploy_app: Option<DeployApp>,
836        #[arguments(owner: $owner, name: $name, version: $version)]
837        pub get_deploy_app_version: Option<DeployAppVersion>,
838    }
839
840    #[derive(cynic::QueryVariables, Debug)]
841    pub struct GetDeployAppVersionVars {
842        pub name: String,
843        pub owner: String,
844        pub version: String,
845    }
846
847    #[derive(cynic::QueryFragment, Debug)]
848    #[cynic(graphql_type = "Query", variables = "GetDeployAppVersionVars")]
849    pub struct GetDeployAppVersion {
850        #[arguments(owner: $owner, name: $name, version: $version)]
851        pub get_deploy_app_version: Option<DeployAppVersion>,
852    }
853
854    #[derive(cynic::QueryVariables, Debug)]
855    pub(crate) struct GetAppVolumesVars {
856        pub name: String,
857        pub owner: String,
858    }
859
860    #[derive(cynic::QueryFragment, Debug)]
861    #[cynic(graphql_type = "Query", variables = "GetAppVolumesVars")]
862    pub(crate) struct GetAppVolumes {
863        #[arguments(owner: $owner, name: $name)]
864        pub get_deploy_app: Option<AppVolumes>,
865    }
866
867    #[derive(cynic::QueryFragment, Debug)]
868    #[cynic(graphql_type = "DeployApp")]
869    pub(crate) struct AppVolumes {
870        pub active_version: Option<AppVersionVolumes>,
871    }
872
873    #[derive(cynic::QueryFragment, Debug)]
874    #[cynic(graphql_type = "DeployAppVersion")]
875    pub(crate) struct AppVersionVolumes {
876        pub volumes: Option<Vec<Option<AppVersionVolume>>>,
877    }
878
879    #[derive(serde::Serialize, cynic::QueryFragment, Debug)]
880    pub struct AppVersionVolume {
881        pub name: String,
882        pub size: Option<BigInt>,
883        pub used_size: Option<BigInt>,
884    }
885
886    #[derive(cynic::QueryVariables, Debug)]
887    pub(crate) struct GetAppDatabasesVars {
888        pub name: String,
889        pub owner: String,
890        pub after: Option<String>,
891    }
892
893    #[derive(cynic::QueryFragment, Debug)]
894    #[cynic(graphql_type = "Query", variables = "GetAppDatabasesVars")]
895    pub(crate) struct GetAppDatabases {
896        #[arguments(owner: $owner, name: $name)]
897        pub get_deploy_app: Option<AppDatabases>,
898    }
899
900    #[derive(cynic::QueryFragment, Debug)]
901    pub(crate) struct AppDatabaseConnection {
902        pub page_info: PageInfo,
903        pub edges: Vec<Option<AppDatabaseEdge>>,
904    }
905
906    #[derive(cynic::QueryFragment, Debug)]
907    #[cynic(graphql_type = "DeployApp")]
908    pub(crate) struct AppDatabases {
909        pub databases: AppDatabaseConnection,
910    }
911
912    #[derive(cynic::QueryFragment, Debug)]
913    pub(crate) struct AppDatabaseEdge {
914        pub node: Option<AppDatabase>,
915    }
916
917    #[derive(serde::Serialize, cynic::QueryFragment, Debug)]
918    pub struct AppDatabase {
919        pub id: cynic::Id,
920        pub name: String,
921        pub created_at: DateTime,
922        pub updated_at: DateTime,
923        pub deleted_at: Option<DateTime>,
924        pub username: String,
925        pub db_explorer_url: Option<String>,
926        pub host: String,
927        pub port: String,
928        pub password: Option<String>,
929    }
930
931    #[derive(cynic::QueryFragment, Debug)]
932    pub struct RegisterDomainPayload {
933        pub success: bool,
934        pub domain: Option<DnsDomain>,
935    }
936
937    #[derive(cynic::QueryVariables, Debug)]
938    pub struct RegisterDomainVars {
939        pub name: String,
940        pub namespace: Option<String>,
941        pub import_records: Option<bool>,
942    }
943
944    #[derive(cynic::QueryFragment, Debug)]
945    #[cynic(graphql_type = "Mutation", variables = "RegisterDomainVars")]
946    pub struct RegisterDomain {
947        #[arguments(input: {name: $name, importRecords: $import_records, namespace: $namespace})]
948        pub register_domain: Option<RegisterDomainPayload>,
949    }
950
951    #[derive(cynic::QueryVariables, Debug)]
952    pub struct UpsertDomainFromZoneFileVars {
953        pub zone_file: String,
954        pub delete_missing_records: Option<bool>,
955    }
956
957    #[derive(cynic::QueryFragment, Debug)]
958    #[cynic(graphql_type = "Mutation", variables = "UpsertDomainFromZoneFileVars")]
959    pub struct UpsertDomainFromZoneFile {
960        #[arguments(input: {zoneFile: $zone_file, deleteMissingRecords: $delete_missing_records})]
961        pub upsert_domain_from_zone_file: Option<UpsertDomainFromZoneFilePayload>,
962    }
963
964    #[derive(cynic::QueryFragment, Debug)]
965    pub struct UpsertDomainFromZoneFilePayload {
966        pub success: bool,
967        pub domain: DnsDomain,
968    }
969
970    #[derive(cynic::QueryVariables, Debug)]
971    pub struct CreateNamespaceVars {
972        pub name: String,
973        pub description: Option<String>,
974    }
975
976    #[derive(cynic::QueryFragment, Debug)]
977    #[cynic(graphql_type = "Mutation", variables = "CreateNamespaceVars")]
978    pub struct CreateNamespace {
979        #[arguments(input: {name: $name, description: $description})]
980        pub create_namespace: Option<CreateNamespacePayload>,
981    }
982
983    #[derive(cynic::QueryFragment, Debug)]
984    pub struct CreateNamespacePayload {
985        pub namespace: Namespace,
986    }
987
988    #[derive(cynic::InputObject, Debug)]
989    pub struct CreateNamespaceInput {
990        pub name: String,
991        pub display_name: Option<String>,
992        pub description: Option<String>,
993        pub avatar: Option<String>,
994        pub client_mutation_id: Option<String>,
995    }
996
997    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
998    pub struct NamespaceEdge {
999        pub node: Option<Namespace>,
1000    }
1001
1002    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1003    pub struct NamespaceConnection {
1004        pub edges: Vec<Option<NamespaceEdge>>,
1005    }
1006
1007    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1008    pub struct Namespace {
1009        pub id: cynic::Id,
1010        pub name: String,
1011        pub global_name: String,
1012    }
1013
1014    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1015    pub struct DeployApp {
1016        pub id: cynic::Id,
1017        pub name: String,
1018        pub created_at: DateTime,
1019        pub updated_at: DateTime,
1020        pub description: Option<String>,
1021        pub active_version: Option<DeployAppVersion>,
1022        pub admin_url: String,
1023        pub owner: Owner,
1024        pub url: String,
1025        pub permalink: String,
1026        pub deleted: bool,
1027        pub aliases: AppAliasConnection,
1028        pub s3_url: Option<Url>,
1029        pub will_perish_at: Option<DateTime>,
1030        pub perish_reason: Option<DeployDeployAppPerishReasonChoices>,
1031    }
1032
1033    #[derive(cynic::Enum, Clone, Copy, Debug)]
1034    pub enum DeployDeployAppPerishReasonChoices {
1035        #[cynic(rename = "USER_PENDING_VERIFICATION")]
1036        UserPendingVerification,
1037        #[cynic(rename = "USER_REQUESTED")]
1038        UserRequested,
1039        #[cynic(rename = "APP_UNCLAIMED")]
1040        AppUnclaimed,
1041    }
1042
1043    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1044    pub struct AppAliasConnection {
1045        pub page_info: PageInfo,
1046        pub edges: Vec<Option<AppAliasEdge>>,
1047    }
1048
1049    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1050    pub struct AppAliasEdge {
1051        pub node: Option<AppAlias>,
1052    }
1053
1054    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1055    pub struct AppAlias {
1056        pub name: String,
1057        pub hostname: String,
1058    }
1059
1060    #[derive(cynic::QueryVariables, Debug, Clone)]
1061    pub struct DeleteAppVars {
1062        pub app_id: cynic::Id,
1063    }
1064
1065    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1066    pub struct DeleteAppPayload {
1067        pub success: bool,
1068    }
1069
1070    #[derive(cynic::QueryFragment, Debug)]
1071    #[cynic(graphql_type = "Mutation", variables = "DeleteAppVars")]
1072    pub struct DeleteApp {
1073        #[arguments(input: { id: $app_id })]
1074        pub delete_app: Option<DeleteAppPayload>,
1075    }
1076
1077    #[derive(cynic::Enum, Clone, Copy, Debug)]
1078    pub enum DeployAppVersionsSortBy {
1079        Newest,
1080        Oldest,
1081    }
1082
1083    #[derive(cynic::QueryVariables, Debug, Clone)]
1084    pub struct GetDeployAppVersionsVars {
1085        pub owner: String,
1086        pub name: String,
1087
1088        pub offset: Option<i32>,
1089        pub before: Option<String>,
1090        pub after: Option<String>,
1091        pub first: Option<i32>,
1092        pub last: Option<i32>,
1093        pub sort_by: Option<DeployAppVersionsSortBy>,
1094    }
1095
1096    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1097    #[cynic(graphql_type = "Query", variables = "GetDeployAppVersionsVars")]
1098    pub struct GetDeployAppVersions {
1099        #[arguments(owner: $owner, name: $name)]
1100        pub get_deploy_app: Option<DeployAppVersions>,
1101    }
1102
1103    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1104    #[cynic(graphql_type = "DeployApp", variables = "GetDeployAppVersionsVars")]
1105    pub struct DeployAppVersions {
1106        #[arguments(
1107            first: $first,
1108            last: $last,
1109            before: $before,
1110            after: $after,
1111            offset: $offset,
1112            sortBy: $sort_by
1113        )]
1114        pub versions: DeployAppVersionConnection,
1115    }
1116
1117    #[derive(cynic::QueryVariables, Debug, Clone)]
1118    pub struct GetDeployAppVersionsByIdVars {
1119        pub id: cynic::Id,
1120
1121        pub offset: Option<i32>,
1122        pub before: Option<String>,
1123        pub after: Option<String>,
1124        pub first: Option<i32>,
1125        pub last: Option<i32>,
1126        pub sort_by: Option<DeployAppVersionsSortBy>,
1127    }
1128
1129    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1130    #[cynic(graphql_type = "DeployApp", variables = "GetDeployAppVersionsByIdVars")]
1131    pub struct DeployAppVersionsById {
1132        #[arguments(
1133            first: $first,
1134            last: $last,
1135            before: $before,
1136            after: $after,
1137            offset: $offset,
1138            sortBy: $sort_by
1139        )]
1140        pub versions: DeployAppVersionConnection,
1141    }
1142
1143    #[derive(cynic::QueryFragment, Debug, Clone)]
1144    #[cynic(graphql_type = "Query", variables = "GetDeployAppVersionsByIdVars")]
1145    pub struct GetDeployAppVersionsById {
1146        #[arguments(id: $id)]
1147        pub node: Option<NodeDeployAppVersions>,
1148    }
1149
1150    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1151    #[cynic(graphql_type = "DeployApp")]
1152    pub struct SparseDeployApp {
1153        pub id: cynic::Id,
1154    }
1155
1156    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1157    pub struct DeployAppVersion {
1158        pub id: cynic::Id,
1159        pub created_at: DateTime,
1160        pub updated_at: DateTime,
1161        pub version: String,
1162        pub description: Option<String>,
1163        pub yaml_config: String,
1164        pub user_yaml_config: String,
1165        pub config: String,
1166        pub json_config: String,
1167        pub url: String,
1168        pub disabled_at: Option<DateTime>,
1169        pub disabled_reason: Option<String>,
1170
1171        pub app: Option<SparseDeployApp>,
1172    }
1173
1174    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1175    pub struct DeployAppVersionConnection {
1176        pub page_info: PageInfo,
1177        pub edges: Vec<Option<DeployAppVersionEdge>>,
1178    }
1179
1180    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1181    pub struct DeployAppVersionEdge {
1182        pub node: Option<DeployAppVersion>,
1183        pub cursor: String,
1184    }
1185
1186    #[derive(cynic::QueryFragment, Debug)]
1187    pub struct DeployAppConnection {
1188        pub page_info: PageInfo,
1189        pub edges: Vec<Option<DeployAppEdge>>,
1190    }
1191
1192    #[derive(cynic::QueryFragment, Debug)]
1193    pub struct DeployAppEdge {
1194        pub node: Option<DeployApp>,
1195        pub cursor: String,
1196    }
1197
1198    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1199    pub struct PageInfo {
1200        pub has_next_page: bool,
1201        pub end_cursor: Option<String>,
1202    }
1203
1204    #[derive(cynic::QueryVariables, Debug)]
1205    pub struct GetNamespaceVars {
1206        pub name: String,
1207    }
1208
1209    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1210    pub struct MarkAppVersionAsActivePayload {
1211        pub app: DeployApp,
1212    }
1213
1214    #[derive(cynic::InputObject, Debug)]
1215    pub struct MarkAppVersionAsActiveInput {
1216        pub app_version: cynic::Id,
1217    }
1218
1219    #[derive(cynic::QueryVariables, Debug)]
1220    pub struct MarkAppVersionAsActiveVars {
1221        pub input: MarkAppVersionAsActiveInput,
1222    }
1223
1224    #[derive(cynic::QueryFragment, Debug)]
1225    #[cynic(graphql_type = "Mutation", variables = "MarkAppVersionAsActiveVars")]
1226    pub struct MarkAppVersionAsActive {
1227        #[arguments(input: $input)]
1228        pub mark_app_version_as_active: Option<MarkAppVersionAsActivePayload>,
1229    }
1230
1231    #[derive(cynic::QueryFragment, Debug)]
1232    #[cynic(graphql_type = "Query", variables = "GetNamespaceVars")]
1233    pub struct GetNamespace {
1234        #[arguments(name: $name)]
1235        pub get_namespace: Option<Namespace>,
1236    }
1237
1238    #[derive(cynic::QueryVariables, Debug)]
1239    pub struct GetNamespaceAppsVars {
1240        pub name: String,
1241        pub after: Option<String>,
1242        pub sort: Option<DeployAppsSortBy>,
1243    }
1244
1245    #[derive(cynic::QueryFragment, Debug)]
1246    #[cynic(graphql_type = "Query", variables = "GetNamespaceAppsVars")]
1247    pub struct GetNamespaceApps {
1248        #[arguments(name: $name)]
1249        pub get_namespace: Option<NamespaceWithApps>,
1250    }
1251
1252    #[derive(cynic::QueryFragment, Debug)]
1253    #[cynic(graphql_type = "Namespace")]
1254    #[cynic(variables = "GetNamespaceAppsVars")]
1255    pub struct NamespaceWithApps {
1256        pub id: cynic::Id,
1257        pub name: String,
1258        #[arguments(after: $after, sortBy: $sort)]
1259        pub apps: DeployAppConnection,
1260    }
1261
1262    #[derive(cynic::QueryVariables, Debug)]
1263    pub struct RedeployActiveAppVariables {
1264        pub id: cynic::Id,
1265    }
1266
1267    #[derive(cynic::QueryFragment, Debug)]
1268    #[cynic(graphql_type = "Mutation", variables = "RedeployActiveAppVariables")]
1269    pub struct RedeployActiveApp {
1270        #[arguments(input: { id: $id })]
1271        pub redeploy_active_version: Option<RedeployActiveVersionPayload>,
1272    }
1273
1274    #[derive(cynic::QueryFragment, Debug)]
1275    pub struct RedeployActiveVersionPayload {
1276        pub app: DeployApp,
1277    }
1278
1279    #[derive(cynic::QueryVariables, Debug)]
1280    pub struct GetAppDeploymentsVariables {
1281        pub after: Option<String>,
1282        pub first: Option<i32>,
1283        pub name: String,
1284        pub offset: Option<i32>,
1285        pub owner: String,
1286    }
1287
1288    #[derive(cynic::QueryFragment, Debug)]
1289    #[cynic(graphql_type = "Query", variables = "GetAppDeploymentsVariables")]
1290    pub struct GetAppDeployments {
1291        #[arguments(owner: $owner, name: $name)]
1292        pub get_deploy_app: Option<DeployAppDeployments>,
1293    }
1294
1295    #[derive(cynic::QueryFragment, Debug)]
1296    #[cynic(graphql_type = "DeployApp", variables = "GetAppDeploymentsVariables")]
1297    pub struct DeployAppDeployments {
1298        // FIXME: add $offset, $after, currently causes an error from the backend
1299        // #[arguments(first: $first, after: $after, offset: $offset)]
1300        pub deployments: Option<DeploymentConnection>,
1301    }
1302
1303    #[derive(cynic::QueryFragment, Debug)]
1304    pub struct DeploymentConnection {
1305        pub page_info: PageInfo,
1306        pub edges: Vec<Option<DeploymentEdge>>,
1307    }
1308
1309    #[derive(cynic::QueryFragment, Debug)]
1310    pub struct DeploymentEdge {
1311        pub node: Option<Deployment>,
1312    }
1313
1314    #[allow(clippy::large_enum_variant)]
1315    #[derive(cynic::InlineFragments, Debug, Clone, Serialize)]
1316    pub enum Deployment {
1317        AutobuildRepository(AutobuildRepository),
1318        NakedDeployment(NakedDeployment),
1319        #[cynic(fallback)]
1320        Other,
1321    }
1322
1323    #[derive(cynic::QueryFragment, serde::Serialize, Debug, Clone)]
1324    pub struct NakedDeployment {
1325        pub id: cynic::Id,
1326        pub created_at: DateTime,
1327        pub updated_at: DateTime,
1328        pub app_version: Option<DeployAppVersion>,
1329    }
1330
1331    #[derive(cynic::QueryFragment, serde::Serialize, Debug, Clone)]
1332    pub struct AutobuildRepository {
1333        pub id: cynic::Id,
1334        pub build_id: Uuid,
1335        pub created_at: DateTime,
1336        pub updated_at: DateTime,
1337        pub status: StatusEnum,
1338        pub log_url: Option<String>,
1339        pub repo_url: String,
1340    }
1341
1342    #[derive(cynic::Enum, Clone, Copy, Debug)]
1343    pub enum StatusEnum {
1344        Success,
1345        Working,
1346        Failed,
1347        Queued,
1348        Timeout,
1349        InternalError,
1350        Cancelled,
1351        Running,
1352    }
1353
1354    impl StatusEnum {
1355        pub fn as_str(&self) -> &'static str {
1356            match self {
1357                Self::Success => "success",
1358                Self::Working => "working",
1359                Self::Failed => "failed",
1360                Self::Queued => "queued",
1361                Self::Timeout => "timeout",
1362                Self::InternalError => "internal_error",
1363                Self::Cancelled => "cancelled",
1364                Self::Running => "running",
1365            }
1366        }
1367    }
1368
1369    #[derive(cynic::QueryVariables, Debug)]
1370    pub struct AutobuildConfigForZipUploadVariables<'a> {
1371        pub upload_url: &'a str,
1372    }
1373
1374    #[derive(cynic::QueryFragment, Debug)]
1375    #[cynic(
1376        graphql_type = "Mutation",
1377        variables = "AutobuildConfigForZipUploadVariables"
1378    )]
1379    pub struct AutobuildConfigForZipUpload {
1380        #[arguments(input: { uploadUrl: $upload_url })]
1381        pub autobuild_config_for_zip_upload: Option<AutobuildConfigForZipUploadPayload>,
1382    }
1383
1384    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1385    pub struct AutobuildConfigForZipUploadPayload {
1386        pub build_config: Option<BuildConfig>,
1387    }
1388
1389    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1390    pub struct BuildConfig {
1391        pub build_cmd: Option<String>,
1392        pub install_cmd: Option<String>,
1393        pub start_cmd: Option<String>,
1394        pub setup_db: bool,
1395        pub preset_name: String,
1396        pub app_name: String,
1397        pub completion_time_in_seconds: i32,
1398        pub branch: Option<String>,
1399    }
1400
1401    #[derive(cynic::InputObject, Debug, Clone)]
1402    pub struct WordpressDeploymentExtraData {
1403        pub site_name: String,
1404        pub admin_username: String,
1405        pub admin_password: String,
1406        pub admin_email: String,
1407        pub language: Option<String>,
1408    }
1409
1410    #[derive(cynic::InputObject, Debug, Clone)]
1411    pub struct AutobuildDeploymentExtraData {
1412        pub wordpress: Option<WordpressDeploymentExtraData>,
1413    }
1414
1415    #[derive(cynic::InputObject, Debug, Clone)]
1416    pub struct JobDefinitionInput {
1417        pub name: Option<String>,
1418        pub package: Option<String>,
1419        pub command: String,
1420        pub cli_args: Option<Vec<Option<String>>>,
1421        pub env: Option<Vec<Option<String>>>,
1422        pub timeout: Option<String>,
1423    }
1424
1425    #[derive(cynic::QueryVariables, Debug, Clone)]
1426    pub struct DeployViaAutobuildVars {
1427        pub repo_url: Option<String>,
1428        pub upload_url: Option<String>,
1429        pub app_name: Option<String>,
1430        pub app_id: Option<cynic::Id>,
1431        pub owner: Option<String>,
1432        pub build_cmd: Option<String>,
1433        pub install_cmd: Option<String>,
1434        pub enable_database: Option<bool>,
1435        pub secrets: Option<Vec<SecretInput>>,
1436        pub extra_data: Option<AutobuildDeploymentExtraData>,
1437        pub params: Option<AutobuildDeploymentExtraData>,
1438        pub managed: Option<bool>,
1439        pub kind: Option<String>,
1440        pub wait_for_screenshot_generation: Option<bool>,
1441        pub region: Option<String>,
1442        pub branch: Option<String>,
1443        pub allow_existing_app: Option<bool>,
1444        pub jobs: Option<Vec<JobDefinitionInput>>,
1445        pub domains: Option<Vec<Option<String>>>,
1446        pub client_mutation_id: Option<String>,
1447    }
1448
1449    #[derive(cynic::QueryFragment, Debug)]
1450    #[cynic(graphql_type = "Mutation", variables = "DeployViaAutobuildVars")]
1451    pub struct DeployViaAutobuild {
1452        #[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 })]
1453        pub deploy_via_autobuild: Option<DeployViaAutobuildPayload>,
1454    }
1455
1456    #[derive(cynic::QueryFragment, Debug)]
1457    pub struct DeployViaAutobuildPayload {
1458        pub success: bool,
1459        pub build_id: Uuid,
1460    }
1461
1462    #[derive(cynic::Scalar, Debug, Clone)]
1463    #[cynic(graphql_type = "UUID")]
1464    pub struct Uuid(pub String);
1465
1466    #[derive(cynic::QueryVariables, Debug)]
1467    pub struct PublishDeployAppVars {
1468        pub config: String,
1469        pub name: cynic::Id,
1470        pub owner: Option<cynic::Id>,
1471        pub make_default: Option<bool>,
1472    }
1473
1474    #[derive(cynic::QueryFragment, Debug)]
1475    #[cynic(graphql_type = "Mutation", variables = "PublishDeployAppVars")]
1476    pub struct PublishDeployApp {
1477        #[arguments(input: { config: { yamlConfig: $config }, name: $name, owner: $owner, makeDefault: $make_default })]
1478        pub publish_deploy_app: Option<PublishDeployAppPayload>,
1479    }
1480
1481    #[derive(cynic::QueryFragment, Debug)]
1482    pub struct PublishDeployAppPayload {
1483        pub deploy_app_version: DeployAppVersion,
1484    }
1485
1486    #[derive(cynic::QueryVariables, Debug)]
1487    pub struct GenerateDeployTokenVars {
1488        pub app_version_id: String,
1489    }
1490
1491    #[derive(cynic::QueryFragment, Debug)]
1492    #[cynic(graphql_type = "Mutation", variables = "GenerateDeployTokenVars")]
1493    pub struct GenerateDeployToken {
1494        #[arguments(input: { deployConfigVersionId: $app_version_id })]
1495        pub generate_deploy_token: Option<GenerateDeployTokenPayload>,
1496    }
1497
1498    #[derive(cynic::QueryFragment, Debug)]
1499    pub struct GenerateDeployTokenPayload {
1500        pub token: String,
1501    }
1502
1503    #[derive(cynic::Enum, Clone, Copy, Debug, PartialEq)]
1504    pub enum LogStream {
1505        Stdout,
1506        Stderr,
1507        Runtime,
1508    }
1509
1510    #[derive(cynic::QueryVariables, Debug, Clone)]
1511    pub struct GetDeployAppLogsVars {
1512        pub name: String,
1513        pub owner: String,
1514        /// The tag associated with a particular app version. Uses the active
1515        /// version if not provided.
1516        pub version: Option<String>,
1517        /// The lower bound for log messages, in nanoseconds since the Unix
1518        /// epoch.
1519        pub starting_from: f64,
1520        /// The upper bound for log messages, in nanoseconds since the Unix
1521        /// epoch.
1522        pub until: Option<f64>,
1523        pub first: Option<i32>,
1524
1525        pub request_id: Option<String>,
1526
1527        pub instance_ids: Option<Vec<String>>,
1528
1529        pub streams: Option<Vec<LogStream>>,
1530    }
1531
1532    #[derive(cynic::QueryFragment, Debug)]
1533    #[cynic(graphql_type = "Query", variables = "GetDeployAppLogsVars")]
1534    pub struct GetDeployAppLogs {
1535        #[arguments(name: $name, owner: $owner, version: $version)]
1536        pub get_deploy_app_version: Option<DeployAppVersionLogs>,
1537    }
1538
1539    #[derive(cynic::QueryFragment, Debug)]
1540    #[cynic(graphql_type = "DeployAppVersion", variables = "GetDeployAppLogsVars")]
1541    pub struct DeployAppVersionLogs {
1542        #[arguments(startingFrom: $starting_from, until: $until, first: $first, instanceIds: $instance_ids, requestId: $request_id, streams: $streams)]
1543        pub logs: LogConnection,
1544    }
1545
1546    #[derive(cynic::QueryFragment, Debug)]
1547    pub struct LogConnection {
1548        pub edges: Vec<Option<LogEdge>>,
1549    }
1550
1551    #[derive(cynic::QueryFragment, Debug)]
1552    pub struct LogEdge {
1553        pub node: Option<Log>,
1554    }
1555
1556    #[derive(cynic::QueryFragment, Debug, serde::Serialize, PartialEq)]
1557    pub struct Log {
1558        pub message: String,
1559        /// When the message was recorded, in nanoseconds since the Unix epoch.
1560        pub timestamp: f64,
1561        pub stream: Option<LogStream>,
1562        pub instance_id: String,
1563    }
1564
1565    #[derive(cynic::Enum, Clone, Copy, Debug, PartialEq, Eq)]
1566    pub enum AutoBuildDeployAppLogKind {
1567        Log,
1568        PreparingToDeployStatus,
1569        FetchingPlanStatus,
1570        BuildStatus,
1571        DeployStatus,
1572        Complete,
1573        Failed,
1574    }
1575
1576    #[derive(cynic::QueryVariables, Debug)]
1577    pub struct AutobuildDeploymentSubscriptionVariables {
1578        pub build_id: Uuid,
1579    }
1580
1581    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1582    #[cynic(
1583        graphql_type = "Subscription",
1584        variables = "AutobuildDeploymentSubscriptionVariables"
1585    )]
1586    pub struct AutobuildDeploymentSubscription {
1587        #[arguments(buildId: $build_id)]
1588        pub autobuild_deployment: Option<AutobuildLog>,
1589    }
1590
1591    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1592    pub struct AutobuildLog {
1593        pub kind: AutoBuildDeployAppLogKind,
1594        pub message: Option<String>,
1595        pub app_version: Option<DeployAppVersion>,
1596        pub timestamp: String,
1597        pub datetime: DateTime,
1598        pub stream: Option<LogStream>,
1599    }
1600
1601    #[derive(cynic::QueryVariables, Debug)]
1602    pub struct GenerateDeployConfigTokenVars {
1603        pub input: String,
1604    }
1605    #[derive(cynic::QueryFragment, Debug)]
1606    #[cynic(graphql_type = "Mutation", variables = "GenerateDeployConfigTokenVars")]
1607    pub struct GenerateDeployConfigToken {
1608        #[arguments(input: { config: $input })]
1609        pub generate_deploy_config_token: Option<GenerateDeployConfigTokenPayload>,
1610    }
1611
1612    #[derive(cynic::QueryFragment, Debug)]
1613    pub struct GenerateDeployConfigTokenPayload {
1614        pub token: String,
1615    }
1616
1617    #[derive(cynic::QueryVariables, Debug)]
1618    pub struct GenerateSshTokenVariables {
1619        pub app_id: Option<cynic::Id>,
1620    }
1621
1622    #[derive(cynic::QueryFragment, Debug)]
1623    #[cynic(graphql_type = "Mutation", variables = "GenerateSshTokenVariables")]
1624    pub struct GenerateSshToken {
1625        #[arguments(input: { appId: $app_id })]
1626        pub generate_ssh_token: Option<GenerateSshTokenPayload>,
1627    }
1628
1629    #[derive(cynic::QueryFragment, Debug)]
1630    pub struct GenerateSshTokenPayload {
1631        pub token: String,
1632    }
1633
1634    #[derive(cynic::QueryVariables, Debug)]
1635    pub struct GetNodeVars {
1636        pub id: cynic::Id,
1637    }
1638
1639    #[derive(cynic::QueryFragment, Debug)]
1640    #[cynic(graphql_type = "Query", variables = "GetNodeVars")]
1641    pub struct GetNode {
1642        #[arguments(id: $id)]
1643        pub node: Option<Node>,
1644    }
1645
1646    #[derive(cynic::QueryVariables, Debug)]
1647    pub struct GetDeployAppByIdVars {
1648        pub app_id: cynic::Id,
1649    }
1650
1651    #[derive(cynic::QueryFragment, Debug)]
1652    #[cynic(graphql_type = "Query", variables = "GetDeployAppByIdVars")]
1653    pub struct GetDeployAppById {
1654        #[arguments(id: $app_id)]
1655        #[cynic(rename = "node")]
1656        pub app: Option<Node>,
1657    }
1658
1659    #[derive(cynic::QueryVariables, Debug)]
1660    pub struct GetDeployAppAndVersionByIdVars {
1661        pub app_id: cynic::Id,
1662        pub version_id: cynic::Id,
1663    }
1664
1665    #[derive(cynic::QueryFragment, Debug)]
1666    #[cynic(graphql_type = "Query", variables = "GetDeployAppAndVersionByIdVars")]
1667    pub struct GetDeployAppAndVersionById {
1668        #[arguments(id: $app_id)]
1669        #[cynic(rename = "node")]
1670        pub app: Option<Node>,
1671        #[arguments(id: $version_id)]
1672        #[cynic(rename = "node")]
1673        pub version: Option<Node>,
1674    }
1675
1676    #[derive(cynic::QueryVariables, Debug)]
1677    pub struct GetDeployAppVersionByIdVars {
1678        pub version_id: cynic::Id,
1679    }
1680
1681    #[derive(cynic::QueryFragment, Debug)]
1682    #[cynic(graphql_type = "Query", variables = "GetDeployAppVersionByIdVars")]
1683    pub struct GetDeployAppVersionById {
1684        #[arguments(id: $version_id)]
1685        #[cynic(rename = "node")]
1686        pub version: Option<Node>,
1687    }
1688
1689    #[derive(cynic::QueryVariables, Debug)]
1690    pub struct DeleteAppSecretVariables {
1691        pub id: cynic::Id,
1692    }
1693
1694    #[derive(cynic::QueryFragment, Debug)]
1695    #[cynic(graphql_type = "Mutation", variables = "DeleteAppSecretVariables")]
1696    pub struct DeleteAppSecret {
1697        #[arguments(input: { id: $id })]
1698        pub delete_app_secret: Option<DeleteAppSecretPayload>,
1699    }
1700
1701    #[derive(cynic::QueryFragment, Debug)]
1702    pub struct DeleteAppSecretPayload {
1703        pub success: bool,
1704    }
1705    #[derive(cynic::QueryVariables, Debug, Clone)]
1706    pub struct GetAllAppSecretsVariables {
1707        pub after: Option<String>,
1708        pub app_id: cynic::Id,
1709        pub before: Option<String>,
1710        pub first: Option<i32>,
1711        pub last: Option<i32>,
1712        pub offset: Option<i32>,
1713        pub names: Option<Vec<String>>,
1714    }
1715
1716    #[derive(cynic::QueryFragment, Debug)]
1717    #[cynic(graphql_type = "Query", variables = "GetAllAppSecretsVariables")]
1718    pub struct GetAllAppSecrets {
1719        #[arguments(appId: $app_id, after: $after, before: $before, first: $first, last: $last, offset: $offset, names: $names)]
1720        pub get_app_secrets: Option<SecretConnection>,
1721    }
1722
1723    #[derive(cynic::QueryFragment, Debug)]
1724    pub struct SecretConnection {
1725        pub edges: Vec<Option<SecretEdge>>,
1726        pub page_info: PageInfo,
1727        pub total_count: Option<i32>,
1728    }
1729
1730    #[derive(cynic::QueryFragment, Debug)]
1731    pub struct SecretEdge {
1732        pub cursor: String,
1733        pub node: Option<Secret>,
1734    }
1735
1736    #[derive(cynic::QueryVariables, Debug)]
1737    pub struct GetAppSecretVariables {
1738        pub app_id: cynic::Id,
1739        pub secret_name: String,
1740    }
1741
1742    #[derive(cynic::QueryFragment, Debug)]
1743    #[cynic(graphql_type = "Query", variables = "GetAppSecretVariables")]
1744    pub struct GetAppSecret {
1745        #[arguments(appId: $app_id, secretName: $secret_name)]
1746        pub get_app_secret: Option<Secret>,
1747    }
1748
1749    #[derive(cynic::QueryVariables, Debug)]
1750    pub struct GetAppSecretValueVariables {
1751        pub id: cynic::Id,
1752    }
1753
1754    #[derive(cynic::QueryFragment, Debug)]
1755    #[cynic(graphql_type = "Query", variables = "GetAppSecretValueVariables")]
1756    pub struct GetAppSecretValue {
1757        #[arguments(id: $id)]
1758        pub get_secret_value: Option<String>,
1759    }
1760
1761    #[derive(cynic::QueryVariables, Debug)]
1762    pub struct UpsertAppSecretVariables<'a> {
1763        pub app_id: cynic::Id,
1764        pub name: &'a str,
1765        pub value: &'a str,
1766    }
1767
1768    #[derive(cynic::QueryFragment, Debug)]
1769    #[cynic(graphql_type = "Mutation", variables = "UpsertAppSecretVariables")]
1770    pub struct UpsertAppSecret {
1771        #[arguments(input: { appId: $app_id, name: $name, value: $value })]
1772        pub upsert_app_secret: Option<UpsertAppSecretPayload>,
1773    }
1774
1775    #[derive(cynic::QueryFragment, Debug)]
1776    pub struct UpsertAppSecretPayload {
1777        pub secret: Secret,
1778        pub success: bool,
1779    }
1780
1781    #[derive(cynic::QueryVariables, Debug)]
1782    pub struct UpsertAppSecretsVariables {
1783        pub app_id: cynic::Id,
1784        pub secrets: Option<Vec<SecretInput>>,
1785    }
1786
1787    #[derive(cynic::QueryFragment, Debug)]
1788    #[cynic(graphql_type = "Mutation", variables = "UpsertAppSecretsVariables")]
1789    pub struct UpsertAppSecrets {
1790        #[arguments(input: { appId: $app_id, secrets: $secrets })]
1791        pub upsert_app_secrets: Option<UpsertAppSecretsPayload>,
1792    }
1793
1794    #[derive(cynic::QueryFragment, Debug)]
1795    pub struct UpsertAppSecretsPayload {
1796        pub secrets: Vec<Option<Secret>>,
1797        pub success: bool,
1798    }
1799
1800    #[derive(cynic::InputObject, Debug, Clone)]
1801    pub struct SecretInput {
1802        pub name: String,
1803        pub value: String,
1804    }
1805    #[derive(cynic::QueryFragment, Debug, Serialize)]
1806    pub struct Secret {
1807        #[serde(skip_serializing)]
1808        pub id: cynic::Id,
1809        pub name: String,
1810        pub created_at: DateTime,
1811        pub updated_at: DateTime,
1812    }
1813
1814    #[derive(cynic::QueryVariables, Debug, Clone)]
1815    pub struct GetAllAppRegionsVariables {
1816        pub after: Option<String>,
1817        pub before: Option<String>,
1818        pub first: Option<i32>,
1819        pub last: Option<i32>,
1820        pub offset: Option<i32>,
1821    }
1822
1823    #[derive(cynic::QueryFragment, Debug)]
1824    #[cynic(graphql_type = "Query", variables = "GetAllAppRegionsVariables")]
1825    pub struct GetAllAppRegions {
1826        #[arguments(after: $after, offset: $offset, before: $before, first: $first, last: $last)]
1827        pub get_app_regions: AppRegionConnection,
1828    }
1829
1830    #[derive(cynic::QueryFragment, Debug)]
1831    pub struct AppRegionConnection {
1832        pub edges: Vec<Option<AppRegionEdge>>,
1833        pub page_info: PageInfo,
1834        pub total_count: Option<i32>,
1835    }
1836
1837    #[derive(cynic::QueryFragment, Debug)]
1838    pub struct AppRegionEdge {
1839        pub cursor: String,
1840        pub node: Option<AppRegion>,
1841    }
1842
1843    #[derive(cynic::QueryFragment, Debug, Serialize)]
1844    pub struct AppRegion {
1845        pub city: String,
1846        pub country: String,
1847        pub id: cynic::Id,
1848        pub name: String,
1849    }
1850
1851    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1852    #[cynic(graphql_type = "TXTRecord")]
1853    pub struct TxtRecord {
1854        pub id: cynic::Id,
1855        pub created_at: DateTime,
1856        pub updated_at: DateTime,
1857        pub deleted_at: Option<DateTime>,
1858        pub name: Option<String>,
1859        pub text: String,
1860        pub ttl: Option<i32>,
1861        pub data: String,
1862
1863        pub domain: DnsDomain,
1864    }
1865
1866    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1867    #[cynic(graphql_type = "SSHFPRecord")]
1868    pub struct SshfpRecord {
1869        pub id: cynic::Id,
1870        pub created_at: DateTime,
1871        pub updated_at: DateTime,
1872        pub deleted_at: Option<DateTime>,
1873        pub name: Option<String>,
1874        pub text: String,
1875        pub ttl: Option<i32>,
1876        #[cynic(rename = "type")]
1877        pub type_: DnsmanagerSshFingerprintRecordTypeChoices,
1878        pub algorithm: DnsmanagerSshFingerprintRecordAlgorithmChoices,
1879        pub fingerprint: String,
1880
1881        pub domain: DnsDomain,
1882    }
1883
1884    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1885    #[cynic(graphql_type = "SRVRecord")]
1886    pub struct SrvRecord {
1887        pub id: cynic::Id,
1888        pub created_at: DateTime,
1889        pub updated_at: DateTime,
1890        pub deleted_at: Option<DateTime>,
1891        pub name: Option<String>,
1892        pub text: String,
1893        pub ttl: Option<i32>,
1894        pub service: String,
1895        pub protocol: String,
1896        pub priority: i32,
1897        pub weight: i32,
1898        pub port: i32,
1899        pub target: String,
1900
1901        pub domain: DnsDomain,
1902    }
1903
1904    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1905    #[cynic(graphql_type = "SOARecord")]
1906    pub struct SoaRecord {
1907        pub id: cynic::Id,
1908        pub created_at: DateTime,
1909        pub updated_at: DateTime,
1910        pub deleted_at: Option<DateTime>,
1911        pub name: Option<String>,
1912        pub text: String,
1913        pub ttl: Option<i32>,
1914        pub mname: String,
1915        pub rname: String,
1916        pub serial: BigInt,
1917        pub refresh: BigInt,
1918        pub retry: BigInt,
1919        pub expire: BigInt,
1920        pub minimum: BigInt,
1921
1922        pub domain: DnsDomain,
1923    }
1924
1925    #[derive(cynic::Enum, Debug, Clone, Copy)]
1926    pub enum DNSRecordsSortBy {
1927        Newest,
1928        Oldest,
1929    }
1930
1931    #[derive(cynic::QueryVariables, Debug, Clone)]
1932    pub struct GetAllDnsRecordsVariables {
1933        pub after: Option<String>,
1934        pub updated_after: Option<DateTime>,
1935        pub sort_by: Option<DNSRecordsSortBy>,
1936        pub first: Option<i32>,
1937    }
1938
1939    #[derive(cynic::QueryFragment, Debug)]
1940    #[cynic(graphql_type = "Query", variables = "GetAllDnsRecordsVariables")]
1941    pub struct GetAllDnsRecords {
1942        #[arguments(
1943            first: $first,
1944            after: $after,
1945            updatedAfter: $updated_after,
1946            sortBy: $sort_by
1947        )]
1948        #[cynic(rename = "getAllDNSRecords")]
1949        pub get_all_dnsrecords: DnsRecordConnection,
1950    }
1951
1952    #[derive(cynic::QueryVariables, Debug, Clone)]
1953    pub struct GetAllDomainsVariables {
1954        pub after: Option<String>,
1955        pub first: Option<i32>,
1956        pub namespace: Option<String>,
1957    }
1958
1959    #[derive(cynic::QueryFragment, Debug)]
1960    #[cynic(graphql_type = "Query", variables = "GetAllDomainsVariables")]
1961    pub struct GetAllDomains {
1962        #[arguments(
1963            first: $first,
1964            after: $after,
1965            namespace: $namespace,
1966        )]
1967        #[cynic(rename = "getAllDomains")]
1968        pub get_all_domains: DnsDomainConnection,
1969    }
1970
1971    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1972    #[cynic(graphql_type = "PTRRecord")]
1973    pub struct PtrRecord {
1974        pub id: cynic::Id,
1975        pub created_at: DateTime,
1976        pub updated_at: DateTime,
1977        pub deleted_at: Option<DateTime>,
1978        pub name: Option<String>,
1979        pub text: String,
1980        pub ttl: Option<i32>,
1981        pub ptrdname: String,
1982
1983        pub domain: DnsDomain,
1984    }
1985
1986    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1987    #[cynic(graphql_type = "NSRecord")]
1988    pub struct NsRecord {
1989        pub id: cynic::Id,
1990        pub created_at: DateTime,
1991        pub updated_at: DateTime,
1992        pub deleted_at: Option<DateTime>,
1993        pub name: Option<String>,
1994        pub text: String,
1995        pub ttl: Option<i32>,
1996        pub nsdname: String,
1997
1998        pub domain: DnsDomain,
1999    }
2000
2001    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2002    #[cynic(graphql_type = "MXRecord")]
2003    pub struct MxRecord {
2004        pub id: cynic::Id,
2005        pub created_at: DateTime,
2006        pub updated_at: DateTime,
2007        pub deleted_at: Option<DateTime>,
2008        pub name: Option<String>,
2009        pub text: String,
2010        pub ttl: Option<i32>,
2011        pub preference: i32,
2012        pub exchange: String,
2013
2014        pub domain: DnsDomain,
2015    }
2016
2017    #[derive(cynic::QueryFragment, Debug)]
2018    #[cynic(graphql_type = "DNSRecordConnection")]
2019    pub struct DnsRecordConnection {
2020        pub page_info: PageInfo,
2021        pub edges: Vec<Option<DnsRecordEdge>>,
2022    }
2023
2024    #[derive(cynic::QueryFragment, Debug)]
2025    #[cynic(graphql_type = "DNSRecordEdge")]
2026    pub struct DnsRecordEdge {
2027        pub node: Option<DnsRecord>,
2028    }
2029
2030    #[derive(cynic::QueryFragment, Debug)]
2031    #[cynic(graphql_type = "DNSDomainConnection")]
2032    pub struct DnsDomainConnection {
2033        pub page_info: PageInfo,
2034        pub edges: Vec<Option<DnsDomainEdge>>,
2035    }
2036
2037    #[derive(cynic::QueryFragment, Debug)]
2038    #[cynic(graphql_type = "DNSDomainEdge")]
2039    pub struct DnsDomainEdge {
2040        pub node: Option<DnsDomain>,
2041    }
2042
2043    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2044    #[cynic(graphql_type = "DNAMERecord")]
2045    pub struct DNameRecord {
2046        pub id: cynic::Id,
2047        pub created_at: DateTime,
2048        pub updated_at: DateTime,
2049        pub deleted_at: Option<DateTime>,
2050        pub name: Option<String>,
2051        pub text: String,
2052        pub ttl: Option<i32>,
2053        pub d_name: String,
2054
2055        pub domain: DnsDomain,
2056    }
2057
2058    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2059    #[cynic(graphql_type = "CNAMERecord")]
2060    pub struct CNameRecord {
2061        pub id: cynic::Id,
2062        pub created_at: DateTime,
2063        pub updated_at: DateTime,
2064        pub deleted_at: Option<DateTime>,
2065        pub name: Option<String>,
2066        pub text: String,
2067        pub ttl: Option<i32>,
2068        pub c_name: String,
2069
2070        pub domain: DnsDomain,
2071    }
2072
2073    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2074    #[cynic(graphql_type = "CAARecord")]
2075    pub struct CaaRecord {
2076        pub id: cynic::Id,
2077        pub created_at: DateTime,
2078        pub updated_at: DateTime,
2079        pub deleted_at: Option<DateTime>,
2080        pub name: Option<String>,
2081        pub text: String,
2082        pub ttl: Option<i32>,
2083        pub value: String,
2084        pub flags: i32,
2085        pub tag: DnsmanagerCertificationAuthorityAuthorizationRecordTagChoices,
2086
2087        pub domain: DnsDomain,
2088    }
2089
2090    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2091    #[cynic(graphql_type = "ARecord")]
2092    pub struct ARecord {
2093        pub id: cynic::Id,
2094        pub created_at: DateTime,
2095        pub updated_at: DateTime,
2096        pub deleted_at: Option<DateTime>,
2097        pub name: Option<String>,
2098        pub text: String,
2099        pub ttl: Option<i32>,
2100        pub address: String,
2101        pub domain: DnsDomain,
2102    }
2103
2104    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2105    #[cynic(graphql_type = "AAAARecord")]
2106    pub struct AaaaRecord {
2107        pub id: cynic::Id,
2108        pub created_at: DateTime,
2109        pub updated_at: DateTime,
2110        pub deleted_at: Option<DateTime>,
2111        pub name: Option<String>,
2112        pub text: String,
2113        pub ttl: Option<i32>,
2114        pub address: String,
2115        pub domain: DnsDomain,
2116    }
2117
2118    #[derive(cynic::InlineFragments, Debug, Clone, Serialize)]
2119    #[cynic(graphql_type = "DNSRecord")]
2120    pub enum DnsRecord {
2121        A(ARecord),
2122        AAAA(AaaaRecord),
2123        CName(CNameRecord),
2124        Txt(TxtRecord),
2125        Mx(MxRecord),
2126        Ns(NsRecord),
2127        CAA(CaaRecord),
2128        DName(DNameRecord),
2129        Ptr(PtrRecord),
2130        Soa(SoaRecord),
2131        Srv(SrvRecord),
2132        Sshfp(SshfpRecord),
2133        #[cynic(fallback)]
2134        Unknown,
2135    }
2136
2137    impl DnsRecord {
2138        pub fn id(&self) -> &str {
2139            match self {
2140                DnsRecord::A(record) => record.id.inner(),
2141                DnsRecord::AAAA(record) => record.id.inner(),
2142                DnsRecord::CName(record) => record.id.inner(),
2143                DnsRecord::Txt(record) => record.id.inner(),
2144                DnsRecord::Mx(record) => record.id.inner(),
2145                DnsRecord::Ns(record) => record.id.inner(),
2146                DnsRecord::CAA(record) => record.id.inner(),
2147                DnsRecord::DName(record) => record.id.inner(),
2148                DnsRecord::Ptr(record) => record.id.inner(),
2149                DnsRecord::Soa(record) => record.id.inner(),
2150                DnsRecord::Srv(record) => record.id.inner(),
2151                DnsRecord::Sshfp(record) => record.id.inner(),
2152                DnsRecord::Unknown => "",
2153            }
2154        }
2155        pub fn name(&self) -> Option<&str> {
2156            match self {
2157                DnsRecord::A(record) => record.name.as_deref(),
2158                DnsRecord::AAAA(record) => record.name.as_deref(),
2159                DnsRecord::CName(record) => record.name.as_deref(),
2160                DnsRecord::Txt(record) => record.name.as_deref(),
2161                DnsRecord::Mx(record) => record.name.as_deref(),
2162                DnsRecord::Ns(record) => record.name.as_deref(),
2163                DnsRecord::CAA(record) => record.name.as_deref(),
2164                DnsRecord::DName(record) => record.name.as_deref(),
2165                DnsRecord::Ptr(record) => record.name.as_deref(),
2166                DnsRecord::Soa(record) => record.name.as_deref(),
2167                DnsRecord::Srv(record) => record.name.as_deref(),
2168                DnsRecord::Sshfp(record) => record.name.as_deref(),
2169                DnsRecord::Unknown => None,
2170            }
2171        }
2172        pub fn ttl(&self) -> Option<i32> {
2173            match self {
2174                DnsRecord::A(record) => record.ttl,
2175                DnsRecord::AAAA(record) => record.ttl,
2176                DnsRecord::CName(record) => record.ttl,
2177                DnsRecord::Txt(record) => record.ttl,
2178                DnsRecord::Mx(record) => record.ttl,
2179                DnsRecord::Ns(record) => record.ttl,
2180                DnsRecord::CAA(record) => record.ttl,
2181                DnsRecord::DName(record) => record.ttl,
2182                DnsRecord::Ptr(record) => record.ttl,
2183                DnsRecord::Soa(record) => record.ttl,
2184                DnsRecord::Srv(record) => record.ttl,
2185                DnsRecord::Sshfp(record) => record.ttl,
2186                DnsRecord::Unknown => None,
2187            }
2188        }
2189
2190        pub fn text(&self) -> &str {
2191            match self {
2192                DnsRecord::A(record) => record.text.as_str(),
2193                DnsRecord::AAAA(record) => record.text.as_str(),
2194                DnsRecord::CName(record) => record.text.as_str(),
2195                DnsRecord::Txt(record) => record.text.as_str(),
2196                DnsRecord::Mx(record) => record.text.as_str(),
2197                DnsRecord::Ns(record) => record.text.as_str(),
2198                DnsRecord::CAA(record) => record.text.as_str(),
2199                DnsRecord::DName(record) => record.text.as_str(),
2200                DnsRecord::Ptr(record) => record.text.as_str(),
2201                DnsRecord::Soa(record) => record.text.as_str(),
2202                DnsRecord::Srv(record) => record.text.as_str(),
2203                DnsRecord::Sshfp(record) => record.text.as_str(),
2204                DnsRecord::Unknown => "",
2205            }
2206        }
2207        pub fn record_type(&self) -> &str {
2208            match self {
2209                DnsRecord::A(_) => "A",
2210                DnsRecord::AAAA(_) => "AAAA",
2211                DnsRecord::CName(_) => "CNAME",
2212                DnsRecord::Txt(_) => "TXT",
2213                DnsRecord::Mx(_) => "MX",
2214                DnsRecord::Ns(_) => "NS",
2215                DnsRecord::CAA(_) => "CAA",
2216                DnsRecord::DName(_) => "DNAME",
2217                DnsRecord::Ptr(_) => "PTR",
2218                DnsRecord::Soa(_) => "SOA",
2219                DnsRecord::Srv(_) => "SRV",
2220                DnsRecord::Sshfp(_) => "SSHFP",
2221                DnsRecord::Unknown => "",
2222            }
2223        }
2224
2225        pub fn domain(&self) -> Option<&DnsDomain> {
2226            match self {
2227                DnsRecord::A(record) => Some(&record.domain),
2228                DnsRecord::AAAA(record) => Some(&record.domain),
2229                DnsRecord::CName(record) => Some(&record.domain),
2230                DnsRecord::Txt(record) => Some(&record.domain),
2231                DnsRecord::Mx(record) => Some(&record.domain),
2232                DnsRecord::Ns(record) => Some(&record.domain),
2233                DnsRecord::CAA(record) => Some(&record.domain),
2234                DnsRecord::DName(record) => Some(&record.domain),
2235                DnsRecord::Ptr(record) => Some(&record.domain),
2236                DnsRecord::Soa(record) => Some(&record.domain),
2237                DnsRecord::Srv(record) => Some(&record.domain),
2238                DnsRecord::Sshfp(record) => Some(&record.domain),
2239                DnsRecord::Unknown => None,
2240            }
2241        }
2242
2243        pub fn created_at(&self) -> Option<&DateTime> {
2244            match self {
2245                DnsRecord::A(record) => Some(&record.created_at),
2246                DnsRecord::AAAA(record) => Some(&record.created_at),
2247                DnsRecord::CName(record) => Some(&record.created_at),
2248                DnsRecord::Txt(record) => Some(&record.created_at),
2249                DnsRecord::Mx(record) => Some(&record.created_at),
2250                DnsRecord::Ns(record) => Some(&record.created_at),
2251                DnsRecord::CAA(record) => Some(&record.created_at),
2252                DnsRecord::DName(record) => Some(&record.created_at),
2253                DnsRecord::Ptr(record) => Some(&record.created_at),
2254                DnsRecord::Soa(record) => Some(&record.created_at),
2255                DnsRecord::Srv(record) => Some(&record.created_at),
2256                DnsRecord::Sshfp(record) => Some(&record.created_at),
2257                DnsRecord::Unknown => None,
2258            }
2259        }
2260
2261        pub fn updated_at(&self) -> Option<&DateTime> {
2262            match self {
2263                Self::A(record) => Some(&record.updated_at),
2264                Self::AAAA(record) => Some(&record.updated_at),
2265                Self::CName(record) => Some(&record.updated_at),
2266                Self::Txt(record) => Some(&record.updated_at),
2267                Self::Mx(record) => Some(&record.updated_at),
2268                Self::Ns(record) => Some(&record.updated_at),
2269                Self::CAA(record) => Some(&record.updated_at),
2270                Self::DName(record) => Some(&record.updated_at),
2271                Self::Ptr(record) => Some(&record.updated_at),
2272                Self::Soa(record) => Some(&record.updated_at),
2273                Self::Srv(record) => Some(&record.updated_at),
2274                Self::Sshfp(record) => Some(&record.updated_at),
2275                Self::Unknown => None,
2276            }
2277        }
2278
2279        pub fn deleted_at(&self) -> Option<&DateTime> {
2280            match self {
2281                Self::A(record) => record.deleted_at.as_ref(),
2282                Self::AAAA(record) => record.deleted_at.as_ref(),
2283                Self::CName(record) => record.deleted_at.as_ref(),
2284                Self::Txt(record) => record.deleted_at.as_ref(),
2285                Self::Mx(record) => record.deleted_at.as_ref(),
2286                Self::Ns(record) => record.deleted_at.as_ref(),
2287                Self::CAA(record) => record.deleted_at.as_ref(),
2288                Self::DName(record) => record.deleted_at.as_ref(),
2289                Self::Ptr(record) => record.deleted_at.as_ref(),
2290                Self::Soa(record) => record.deleted_at.as_ref(),
2291                Self::Srv(record) => record.deleted_at.as_ref(),
2292                Self::Sshfp(record) => record.deleted_at.as_ref(),
2293                Self::Unknown => None,
2294            }
2295        }
2296    }
2297
2298    #[derive(cynic::Enum, Clone, Copy, Debug)]
2299    pub enum DnsmanagerCertificationAuthorityAuthorizationRecordTagChoices {
2300        Issue,
2301        Issuewild,
2302        Iodef,
2303    }
2304
2305    impl DnsmanagerCertificationAuthorityAuthorizationRecordTagChoices {
2306        pub fn as_str(self) -> &'static str {
2307            match self {
2308                Self::Issue => "issue",
2309                Self::Issuewild => "issuewild",
2310                Self::Iodef => "iodef",
2311            }
2312        }
2313    }
2314
2315    #[derive(cynic::Enum, Clone, Copy, Debug)]
2316    pub enum DnsmanagerSshFingerprintRecordAlgorithmChoices {
2317        #[cynic(rename = "A_1")]
2318        A1,
2319        #[cynic(rename = "A_2")]
2320        A2,
2321        #[cynic(rename = "A_3")]
2322        A3,
2323        #[cynic(rename = "A_4")]
2324        A4,
2325    }
2326
2327    #[derive(cynic::Enum, Clone, Copy, Debug)]
2328    pub enum DnsmanagerSshFingerprintRecordTypeChoices {
2329        #[cynic(rename = "A_1")]
2330        A1,
2331        #[cynic(rename = "A_2")]
2332        A2,
2333    }
2334
2335    #[derive(cynic::QueryVariables, Debug)]
2336    pub struct GetDomainVars {
2337        pub domain: String,
2338    }
2339
2340    #[derive(cynic::QueryFragment, Debug)]
2341    #[cynic(graphql_type = "Query", variables = "GetDomainVars")]
2342    pub struct GetDomain {
2343        #[arguments(name: $domain)]
2344        pub get_domain: Option<DnsDomain>,
2345    }
2346
2347    #[derive(cynic::QueryFragment, Debug)]
2348    #[cynic(graphql_type = "Query", variables = "GetDomainVars")]
2349    pub struct GetDomainWithZoneFile {
2350        #[arguments(name: $domain)]
2351        pub get_domain: Option<DnsDomainWithZoneFile>,
2352    }
2353
2354    #[derive(cynic::QueryFragment, Debug)]
2355    #[cynic(graphql_type = "Query", variables = "GetDomainVars")]
2356    pub struct GetDomainWithRecords {
2357        #[arguments(name: $domain)]
2358        pub get_domain: Option<DnsDomainWithRecords>,
2359    }
2360
2361    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2362    #[cynic(graphql_type = "DNSDomain")]
2363    pub struct DnsDomain {
2364        pub id: cynic::Id,
2365        pub name: String,
2366        pub slug: String,
2367        pub owner: Owner,
2368    }
2369
2370    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2371    #[cynic(graphql_type = "DNSDomain")]
2372    pub struct DnsDomainWithZoneFile {
2373        pub id: cynic::Id,
2374        pub name: String,
2375        pub slug: String,
2376        pub zone_file: String,
2377    }
2378
2379    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2380    #[cynic(graphql_type = "DNSDomain")]
2381    pub struct DnsDomainWithRecords {
2382        pub id: cynic::Id,
2383        pub name: String,
2384        pub slug: String,
2385        pub records: Option<Vec<Option<DnsRecord>>>,
2386    }
2387
2388    #[derive(cynic::QueryVariables, Debug)]
2389    pub struct PurgeCacheForAppVersionVars {
2390        pub id: cynic::Id,
2391    }
2392
2393    #[derive(cynic::QueryFragment, Debug)]
2394    pub struct PurgeCacheForAppVersionPayload {
2395        pub app_version: DeployAppVersion,
2396    }
2397
2398    #[derive(cynic::QueryFragment, Debug)]
2399    #[cynic(graphql_type = "Mutation", variables = "PurgeCacheForAppVersionVars")]
2400    pub struct PurgeCacheForAppVersion {
2401        #[arguments(input: {id: $id})]
2402        pub purge_cache_for_app_version: Option<PurgeCacheForAppVersionPayload>,
2403    }
2404
2405    #[derive(cynic::Scalar, Debug, Clone)]
2406    #[cynic(graphql_type = "URL")]
2407    pub struct Url(pub String);
2408
2409    #[derive(cynic::Scalar, Debug, Clone)]
2410    pub struct BigInt(pub i64);
2411
2412    #[derive(cynic::Enum, Clone, Copy, Debug, PartialEq, Eq)]
2413    pub enum ProgrammingLanguage {
2414        Python,
2415        Javascript,
2416    }
2417
2418    /// A library that exposes bindings to a Wasmer package.
2419    #[derive(Debug, Clone)]
2420    pub struct Bindings {
2421        /// A unique ID specifying this set of bindings.
2422        pub id: String,
2423        /// The URL which can be used to download the files that were generated
2424        /// (typically as a `*.tar.gz` file).
2425        pub url: String,
2426        /// The programming language these bindings are written in.
2427        pub language: ProgrammingLanguage,
2428        /// The generator used to generate these bindings.
2429        pub generator: BindingsGenerator,
2430    }
2431
2432    #[derive(cynic::QueryVariables, Debug, Clone)]
2433    pub struct GetBindingsQueryVariables<'a> {
2434        pub name: &'a str,
2435        pub version: Option<&'a str>,
2436    }
2437
2438    #[derive(cynic::QueryFragment, Debug, Clone)]
2439    #[cynic(graphql_type = "Query", variables = "GetBindingsQueryVariables")]
2440    pub struct GetBindingsQuery {
2441        #[arguments(name: $name, version: $version)]
2442        #[cynic(rename = "getPackageVersion")]
2443        pub package_version: Option<PackageBindingsVersion>,
2444    }
2445
2446    #[derive(cynic::QueryFragment, Debug, Clone)]
2447    #[cynic(graphql_type = "PackageVersion")]
2448    pub struct PackageBindingsVersion {
2449        pub bindings: Vec<Option<PackageVersionLanguageBinding>>,
2450    }
2451
2452    #[derive(cynic::QueryFragment, Debug, Clone)]
2453    pub struct BindingsGenerator {
2454        pub package_version: PackageVersion,
2455        pub command_name: String,
2456    }
2457
2458    #[derive(cynic::QueryFragment, Debug, Clone)]
2459    pub struct PackageVersionLanguageBinding {
2460        pub id: cynic::Id,
2461        pub language: ProgrammingLanguage,
2462        pub url: String,
2463        pub generator: BindingsGenerator,
2464        pub __typename: String,
2465    }
2466
2467    #[derive(cynic::QueryVariables, Debug)]
2468    pub struct PackageVersionReadySubscriptionVariables {
2469        pub package_version_id: cynic::Id,
2470    }
2471
2472    #[derive(cynic::QueryFragment, Debug)]
2473    #[cynic(
2474        graphql_type = "Subscription",
2475        variables = "PackageVersionReadySubscriptionVariables"
2476    )]
2477    pub struct PackageVersionReadySubscription {
2478        #[arguments(packageVersionId: $package_version_id)]
2479        pub package_version_ready: PackageVersionReadyResponse,
2480    }
2481
2482    #[derive(cynic::QueryFragment, Debug)]
2483    pub struct PackageVersionReadyResponse {
2484        pub state: PackageVersionState,
2485        pub success: bool,
2486    }
2487
2488    #[derive(cynic::Enum, Clone, Copy, Debug)]
2489    pub enum PackageVersionState {
2490        WebcGenerated,
2491        BindingsGenerated,
2492        NativeExesGenerated,
2493    }
2494
2495    #[derive(cynic::InlineFragments, Debug, Clone)]
2496    #[cynic(graphql_type = "Node", variables = "GetDeployAppVersionsByIdVars")]
2497    pub enum NodeDeployAppVersions {
2498        DeployApp(Box<DeployAppVersionsById>),
2499        #[cynic(fallback)]
2500        Unknown,
2501    }
2502
2503    impl NodeDeployAppVersions {
2504        pub fn into_app(self) -> Option<DeployAppVersionsById> {
2505            match self {
2506                Self::DeployApp(v) => Some(*v),
2507                _ => None,
2508            }
2509        }
2510    }
2511
2512    #[derive(cynic::InlineFragments, Debug)]
2513    pub enum Node {
2514        DeployApp(Box<DeployApp>),
2515        DeployAppVersion(Box<DeployAppVersion>),
2516        AutobuildRepository(Box<AutobuildRepository>),
2517        #[cynic(fallback)]
2518        Unknown,
2519    }
2520
2521    impl Node {
2522        pub fn into_deploy_app(self) -> Option<DeployApp> {
2523            match self {
2524                Node::DeployApp(app) => Some(*app),
2525                _ => None,
2526            }
2527        }
2528
2529        pub fn into_deploy_app_version(self) -> Option<DeployAppVersion> {
2530            match self {
2531                Node::DeployAppVersion(version) => Some(*version),
2532                _ => None,
2533            }
2534        }
2535    }
2536}
2537
2538#[allow(non_snake_case, non_camel_case_types)]
2539mod schema {
2540    cynic::use_schema!(r#"schema.graphql"#);
2541}