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    }
588
589    #[derive(cynic::QueryFragment, Debug)]
590    #[cynic(
591        graphql_type = "Query",
592        variables = "GetSignedUrlForPackageUploadVariables"
593    )]
594    pub struct GetSignedUrlForPackageUpload {
595        #[arguments(name: $name, version: $version, filename: $filename, expiresAfterSeconds: $expires_after_seconds)]
596        pub get_signed_url_for_package_upload: Option<SignedUrl>,
597    }
598
599    #[derive(cynic::QueryFragment, Debug)]
600    pub struct SignedUrl {
601        pub url: String,
602    }
603
604    #[derive(cynic::QueryVariables, Debug)]
605    pub struct GenerateUploadUrlVariables<'a> {
606        pub expires_after_seconds: Option<i32>,
607        pub filename: &'a str,
608        pub name: Option<&'a str>,
609        pub version: Option<&'a str>,
610    }
611
612    #[derive(cynic::QueryFragment, Debug)]
613    #[cynic(graphql_type = "Mutation", variables = "GenerateUploadUrlVariables")]
614    pub struct GenerateUploadUrl {
615        #[arguments(input: { expiresAfterSeconds: $expires_after_seconds, filename: $filename, name: $name, version: $version })]
616        pub generate_upload_url: Option<GenerateUploadUrlPayload>,
617    }
618
619    #[derive(cynic::QueryFragment, Debug)]
620    pub struct GenerateUploadUrlPayload {
621        #[cynic(rename = "signedUrl")]
622        pub signed_url: SignedUrl,
623    }
624
625    #[derive(cynic::QueryFragment, Debug)]
626    pub struct PackageWebcConnection {
627        pub page_info: PageInfo,
628        pub edges: Vec<Option<PackageWebcEdge>>,
629    }
630
631    #[derive(cynic::QueryFragment, Debug)]
632    pub struct PackageWebcEdge {
633        pub node: Option<PackageWebc>,
634    }
635
636    #[derive(cynic::QueryFragment, Debug)]
637    pub struct PackageVersionConnection {
638        pub page_info: PageInfo,
639        pub edges: Vec<Option<PackageVersionEdge>>,
640    }
641
642    #[derive(cynic::QueryFragment, Debug)]
643    pub struct PackageVersionEdge {
644        pub node: Option<PackageVersionWithPackage>,
645        pub cursor: String,
646    }
647
648    #[derive(cynic::QueryVariables, Debug)]
649    pub struct GetPackageAndAppVars {
650        pub package: String,
651        pub app_owner: String,
652        pub app_name: String,
653    }
654
655    #[derive(cynic::QueryFragment, Debug)]
656    #[cynic(graphql_type = "Query", variables = "GetPackageAndAppVars")]
657    pub struct GetPackageAndApp {
658        #[arguments(name: $package)]
659        pub get_package: Option<Package>,
660        #[arguments(owner: $app_owner, name: $app_name)]
661        pub get_deploy_app: Option<DeployApp>,
662    }
663
664    #[derive(cynic::QueryVariables, Debug)]
665    pub struct GetCurrentUserWithAppsVars {
666        pub first: Option<i32>,
667        pub after: Option<String>,
668        pub sort: Option<DeployAppsSortBy>,
669    }
670
671    #[derive(cynic::QueryFragment, Debug)]
672    #[cynic(graphql_type = "Query", variables = "GetCurrentUserWithAppsVars")]
673    pub struct GetCurrentUserWithApps {
674        pub viewer: Option<UserWithApps>,
675    }
676
677    #[derive(cynic::QueryFragment, Debug)]
678    #[cynic(graphql_type = "User")]
679    #[cynic(variables = "GetCurrentUserWithAppsVars")]
680    pub struct UserWithApps {
681        pub id: cynic::Id,
682        pub username: String,
683        #[arguments(after: $after, sortBy: $sort, first: $first)]
684        pub apps: DeployAppConnection,
685    }
686
687    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
688    pub struct Owner {
689        pub global_name: String,
690    }
691
692    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
693    #[cynic(graphql_type = "User", variables = "GetCurrentUserWithNamespacesVars")]
694    pub struct UserWithNamespaces {
695        pub id: cynic::Id,
696        pub username: String,
697        #[arguments(role: $namespace_role)]
698        pub namespaces: NamespaceConnection,
699    }
700
701    #[derive(cynic::QueryVariables, Debug)]
702    pub struct GetUserAppsVars {
703        pub username: String,
704    }
705
706    #[derive(cynic::QueryFragment, Debug)]
707    #[cynic(graphql_type = "Query", variables = "GetUserAppsVars")]
708    pub struct GetUserApps {
709        #[arguments(username: $username)]
710        pub get_user: Option<User>,
711    }
712
713    #[derive(cynic::QueryVariables, Debug)]
714    pub struct GetDeployAppVars {
715        pub name: String,
716        pub owner: String,
717    }
718
719    #[derive(cynic::QueryFragment, Debug)]
720    #[cynic(graphql_type = "Query", variables = "GetDeployAppVars")]
721    pub struct GetDeployApp {
722        #[arguments(owner: $owner, name: $name)]
723        pub get_deploy_app: Option<DeployApp>,
724    }
725
726    #[derive(cynic::QueryFragment, Debug)]
727    #[cynic(graphql_type = "Query", variables = "GetDeployAppVars")]
728    pub struct GetDeployAppS3Credentials {
729        #[arguments(owner: $owner, name: $name)]
730        pub get_deploy_app: Option<AppWithS3Credentials>,
731    }
732
733    #[derive(cynic::QueryFragment, Debug)]
734    #[cynic(graphql_type = "DeployApp", variables = "GetDeployAppVars")]
735    pub struct AppWithS3Credentials {
736        pub s3_credentials: Option<S3Credentials>,
737    }
738
739    #[derive(cynic::QueryFragment, Debug)]
740    pub struct S3Credentials {
741        pub access_key: String,
742        pub secret_key: String,
743        pub endpoint: String,
744    }
745
746    #[derive(cynic::QueryVariables, Debug)]
747    pub struct RotateS3SecretsForAppVariables {
748        pub id: cynic::Id,
749    }
750
751    #[derive(cynic::QueryFragment, Debug)]
752    #[cynic(
753        graphql_type = "Mutation",
754        variables = "RotateS3SecretsForAppVariables"
755    )]
756    pub struct RotateS3SecretsForApp {
757        #[arguments(input: { id: $id })]
758        pub rotate_s3_secrets_for_app: Option<RotateS3SecretsForAppPayload>,
759    }
760
761    #[derive(cynic::QueryFragment, Debug)]
762    pub struct RotateS3SecretsForAppPayload {
763        pub client_mutation_id: Option<String>,
764    }
765
766    #[derive(cynic::QueryVariables, Debug, Clone)]
767    pub struct PaginationVars {
768        pub offset: Option<i32>,
769        pub before: Option<String>,
770        pub after: Option<String>,
771        pub first: Option<i32>,
772        pub last: Option<i32>,
773    }
774
775    #[derive(cynic::Enum, Clone, Copy, Debug)]
776    pub enum DeployAppsSortBy {
777        Newest,
778        Oldest,
779        MostActive,
780    }
781
782    #[derive(cynic::QueryVariables, Debug, Clone, Default)]
783    pub struct GetDeployAppsVars {
784        pub offset: Option<i32>,
785        pub before: Option<String>,
786        pub after: Option<String>,
787        pub first: Option<i32>,
788        pub last: Option<i32>,
789
790        pub updated_after: Option<DateTime>,
791        pub sort_by: Option<DeployAppsSortBy>,
792    }
793
794    #[derive(cynic::QueryFragment, Debug)]
795    #[cynic(graphql_type = "Query", variables = "GetDeployAppsVars")]
796    pub struct GetDeployApps {
797        #[arguments(
798            first: $first,
799            last: $last,
800            after: $after,
801            before: $before,
802            offset: $offset,
803            updatedAfter: $updated_after,
804            sortBy: $sort_by,
805        )]
806        pub get_deploy_apps: Option<DeployAppConnection>,
807    }
808
809    #[derive(cynic::QueryVariables, Debug)]
810    pub struct GetDeployAppByAliasVars {
811        pub alias: String,
812    }
813
814    #[derive(cynic::QueryFragment, Debug)]
815    #[cynic(graphql_type = "Query", variables = "GetDeployAppByAliasVars")]
816    pub struct GetDeployAppByAlias {
817        #[arguments(alias: $alias)]
818        pub get_app_by_global_alias: Option<DeployApp>,
819    }
820
821    #[derive(cynic::QueryVariables, Debug)]
822    pub struct GetDeployAppAndVersionVars {
823        pub name: String,
824        pub owner: String,
825        pub version: String,
826    }
827
828    #[derive(cynic::QueryFragment, Debug)]
829    #[cynic(graphql_type = "Query", variables = "GetDeployAppAndVersionVars")]
830    pub struct GetDeployAppAndVersion {
831        #[arguments(owner: $owner, name: $name)]
832        pub get_deploy_app: Option<DeployApp>,
833        #[arguments(owner: $owner, name: $name, version: $version)]
834        pub get_deploy_app_version: Option<DeployAppVersion>,
835    }
836
837    #[derive(cynic::QueryVariables, Debug)]
838    pub struct GetDeployAppVersionVars {
839        pub name: String,
840        pub owner: String,
841        pub version: String,
842    }
843
844    #[derive(cynic::QueryFragment, Debug)]
845    #[cynic(graphql_type = "Query", variables = "GetDeployAppVersionVars")]
846    pub struct GetDeployAppVersion {
847        #[arguments(owner: $owner, name: $name, version: $version)]
848        pub get_deploy_app_version: Option<DeployAppVersion>,
849    }
850
851    #[derive(cynic::QueryVariables, Debug)]
852    pub(crate) struct GetAppVolumesVars {
853        pub name: String,
854        pub owner: String,
855    }
856
857    #[derive(cynic::QueryFragment, Debug)]
858    #[cynic(graphql_type = "Query", variables = "GetAppVolumesVars")]
859    pub(crate) struct GetAppVolumes {
860        #[arguments(owner: $owner, name: $name)]
861        pub get_deploy_app: Option<AppVolumes>,
862    }
863
864    #[derive(cynic::QueryFragment, Debug)]
865    #[cynic(graphql_type = "DeployApp")]
866    pub(crate) struct AppVolumes {
867        pub active_version: Option<AppVersionVolumes>,
868    }
869
870    #[derive(cynic::QueryFragment, Debug)]
871    #[cynic(graphql_type = "DeployAppVersion")]
872    pub(crate) struct AppVersionVolumes {
873        pub volumes: Option<Vec<Option<AppVersionVolume>>>,
874    }
875
876    #[derive(serde::Serialize, cynic::QueryFragment, Debug)]
877    pub struct AppVersionVolume {
878        pub name: String,
879        pub size: Option<BigInt>,
880        pub used_size: Option<BigInt>,
881    }
882
883    #[derive(cynic::QueryVariables, Debug)]
884    pub(crate) struct GetAppDatabasesVars {
885        pub name: String,
886        pub owner: String,
887        pub after: Option<String>,
888    }
889
890    #[derive(cynic::QueryFragment, Debug)]
891    #[cynic(graphql_type = "Query", variables = "GetAppDatabasesVars")]
892    pub(crate) struct GetAppDatabases {
893        #[arguments(owner: $owner, name: $name)]
894        pub get_deploy_app: Option<AppDatabases>,
895    }
896
897    #[derive(cynic::QueryFragment, Debug)]
898    pub(crate) struct AppDatabaseConnection {
899        pub page_info: PageInfo,
900        pub edges: Vec<Option<AppDatabaseEdge>>,
901    }
902
903    #[derive(cynic::QueryFragment, Debug)]
904    #[cynic(graphql_type = "DeployApp")]
905    pub(crate) struct AppDatabases {
906        pub databases: AppDatabaseConnection,
907    }
908
909    #[derive(cynic::QueryFragment, Debug)]
910    pub(crate) struct AppDatabaseEdge {
911        pub node: Option<AppDatabase>,
912    }
913
914    #[derive(serde::Serialize, cynic::QueryFragment, Debug)]
915    pub struct AppDatabase {
916        pub id: cynic::Id,
917        pub name: String,
918        pub created_at: DateTime,
919        pub updated_at: DateTime,
920        pub deleted_at: Option<DateTime>,
921        pub username: String,
922        pub db_explorer_url: Option<String>,
923        pub host: String,
924        pub port: String,
925        pub password: Option<String>,
926    }
927
928    #[derive(cynic::QueryFragment, Debug)]
929    pub struct RegisterDomainPayload {
930        pub success: bool,
931        pub domain: Option<DnsDomain>,
932    }
933
934    #[derive(cynic::QueryVariables, Debug)]
935    pub struct RegisterDomainVars {
936        pub name: String,
937        pub namespace: Option<String>,
938        pub import_records: Option<bool>,
939    }
940
941    #[derive(cynic::QueryFragment, Debug)]
942    #[cynic(graphql_type = "Mutation", variables = "RegisterDomainVars")]
943    pub struct RegisterDomain {
944        #[arguments(input: {name: $name, importRecords: $import_records, namespace: $namespace})]
945        pub register_domain: Option<RegisterDomainPayload>,
946    }
947
948    #[derive(cynic::QueryVariables, Debug)]
949    pub struct UpsertDomainFromZoneFileVars {
950        pub zone_file: String,
951        pub delete_missing_records: Option<bool>,
952    }
953
954    #[derive(cynic::QueryFragment, Debug)]
955    #[cynic(graphql_type = "Mutation", variables = "UpsertDomainFromZoneFileVars")]
956    pub struct UpsertDomainFromZoneFile {
957        #[arguments(input: {zoneFile: $zone_file, deleteMissingRecords: $delete_missing_records})]
958        pub upsert_domain_from_zone_file: Option<UpsertDomainFromZoneFilePayload>,
959    }
960
961    #[derive(cynic::QueryFragment, Debug)]
962    pub struct UpsertDomainFromZoneFilePayload {
963        pub success: bool,
964        pub domain: DnsDomain,
965    }
966
967    #[derive(cynic::QueryVariables, Debug)]
968    pub struct CreateNamespaceVars {
969        pub name: String,
970        pub description: Option<String>,
971    }
972
973    #[derive(cynic::QueryFragment, Debug)]
974    #[cynic(graphql_type = "Mutation", variables = "CreateNamespaceVars")]
975    pub struct CreateNamespace {
976        #[arguments(input: {name: $name, description: $description})]
977        pub create_namespace: Option<CreateNamespacePayload>,
978    }
979
980    #[derive(cynic::QueryFragment, Debug)]
981    pub struct CreateNamespacePayload {
982        pub namespace: Namespace,
983    }
984
985    #[derive(cynic::InputObject, Debug)]
986    pub struct CreateNamespaceInput {
987        pub name: String,
988        pub display_name: Option<String>,
989        pub description: Option<String>,
990        pub avatar: Option<String>,
991        pub client_mutation_id: Option<String>,
992    }
993
994    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
995    pub struct NamespaceEdge {
996        pub node: Option<Namespace>,
997    }
998
999    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1000    pub struct NamespaceConnection {
1001        pub edges: Vec<Option<NamespaceEdge>>,
1002    }
1003
1004    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1005    pub struct Namespace {
1006        pub id: cynic::Id,
1007        pub name: String,
1008        pub global_name: String,
1009    }
1010
1011    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1012    pub struct DeployApp {
1013        pub id: cynic::Id,
1014        pub name: String,
1015        pub created_at: DateTime,
1016        pub updated_at: DateTime,
1017        pub description: Option<String>,
1018        pub active_version: Option<DeployAppVersion>,
1019        pub admin_url: String,
1020        pub owner: Owner,
1021        pub url: String,
1022        pub permalink: String,
1023        pub deleted: bool,
1024        pub aliases: AppAliasConnection,
1025        pub s3_url: Option<Url>,
1026    }
1027
1028    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1029    pub struct AppAliasConnection {
1030        pub page_info: PageInfo,
1031        pub edges: Vec<Option<AppAliasEdge>>,
1032    }
1033
1034    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1035    pub struct AppAliasEdge {
1036        pub node: Option<AppAlias>,
1037    }
1038
1039    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1040    pub struct AppAlias {
1041        pub name: String,
1042        pub hostname: String,
1043    }
1044
1045    #[derive(cynic::QueryVariables, Debug, Clone)]
1046    pub struct DeleteAppVars {
1047        pub app_id: cynic::Id,
1048    }
1049
1050    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1051    pub struct DeleteAppPayload {
1052        pub success: bool,
1053    }
1054
1055    #[derive(cynic::QueryFragment, Debug)]
1056    #[cynic(graphql_type = "Mutation", variables = "DeleteAppVars")]
1057    pub struct DeleteApp {
1058        #[arguments(input: { id: $app_id })]
1059        pub delete_app: Option<DeleteAppPayload>,
1060    }
1061
1062    #[derive(cynic::Enum, Clone, Copy, Debug)]
1063    pub enum DeployAppVersionsSortBy {
1064        Newest,
1065        Oldest,
1066    }
1067
1068    #[derive(cynic::QueryVariables, Debug, Clone)]
1069    pub struct GetDeployAppVersionsVars {
1070        pub owner: String,
1071        pub name: String,
1072
1073        pub offset: Option<i32>,
1074        pub before: Option<String>,
1075        pub after: Option<String>,
1076        pub first: Option<i32>,
1077        pub last: Option<i32>,
1078        pub sort_by: Option<DeployAppVersionsSortBy>,
1079    }
1080
1081    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1082    #[cynic(graphql_type = "Query", variables = "GetDeployAppVersionsVars")]
1083    pub struct GetDeployAppVersions {
1084        #[arguments(owner: $owner, name: $name)]
1085        pub get_deploy_app: Option<DeployAppVersions>,
1086    }
1087
1088    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1089    #[cynic(graphql_type = "DeployApp", variables = "GetDeployAppVersionsVars")]
1090    pub struct DeployAppVersions {
1091        #[arguments(
1092            first: $first,
1093            last: $last,
1094            before: $before,
1095            after: $after,
1096            offset: $offset,
1097            sortBy: $sort_by
1098        )]
1099        pub versions: DeployAppVersionConnection,
1100    }
1101
1102    #[derive(cynic::QueryVariables, Debug, Clone)]
1103    pub struct GetDeployAppVersionsByIdVars {
1104        pub id: cynic::Id,
1105
1106        pub offset: Option<i32>,
1107        pub before: Option<String>,
1108        pub after: Option<String>,
1109        pub first: Option<i32>,
1110        pub last: Option<i32>,
1111        pub sort_by: Option<DeployAppVersionsSortBy>,
1112    }
1113
1114    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1115    #[cynic(graphql_type = "DeployApp", variables = "GetDeployAppVersionsByIdVars")]
1116    pub struct DeployAppVersionsById {
1117        #[arguments(
1118            first: $first,
1119            last: $last,
1120            before: $before,
1121            after: $after,
1122            offset: $offset,
1123            sortBy: $sort_by
1124        )]
1125        pub versions: DeployAppVersionConnection,
1126    }
1127
1128    #[derive(cynic::QueryFragment, Debug, Clone)]
1129    #[cynic(graphql_type = "Query", variables = "GetDeployAppVersionsByIdVars")]
1130    pub struct GetDeployAppVersionsById {
1131        #[arguments(id: $id)]
1132        pub node: Option<NodeDeployAppVersions>,
1133    }
1134
1135    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1136    #[cynic(graphql_type = "DeployApp")]
1137    pub struct SparseDeployApp {
1138        pub id: cynic::Id,
1139    }
1140
1141    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1142    pub struct DeployAppVersion {
1143        pub id: cynic::Id,
1144        pub created_at: DateTime,
1145        pub updated_at: DateTime,
1146        pub version: String,
1147        pub description: Option<String>,
1148        pub yaml_config: String,
1149        pub user_yaml_config: String,
1150        pub config: String,
1151        pub json_config: String,
1152        pub url: String,
1153        pub disabled_at: Option<DateTime>,
1154        pub disabled_reason: Option<String>,
1155
1156        pub app: Option<SparseDeployApp>,
1157    }
1158
1159    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1160    pub struct DeployAppVersionConnection {
1161        pub page_info: PageInfo,
1162        pub edges: Vec<Option<DeployAppVersionEdge>>,
1163    }
1164
1165    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1166    pub struct DeployAppVersionEdge {
1167        pub node: Option<DeployAppVersion>,
1168        pub cursor: String,
1169    }
1170
1171    #[derive(cynic::QueryFragment, Debug)]
1172    pub struct DeployAppConnection {
1173        pub page_info: PageInfo,
1174        pub edges: Vec<Option<DeployAppEdge>>,
1175    }
1176
1177    #[derive(cynic::QueryFragment, Debug)]
1178    pub struct DeployAppEdge {
1179        pub node: Option<DeployApp>,
1180        pub cursor: String,
1181    }
1182
1183    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1184    pub struct PageInfo {
1185        pub has_next_page: bool,
1186        pub end_cursor: Option<String>,
1187    }
1188
1189    #[derive(cynic::QueryVariables, Debug)]
1190    pub struct GetNamespaceVars {
1191        pub name: String,
1192    }
1193
1194    #[derive(cynic::QueryFragment, Serialize, Debug, Clone)]
1195    pub struct MarkAppVersionAsActivePayload {
1196        pub app: DeployApp,
1197    }
1198
1199    #[derive(cynic::InputObject, Debug)]
1200    pub struct MarkAppVersionAsActiveInput {
1201        pub app_version: cynic::Id,
1202    }
1203
1204    #[derive(cynic::QueryVariables, Debug)]
1205    pub struct MarkAppVersionAsActiveVars {
1206        pub input: MarkAppVersionAsActiveInput,
1207    }
1208
1209    #[derive(cynic::QueryFragment, Debug)]
1210    #[cynic(graphql_type = "Mutation", variables = "MarkAppVersionAsActiveVars")]
1211    pub struct MarkAppVersionAsActive {
1212        #[arguments(input: $input)]
1213        pub mark_app_version_as_active: Option<MarkAppVersionAsActivePayload>,
1214    }
1215
1216    #[derive(cynic::QueryFragment, Debug)]
1217    #[cynic(graphql_type = "Query", variables = "GetNamespaceVars")]
1218    pub struct GetNamespace {
1219        #[arguments(name: $name)]
1220        pub get_namespace: Option<Namespace>,
1221    }
1222
1223    #[derive(cynic::QueryVariables, Debug)]
1224    pub struct GetNamespaceAppsVars {
1225        pub name: String,
1226        pub after: Option<String>,
1227        pub sort: Option<DeployAppsSortBy>,
1228    }
1229
1230    #[derive(cynic::QueryFragment, Debug)]
1231    #[cynic(graphql_type = "Query", variables = "GetNamespaceAppsVars")]
1232    pub struct GetNamespaceApps {
1233        #[arguments(name: $name)]
1234        pub get_namespace: Option<NamespaceWithApps>,
1235    }
1236
1237    #[derive(cynic::QueryFragment, Debug)]
1238    #[cynic(graphql_type = "Namespace")]
1239    #[cynic(variables = "GetNamespaceAppsVars")]
1240    pub struct NamespaceWithApps {
1241        pub id: cynic::Id,
1242        pub name: String,
1243        #[arguments(after: $after, sortBy: $sort)]
1244        pub apps: DeployAppConnection,
1245    }
1246
1247    #[derive(cynic::QueryVariables, Debug)]
1248    pub struct RedeployActiveAppVariables {
1249        pub id: cynic::Id,
1250    }
1251
1252    #[derive(cynic::QueryFragment, Debug)]
1253    #[cynic(graphql_type = "Mutation", variables = "RedeployActiveAppVariables")]
1254    pub struct RedeployActiveApp {
1255        #[arguments(input: { id: $id })]
1256        pub redeploy_active_version: Option<RedeployActiveVersionPayload>,
1257    }
1258
1259    #[derive(cynic::QueryFragment, Debug)]
1260    pub struct RedeployActiveVersionPayload {
1261        pub app: DeployApp,
1262    }
1263
1264    #[derive(cynic::QueryVariables, Debug)]
1265    pub struct GetAppDeploymentsVariables {
1266        pub after: Option<String>,
1267        pub first: Option<i32>,
1268        pub name: String,
1269        pub offset: Option<i32>,
1270        pub owner: String,
1271    }
1272
1273    #[derive(cynic::QueryFragment, Debug)]
1274    #[cynic(graphql_type = "Query", variables = "GetAppDeploymentsVariables")]
1275    pub struct GetAppDeployments {
1276        #[arguments(owner: $owner, name: $name)]
1277        pub get_deploy_app: Option<DeployAppDeployments>,
1278    }
1279
1280    #[derive(cynic::QueryFragment, Debug)]
1281    #[cynic(graphql_type = "DeployApp", variables = "GetAppDeploymentsVariables")]
1282    pub struct DeployAppDeployments {
1283        // FIXME: add $offset, $after, currently causes an error from the backend
1284        // #[arguments(first: $first, after: $after, offset: $offset)]
1285        pub deployments: Option<DeploymentConnection>,
1286    }
1287
1288    #[derive(cynic::QueryFragment, Debug)]
1289    pub struct DeploymentConnection {
1290        pub page_info: PageInfo,
1291        pub edges: Vec<Option<DeploymentEdge>>,
1292    }
1293
1294    #[derive(cynic::QueryFragment, Debug)]
1295    pub struct DeploymentEdge {
1296        pub node: Option<Deployment>,
1297    }
1298
1299    #[allow(clippy::large_enum_variant)]
1300    #[derive(cynic::InlineFragments, Debug, Clone, Serialize)]
1301    pub enum Deployment {
1302        AutobuildRepository(AutobuildRepository),
1303        NakedDeployment(NakedDeployment),
1304        #[cynic(fallback)]
1305        Other,
1306    }
1307
1308    #[derive(cynic::QueryFragment, serde::Serialize, Debug, Clone)]
1309    pub struct NakedDeployment {
1310        pub id: cynic::Id,
1311        pub created_at: DateTime,
1312        pub updated_at: DateTime,
1313        pub app_version: Option<DeployAppVersion>,
1314    }
1315
1316    #[derive(cynic::QueryFragment, serde::Serialize, Debug, Clone)]
1317    pub struct AutobuildRepository {
1318        pub id: cynic::Id,
1319        pub build_id: Uuid,
1320        pub created_at: DateTime,
1321        pub updated_at: DateTime,
1322        pub status: StatusEnum,
1323        pub log_url: Option<String>,
1324        pub repo_url: String,
1325    }
1326
1327    #[derive(cynic::Enum, Clone, Copy, Debug)]
1328    pub enum StatusEnum {
1329        Success,
1330        Working,
1331        Failed,
1332        Queued,
1333        Timeout,
1334        InternalError,
1335        Cancelled,
1336        Running,
1337    }
1338
1339    impl StatusEnum {
1340        pub fn as_str(&self) -> &'static str {
1341            match self {
1342                Self::Success => "success",
1343                Self::Working => "working",
1344                Self::Failed => "failed",
1345                Self::Queued => "queued",
1346                Self::Timeout => "timeout",
1347                Self::InternalError => "internal_error",
1348                Self::Cancelled => "cancelled",
1349                Self::Running => "running",
1350            }
1351        }
1352    }
1353
1354    #[derive(cynic::QueryVariables, Debug)]
1355    pub struct AutobuildConfigForZipUploadVariables<'a> {
1356        pub upload_url: &'a str,
1357    }
1358
1359    #[derive(cynic::QueryFragment, Debug)]
1360    #[cynic(
1361        graphql_type = "Mutation",
1362        variables = "AutobuildConfigForZipUploadVariables"
1363    )]
1364    pub struct AutobuildConfigForZipUpload {
1365        #[arguments(input: { uploadUrl: $upload_url })]
1366        pub autobuild_config_for_zip_upload: Option<AutobuildConfigForZipUploadPayload>,
1367    }
1368
1369    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1370    pub struct AutobuildConfigForZipUploadPayload {
1371        pub build_config: Option<BuildConfig>,
1372    }
1373
1374    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1375    pub struct BuildConfig {
1376        pub build_cmd: Option<String>,
1377        pub install_cmd: Option<String>,
1378        pub start_cmd: Option<String>,
1379        pub setup_db: bool,
1380        pub preset_name: String,
1381        pub app_name: String,
1382        pub completion_time_in_seconds: i32,
1383        pub branch: Option<String>,
1384    }
1385
1386    #[derive(cynic::InputObject, Debug, Clone)]
1387    pub struct WordpressDeploymentExtraData {
1388        pub site_name: String,
1389        pub admin_username: String,
1390        pub admin_password: String,
1391        pub admin_email: String,
1392        pub language: Option<String>,
1393    }
1394
1395    #[derive(cynic::InputObject, Debug, Clone)]
1396    pub struct AutobuildDeploymentExtraData {
1397        pub wordpress: Option<WordpressDeploymentExtraData>,
1398    }
1399
1400    #[derive(cynic::InputObject, Debug, Clone)]
1401    pub struct JobDefinitionInput {
1402        pub name: Option<String>,
1403        pub package: Option<String>,
1404        pub command: String,
1405        pub cli_args: Option<Vec<Option<String>>>,
1406        pub env: Option<Vec<Option<String>>>,
1407        pub timeout: Option<String>,
1408    }
1409
1410    #[derive(cynic::QueryVariables, Debug, Clone)]
1411    pub struct DeployViaAutobuildVars {
1412        pub repo_url: Option<String>,
1413        pub upload_url: Option<String>,
1414        pub app_name: Option<String>,
1415        pub app_id: Option<cynic::Id>,
1416        pub owner: Option<String>,
1417        pub build_cmd: Option<String>,
1418        pub install_cmd: Option<String>,
1419        pub enable_database: Option<bool>,
1420        pub secrets: Option<Vec<SecretInput>>,
1421        pub extra_data: Option<AutobuildDeploymentExtraData>,
1422        pub params: Option<AutobuildDeploymentExtraData>,
1423        pub managed: Option<bool>,
1424        pub kind: Option<String>,
1425        pub wait_for_screenshot_generation: Option<bool>,
1426        pub region: Option<String>,
1427        pub branch: Option<String>,
1428        pub allow_existing_app: Option<bool>,
1429        pub jobs: Option<Vec<JobDefinitionInput>>,
1430        pub domains: Option<Vec<Option<String>>>,
1431        pub client_mutation_id: Option<String>,
1432    }
1433
1434    #[derive(cynic::QueryFragment, Debug)]
1435    #[cynic(graphql_type = "Mutation", variables = "DeployViaAutobuildVars")]
1436    pub struct DeployViaAutobuild {
1437        #[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 })]
1438        pub deploy_via_autobuild: Option<DeployViaAutobuildPayload>,
1439    }
1440
1441    #[derive(cynic::QueryFragment, Debug)]
1442    pub struct DeployViaAutobuildPayload {
1443        pub success: bool,
1444        pub build_id: Uuid,
1445    }
1446
1447    #[derive(cynic::Scalar, Debug, Clone)]
1448    #[cynic(graphql_type = "UUID")]
1449    pub struct Uuid(pub String);
1450
1451    #[derive(cynic::QueryVariables, Debug)]
1452    pub struct PublishDeployAppVars {
1453        pub config: String,
1454        pub name: cynic::Id,
1455        pub owner: Option<cynic::Id>,
1456        pub make_default: Option<bool>,
1457    }
1458
1459    #[derive(cynic::QueryFragment, Debug)]
1460    #[cynic(graphql_type = "Mutation", variables = "PublishDeployAppVars")]
1461    pub struct PublishDeployApp {
1462        #[arguments(input: { config: { yamlConfig: $config }, name: $name, owner: $owner, makeDefault: $make_default })]
1463        pub publish_deploy_app: Option<PublishDeployAppPayload>,
1464    }
1465
1466    #[derive(cynic::QueryFragment, Debug)]
1467    pub struct PublishDeployAppPayload {
1468        pub deploy_app_version: DeployAppVersion,
1469    }
1470
1471    #[derive(cynic::QueryVariables, Debug)]
1472    pub struct GenerateDeployTokenVars {
1473        pub app_version_id: String,
1474    }
1475
1476    #[derive(cynic::QueryFragment, Debug)]
1477    #[cynic(graphql_type = "Mutation", variables = "GenerateDeployTokenVars")]
1478    pub struct GenerateDeployToken {
1479        #[arguments(input: { deployConfigVersionId: $app_version_id })]
1480        pub generate_deploy_token: Option<GenerateDeployTokenPayload>,
1481    }
1482
1483    #[derive(cynic::QueryFragment, Debug)]
1484    pub struct GenerateDeployTokenPayload {
1485        pub token: String,
1486    }
1487
1488    #[derive(cynic::Enum, Clone, Copy, Debug, PartialEq)]
1489    pub enum LogStream {
1490        Stdout,
1491        Stderr,
1492        Runtime,
1493    }
1494
1495    #[derive(cynic::QueryVariables, Debug, Clone)]
1496    pub struct GetDeployAppLogsVars {
1497        pub name: String,
1498        pub owner: String,
1499        /// The tag associated with a particular app version. Uses the active
1500        /// version if not provided.
1501        pub version: Option<String>,
1502        /// The lower bound for log messages, in nanoseconds since the Unix
1503        /// epoch.
1504        pub starting_from: f64,
1505        /// The upper bound for log messages, in nanoseconds since the Unix
1506        /// epoch.
1507        pub until: Option<f64>,
1508        pub first: Option<i32>,
1509
1510        pub request_id: Option<String>,
1511
1512        pub instance_ids: Option<Vec<String>>,
1513
1514        pub streams: Option<Vec<LogStream>>,
1515    }
1516
1517    #[derive(cynic::QueryFragment, Debug)]
1518    #[cynic(graphql_type = "Query", variables = "GetDeployAppLogsVars")]
1519    pub struct GetDeployAppLogs {
1520        #[arguments(name: $name, owner: $owner, version: $version)]
1521        pub get_deploy_app_version: Option<DeployAppVersionLogs>,
1522    }
1523
1524    #[derive(cynic::QueryFragment, Debug)]
1525    #[cynic(graphql_type = "DeployAppVersion", variables = "GetDeployAppLogsVars")]
1526    pub struct DeployAppVersionLogs {
1527        #[arguments(startingFrom: $starting_from, until: $until, first: $first, instanceIds: $instance_ids, requestId: $request_id, streams: $streams)]
1528        pub logs: LogConnection,
1529    }
1530
1531    #[derive(cynic::QueryFragment, Debug)]
1532    pub struct LogConnection {
1533        pub edges: Vec<Option<LogEdge>>,
1534    }
1535
1536    #[derive(cynic::QueryFragment, Debug)]
1537    pub struct LogEdge {
1538        pub node: Option<Log>,
1539    }
1540
1541    #[derive(cynic::QueryFragment, Debug, serde::Serialize, PartialEq)]
1542    pub struct Log {
1543        pub message: String,
1544        /// When the message was recorded, in nanoseconds since the Unix epoch.
1545        pub timestamp: f64,
1546        pub stream: Option<LogStream>,
1547        pub instance_id: String,
1548    }
1549
1550    #[derive(cynic::Enum, Clone, Copy, Debug, PartialEq, Eq)]
1551    pub enum AutoBuildDeployAppLogKind {
1552        Log,
1553        PreparingToDeployStatus,
1554        FetchingPlanStatus,
1555        BuildStatus,
1556        DeployStatus,
1557        Complete,
1558        Failed,
1559    }
1560
1561    #[derive(cynic::QueryVariables, Debug)]
1562    pub struct AutobuildDeploymentSubscriptionVariables {
1563        pub build_id: Uuid,
1564    }
1565
1566    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1567    #[cynic(
1568        graphql_type = "Subscription",
1569        variables = "AutobuildDeploymentSubscriptionVariables"
1570    )]
1571    pub struct AutobuildDeploymentSubscription {
1572        #[arguments(buildId: $build_id)]
1573        pub autobuild_deployment: Option<AutobuildLog>,
1574    }
1575
1576    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1577    pub struct AutobuildLog {
1578        pub kind: AutoBuildDeployAppLogKind,
1579        pub message: Option<String>,
1580        pub app_version: Option<DeployAppVersion>,
1581        pub timestamp: String,
1582        pub datetime: DateTime,
1583        pub stream: Option<LogStream>,
1584    }
1585
1586    #[derive(cynic::QueryVariables, Debug)]
1587    pub struct GenerateDeployConfigTokenVars {
1588        pub input: String,
1589    }
1590    #[derive(cynic::QueryFragment, Debug)]
1591    #[cynic(graphql_type = "Mutation", variables = "GenerateDeployConfigTokenVars")]
1592    pub struct GenerateDeployConfigToken {
1593        #[arguments(input: { config: $input })]
1594        pub generate_deploy_config_token: Option<GenerateDeployConfigTokenPayload>,
1595    }
1596
1597    #[derive(cynic::QueryFragment, Debug)]
1598    pub struct GenerateDeployConfigTokenPayload {
1599        pub token: String,
1600    }
1601
1602    #[derive(cynic::QueryVariables, Debug)]
1603    pub struct GenerateSshTokenVariables {
1604        pub app_id: Option<cynic::Id>,
1605    }
1606
1607    #[derive(cynic::QueryFragment, Debug)]
1608    #[cynic(graphql_type = "Mutation", variables = "GenerateSshTokenVariables")]
1609    pub struct GenerateSshToken {
1610        #[arguments(input: { appId: $app_id })]
1611        pub generate_ssh_token: Option<GenerateSshTokenPayload>,
1612    }
1613
1614    #[derive(cynic::QueryFragment, Debug)]
1615    pub struct GenerateSshTokenPayload {
1616        pub token: String,
1617    }
1618
1619    #[derive(cynic::QueryVariables, Debug)]
1620    pub struct GetNodeVars {
1621        pub id: cynic::Id,
1622    }
1623
1624    #[derive(cynic::QueryFragment, Debug)]
1625    #[cynic(graphql_type = "Query", variables = "GetNodeVars")]
1626    pub struct GetNode {
1627        #[arguments(id: $id)]
1628        pub node: Option<Node>,
1629    }
1630
1631    #[derive(cynic::QueryVariables, Debug)]
1632    pub struct GetDeployAppByIdVars {
1633        pub app_id: cynic::Id,
1634    }
1635
1636    #[derive(cynic::QueryFragment, Debug)]
1637    #[cynic(graphql_type = "Query", variables = "GetDeployAppByIdVars")]
1638    pub struct GetDeployAppById {
1639        #[arguments(id: $app_id)]
1640        #[cynic(rename = "node")]
1641        pub app: Option<Node>,
1642    }
1643
1644    #[derive(cynic::QueryVariables, Debug)]
1645    pub struct GetDeployAppAndVersionByIdVars {
1646        pub app_id: cynic::Id,
1647        pub version_id: cynic::Id,
1648    }
1649
1650    #[derive(cynic::QueryFragment, Debug)]
1651    #[cynic(graphql_type = "Query", variables = "GetDeployAppAndVersionByIdVars")]
1652    pub struct GetDeployAppAndVersionById {
1653        #[arguments(id: $app_id)]
1654        #[cynic(rename = "node")]
1655        pub app: Option<Node>,
1656        #[arguments(id: $version_id)]
1657        #[cynic(rename = "node")]
1658        pub version: Option<Node>,
1659    }
1660
1661    #[derive(cynic::QueryVariables, Debug)]
1662    pub struct GetDeployAppVersionByIdVars {
1663        pub version_id: cynic::Id,
1664    }
1665
1666    #[derive(cynic::QueryFragment, Debug)]
1667    #[cynic(graphql_type = "Query", variables = "GetDeployAppVersionByIdVars")]
1668    pub struct GetDeployAppVersionById {
1669        #[arguments(id: $version_id)]
1670        #[cynic(rename = "node")]
1671        pub version: Option<Node>,
1672    }
1673
1674    #[derive(cynic::QueryVariables, Debug)]
1675    pub struct DeleteAppSecretVariables {
1676        pub id: cynic::Id,
1677    }
1678
1679    #[derive(cynic::QueryFragment, Debug)]
1680    #[cynic(graphql_type = "Mutation", variables = "DeleteAppSecretVariables")]
1681    pub struct DeleteAppSecret {
1682        #[arguments(input: { id: $id })]
1683        pub delete_app_secret: Option<DeleteAppSecretPayload>,
1684    }
1685
1686    #[derive(cynic::QueryFragment, Debug)]
1687    pub struct DeleteAppSecretPayload {
1688        pub success: bool,
1689    }
1690    #[derive(cynic::QueryVariables, Debug, Clone)]
1691    pub struct GetAllAppSecretsVariables {
1692        pub after: Option<String>,
1693        pub app_id: cynic::Id,
1694        pub before: Option<String>,
1695        pub first: Option<i32>,
1696        pub last: Option<i32>,
1697        pub offset: Option<i32>,
1698        pub names: Option<Vec<String>>,
1699    }
1700
1701    #[derive(cynic::QueryFragment, Debug)]
1702    #[cynic(graphql_type = "Query", variables = "GetAllAppSecretsVariables")]
1703    pub struct GetAllAppSecrets {
1704        #[arguments(appId: $app_id, after: $after, before: $before, first: $first, last: $last, offset: $offset, names: $names)]
1705        pub get_app_secrets: Option<SecretConnection>,
1706    }
1707
1708    #[derive(cynic::QueryFragment, Debug)]
1709    pub struct SecretConnection {
1710        pub edges: Vec<Option<SecretEdge>>,
1711        pub page_info: PageInfo,
1712        pub total_count: Option<i32>,
1713    }
1714
1715    #[derive(cynic::QueryFragment, Debug)]
1716    pub struct SecretEdge {
1717        pub cursor: String,
1718        pub node: Option<Secret>,
1719    }
1720
1721    #[derive(cynic::QueryVariables, Debug)]
1722    pub struct GetAppSecretVariables {
1723        pub app_id: cynic::Id,
1724        pub secret_name: String,
1725    }
1726
1727    #[derive(cynic::QueryFragment, Debug)]
1728    #[cynic(graphql_type = "Query", variables = "GetAppSecretVariables")]
1729    pub struct GetAppSecret {
1730        #[arguments(appId: $app_id, secretName: $secret_name)]
1731        pub get_app_secret: Option<Secret>,
1732    }
1733
1734    #[derive(cynic::QueryVariables, Debug)]
1735    pub struct GetAppSecretValueVariables {
1736        pub id: cynic::Id,
1737    }
1738
1739    #[derive(cynic::QueryFragment, Debug)]
1740    #[cynic(graphql_type = "Query", variables = "GetAppSecretValueVariables")]
1741    pub struct GetAppSecretValue {
1742        #[arguments(id: $id)]
1743        pub get_secret_value: Option<String>,
1744    }
1745
1746    #[derive(cynic::QueryVariables, Debug)]
1747    pub struct UpsertAppSecretVariables<'a> {
1748        pub app_id: cynic::Id,
1749        pub name: &'a str,
1750        pub value: &'a str,
1751    }
1752
1753    #[derive(cynic::QueryFragment, Debug)]
1754    #[cynic(graphql_type = "Mutation", variables = "UpsertAppSecretVariables")]
1755    pub struct UpsertAppSecret {
1756        #[arguments(input: { appId: $app_id, name: $name, value: $value })]
1757        pub upsert_app_secret: Option<UpsertAppSecretPayload>,
1758    }
1759
1760    #[derive(cynic::QueryFragment, Debug)]
1761    pub struct UpsertAppSecretPayload {
1762        pub secret: Secret,
1763        pub success: bool,
1764    }
1765
1766    #[derive(cynic::QueryVariables, Debug)]
1767    pub struct UpsertAppSecretsVariables {
1768        pub app_id: cynic::Id,
1769        pub secrets: Option<Vec<SecretInput>>,
1770    }
1771
1772    #[derive(cynic::QueryFragment, Debug)]
1773    #[cynic(graphql_type = "Mutation", variables = "UpsertAppSecretsVariables")]
1774    pub struct UpsertAppSecrets {
1775        #[arguments(input: { appId: $app_id, secrets: $secrets })]
1776        pub upsert_app_secrets: Option<UpsertAppSecretsPayload>,
1777    }
1778
1779    #[derive(cynic::QueryFragment, Debug)]
1780    pub struct UpsertAppSecretsPayload {
1781        pub secrets: Vec<Option<Secret>>,
1782        pub success: bool,
1783    }
1784
1785    #[derive(cynic::InputObject, Debug, Clone)]
1786    pub struct SecretInput {
1787        pub name: String,
1788        pub value: String,
1789    }
1790    #[derive(cynic::QueryFragment, Debug, Serialize)]
1791    pub struct Secret {
1792        #[serde(skip_serializing)]
1793        pub id: cynic::Id,
1794        pub name: String,
1795        pub created_at: DateTime,
1796        pub updated_at: DateTime,
1797    }
1798
1799    #[derive(cynic::QueryVariables, Debug, Clone)]
1800    pub struct GetAllAppRegionsVariables {
1801        pub after: Option<String>,
1802        pub before: Option<String>,
1803        pub first: Option<i32>,
1804        pub last: Option<i32>,
1805        pub offset: Option<i32>,
1806    }
1807
1808    #[derive(cynic::QueryFragment, Debug)]
1809    #[cynic(graphql_type = "Query", variables = "GetAllAppRegionsVariables")]
1810    pub struct GetAllAppRegions {
1811        #[arguments(after: $after, offset: $offset, before: $before, first: $first, last: $last)]
1812        pub get_app_regions: AppRegionConnection,
1813    }
1814
1815    #[derive(cynic::QueryFragment, Debug)]
1816    pub struct AppRegionConnection {
1817        pub edges: Vec<Option<AppRegionEdge>>,
1818        pub page_info: PageInfo,
1819        pub total_count: Option<i32>,
1820    }
1821
1822    #[derive(cynic::QueryFragment, Debug)]
1823    pub struct AppRegionEdge {
1824        pub cursor: String,
1825        pub node: Option<AppRegion>,
1826    }
1827
1828    #[derive(cynic::QueryFragment, Debug, Serialize)]
1829    pub struct AppRegion {
1830        pub city: String,
1831        pub country: String,
1832        pub id: cynic::Id,
1833        pub name: String,
1834    }
1835
1836    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1837    #[cynic(graphql_type = "TXTRecord")]
1838    pub struct TxtRecord {
1839        pub id: cynic::Id,
1840        pub created_at: DateTime,
1841        pub updated_at: DateTime,
1842        pub deleted_at: Option<DateTime>,
1843        pub name: Option<String>,
1844        pub text: String,
1845        pub ttl: Option<i32>,
1846        pub data: String,
1847
1848        pub domain: DnsDomain,
1849    }
1850
1851    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1852    #[cynic(graphql_type = "SSHFPRecord")]
1853    pub struct SshfpRecord {
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        #[cynic(rename = "type")]
1862        pub type_: DnsmanagerSshFingerprintRecordTypeChoices,
1863        pub algorithm: DnsmanagerSshFingerprintRecordAlgorithmChoices,
1864        pub fingerprint: String,
1865
1866        pub domain: DnsDomain,
1867    }
1868
1869    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1870    #[cynic(graphql_type = "SRVRecord")]
1871    pub struct SrvRecord {
1872        pub id: cynic::Id,
1873        pub created_at: DateTime,
1874        pub updated_at: DateTime,
1875        pub deleted_at: Option<DateTime>,
1876        pub name: Option<String>,
1877        pub text: String,
1878        pub ttl: Option<i32>,
1879        pub service: String,
1880        pub protocol: String,
1881        pub priority: i32,
1882        pub weight: i32,
1883        pub port: i32,
1884        pub target: String,
1885
1886        pub domain: DnsDomain,
1887    }
1888
1889    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1890    #[cynic(graphql_type = "SOARecord")]
1891    pub struct SoaRecord {
1892        pub id: cynic::Id,
1893        pub created_at: DateTime,
1894        pub updated_at: DateTime,
1895        pub deleted_at: Option<DateTime>,
1896        pub name: Option<String>,
1897        pub text: String,
1898        pub ttl: Option<i32>,
1899        pub mname: String,
1900        pub rname: String,
1901        pub serial: BigInt,
1902        pub refresh: BigInt,
1903        pub retry: BigInt,
1904        pub expire: BigInt,
1905        pub minimum: BigInt,
1906
1907        pub domain: DnsDomain,
1908    }
1909
1910    #[derive(cynic::Enum, Debug, Clone, Copy)]
1911    pub enum DNSRecordsSortBy {
1912        Newest,
1913        Oldest,
1914    }
1915
1916    #[derive(cynic::QueryVariables, Debug, Clone)]
1917    pub struct GetAllDnsRecordsVariables {
1918        pub after: Option<String>,
1919        pub updated_after: Option<DateTime>,
1920        pub sort_by: Option<DNSRecordsSortBy>,
1921        pub first: Option<i32>,
1922    }
1923
1924    #[derive(cynic::QueryFragment, Debug)]
1925    #[cynic(graphql_type = "Query", variables = "GetAllDnsRecordsVariables")]
1926    pub struct GetAllDnsRecords {
1927        #[arguments(
1928            first: $first,
1929            after: $after,
1930            updatedAfter: $updated_after,
1931            sortBy: $sort_by
1932        )]
1933        #[cynic(rename = "getAllDNSRecords")]
1934        pub get_all_dnsrecords: DnsRecordConnection,
1935    }
1936
1937    #[derive(cynic::QueryVariables, Debug, Clone)]
1938    pub struct GetAllDomainsVariables {
1939        pub after: Option<String>,
1940        pub first: Option<i32>,
1941        pub namespace: Option<String>,
1942    }
1943
1944    #[derive(cynic::QueryFragment, Debug)]
1945    #[cynic(graphql_type = "Query", variables = "GetAllDomainsVariables")]
1946    pub struct GetAllDomains {
1947        #[arguments(
1948            first: $first,
1949            after: $after,
1950            namespace: $namespace,
1951        )]
1952        #[cynic(rename = "getAllDomains")]
1953        pub get_all_domains: DnsDomainConnection,
1954    }
1955
1956    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1957    #[cynic(graphql_type = "PTRRecord")]
1958    pub struct PtrRecord {
1959        pub id: cynic::Id,
1960        pub created_at: DateTime,
1961        pub updated_at: DateTime,
1962        pub deleted_at: Option<DateTime>,
1963        pub name: Option<String>,
1964        pub text: String,
1965        pub ttl: Option<i32>,
1966        pub ptrdname: String,
1967
1968        pub domain: DnsDomain,
1969    }
1970
1971    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1972    #[cynic(graphql_type = "NSRecord")]
1973    pub struct NsRecord {
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 nsdname: String,
1982
1983        pub domain: DnsDomain,
1984    }
1985
1986    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
1987    #[cynic(graphql_type = "MXRecord")]
1988    pub struct MxRecord {
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 preference: i32,
1997        pub exchange: String,
1998
1999        pub domain: DnsDomain,
2000    }
2001
2002    #[derive(cynic::QueryFragment, Debug)]
2003    #[cynic(graphql_type = "DNSRecordConnection")]
2004    pub struct DnsRecordConnection {
2005        pub page_info: PageInfo,
2006        pub edges: Vec<Option<DnsRecordEdge>>,
2007    }
2008
2009    #[derive(cynic::QueryFragment, Debug)]
2010    #[cynic(graphql_type = "DNSRecordEdge")]
2011    pub struct DnsRecordEdge {
2012        pub node: Option<DnsRecord>,
2013    }
2014
2015    #[derive(cynic::QueryFragment, Debug)]
2016    #[cynic(graphql_type = "DNSDomainConnection")]
2017    pub struct DnsDomainConnection {
2018        pub page_info: PageInfo,
2019        pub edges: Vec<Option<DnsDomainEdge>>,
2020    }
2021
2022    #[derive(cynic::QueryFragment, Debug)]
2023    #[cynic(graphql_type = "DNSDomainEdge")]
2024    pub struct DnsDomainEdge {
2025        pub node: Option<DnsDomain>,
2026    }
2027
2028    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2029    #[cynic(graphql_type = "DNAMERecord")]
2030    pub struct DNameRecord {
2031        pub id: cynic::Id,
2032        pub created_at: DateTime,
2033        pub updated_at: DateTime,
2034        pub deleted_at: Option<DateTime>,
2035        pub name: Option<String>,
2036        pub text: String,
2037        pub ttl: Option<i32>,
2038        pub d_name: String,
2039
2040        pub domain: DnsDomain,
2041    }
2042
2043    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2044    #[cynic(graphql_type = "CNAMERecord")]
2045    pub struct CNameRecord {
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 c_name: String,
2054
2055        pub domain: DnsDomain,
2056    }
2057
2058    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2059    #[cynic(graphql_type = "CAARecord")]
2060    pub struct CaaRecord {
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 value: String,
2069        pub flags: i32,
2070        pub tag: DnsmanagerCertificationAuthorityAuthorizationRecordTagChoices,
2071
2072        pub domain: DnsDomain,
2073    }
2074
2075    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2076    #[cynic(graphql_type = "ARecord")]
2077    pub struct ARecord {
2078        pub id: cynic::Id,
2079        pub created_at: DateTime,
2080        pub updated_at: DateTime,
2081        pub deleted_at: Option<DateTime>,
2082        pub name: Option<String>,
2083        pub text: String,
2084        pub ttl: Option<i32>,
2085        pub address: String,
2086        pub domain: DnsDomain,
2087    }
2088
2089    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2090    #[cynic(graphql_type = "AAAARecord")]
2091    pub struct AaaaRecord {
2092        pub id: cynic::Id,
2093        pub created_at: DateTime,
2094        pub updated_at: DateTime,
2095        pub deleted_at: Option<DateTime>,
2096        pub name: Option<String>,
2097        pub text: String,
2098        pub ttl: Option<i32>,
2099        pub address: String,
2100        pub domain: DnsDomain,
2101    }
2102
2103    #[derive(cynic::InlineFragments, Debug, Clone, Serialize)]
2104    #[cynic(graphql_type = "DNSRecord")]
2105    pub enum DnsRecord {
2106        A(ARecord),
2107        AAAA(AaaaRecord),
2108        CName(CNameRecord),
2109        Txt(TxtRecord),
2110        Mx(MxRecord),
2111        Ns(NsRecord),
2112        CAA(CaaRecord),
2113        DName(DNameRecord),
2114        Ptr(PtrRecord),
2115        Soa(SoaRecord),
2116        Srv(SrvRecord),
2117        Sshfp(SshfpRecord),
2118        #[cynic(fallback)]
2119        Unknown,
2120    }
2121
2122    impl DnsRecord {
2123        pub fn id(&self) -> &str {
2124            match self {
2125                DnsRecord::A(record) => record.id.inner(),
2126                DnsRecord::AAAA(record) => record.id.inner(),
2127                DnsRecord::CName(record) => record.id.inner(),
2128                DnsRecord::Txt(record) => record.id.inner(),
2129                DnsRecord::Mx(record) => record.id.inner(),
2130                DnsRecord::Ns(record) => record.id.inner(),
2131                DnsRecord::CAA(record) => record.id.inner(),
2132                DnsRecord::DName(record) => record.id.inner(),
2133                DnsRecord::Ptr(record) => record.id.inner(),
2134                DnsRecord::Soa(record) => record.id.inner(),
2135                DnsRecord::Srv(record) => record.id.inner(),
2136                DnsRecord::Sshfp(record) => record.id.inner(),
2137                DnsRecord::Unknown => "",
2138            }
2139        }
2140        pub fn name(&self) -> Option<&str> {
2141            match self {
2142                DnsRecord::A(record) => record.name.as_deref(),
2143                DnsRecord::AAAA(record) => record.name.as_deref(),
2144                DnsRecord::CName(record) => record.name.as_deref(),
2145                DnsRecord::Txt(record) => record.name.as_deref(),
2146                DnsRecord::Mx(record) => record.name.as_deref(),
2147                DnsRecord::Ns(record) => record.name.as_deref(),
2148                DnsRecord::CAA(record) => record.name.as_deref(),
2149                DnsRecord::DName(record) => record.name.as_deref(),
2150                DnsRecord::Ptr(record) => record.name.as_deref(),
2151                DnsRecord::Soa(record) => record.name.as_deref(),
2152                DnsRecord::Srv(record) => record.name.as_deref(),
2153                DnsRecord::Sshfp(record) => record.name.as_deref(),
2154                DnsRecord::Unknown => None,
2155            }
2156        }
2157        pub fn ttl(&self) -> Option<i32> {
2158            match self {
2159                DnsRecord::A(record) => record.ttl,
2160                DnsRecord::AAAA(record) => record.ttl,
2161                DnsRecord::CName(record) => record.ttl,
2162                DnsRecord::Txt(record) => record.ttl,
2163                DnsRecord::Mx(record) => record.ttl,
2164                DnsRecord::Ns(record) => record.ttl,
2165                DnsRecord::CAA(record) => record.ttl,
2166                DnsRecord::DName(record) => record.ttl,
2167                DnsRecord::Ptr(record) => record.ttl,
2168                DnsRecord::Soa(record) => record.ttl,
2169                DnsRecord::Srv(record) => record.ttl,
2170                DnsRecord::Sshfp(record) => record.ttl,
2171                DnsRecord::Unknown => None,
2172            }
2173        }
2174
2175        pub fn text(&self) -> &str {
2176            match self {
2177                DnsRecord::A(record) => record.text.as_str(),
2178                DnsRecord::AAAA(record) => record.text.as_str(),
2179                DnsRecord::CName(record) => record.text.as_str(),
2180                DnsRecord::Txt(record) => record.text.as_str(),
2181                DnsRecord::Mx(record) => record.text.as_str(),
2182                DnsRecord::Ns(record) => record.text.as_str(),
2183                DnsRecord::CAA(record) => record.text.as_str(),
2184                DnsRecord::DName(record) => record.text.as_str(),
2185                DnsRecord::Ptr(record) => record.text.as_str(),
2186                DnsRecord::Soa(record) => record.text.as_str(),
2187                DnsRecord::Srv(record) => record.text.as_str(),
2188                DnsRecord::Sshfp(record) => record.text.as_str(),
2189                DnsRecord::Unknown => "",
2190            }
2191        }
2192        pub fn record_type(&self) -> &str {
2193            match self {
2194                DnsRecord::A(_) => "A",
2195                DnsRecord::AAAA(_) => "AAAA",
2196                DnsRecord::CName(_) => "CNAME",
2197                DnsRecord::Txt(_) => "TXT",
2198                DnsRecord::Mx(_) => "MX",
2199                DnsRecord::Ns(_) => "NS",
2200                DnsRecord::CAA(_) => "CAA",
2201                DnsRecord::DName(_) => "DNAME",
2202                DnsRecord::Ptr(_) => "PTR",
2203                DnsRecord::Soa(_) => "SOA",
2204                DnsRecord::Srv(_) => "SRV",
2205                DnsRecord::Sshfp(_) => "SSHFP",
2206                DnsRecord::Unknown => "",
2207            }
2208        }
2209
2210        pub fn domain(&self) -> Option<&DnsDomain> {
2211            match self {
2212                DnsRecord::A(record) => Some(&record.domain),
2213                DnsRecord::AAAA(record) => Some(&record.domain),
2214                DnsRecord::CName(record) => Some(&record.domain),
2215                DnsRecord::Txt(record) => Some(&record.domain),
2216                DnsRecord::Mx(record) => Some(&record.domain),
2217                DnsRecord::Ns(record) => Some(&record.domain),
2218                DnsRecord::CAA(record) => Some(&record.domain),
2219                DnsRecord::DName(record) => Some(&record.domain),
2220                DnsRecord::Ptr(record) => Some(&record.domain),
2221                DnsRecord::Soa(record) => Some(&record.domain),
2222                DnsRecord::Srv(record) => Some(&record.domain),
2223                DnsRecord::Sshfp(record) => Some(&record.domain),
2224                DnsRecord::Unknown => None,
2225            }
2226        }
2227
2228        pub fn created_at(&self) -> Option<&DateTime> {
2229            match self {
2230                DnsRecord::A(record) => Some(&record.created_at),
2231                DnsRecord::AAAA(record) => Some(&record.created_at),
2232                DnsRecord::CName(record) => Some(&record.created_at),
2233                DnsRecord::Txt(record) => Some(&record.created_at),
2234                DnsRecord::Mx(record) => Some(&record.created_at),
2235                DnsRecord::Ns(record) => Some(&record.created_at),
2236                DnsRecord::CAA(record) => Some(&record.created_at),
2237                DnsRecord::DName(record) => Some(&record.created_at),
2238                DnsRecord::Ptr(record) => Some(&record.created_at),
2239                DnsRecord::Soa(record) => Some(&record.created_at),
2240                DnsRecord::Srv(record) => Some(&record.created_at),
2241                DnsRecord::Sshfp(record) => Some(&record.created_at),
2242                DnsRecord::Unknown => None,
2243            }
2244        }
2245
2246        pub fn updated_at(&self) -> Option<&DateTime> {
2247            match self {
2248                Self::A(record) => Some(&record.updated_at),
2249                Self::AAAA(record) => Some(&record.updated_at),
2250                Self::CName(record) => Some(&record.updated_at),
2251                Self::Txt(record) => Some(&record.updated_at),
2252                Self::Mx(record) => Some(&record.updated_at),
2253                Self::Ns(record) => Some(&record.updated_at),
2254                Self::CAA(record) => Some(&record.updated_at),
2255                Self::DName(record) => Some(&record.updated_at),
2256                Self::Ptr(record) => Some(&record.updated_at),
2257                Self::Soa(record) => Some(&record.updated_at),
2258                Self::Srv(record) => Some(&record.updated_at),
2259                Self::Sshfp(record) => Some(&record.updated_at),
2260                Self::Unknown => None,
2261            }
2262        }
2263
2264        pub fn deleted_at(&self) -> Option<&DateTime> {
2265            match self {
2266                Self::A(record) => record.deleted_at.as_ref(),
2267                Self::AAAA(record) => record.deleted_at.as_ref(),
2268                Self::CName(record) => record.deleted_at.as_ref(),
2269                Self::Txt(record) => record.deleted_at.as_ref(),
2270                Self::Mx(record) => record.deleted_at.as_ref(),
2271                Self::Ns(record) => record.deleted_at.as_ref(),
2272                Self::CAA(record) => record.deleted_at.as_ref(),
2273                Self::DName(record) => record.deleted_at.as_ref(),
2274                Self::Ptr(record) => record.deleted_at.as_ref(),
2275                Self::Soa(record) => record.deleted_at.as_ref(),
2276                Self::Srv(record) => record.deleted_at.as_ref(),
2277                Self::Sshfp(record) => record.deleted_at.as_ref(),
2278                Self::Unknown => None,
2279            }
2280        }
2281    }
2282
2283    #[derive(cynic::Enum, Clone, Copy, Debug)]
2284    pub enum DnsmanagerCertificationAuthorityAuthorizationRecordTagChoices {
2285        Issue,
2286        Issuewild,
2287        Iodef,
2288    }
2289
2290    impl DnsmanagerCertificationAuthorityAuthorizationRecordTagChoices {
2291        pub fn as_str(self) -> &'static str {
2292            match self {
2293                Self::Issue => "issue",
2294                Self::Issuewild => "issuewild",
2295                Self::Iodef => "iodef",
2296            }
2297        }
2298    }
2299
2300    #[derive(cynic::Enum, Clone, Copy, Debug)]
2301    pub enum DnsmanagerSshFingerprintRecordAlgorithmChoices {
2302        #[cynic(rename = "A_1")]
2303        A1,
2304        #[cynic(rename = "A_2")]
2305        A2,
2306        #[cynic(rename = "A_3")]
2307        A3,
2308        #[cynic(rename = "A_4")]
2309        A4,
2310    }
2311
2312    #[derive(cynic::Enum, Clone, Copy, Debug)]
2313    pub enum DnsmanagerSshFingerprintRecordTypeChoices {
2314        #[cynic(rename = "A_1")]
2315        A1,
2316        #[cynic(rename = "A_2")]
2317        A2,
2318    }
2319
2320    #[derive(cynic::QueryVariables, Debug)]
2321    pub struct GetDomainVars {
2322        pub domain: String,
2323    }
2324
2325    #[derive(cynic::QueryFragment, Debug)]
2326    #[cynic(graphql_type = "Query", variables = "GetDomainVars")]
2327    pub struct GetDomain {
2328        #[arguments(name: $domain)]
2329        pub get_domain: Option<DnsDomain>,
2330    }
2331
2332    #[derive(cynic::QueryFragment, Debug)]
2333    #[cynic(graphql_type = "Query", variables = "GetDomainVars")]
2334    pub struct GetDomainWithZoneFile {
2335        #[arguments(name: $domain)]
2336        pub get_domain: Option<DnsDomainWithZoneFile>,
2337    }
2338
2339    #[derive(cynic::QueryFragment, Debug)]
2340    #[cynic(graphql_type = "Query", variables = "GetDomainVars")]
2341    pub struct GetDomainWithRecords {
2342        #[arguments(name: $domain)]
2343        pub get_domain: Option<DnsDomainWithRecords>,
2344    }
2345
2346    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2347    #[cynic(graphql_type = "DNSDomain")]
2348    pub struct DnsDomain {
2349        pub id: cynic::Id,
2350        pub name: String,
2351        pub slug: String,
2352        pub owner: Owner,
2353    }
2354
2355    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2356    #[cynic(graphql_type = "DNSDomain")]
2357    pub struct DnsDomainWithZoneFile {
2358        pub id: cynic::Id,
2359        pub name: String,
2360        pub slug: String,
2361        pub zone_file: String,
2362    }
2363
2364    #[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
2365    #[cynic(graphql_type = "DNSDomain")]
2366    pub struct DnsDomainWithRecords {
2367        pub id: cynic::Id,
2368        pub name: String,
2369        pub slug: String,
2370        pub records: Option<Vec<Option<DnsRecord>>>,
2371    }
2372
2373    #[derive(cynic::QueryVariables, Debug)]
2374    pub struct PurgeCacheForAppVersionVars {
2375        pub id: cynic::Id,
2376    }
2377
2378    #[derive(cynic::QueryFragment, Debug)]
2379    pub struct PurgeCacheForAppVersionPayload {
2380        pub app_version: DeployAppVersion,
2381    }
2382
2383    #[derive(cynic::QueryFragment, Debug)]
2384    #[cynic(graphql_type = "Mutation", variables = "PurgeCacheForAppVersionVars")]
2385    pub struct PurgeCacheForAppVersion {
2386        #[arguments(input: {id: $id})]
2387        pub purge_cache_for_app_version: Option<PurgeCacheForAppVersionPayload>,
2388    }
2389
2390    #[derive(cynic::Scalar, Debug, Clone)]
2391    #[cynic(graphql_type = "URL")]
2392    pub struct Url(pub String);
2393
2394    #[derive(cynic::Scalar, Debug, Clone)]
2395    pub struct BigInt(pub i64);
2396
2397    #[derive(cynic::Enum, Clone, Copy, Debug, PartialEq, Eq)]
2398    pub enum ProgrammingLanguage {
2399        Python,
2400        Javascript,
2401    }
2402
2403    /// A library that exposes bindings to a Wasmer package.
2404    #[derive(Debug, Clone)]
2405    pub struct Bindings {
2406        /// A unique ID specifying this set of bindings.
2407        pub id: String,
2408        /// The URL which can be used to download the files that were generated
2409        /// (typically as a `*.tar.gz` file).
2410        pub url: String,
2411        /// The programming language these bindings are written in.
2412        pub language: ProgrammingLanguage,
2413        /// The generator used to generate these bindings.
2414        pub generator: BindingsGenerator,
2415    }
2416
2417    #[derive(cynic::QueryVariables, Debug, Clone)]
2418    pub struct GetBindingsQueryVariables<'a> {
2419        pub name: &'a str,
2420        pub version: Option<&'a str>,
2421    }
2422
2423    #[derive(cynic::QueryFragment, Debug, Clone)]
2424    #[cynic(graphql_type = "Query", variables = "GetBindingsQueryVariables")]
2425    pub struct GetBindingsQuery {
2426        #[arguments(name: $name, version: $version)]
2427        #[cynic(rename = "getPackageVersion")]
2428        pub package_version: Option<PackageBindingsVersion>,
2429    }
2430
2431    #[derive(cynic::QueryFragment, Debug, Clone)]
2432    #[cynic(graphql_type = "PackageVersion")]
2433    pub struct PackageBindingsVersion {
2434        pub bindings: Vec<Option<PackageVersionLanguageBinding>>,
2435    }
2436
2437    #[derive(cynic::QueryFragment, Debug, Clone)]
2438    pub struct BindingsGenerator {
2439        pub package_version: PackageVersion,
2440        pub command_name: String,
2441    }
2442
2443    #[derive(cynic::QueryFragment, Debug, Clone)]
2444    pub struct PackageVersionLanguageBinding {
2445        pub id: cynic::Id,
2446        pub language: ProgrammingLanguage,
2447        pub url: String,
2448        pub generator: BindingsGenerator,
2449        pub __typename: String,
2450    }
2451
2452    #[derive(cynic::QueryVariables, Debug)]
2453    pub struct PackageVersionReadySubscriptionVariables {
2454        pub package_version_id: cynic::Id,
2455    }
2456
2457    #[derive(cynic::QueryFragment, Debug)]
2458    #[cynic(
2459        graphql_type = "Subscription",
2460        variables = "PackageVersionReadySubscriptionVariables"
2461    )]
2462    pub struct PackageVersionReadySubscription {
2463        #[arguments(packageVersionId: $package_version_id)]
2464        pub package_version_ready: PackageVersionReadyResponse,
2465    }
2466
2467    #[derive(cynic::QueryFragment, Debug)]
2468    pub struct PackageVersionReadyResponse {
2469        pub state: PackageVersionState,
2470        pub success: bool,
2471    }
2472
2473    #[derive(cynic::Enum, Clone, Copy, Debug)]
2474    pub enum PackageVersionState {
2475        WebcGenerated,
2476        BindingsGenerated,
2477        NativeExesGenerated,
2478    }
2479
2480    #[derive(cynic::InlineFragments, Debug, Clone)]
2481    #[cynic(graphql_type = "Node", variables = "GetDeployAppVersionsByIdVars")]
2482    pub enum NodeDeployAppVersions {
2483        DeployApp(Box<DeployAppVersionsById>),
2484        #[cynic(fallback)]
2485        Unknown,
2486    }
2487
2488    impl NodeDeployAppVersions {
2489        pub fn into_app(self) -> Option<DeployAppVersionsById> {
2490            match self {
2491                Self::DeployApp(v) => Some(*v),
2492                _ => None,
2493            }
2494        }
2495    }
2496
2497    #[derive(cynic::InlineFragments, Debug)]
2498    pub enum Node {
2499        DeployApp(Box<DeployApp>),
2500        DeployAppVersion(Box<DeployAppVersion>),
2501        AutobuildRepository(Box<AutobuildRepository>),
2502        #[cynic(fallback)]
2503        Unknown,
2504    }
2505
2506    impl Node {
2507        pub fn into_deploy_app(self) -> Option<DeployApp> {
2508            match self {
2509                Node::DeployApp(app) => Some(*app),
2510                _ => None,
2511            }
2512        }
2513
2514        pub fn into_deploy_app_version(self) -> Option<DeployAppVersion> {
2515            match self {
2516                Node::DeployAppVersion(version) => Some(*version),
2517                _ => None,
2518            }
2519        }
2520    }
2521}
2522
2523#[allow(non_snake_case, non_camel_case_types)]
2524mod schema {
2525    cynic::use_schema!(r#"schema.graphql"#);
2526}