1 package com.atlassian.marketplace.client.api;
2
3 import com.atlassian.fugue.Option;
4 import com.atlassian.marketplace.client.MarketplaceClient;
5 import com.atlassian.marketplace.client.MpacException;
6 import com.atlassian.marketplace.client.model.LicenseType;
7
8 /**
9 * Starting point for all resources that return software license type information. Use
10 * {@link MarketplaceClient#licenseTypes()} to access this API.
11 * @since 2.0.0
12 */
13 public interface LicenseTypes
14 {
15 /**
16 * Returns all of the available license types.
17 * @throws MpacException if the server was unavailable or returned an error
18 */
19 Iterable<LicenseType> getAllLicenseTypes() throws MpacException;
20
21 /**
22 * Searches for a license type by its "key" property - for instance, "gpl" or "commercial".
23 * The resource URIs for license types may change in the future, but their keys will not change.
24 * @param licenseKey the key of the desired license type
25 * @return the license type object, or {@link Option#none()} if no such license type exists
26 * @throws MpacException if the server was unavailable or returned an error
27 */
28 Option<LicenseType> getByKey(String licenseKey) throws MpacException;
29 }