Uploading file with hashing to tailored audience



Hi Twitter Team,

I have succesfully created the tailored audience using java sdk of ads api but i need one help here.
Now , i need to upload an email file with hashing to the created tailored audience.

Could you please help with the set of code to do so.

I see the below code in TwitterAudienceapiImpl
public TwitterTonUploadResponse uploadTailoredAudience(File file) throws TwitterException {
String baseUrl = TwitterAdsConstants.POST_TON_DATA;
Map<String, String> customHeaders = Maps.newHashMap();
List params = new ArrayList<>();
customHeaders.put(“X-TON-Expires”, getXTonExpireTime());
if (file.length() > SIXTY_FOUR_MB) {
return uploadInChunks(file, baseUrl, customHeaders);
} else {
customHeaders.put(“Content-Type”, “text/plain”);
customHeaders.put(“Content-Length”, String.valueOf(file.length()));
params.add(new HttpParameter(“file”, file));
return twitterAdsClient.executeHttpRequestForTon(baseUrl, params.toArray(new HttpParameter[params.size()]), HttpVerb.POST, customHeaders);
But i need help with how to use this in my implementation.