1 package com.atlassian.marketplace.client.model;
2
3 import java.net.URI;
4
5 import com.atlassian.fugue.Option;
6
7 import static com.atlassian.fugue.Option.none;
8 import static com.atlassian.fugue.Option.some;
9
10 /**
11 * Information about an Atlassian software package, such as JIRA Service Desk.
12 * @see com.atlassian.marketplace.client.api.Products
13 * @since 2.0.0
14 */
15 public final class Product
16 {
17 Links _links;
18 Embedded _embedded;
19 String key;
20 String name;
21 String summary;
22
23 public Links getLinks()
24 {
25 return _links;
26 }
27
28 /**
29 * The short unique identifier for the product.
30 */
31 public String getKey()
32 {
33 return key;
34 }
35
36 /**
37 * The product name.
38 */
39 public String getName()
40 {
41 return name;
42 }
43
44 /**
45 * A human-readable short description of the product.
46 */
47 public String getSummary()
48 {
49 return summary;
50 }
51
52 /**
53 * The URI of the web page describing available downloads for this product, if any.
54 */
55 public Option<URI> getDownloadsPageUri()
56 {
57 return _links.getUri("downloads");
58 }
59
60 /**
61 * The product logo.
62 */
63 public Option<ImageInfo> getLogo()
64 {
65 return _embedded.logo;
66 }
67
68 /**
69 * The alternate logo that includes the product name as part of the image.
70 */
71 public Option<ImageInfo> getTitleLogo()
72 {
73 return _embedded.titleLogo;
74 }
75
76 /**
77 * The product's current version (or the version that matched the query), if available.
78 * Note that some product properties, such as the URI of the installable binary, are really
79 * properties of the version and will only be available if you set the "withVersion" property
80 * on the query.
81 */
82 public Option<ProductVersion> getVersion()
83 {
84 return _embedded.version;
85 }
86
87 /**
88 * The version string of the product's current version (or the version that matched the query),
89 * if available. Same as calling {@link #getVersion()} and then calling {@link ProductVersion#getName()}
90 * on the result.
91 */
92 public Option<String> getVersionName()
93 {
94 for (ProductVersion v: getVersion())
95 {
96 return some(v.getName());
97 }
98 return none();
99 }
100
101 static final class Embedded
102 {
103 Option<ImageInfo> logo;
104 Option<ImageInfo> titleLogo;
105 Option<ProductVersion> version;
106 }
107 }