com.codota.service.client.requests.SaveToBoxRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of codota-sdk-java Show documentation
Show all versions of codota-sdk-java Show documentation
Java SDK for working with the Codota API
package com.codota.service.client.requests;
import com.codota.service.client.requests.base.PostRequest;
import com.codota.service.connector.ServiceConnector;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
/**
* Created by yahave on 21/12/2016.
*/
public class SaveToBoxRequest extends PostRequest {
private static final String BOX_SAVE_SNIPPET_ROUTE = "/user-snippet";
public SaveToBoxRequest(ServiceConnector connector, String token) {
super(connector, connector.getBase() + BOX_SAVE_SNIPPET_ROUTE, token);
}
@Override
public String parse(String response) {
JsonParser parser = new JsonParser();
JsonElement root = parser.parse(response);
JsonObject obj = root.getAsJsonObject();
JsonElement idElem = obj.get("id");
return idElem.getAsString();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy