use of lombok.SneakyThrows in project instagram4j by brunocvcunha.
the class InstagramLoginTwoFactorRequest method getPayload.
@Override
@SneakyThrows
public String getPayload() {
ObjectMapper mapper = new ObjectMapper();
String payloadJson = mapper.writeValueAsString(payload);
return payloadJson;
}
use of lombok.SneakyThrows in project instagram4j by brunocvcunha.
the class InstagramPostCommentRequest method getPayload.
@Override
@SneakyThrows
public String getPayload() {
Map<String, Object> likeMap = new LinkedHashMap<>();
likeMap.put("_uuid", api.getUuid());
likeMap.put("_uid", api.getUserId());
likeMap.put("_csrftoken", api.getOrFetchCsrf());
likeMap.put("comment_text", commentText);
ObjectMapper mapper = new ObjectMapper();
String payloadJson = mapper.writeValueAsString(likeMap);
return payloadJson;
}
use of lombok.SneakyThrows in project instagram4j by brunocvcunha.
the class InstagramRequest method parseJson.
/**
* Parses Json into type
* @param str Entity content
* @param clazz Class
* @return Result
*/
@SneakyThrows
public <U> U parseJson(String str, Class<U> clazz) {
if (log.isInfoEnabled()) {
if (log.isDebugEnabled()) {
log.debug("Reading " + clazz.getSimpleName() + " from " + str);
} else {
String printStr = str;
if (printStr.length() > 128) {
printStr = printStr.substring(0, 128);
}
log.info("Reading " + clazz.getSimpleName() + " from " + printStr);
}
}
ObjectMapper objectMapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false).configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
return objectMapper.readValue(str, clazz);
}
use of lombok.SneakyThrows in project instagram4j by brunocvcunha.
the class InstagramExposeRequest method getPayload.
@Override
@SneakyThrows
public String getPayload() {
Map<String, Object> likeMap = new LinkedHashMap<>();
likeMap.put("_uuid", api.getUuid());
likeMap.put("_uid", api.getUserId());
likeMap.put("id", api.getUserId());
likeMap.put("_csrftoken", api.getOrFetchCsrf());
likeMap.put("experiment", "ig_android_profile_contextual_feed");
ObjectMapper mapper = new ObjectMapper();
String payloadJson = mapper.writeValueAsString(likeMap);
return payloadJson;
}
use of lombok.SneakyThrows in project instagram4j by brunocvcunha.
the class InstagramZeroRatingTokenRequest method getPayload.
@Override
@SneakyThrows
public String getPayload() {
Map<String, Object> likeMap = new LinkedHashMap<>();
likeMap.put("token_hash", "");
ObjectMapper mapper = new ObjectMapper();
String payloadJson = mapper.writeValueAsString(likeMap);
return payloadJson;
}
Aggregations