public class MixpanelAPI extends Object
Modifier and Type | Field and Description |
---|---|
protected String |
mEventsEndpoint |
protected String |
mGroupsEndpoint |
protected String |
mPeopleEndpoint |
Constructor and Description |
---|
MixpanelAPI()
Constructs a MixpanelAPI object associated with the production, Mixpanel services.
|
MixpanelAPI(String eventsEndpoint,
String peopleEndpoint)
Create a MixpaneAPI associated with custom URLS for events and people updates.
|
MixpanelAPI(String eventsEndpoint,
String peopleEndpoint,
String groupsEndpoint)
Create a MixpaneAPI associated with custom URLS for the Mixpanel service.
|
Modifier and Type | Method and Description |
---|---|
void |
deliver(ClientDelivery toSend)
Sends a ClientDelivery full of messages to Mixpanel's servers.
|
void |
deliver(ClientDelivery toSend,
boolean useIpAddress)
Attempts to send a given delivery to the Mixpanel servers.
|
protected String |
encodeDataString(String dataString)
apply Base64 encoding followed by URL encoding
|
void |
sendMessage(org.json.JSONObject message)
Sends a single message to Mixpanel servers.
|
protected final String mEventsEndpoint
protected final String mPeopleEndpoint
protected final String mGroupsEndpoint
public MixpanelAPI()
public MixpanelAPI(String eventsEndpoint, String peopleEndpoint)
eventsEndpoint
- a URL that will accept Mixpanel events messagespeopleEndpoint
- a URL that will accept Mixpanel people messagesMixpanelAPI()
public MixpanelAPI(String eventsEndpoint, String peopleEndpoint, String groupsEndpoint)
eventsEndpoint
- a URL that will accept Mixpanel events messagespeopleEndpoint
- a URL that will accept Mixpanel people messagesgroupsEndpoint
- a URL that will accept Mixpanel groups messagesMixpanelAPI()
public void sendMessage(org.json.JSONObject message) throws MixpanelMessageException, IOException
deliver(ClientDelivery)
message
- A JSONObject formatted by #MessageBuilder
MixpanelMessageException
- if the given JSONObject is not (apparently) a Mixpanel message. This is a RuntimeException, callers should take care to submit only correctly formatted messages.IOException
- ifpublic void deliver(ClientDelivery toSend) throws IOException
toSend
- IOException
ClientDelivery
public void deliver(ClientDelivery toSend, boolean useIpAddress) throws IOException
toSend
- a ClientDelivery containing a number of Mixpanel messagesIOException
ClientDelivery
protected String encodeDataString(String dataString)
dataString
- JSON formatted stringNullPointerException
- If dataString
is null
Copyright © 2019. All rights reserved.