Interface SubscriptionApi
-
- All Superinterfaces:
KillbillApi
public interface SubscriptionApi extends KillbillApi
API to manage the retrieval ofSubscriptioninformation.
-
-
Field Summary
Fields Modifier and Type Field Description static intALL_EVENTSstatic intFUTURE_EVENTSstatic intFUTURE_OR_PRESENT_EVENTSstatic intPAST_EVENTSstatic intPAST_OR_PRESENT_EVENTSstatic intPRESENT_EVENTS
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddBlockingState(BlockingState blockingState, org.joda.time.DateTime effectiveDate, Iterable<PluginProperty> properties, CallContext context)Add aBlockingStatevoidaddBlockingState(BlockingState blockingState, org.joda.time.LocalDate effectiveDate, Iterable<PluginProperty> properties, CallContext context)Add aBlockingStateSubscriptionBundlegetActiveSubscriptionBundleForExternalKey(String externalKey, TenantContext context)Retrieves all theSubscriptionBundlefor the given external key.List<AuditLogWithHistory>getBlockingStateAuditLogsWithHistoryForId(UUID blockingId, AuditLevel auditLevel, TenantContext context)Get all the audit entries with history for a given blocking state.Iterable<BlockingState>getBlockingStates(UUID accountId, List<BlockingStateType> typeFilter, List<String> svcsFilter, OrderingType orderingType, int timeFilter, TenantContext context)List<AuditLogWithHistory>getSubscriptionAuditLogsWithHistoryForId(UUID entitlementId, AuditLevel auditLevel, TenantContext context)Get all the audit entries with history for a given subscription.SubscriptionBundlegetSubscriptionBundle(UUID bundleId, TenantContext context)Retrieves all theSubscriptionattached to the base entitlement.List<AuditLogWithHistory>getSubscriptionBundleAuditLogsWithHistoryForId(UUID bundleId, AuditLevel auditLevel, TenantContext context)Get all the audit entries with history for a given bundle.Pagination<SubscriptionBundle>getSubscriptionBundles(Long offset, Long limit, TenantContext context)Pagination<SubscriptionBundle>getSubscriptionBundlesForAccountId(UUID accountId, Long offset, Long limit, TenantContext context)List<SubscriptionBundle>getSubscriptionBundlesForAccountId(UUID accountId, TenantContext context)Retrieves all theSubscriptionBundlefor a given account.List<SubscriptionBundle>getSubscriptionBundlesForAccountIdAndExternalKey(UUID accountId, String externalKey, TenantContext context)Retrieves all theSubscriptionBundlefor a given account and matching an external key.List<SubscriptionBundle>getSubscriptionBundlesForExternalKey(String externalKey, TenantContext context)Returns an ordered list of allSubscriptionBundlefor a given external key.List<AuditLogWithHistory>getSubscriptionEventAuditLogsWithHistoryForId(UUID EventId, AuditLevel auditLevel, TenantContext context)Get all the audit entries with history for a given subscription event.SubscriptiongetSubscriptionForEntitlementId(UUID entitlementId, boolean includeDeletedEvents, TenantContext context)Retrieves aSubscriptionfor the entitlement idSubscriptiongetSubscriptionForExternalKey(String externalKey, boolean includeDeletedEvents, TenantContext context)Retrieves aSubscriptionfor a given external keyPagination<SubscriptionBundle>searchSubscriptionBundles(String searchKey, Long offset, Long limit, TenantContext context)Find allSubscriptionBundlehaving their id, account id or external key matching the search keyvoidupdateExternalKey(UUID bundleId, String newExternalKey, CallContext context)Update the externalKey for a given bundle
-
-
-
Field Detail
-
PAST_EVENTS
static final int PAST_EVENTS
- See Also:
- Constant Field Values
-
PRESENT_EVENTS
static final int PRESENT_EVENTS
- See Also:
- Constant Field Values
-
FUTURE_EVENTS
static final int FUTURE_EVENTS
- See Also:
- Constant Field Values
-
PAST_OR_PRESENT_EVENTS
static final int PAST_OR_PRESENT_EVENTS
- See Also:
- Constant Field Values
-
FUTURE_OR_PRESENT_EVENTS
static final int FUTURE_OR_PRESENT_EVENTS
- See Also:
- Constant Field Values
-
ALL_EVENTS
static final int ALL_EVENTS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getSubscriptionForEntitlementId
Subscription getSubscriptionForEntitlementId(UUID entitlementId, boolean includeDeletedEvents, TenantContext context) throws SubscriptionApiException
Retrieves aSubscriptionfor the entitlement id- Parameters:
entitlementId- the id of the entitlement associated with the subscriptionincludeDeletedEvents- flag that specifies whether deleted events should be returnedcontext- the context- Returns:
- the subscription
- Throws:
SubscriptionApiException- if it odes not exist
-
getSubscriptionForExternalKey
Subscription getSubscriptionForExternalKey(String externalKey, boolean includeDeletedEvents, TenantContext context) throws SubscriptionApiException
Retrieves aSubscriptionfor a given external key- Parameters:
externalKey- the external key for the subscriptionincludeDeletedEvents- flag that specifies whether deleted events should be returnedcontext-- Returns:
- Throws:
SubscriptionApiException
-
getSubscriptionBundle
SubscriptionBundle getSubscriptionBundle(UUID bundleId, TenantContext context) throws SubscriptionApiException
Retrieves all theSubscriptionattached to the base entitlement.- Parameters:
bundleId- the id of the bundlecontext- the context- Returns:
- a list of subscriptions
- Throws:
SubscriptionApiException- if the baseEntitlementId does not exist.
-
updateExternalKey
void updateExternalKey(UUID bundleId, String newExternalKey, CallContext context) throws EntitlementApiException
Update the externalKey for a given bundle- Parameters:
bundleId- ; bundle idnewExternalKey- : the new value for the externalKeycontext- : the call context- Throws:
EntitlementApiException
-
getSubscriptionBundlesForAccountIdAndExternalKey
List<SubscriptionBundle> getSubscriptionBundlesForAccountIdAndExternalKey(UUID accountId, String externalKey, TenantContext context) throws SubscriptionApiException
Retrieves all theSubscriptionBundlefor a given account and matching an external key.- Parameters:
accountId- the account idexternalKey- the external keycontext- the context- Returns:
- a
SubscriptionBundle - Throws:
SubscriptionApiException- if there is n o such object matching the account and external key
-
getActiveSubscriptionBundleForExternalKey
SubscriptionBundle getActiveSubscriptionBundleForExternalKey(String externalKey, TenantContext context) throws SubscriptionApiException
Retrieves all theSubscriptionBundlefor the given external key. It is possible to have multipleSubscriptionBundlefor a given external key in the system but only one will be active -- i.e. will containSubscriptionin the active state.- Parameters:
externalKey- the external keycontext- the context- Returns:
- a
SubscriptionBundle - Throws:
SubscriptionApiException- if there is no such object
-
getSubscriptionBundlesForExternalKey
List<SubscriptionBundle> getSubscriptionBundlesForExternalKey(String externalKey, TenantContext context) throws SubscriptionApiException
Returns an ordered list of allSubscriptionBundlefor a given external key.- Returns:
- Throws:
SubscriptionApiException
-
getSubscriptionBundlesForAccountId
List<SubscriptionBundle> getSubscriptionBundlesForAccountId(UUID accountId, TenantContext context) throws SubscriptionApiException
Retrieves all theSubscriptionBundlefor a given account.- Parameters:
accountId- the account idcontext- the context- Returns:
- list of
SubscriptionBundle - Throws:
SubscriptionApiException- if the account does not exist
-
getSubscriptionBundlesForAccountId
Pagination<SubscriptionBundle> getSubscriptionBundlesForAccountId(UUID accountId, Long offset, Long limit, TenantContext context) throws SubscriptionApiException
- Parameters:
accountId- the account idoffset- the offset of the first resultlimit- the maximum number of results to retrievecontext- the context- Returns:
- the list of
SubscriptionBundlefor that account - Throws:
SubscriptionApiException- if the account does not exist
-
getSubscriptionBundles
Pagination<SubscriptionBundle> getSubscriptionBundles(Long offset, Long limit, TenantContext context)
- Parameters:
context- the user contextoffset- the offset of the first resultlimit- the maximum number of results to retrieve- Returns:
- the list of
SubscriptionBundlefor that tenant
-
searchSubscriptionBundles
Pagination<SubscriptionBundle> searchSubscriptionBundles(String searchKey, Long offset, Long limit, TenantContext context)
Find allSubscriptionBundlehaving their id, account id or external key matching the search key- Parameters:
searchKey- the search keyoffset- the offset of the first resultlimit- the maximum number of results to retrievecontext- the user context- Returns:
- the list of
SubscriptionBundlematching this search key for that tenant
-
addBlockingState
void addBlockingState(BlockingState blockingState, org.joda.time.LocalDate effectiveDate, Iterable<PluginProperty> properties, CallContext context) throws EntitlementApiException
Add aBlockingStateThe date is interpreted by the system to be in the timezone specified at theAccount- Parameters:
blockingState- the blockingState to be addedeffectiveDate- the date in the account time zone at which the operation should be effective, if null this is interpreted to be immediateproperties- plugin specific propertiescontext- the context- Throws:
EntitlementApiException- if the entitlement was not in ACTIVE state
-
addBlockingState
void addBlockingState(BlockingState blockingState, org.joda.time.DateTime effectiveDate, Iterable<PluginProperty> properties, CallContext context) throws EntitlementApiException
Add aBlockingStateThe date is interpreted by the system to be in the timezone specified at theAccount- Parameters:
blockingState- the blockingState to be addedeffectiveDate- the datetime at which the operation should be effective, if null this is interpreted to be immediateproperties- plugin specific propertiescontext- the context- Throws:
EntitlementApiException- if the entitlement was not in ACTIVE state
-
getBlockingStates
Iterable<BlockingState> getBlockingStates(UUID accountId, List<BlockingStateType> typeFilter, List<String> svcsFilter, OrderingType orderingType, int timeFilter, TenantContext context) throws EntitlementApiException
- Parameters:
accountId- the account idtypeFilter- the list ofBlockingStateTypefilters. All types are returned if null or empty.svcsFilter- the list of service filters. All services are returned if null or empty.orderingType- the ordering direction, that isASCENDINGorDESCENDINGtimeFilter- the filtering types constructed as a bitwise operationcontext- the user context- Returns:
- the ordered list of
BlockingState - Throws:
EntitlementApiException- if the account is invalid.
-
getSubscriptionBundleAuditLogsWithHistoryForId
List<AuditLogWithHistory> getSubscriptionBundleAuditLogsWithHistoryForId(UUID bundleId, AuditLevel auditLevel, TenantContext context)
Get all the audit entries with history for a given bundle.- Parameters:
bundleId- the bundleId idauditLevel- audit level (verbosity)context- the tenant context- Returns:
- all audit entries with history for a bundle
-
getSubscriptionAuditLogsWithHistoryForId
List<AuditLogWithHistory> getSubscriptionAuditLogsWithHistoryForId(UUID entitlementId, AuditLevel auditLevel, TenantContext context)
Get all the audit entries with history for a given subscription.- Parameters:
entitlementId- the entitlementId idauditLevel- audit level (verbosity)context- the tenant context- Returns:
- all audit entries with history for a subscription
-
getSubscriptionEventAuditLogsWithHistoryForId
List<AuditLogWithHistory> getSubscriptionEventAuditLogsWithHistoryForId(UUID EventId, AuditLevel auditLevel, TenantContext context)
Get all the audit entries with history for a given subscription event.- Parameters:
EventId- the subscription event idauditLevel- audit level (verbosity)context- the tenant context- Returns:
- all audit entries with history for a subscription event
-
getBlockingStateAuditLogsWithHistoryForId
List<AuditLogWithHistory> getBlockingStateAuditLogsWithHistoryForId(UUID blockingId, AuditLevel auditLevel, TenantContext context)
Get all the audit entries with history for a given blocking state.- Parameters:
blockingId- the blocking idauditLevel- audit level (verbosity)context- the tenant context- Returns:
- all audit entries with history for a blocking state
-
-