winget_types/locale/mod.rs
1mod agreement;
2mod author;
3mod copyright;
4mod description;
5mod documentation;
6mod icon;
7mod installation_notes;
8mod license;
9mod moniker;
10mod package_name;
11mod publisher;
12mod release_notes;
13mod short_description;
14mod tag;
15
16use alloc::collections::BTreeSet;
17
18pub use agreement::Agreement;
19pub use author::{Author, AuthorError};
20pub use copyright::{Copyright, CopyrightError};
21pub use description::{Description, DescriptionError};
22pub use documentation::{DocumentLabel, Documentation};
23pub use icon::Icon;
24pub use installation_notes::{InstallationNotes, InstallationNotesError};
25pub use license::{License, LicenseError};
26pub use moniker::Moniker;
27pub use package_name::{PackageName, PackageNameError};
28pub use publisher::{Publisher, PublisherError};
29pub use release_notes::{ReleaseNotes, ReleaseNotesError};
30pub use short_description::{ShortDescription, ShortDescriptionError};
31pub use tag::{Tag, TagError};
32use url::Url;
33
34use super::{
35 LanguageTag, Manifest, ManifestType, ManifestVersion, PackageIdentifier, PackageVersion,
36 url::{
37 CopyrightUrl, LicenseUrl, PackageUrl, PublisherSupportUrl, PublisherUrl, ReleaseNotesUrl,
38 },
39};
40
41#[derive(Default)]
42#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
43#[cfg_attr(feature = "serde", serde(rename_all = "PascalCase"))]
44pub struct DefaultLocaleManifest {
45 /// The unique identifier for a given package.
46 ///
47 /// This value is generally in the form of `Publisher.Package`. It is case-sensitive, and this
48 /// value must match the folder structure under the partition directory in GitHub.
49 pub package_identifier: PackageIdentifier,
50
51 /// The version of the package.
52 ///
53 /// It is related to the specific release this manifests targets. In some cases you will see a
54 /// perfectly formed [semantic version] number, and in other cases you might see something
55 /// different. These may be date driven, or they might have other characters with some package
56 /// specific meaning for example.
57 ///
58 /// The Windows Package Manager client uses this version to determine if an upgrade for a
59 /// package is available. In some cases, packages may be released with a marketing driven
60 /// version, and that causes trouble with the [`winget upgrade`] command.
61 ///
62 /// The current best practice is to use the value reported in Add / Remove Programs when this
63 /// version of the package is installed. In some cases, packages do not report a version
64 /// resulting in an upgrade loop or other unwanted behavior.
65 ///
66 /// [semantic version]: https://semver.org/
67 /// [`winget upgrade`]: https://docs.microsoft.com/windows/package-manager/winget/upgrade
68 pub package_version: PackageVersion,
69
70 /// The locale for package metadata.
71 ///
72 /// The format is BCP-47. This value identifies the language for meta-data to be displayed to a
73 /// user when no locale file matching their preferences is available. The Microsoft community
74 /// package repository validation pipelines also use this value to determine appropriate
75 /// validation rules for this file.
76 pub package_locale: LanguageTag,
77
78 /// The name of the publisher for a given package.
79 ///
80 /// This field is intended to allow the full publisher's or ISV's name to be displayed as they
81 /// wish.
82 ///
83 /// With the 1.9 release of the Windows Package Manager, this name affects how packages from a
84 /// source are mapped to Apps installed in Windows 10 and Windows 11 via Add / Remove Programs
85 /// (ARP) and Windows Apps & Features respectively. The best practice is to ensure this matches
86 /// the entry for the package when it has been installed. This should be the value of the
87 /// `Publisher` sub-key for the package in the [Windows registry]. The impact is associated with
88 /// `winget upgrade` and `winget list`.
89 ///
90 /// [Windows registry]: https://learn.microsoft.com/windows/win32/msi/uninstall-registry-key
91 pub publisher: Publisher,
92
93 /// The website for the publisher or ISV.
94 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
95 pub publisher_url: Option<PublisherUrl>,
96
97 /// The website for the publisher or ISV.
98 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
99 pub publisher_support_url: Option<PublisherSupportUrl>,
100
101 /// The privacy website or specific web page provided the publisher or ISV.
102 ///
103 /// If there is a privacy website or specific web page for the package it is preferred over a
104 /// generic privacy page for the publisher.
105 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
106 pub privacy_url: Option<Url>,
107
108 /// The author of a package.
109 ///
110 /// In some cases, the author is an individual who develops and or maintains the package. In
111 /// other cases this may be a URL pointing to the contributors web page for a package.
112 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
113 pub author: Option<Author>,
114
115 /// The name of the package.
116 ///
117 /// This field is intended to allow the full package name to be displayed as the publisher or
118 /// ISV wishes.
119 ///
120 /// With the 1.9 release of the Windows Package Manager, this name affects how packages from a
121 /// source are mapped to Apps installed in Windows 10 via Add / Remove Programs (ARP). The best
122 /// practice is to ensure this matches the ARP entry for the package name when it has been
123 /// installed. This should be the value of the `DisplayName` subkey for the package in the
124 /// [Windows registry]. The impact is associated with `winget upgrade` and `winget list`.
125 ///
126 /// [Windows registry]: https://learn.microsoft.com/windows/win32/msi/uninstall-registry-key
127 pub package_name: PackageName,
128
129 /// The website for the package.
130 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
131 pub package_url: Option<PackageUrl>,
132
133 /// The license governing the use and or distribution for the product.
134 ///
135 /// This could be an open source license, or a commercial license. Please note that a copyright
136 /// is not considered a license. If there is no available information on a product's license,
137 /// [`Proprietary`] should be the value in this field.
138 ///
139 /// [`Proprietary`]: License::PROPRIETARY
140 pub license: License,
141
142 /// The license website or specific web page provided the publisher or ISV.
143 ///
144 /// If there is a license website or specific web page for the package it is preferred over a
145 /// generic license page for the publisher.
146 ///
147 /// If this is a link to the license file for an open source project, it should be specific to
148 /// the version for the package. Some open source projects change their license over time.
149 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
150 pub license_url: Option<LicenseUrl>,
151
152 /// The copyright for the package.
153 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
154 pub copyright: Option<Copyright>,
155
156 /// The copyright website or specific web page provided the publisher or ISV.
157 ///
158 /// If there is a copyright website or specific web page for the package it is preferred over a
159 /// generic copyright page for the publisher.
160 ///
161 /// If this is a link to the copyright file for an open source project, it should be specific to
162 /// the version for the package. Some open source projects change their copyright over time.
163 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
164 pub copyright_url: Option<CopyrightUrl>,
165
166 /// The description for a package.
167 ///
168 /// It is intended for use in `winget show` to help a user understand what the package is.
169 ///
170 /// This should be something descriptive about what the package does, and it should not simply
171 /// state something like `<package name> installer` or `<package name> setup`.
172 pub short_description: ShortDescription,
173
174 /// The full or long description for a package.
175 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
176 pub description: Option<Description>,
177
178 /// The most common term users would search for when installing or upgrading a package.
179 ///
180 /// If only one package uses this moniker, then the [install], [list] and [upgrade] command may
181 /// match with this package.
182 ///
183 /// Moniker is the third property evaluated when searching for a matching package.
184 ///
185 /// [install]: https://docs.microsoft.com/windows/package-manager/winget/install
186 /// [list]: https://docs.microsoft.com/windows/package-manager/winget/list
187 /// [upgrade]: https://docs.microsoft.com/windows/package-manager/winget/upgrade
188 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
189 pub moniker: Option<Moniker>,
190
191 /// Other common term users would search for when looking for packages.
192 ///
193 /// Tags should be pertinent to what a user might search for when looking for a specific
194 /// package.
195 ///
196 /// The best practice is to present these terms in all lower case with hyphens rather than
197 /// spaces.
198 #[cfg_attr(
199 feature = "serde",
200 serde(skip_serializing_if = "BTreeSet::is_empty", default)
201 )]
202 pub tags: BTreeSet<Tag>,
203
204 /// Any agreements a user must accept prior to download and subsequent install or upgrade.
205 ///
206 /// Agreements are only allowed in the community repository when the manifest is maintained by a
207 /// verified developer.
208 #[cfg_attr(
209 feature = "serde",
210 serde(skip_serializing_if = "BTreeSet::is_empty", default)
211 )]
212 pub agreements: BTreeSet<Agreement>,
213
214 /// The release notes for a package.
215 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
216 pub release_notes: Option<ReleaseNotes>,
217
218 /// Release notes webpage for a package.
219 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
220 pub release_notes_url: Option<ReleaseNotesUrl>,
221
222 /// The purchase url for acquiring entitlement for a package.
223 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
224 pub purchase_url: Option<Url>,
225
226 /// The notes displayed to the user upon completion of a package installation.
227 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
228 pub installation_notes: Option<InstallationNotes>,
229
230 /// Any documentation for providing software guides such as manuals and troubleshooting URLs.
231 #[cfg_attr(
232 feature = "serde",
233 serde(skip_serializing_if = "BTreeSet::is_empty", default)
234 )]
235 pub documentations: BTreeSet<Documentation>,
236
237 #[cfg_attr(
238 feature = "serde",
239 serde(skip_serializing_if = "BTreeSet::is_empty", default)
240 )]
241 pub icons: BTreeSet<Icon>,
242
243 /// The manifest type.
244 ///
245 /// Must have the value [`defaultLocale`]. The Microsoft community package repository validation
246 /// pipelines also use this value to determine appropriate validation rules when evaluating this
247 /// file.
248 ///
249 /// [`defaultLocale`]: ManifestType::DefaultLocale
250 #[cfg_attr(feature = "serde", serde(default = "ManifestType::default_locale"))]
251 pub manifest_type: ManifestType,
252
253 /// The manifest syntax version.
254 ///
255 /// Must have the value `1.10.0`. The Microsoft community package repository validation
256 /// pipelines also use this value to determine appropriate validation rules when evaluating this
257 /// file.
258 #[cfg_attr(feature = "serde", serde(default))]
259 pub manifest_version: ManifestVersion,
260}
261
262impl Manifest for DefaultLocaleManifest {
263 const SCHEMA: &'static str = "https://aka.ms/winget-manifest.defaultLocale.1.10.0.schema.json";
264
265 const TYPE: ManifestType = ManifestType::DefaultLocale;
266}
267
268#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
269#[cfg_attr(feature = "serde", serde(rename_all = "PascalCase"))]
270pub struct LocaleManifest {
271 /// The unique identifier for a given package.
272 ///
273 /// This value is generally in the form of `Publisher.Package`. It is case-sensitive, and this
274 /// value must match the folder structure under the partition directory in GitHub.
275 pub package_identifier: PackageIdentifier,
276
277 /// The version of the package.
278 ///
279 /// It is related to the specific release this manifests targets. In some cases you will see a
280 /// perfectly formed [semantic version] number, and in other cases you might see something
281 /// different. These may be date driven, or they might have other characters with some package
282 /// specific meaning for example.
283 ///
284 /// The Windows Package Manager client uses this version to determine if an upgrade for a
285 /// package is available. In some cases, packages may be released with a marketing driven
286 /// version, and that causes trouble with the [`winget upgrade`] command.
287 ///
288 /// The current best practice is to use the value reported in Add / Remove Programs when this
289 /// version of the package is installed. In some cases, packages do not report a version
290 /// resulting in an upgrade loop or other unwanted behavior.
291 ///
292 /// [semantic version]: https://semver.org/
293 /// [`winget upgrade`]: https://docs.microsoft.com/windows/package-manager/winget/upgrade
294 pub package_version: PackageVersion,
295
296 /// The locale for package metadata.
297 ///
298 /// The format is BCP-47. This value identifies the language for meta-data to be displayed to a
299 /// user when no locale file matching their preferences is available. The Microsoft community
300 /// package repository validation pipelines also use this value to determine appropriate
301 /// validation rules for this file.
302 pub package_locale: LanguageTag,
303
304 /// The name of the publisher for a given package.
305 ///
306 /// This field is intended to allow the full publisher's or ISV's name to be displayed as they
307 /// wish.
308 ///
309 /// With the 1.9 release of the Windows Package Manager, this name affects how packages from a
310 /// source are mapped to Apps installed in Windows 10 and Windows 11 via Add / Remove Programs
311 /// (ARP) and Windows Apps & Features respectively. The best practice is to ensure this matches
312 /// the entry for the package when it has been installed. This should be the value of the
313 /// `Publisher` sub-key for the package in the [Windows registry]. The impact is associated with
314 /// `winget upgrade` and `winget list`.
315 ///
316 /// [Windows registry]: https://learn.microsoft.com/windows/win32/msi/uninstall-registry-key
317 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
318 pub publisher: Option<Publisher>,
319
320 /// The website for the publisher or ISV.
321 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
322 pub publisher_url: Option<PublisherUrl>,
323
324 /// The website for the publisher or ISV.
325 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
326 pub publisher_support_url: Option<PublisherSupportUrl>,
327
328 /// The privacy website or specific web page provided the publisher or ISV.
329 ///
330 /// If there is a privacy website or specific web page for the package it is preferred over a
331 /// generic privacy page for the publisher.
332 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
333 pub privacy_url: Option<Url>,
334
335 /// The author of a package.
336 ///
337 /// In some cases, the author is an individual who develops and or maintains the package. In
338 /// other cases this may be a URL pointing to the contributors web page for a package.
339 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
340 pub author: Option<Author>,
341
342 /// The name of the package.
343 ///
344 /// This field is intended to allow the full package name to be displayed as the publisher or
345 /// ISV wishes.
346 ///
347 /// With the 1.9 release of the Windows Package Manager, this name affects how packages from a
348 /// source are mapped to Apps installed in Windows 10 via Add / Remove Programs (ARP). The best
349 /// practice is to ensure this matches the ARP entry for the package name when it has been
350 /// installed. This should be the value of the `DisplayName` subkey for the package in the
351 /// [Windows registry]. The impact is associated with `winget upgrade` and `winget list`.
352 ///
353 /// [Windows registry]: https://learn.microsoft.com/windows/win32/msi/uninstall-registry-key
354 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
355 pub package_name: Option<PackageName>,
356
357 /// The website for the package.
358 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
359 pub package_url: Option<PackageUrl>,
360
361 /// The license governing the use and or distribution for the product.
362 ///
363 /// This could be an open source license, or a commercial license. Please note that a copyright
364 /// is not considered a license. If there is no available information on a product's license,
365 /// `Proprietary` should be the value in this field.
366 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
367 pub license: Option<License>,
368
369 /// The license website or specific web page provided the publisher or ISV.
370 ///
371 /// If there is a license website or specific web page for the package it is preferred over a
372 /// generic license page for the publisher.
373 ///
374 /// If this is a link to the license file for an open source project, it should be specific to
375 /// the version for the package. Some open source projects change their license over time.
376 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
377 pub license_url: Option<LicenseUrl>,
378
379 /// The copyright for the package.
380 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
381 pub copyright: Option<Copyright>,
382
383 /// The copyright website or specific web page provided the publisher or ISV.
384 ///
385 /// If there is a copyright website or specific web page for the package it is preferred over a
386 /// generic copyright page for the publisher.
387 ///
388 /// If this is a link to the copyright file for an open source project, it should be specific to
389 /// the version for the package. Some open source projects change their copyright over time.
390 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
391 pub copyright_url: Option<CopyrightUrl>,
392
393 /// The description for a package.
394 ///
395 /// It is intended for use in `winget show` to help a user understand what the package is.
396 ///
397 /// This should be something descriptive about what the package does, and it should not simply
398 /// state something like `<package name> installer` or `<package name> setup`.
399 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
400 pub short_description: Option<ShortDescription>,
401
402 /// The full or long description for a package.
403 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
404 pub description: Option<Description>,
405
406 /// Other common term users would search for when looking for packages.
407 ///
408 /// Tags should be pertinent to what a user might search for when looking for a specific
409 /// package.
410 ///
411 /// The best practice is to present these terms in all lower case with hyphens rather than
412 /// spaces.
413 #[cfg_attr(
414 feature = "serde",
415 serde(skip_serializing_if = "BTreeSet::is_empty", default)
416 )]
417 pub tags: BTreeSet<Tag>,
418
419 /// Any agreements a user must accept prior to download and subsequent install or upgrade.
420 ///
421 /// Agreements are only allowed in the community repository when the manifest is maintained by a
422 /// verified developer.
423 #[cfg_attr(
424 feature = "serde",
425 serde(skip_serializing_if = "BTreeSet::is_empty", default)
426 )]
427 pub agreements: BTreeSet<Agreement>,
428
429 /// The release notes for a package.
430 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
431 pub release_notes: Option<ReleaseNotes>,
432
433 /// Release notes webpage for a package.
434 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
435 pub release_notes_url: Option<ReleaseNotesUrl>,
436
437 /// The purchase url for acquiring entitlement for a package.
438 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
439 pub purchase_url: Option<Url>,
440
441 /// The notes displayed to the user upon completion of a package installation.
442 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
443 pub installation_notes: Option<InstallationNotes>,
444
445 /// Any documentation for providing software guides such as manuals and troubleshooting URLs.
446 #[cfg_attr(
447 feature = "serde",
448 serde(skip_serializing_if = "BTreeSet::is_empty", default)
449 )]
450 pub documentations: BTreeSet<Documentation>,
451
452 #[cfg_attr(
453 feature = "serde",
454 serde(skip_serializing_if = "BTreeSet::is_empty", default)
455 )]
456 pub icons: BTreeSet<Icon>,
457
458 /// The manifest type.
459 ///
460 /// Must have the value [`locale`]. The Microsoft community package repository validation
461 /// pipelines also use this value to determine appropriate validation rules when evaluating this
462 /// file.
463 ///
464 /// [`locale`]: ManifestType::Locale
465 #[cfg_attr(feature = "serde", serde(default = "ManifestType::locale"))]
466 pub manifest_type: ManifestType,
467
468 /// The manifest syntax version.
469 ///
470 /// Must have the value `1.10.0`. The Microsoft community package repository validation
471 /// pipelines also use this value to determine appropriate validation rules when evaluating this
472 /// file.
473 #[cfg_attr(feature = "serde", serde(default))]
474 pub manifest_version: ManifestVersion,
475}
476
477impl Manifest for LocaleManifest {
478 const SCHEMA: &'static str = "https://aka.ms/winget-manifest.locale.1.10.0.schema.json";
479
480 const TYPE: ManifestType = ManifestType::Locale;
481}