Skip to content

v2.3.0 #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 3 additions & 23 deletions example/src/TestApi.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import com.Upwork.api.OAuthClient;
import com.Upwork.api.Routers.Graphql;
import com.Upwork.api.Routers.Organization.Users;
import com.google.api.client.auth.oauth2.TokenResponse;
import org.json.JSONException;
import org.json.JSONObject;
Expand Down Expand Up @@ -54,26 +53,7 @@ public static void main(String[] args) throws Exception {
// client.getTokenResponseByRefreshToken(tokenResponse.getRefreshToken(), null);
// System.out.println(refreshedTokenResponse.getAccessToken());

JSONObject json1 = null;
try {
// Get info of authenticated user
Users users = new Users(client);
json1 = users.getMyInfo();

// get my uid
String myId = null;
try {
JSONObject user = json1.getJSONObject("user");
myId = user.getString("id");
System.out.println(myId);
} catch (JSONException e) {
e.printStackTrace();
}
} catch (JSONException e) {
e.printStackTrace();
}

JSONObject json2 = null;
JSONObject json = null;
HashMap<String, String> params = new HashMap<String, String>();
params.put("query", "{\n" +
" user {\n" +
Expand All @@ -89,12 +69,12 @@ public static void main(String[] args) throws Exception {
// client.setOrgUidHeader("1234567890"); // Organization UID (optional)
// Get info of authenticated user using GraphQL query
Graphql graphql = new Graphql(client);
json2 = graphql.Execute(params);
json = graphql.Execute(params);

// get my uid
String myUid = null;
try {
JSONObject data = json2.getJSONObject("data");
JSONObject data = json.getJSONObject("data");
myUid = data.getJSONObject("user").getString("id");
System.out.println(myUid);
} catch (JSONException e) {
Expand Down
Binary file modified lib/java-upwork.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.Upwork</groupId>
<artifactId>api</artifactId>
<version>2.2.1</version>
<version>2.3.0</version>
<packaging>jar</packaging>
<name>java-upwork-oauth2</name>
<description>JAVA bindings for Upwork API (OAuth2)</description>
Expand Down
6 changes: 3 additions & 3 deletions src/com/Upwork/api/Routers/Activities/Engagement.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public Engagement(OAuthClient client) {
* @return {@link JSONObject}
*/
public JSONObject getSpecific(String engagement_ref) throws JSONException {
return oClient.get("/tasks/v2/tasks/contracts/" + engagement_ref);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

/**
Expand All @@ -65,7 +65,7 @@ public JSONObject getSpecific(String engagement_ref) throws JSONException {
* @return {@link JSONObject}
*/
public JSONObject assign(String company, String team, String engagement, HashMap<String, String> params) throws JSONException {
return oClient.put("/otask/v1/tasks/companies/" + company + "/teams/" + team + "/engagements/" + engagement + "/tasks", params);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

/**
Expand All @@ -77,7 +77,7 @@ public JSONObject assign(String company, String team, String engagement, HashMap
* @return {@link JSONObject}
*/
public JSONObject assignToEngagement(String engagement_ref, HashMap<String, String> params) throws JSONException {
return oClient.put("/tasks/v2/tasks/contracts/" + engagement_ref, params);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

}
12 changes: 6 additions & 6 deletions src/com/Upwork/api/Routers/Activities/Team.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private JSONObject _getByType(String company, String team, String code) throws J
url = "/" + code;
}

return oClient.get("/otask/v1/tasks/companies/" + company + "/teams/" + team + "/tasks" + url);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

/**
Expand Down Expand Up @@ -95,7 +95,7 @@ public JSONObject getSpecificList(String company, String team, String code) thro
* @return {@link JSONObject}
*/
public JSONObject addActivity(String company, String team, HashMap<String, String> params) throws JSONException {
return oClient.post("/otask/v1/tasks/companies/" + company + "/teams/" + team + "/tasks", params);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

/**
Expand All @@ -109,7 +109,7 @@ public JSONObject addActivity(String company, String team, HashMap<String, Strin
* @return {@link JSONObject}
*/
public JSONObject updateActivity(String company, String team, String code, HashMap<String, String> params) throws JSONException {
return oClient.put("/otask/v1/tasks/companies/" + company + "/teams/" + team + "/tasks/" + code, params);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

/**
Expand All @@ -122,7 +122,7 @@ public JSONObject updateActivity(String company, String team, String code, HashM
* @return {@link JSONObject}
*/
public JSONObject archiveActivity(String company, String team, String code) throws JSONException {
return oClient.put("/otask/v1/tasks/companies/" + company + "/teams/" + team + "/archive/" + code);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

/**
Expand All @@ -135,7 +135,7 @@ public JSONObject archiveActivity(String company, String team, String code) thro
* @return {@link JSONObject}
*/
public JSONObject unarchiveActivity(String company, String team, String code) throws JSONException {
return oClient.put("/otask/v1/tasks/companies/" + company + "/teams/" + team + "/unarchive/" + code);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

/**
Expand All @@ -147,7 +147,7 @@ public JSONObject unarchiveActivity(String company, String team, String code) th
* @return {@link JSONObject}
*/
public JSONObject updateBatch(String company, HashMap<String, String> params) throws JSONException {
return oClient.put("/otask/v1/tasks/companies/" + company + "/tasks/batch", params);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

}
2 changes: 1 addition & 1 deletion src/com/Upwork/api/Routers/Auth.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public Auth(OAuthClient client) {
* @return {@link JSONObject}
* */
public JSONObject getUserInfo() throws JSONException {
return oClient.get("/auth/v1/info");
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

}
4 changes: 2 additions & 2 deletions src/com/Upwork/api/Routers/Freelancers/Profile.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public Profile(OAuthClient client) {
* @return {@link JSONObject}
*/
public JSONObject getSpecific(String key) throws JSONException {
return oClient.get("/profiles/v1/providers/" + key);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

/**
Expand All @@ -60,6 +60,6 @@ public JSONObject getSpecific(String key) throws JSONException {
* @return {@link JSONObject}
*/
public JSONObject getSpecificBrief(String key) throws JSONException {
return oClient.get("/profiles/v1/providers/" + key + "/brief");
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}
}
2 changes: 1 addition & 1 deletion src/com/Upwork/api/Routers/Freelancers/Search.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public Search(OAuthClient client) {
* @return {@link JSONObject}
*/
public JSONObject find(HashMap<String, String> params) throws JSONException {
return oClient.get("/profiles/v2/search/providers", params);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

}
4 changes: 2 additions & 2 deletions src/com/Upwork/api/Routers/Hr/Clients/Applications.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public Applications(OAuthClient client) {
* @return object
*/
public JSONObject getList(HashMap<String, String> params) throws JSONException {
return oClient.get("/hr/v4/clients/applications", params);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

/**
Expand All @@ -61,7 +61,7 @@ public JSONObject getList(HashMap<String, String> params) throws JSONException {
* @return object
*/
public JSONObject getSpecific(String reference, HashMap<String, String> params) throws JSONException {
return oClient.get("/hr/v4/clients/applications/" + reference, params);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

}
6 changes: 3 additions & 3 deletions src/com/Upwork/api/Routers/Hr/Clients/Offers.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public Offers(OAuthClient client) {
* @return {@link JSONObject}
*/
public JSONObject getList(HashMap<String, String> params) throws JSONException {
return oClient.get("/offers/v1/clients/offers", params);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

/**
Expand All @@ -63,7 +63,7 @@ public JSONObject getList(HashMap<String, String> params) throws JSONException {
* @return {@link JSONObject}
*/
public JSONObject getSpecific(String reference, HashMap<String, String> params) throws JSONException {
return oClient.get("/offers/v1/clients/offers/" + reference, params);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

/**
Expand All @@ -74,7 +74,7 @@ public JSONObject getSpecific(String reference, HashMap<String, String> params)
* @return {@link JSONObject}
*/
public JSONObject makeOffer(HashMap<String, String> params) throws JSONException {
return oClient.post("/offers/v1/clients/offers", params);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

}
6 changes: 3 additions & 3 deletions src/com/Upwork/api/Routers/Hr/Contracts.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public Contracts(OAuthClient client) {
* @return {@link JSONObject}
*/
public JSONObject suspendContract(String reference, HashMap<String, String> params) throws JSONException {
return oClient.put("/hr/v2/contracts/" + reference + "/suspend", params);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

/**
Expand All @@ -64,7 +64,7 @@ public JSONObject suspendContract(String reference, HashMap<String, String> para
* @return {@link JSONObject}
*/
public JSONObject restartContract(String reference, HashMap<String, String> params) throws JSONException {
return oClient.put("/hr/v2/contracts/" + reference + "/restart", params);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

/**
Expand All @@ -76,7 +76,7 @@ public JSONObject restartContract(String reference, HashMap<String, String> para
* @return {@link JSONObject}
*/
public JSONObject endContract(String reference, HashMap<String, String> params) throws JSONException {
return oClient.delete("/hr/v2/contracts/" + reference, params);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

}
4 changes: 2 additions & 2 deletions src/com/Upwork/api/Routers/Hr/Engagements.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public Engagements(OAuthClient client) {
* @return {@link JSONObject}
*/
public JSONObject getList(HashMap<String, String> params) throws JSONException {
return oClient.get("/hr/v2/engagements", params);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

/**
Expand All @@ -62,7 +62,7 @@ public JSONObject getList(HashMap<String, String> params) throws JSONException {
* @return {@link JSONObject}
*/
public JSONObject getSpecific(String reference) throws JSONException {
return oClient.get("/hr/v2/engagements/" + reference);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

}
4 changes: 2 additions & 2 deletions src/com/Upwork/api/Routers/Hr/Freelancers/Applications.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public Applications(OAuthClient client) {
* @return {@link JSONObject}
*/
public JSONObject getList(HashMap<String, String> params) throws JSONException {
return oClient.get("/hr/v4/contractors/applications", params);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

/**
Expand All @@ -62,7 +62,7 @@ public JSONObject getList(HashMap<String, String> params) throws JSONException {
* @return {@link JSONObject}
*/
public JSONObject getSpecific(String reference) throws JSONException {
return oClient.get("/hr/v4/contractors/applications/" + reference);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

}
6 changes: 3 additions & 3 deletions src/com/Upwork/api/Routers/Hr/Freelancers/Offers.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public Offers(OAuthClient client) {
* @return {@link JSONObject}
*/
public JSONObject getList(HashMap<String, String> params) throws JSONException {
return oClient.get("/offers/v1/contractors/offers", params);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

/**
Expand All @@ -62,7 +62,7 @@ public JSONObject getList(HashMap<String, String> params) throws JSONException {
* @return {@link JSONObject}
*/
public JSONObject getSpecific(String reference) throws JSONException {
return oClient.get("/offers/v1/contractors/offers/" + reference);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

/**
Expand All @@ -74,7 +74,7 @@ public JSONObject getSpecific(String reference) throws JSONException {
* @return {@link JSONObject}
*/
public JSONObject actions(String reference, HashMap<String, String> params) throws JSONException {
return oClient.post("/offers/v1/contractors/offers/" + reference, params);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

}
2 changes: 1 addition & 1 deletion src/com/Upwork/api/Routers/Hr/Interviews.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public Interviews(OAuthClient client) {
* @return {@link JSONObject}
*/
public JSONObject invite(String jobKey, HashMap<String, String> params) throws JSONException {
return oClient.post("/hr/v1/jobs/" + jobKey + "/candidates", params);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

}
10 changes: 5 additions & 5 deletions src/com/Upwork/api/Routers/Hr/Jobs.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public Jobs(OAuthClient client) {
* @return {@link JSONObject}
*/
public JSONObject getList(HashMap<String, String> params) throws JSONException {
return oClient.get("/hr/v2/jobs", params);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

/**
Expand All @@ -62,7 +62,7 @@ public JSONObject getList(HashMap<String, String> params) throws JSONException {
* @return {@link JSONObject}
*/
public JSONObject getSpecific(String key) throws JSONException {
return oClient.get("/hr/v2/jobs/" + key);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

/**
Expand All @@ -73,7 +73,7 @@ public JSONObject getSpecific(String key) throws JSONException {
* @return {@link JSONObject}
*/
public JSONObject postJob(HashMap<String, String> params) throws JSONException {
return oClient.post("/hr/v2/jobs", params);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

/**
Expand All @@ -85,7 +85,7 @@ public JSONObject postJob(HashMap<String, String> params) throws JSONException {
* @return {@link JSONObject}
*/
public JSONObject editJob(String key, HashMap<String, String> params) throws JSONException {
return oClient.put("/hr/v2/jobs/" + key, params);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

/**
Expand All @@ -97,7 +97,7 @@ public JSONObject editJob(String key, HashMap<String, String> params) throws JSO
* @return {@link JSONObject}
*/
public JSONObject deleteJob(String key, HashMap<String, String> params) throws JSONException {
return oClient.delete("/hr/v2/jobs/" + key, params);
throw new UnsupportedOperationException("The legacy API was deprecated. Please, use GraphQL call - see example in this library.");
}

}
Loading