public class AudienceSetClient extends Object implements Closeable
To create a client, you must specify:
Modifier and Type | Class and Description |
---|---|
static class |
AudienceSetClient.ClientParams
Parameter object for configuring an
AudienceSetClient 's behavior. |
static interface |
AudienceSetClient.InnerClient |
Modifier and Type | Method and Description |
---|---|
void |
awaitOK()
Blocks until the client is in SyncState.OK.
|
void |
close() |
Set<String> |
getActiveBuilds()
Returns a set representing the ids of the active designs.
|
String |
getDesignId(String buildId)
Returns the id of the design associated with the build.
|
String |
getDesignName(String buildId)
Returns the name of the design associated with the build.
|
long |
getMaxMemory()
Returns the specified maximum memory usage, in bytes
|
String |
getPartnerId()
Returns the associated partner id.
|
String |
getPath()
Returns the associated file system path.
|
long |
getRequiredMemory()
Returns the bytes required by the current configuration.
|
SyncState |
getSyncState()
Returns the current sync state for the client.
|
List<String> |
getTargetingCodes(String buildId)
Returns the targeting codes in the specified design.
|
boolean |
isMerged(String buildId)
Return whether the index for given buildId is merged or not.
|
static AudienceSetClient |
newClient(AudienceSetClient.ClientParams clientParams)
Creates a new Audience Set client.
|
static AudienceSetClient |
newClient(String organizationId,
String apiKey,
String secretKey,
String path,
long maxMemory)
Deprecated.
as of 3.0.0 - use
newClient(ClientParams) instead, as additional overloads for
newClient(...) will not be added to correspond to new fields in AudienceSetClient.ClientParams . |
static AudienceSetClient |
newClient(String organizationId,
String apiKey,
String secretKey,
String path,
long maxMemory,
List<String> deploymentTags)
Deprecated.
as of 5.0.0 - use
newClient(ClientParams) instead, as additional overloads for
newClient(...) will not be added to correspond to new fields in AudienceSetClient.ClientParams . |
List<Match> |
test(String canonicalId)
Deprecated.
replaced by
test(String, String) |
List<Match> |
test(String dataSource,
String canonicalId)
Tests the given canonicalId against Audience sets belonging to the given dataSource.
|
public static AudienceSetClient newClient(String organizationId, String apiKey, String secretKey, String path, long maxMemory) throws IllegalArgumentException
newClient(ClientParams)
instead, as additional overloads for
newClient(...)
will not be added to correspond to new fields in AudienceSetClient.ClientParams
.AudienceSetClient
without setting any deployment tags. See newClient(String, String,
String, String, long, List)
for documentation on all the parameters.IllegalArgumentException
public static AudienceSetClient newClient(String organizationId, String apiKey, String secretKey, String path, long maxMemory, List<String> deploymentTags) throws IllegalArgumentException
newClient(ClientParams)
instead, as additional overloads for
newClient(...)
will not be added to correspond to new fields in AudienceSetClient.ClientParams
.organizationId
- the organization-id provided by FactualapiKey
- the API key, available via http://factual.comsecretKey
- the secret key, available via http://factual.compath
- the filesystem path for the directory which will be used for caching data filesmaxMemory
- the maximum memory, in bytes, which will be used by the client. If the required memory
for the latest configuration exceeds this value, getSyncState() will return
SyncState.INSUFFICIENT_MEMORYdeploymentTags
- specifies which indices should be loaded in this client. If more than one deployment tag
is specified, only indices which have ALL the tags will be loaded.IllegalArgumentException
- if another client has been created for the same organizationId on a different
path or with a different maxMemory.public static AudienceSetClient newClient(AudienceSetClient.ClientParams clientParams) throws IllegalArgumentException
IllegalArgumentException
- if another client has been created for the same organizationId on a different
path or with a different maxMemory.public void close()
close
in interface Closeable
close
in interface AutoCloseable
@Deprecated public List<Match> test(String canonicalId) throws IOException
test(String, String)
canonicalId
- the canonical user-idIOException
public List<Match> test(String dataSource, String canonicalId) throws IOException
dataSource
- data source the given canonicalId is fromcanonicalId
- the canonical user-idIOException
public Set<String> getActiveBuilds()
public String getDesignName(String buildId)
public String getDesignId(String buildId)
public List<String> getTargetingCodes(String buildId)
public boolean isMerged(String buildId)
public SyncState getSyncState()
public void awaitOK() throws InterruptedException
This function can be used in cases where you don't wish to use the client until the latest configuration is loaded. If the client is unable to reach Factual's servers, this may block for arbitrarily long times.
InterruptedException
public long getRequiredMemory()
public long getMaxMemory()
public String getPartnerId()
public String getPath()