1 package com.atlassian.marketplace.client.model;
2
3 import java.net.URI;
4 import java.util.Map;
5
6 import com.atlassian.fugue.Option;
7 import com.atlassian.marketplace.client.api.VendorExternalLinkType;
8
9 import static com.atlassian.fugue.Option.none;
10 import static com.atlassian.fugue.Option.option;
11
12 /**
13 * Details about a vendor. Includes all the properties of {@link VendorBase}, but adds
14 * further details; to get these details, you will need to query the vendor individually
15 * with {@link com.atlassian.marketplace.client.api.Vendors#getById}.
16 * @see VendorSummary
17 * @since 2.0.0
18 */
19 public final class Vendor extends VendorBase
20 {
21 @ReadOnly Embedded _embedded;
22 Option<String> description;
23 Option<Address> address;
24 String email;
25 Option<String> phone;
26 Map<String, URI> vendorLinks;
27 Option<String> otherContactDetails;
28 SupportDetails supportDetails = new SupportDetails(); // required in schema, but not supported in client API
29
30 /**
31 * Short introductory text that appears on the vendor's Marketplace page.
32 * @see ModelBuilders.VendorBuilder#description(Option)
33 */
34 public Option<String> getDescription()
35 {
36 return description;
37 }
38
39 /**
40 * The vendor's public contact email.
41 * @see ModelBuilders.VendorBuilder#email(String)
42 */
43 public String getEmail()
44 {
45 return email;
46 }
47
48 /**
49 * The vendor's public contact address.
50 * @see ModelBuilders.VendorBuilder#address(Option)
51 */
52 public Option<Address> getAddress()
53 {
54 return address;
55 }
56
57 /**
58 * The vendor's public phone number.
59 * @see ModelBuilders.VendorBuilder#phone(Option)
60 */
61 public Option<String> getPhone()
62 {
63 return phone;
64 }
65
66 /**
67 * Any other public contact information the vendor wishes to provide.
68 * @see ModelBuilders.VendorBuilder#otherContactDetails(Option)
69 */
70 public Option<String> getOtherContactDetails()
71 {
72 return otherContactDetails;
73 }
74
75 /**
76 * Returns one of the optional vendor-specified external links for the vendor.
77 * @param type specifies which type of link to get
78 * @return the link URI, or {@link Option#none()} if there is no such link
79 */
80 public Option<URI> getExternalLinkUri(VendorExternalLinkType type)
81 {
82 return option(vendorLinks.get(type.getKey()));
83 }
84
85 @Override
86 public Option<ImageInfo> getLogo()
87 {
88 return _embedded.logo;
89 }
90
91 static final class Embedded
92 {
93 Option<ImageInfo> logo;
94 }
95
96 static final class SupportDetails
97 {
98 Option<String> emergencyContact = none();
99 }
100 }