├── .docgen
├── .github
└── workflows
│ └── build.yml
├── .gitignore
├── .tests
├── CHANGES.md
├── LICENSE
├── NOTICE
├── README.md
├── build.xml
├── doc
└── java-upwork-javadoc.zip
├── example-android
├── .gitignore
├── .idea
│ ├── .name
│ ├── compiler.xml
│ ├── copyright
│ │ └── profiles_settings.xml
│ ├── encodings.xml
│ ├── gradle.xml
│ ├── libraries
│ │ ├── commons_codec_1_3.xml
│ │ ├── httpclient_android_4_3_3.xml
│ │ ├── java_json.xml
│ │ ├── java_upwork.xml
│ │ ├── signpost_commonshttp4_1_2_1_2.xml
│ │ └── signpost_core_1_2_1_2.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── scopes
│ │ └── scope_settings.xml
│ └── vcs.xml
├── Example-UpworkAPI.iml
├── README
├── app
│ ├── .gitignore
│ ├── app.iml
│ ├── build.gradle
│ ├── libs
│ │ └── java-upwork.jar
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── upwork
│ │ │ └── example_upworkapi
│ │ │ └── ApplicationTest.java
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ └── com
│ │ │ └── upwork
│ │ │ └── example_upworkapi
│ │ │ └── MyActivity.java
│ │ └── res
│ │ ├── drawable-hdpi
│ │ └── ic_launcher.png
│ │ ├── drawable-mdpi
│ │ └── ic_launcher.png
│ │ ├── drawable-xhdpi
│ │ └── ic_launcher.png
│ │ ├── drawable-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── layout
│ │ ├── activity_my.xml
│ │ └── fragment_my.xml
│ │ ├── menu
│ │ └── my.xml
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ └── values
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── sample-screen.png
└── settings.gradle
├── example-maven
├── .classpath
├── pom.xml
├── src
│ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── Upwork
│ │ │ └── test_api
│ │ │ └── App.java
│ └── test
│ │ └── java
│ │ └── com
│ │ └── Upwork
│ │ └── test_api
│ │ └── AppTest.java
└── upwork.properties
├── example
├── Makefile
├── README.md
├── src
│ └── TestApi.java
└── upwork.properties
├── lib
├── httpcomponents-client-4.3.3
│ ├── commons-codec-1.6.jar
│ ├── commons-logging-1.1.3.jar
│ ├── httpclient-4.3.3.jar
│ └── httpcore-4.3.2.jar
├── java-json.jar
├── java-upwork.jar
├── junit-4.11
│ ├── hamcrest-core-1.3.jar
│ └── junit-4.11.jar
├── mockito-all-1.9.5.jar
├── powermock-mockito-junit-1.5.5
│ ├── cglib-nodep-2.2.2.jar
│ ├── javassist-3.18.2-GA.jar
│ ├── mockito-all-1.9.5.jar
│ ├── objenesis-2.1.jar
│ └── powermock-mockito-1.5.5-full.jar
└── signpost-1.2.1.2
│ ├── signpost-commonshttp4-1.2.1.2.jar
│ └── signpost-core-1.2.1.2.jar
├── pom.xml
├── src
└── com
│ └── Upwork
│ ├── ClassPreamble.java
│ └── api
│ ├── Config.java
│ ├── OAuthClient.java
│ ├── Routers
│ ├── Activities
│ │ ├── Engagement.java
│ │ └── Team.java
│ ├── Auth.java
│ ├── Freelancers
│ │ ├── Profile.java
│ │ └── Search.java
│ ├── Hr
│ │ ├── Clients
│ │ │ ├── Applications.java
│ │ │ └── Offers.java
│ │ ├── Contracts.java
│ │ ├── Engagements.java
│ │ ├── Freelancers
│ │ │ ├── Applications.java
│ │ │ └── Offers.java
│ │ ├── Interviews.java
│ │ ├── Jobs.java
│ │ ├── Milestones.java
│ │ ├── Roles.java
│ │ └── Submissions.java
│ ├── Jobs
│ │ ├── Profile.java
│ │ └── Search.java
│ ├── Messages.java
│ ├── Metadata.java
│ ├── Organization
│ │ ├── Companies.java
│ │ ├── Teams.java
│ │ └── Users.java
│ ├── Payments.java
│ ├── Reports
│ │ ├── Finance
│ │ │ ├── Accounts.java
│ │ │ ├── Billings.java
│ │ │ └── Earnings.java
│ │ └── Time.java
│ ├── Snapshot.java
│ ├── Workdays.java
│ └── Workdiary.java
│ └── UpworkRestClient.java
├── test
└── com
│ └── Upwork
│ └── api
│ ├── ConfigTest.java
│ ├── OAuthClientTest.java
│ └── Routers
│ ├── Activities
│ ├── EngagementTest.java
│ └── TeamTest.java
│ ├── AuthTest.java
│ ├── Freelancers
│ ├── ProfileTest.java
│ └── SearchTest.java
│ ├── Helper.java
│ ├── Hr
│ ├── Clients
│ │ ├── ApplicationsTest.java
│ │ └── OffersTest.java
│ ├── ContractsTest.java
│ ├── EngagementsTest.java
│ ├── Freelancers
│ │ ├── ApplicationsTest.java
│ │ └── OffersTest.java
│ ├── InterviewsTest.java
│ ├── JobsTest.java
│ ├── MilestonesTest.java
│ ├── RolesTest.java
│ └── SubmissionsTest.java
│ ├── Jobs
│ ├── ProfileTest.java
│ └── SearchTest.java
│ ├── MessagesTest.java
│ ├── MetadataTest.java
│ ├── Organization
│ ├── CompaniesTest.java
│ ├── TeamsTest.java
│ └── UsersTest.java
│ ├── PaymentsTest.java
│ ├── Reports
│ ├── Finance
│ │ ├── AccountsTest.java
│ │ ├── BillingsTest.java
│ │ └── EarningsTest.java
│ └── TimeTest.java
│ ├── SnapshotTest.java
│ ├── WorkdaysTest.java
│ └── WorkdiaryTest.java
└── vendor-lib
├── README
├── httpcomponents-client-4.3.3
├── commons-codec-1.6.jar
├── commons-logging-1.1.3.jar
├── httpclient-4.3.3.jar
└── httpcore-4.3.2.jar
├── java-json.jar
└── signpost-1.2.1.2
├── signpost-commonshttp4-1.2.1.2.jar
└── signpost-core-1.2.1.2.jar
/.docgen:
--------------------------------------------------------------------------------
1 | javadoc -sourcepath src -d docs_html -subpackages com
2 |
--------------------------------------------------------------------------------
/.github/workflows/build.yml:
--------------------------------------------------------------------------------
1 | name: build
2 |
3 | on:
4 | push:
5 | paths-ignore:
6 | - '**.md'
7 | pull_request:
8 | paths-ignore:
9 | - '**.md'
10 |
11 | jobs:
12 | build:
13 |
14 | runs-on: ${{ matrix.os }}
15 | strategy:
16 | fail-fast: false
17 | matrix:
18 | os: [ubuntu-latest, macos-latest]
19 | java: [ '8' ]
20 |
21 | steps:
22 | - uses: actions/checkout@v2
23 | - name: Set up JDK
24 | uses: actions/setup-java@v2
25 | with:
26 | java-version: ${{ matrix.java }}
27 | distribution: 'adopt'
28 | - name: MVN Install
29 | run: |
30 | mvn install -DskipTests=true -Dgpg.skip=true
31 | - name: Build with Ant
32 | run: |
33 | ant test
34 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | #maven
2 | target/
3 |
4 | #IDEs
5 | .idea/
6 | *.iml
7 | .project
8 | .classpath
9 |
10 | #example build
11 | example/src/*.class
12 |
--------------------------------------------------------------------------------
/.tests:
--------------------------------------------------------------------------------
1 | ant test
2 |
--------------------------------------------------------------------------------
/CHANGES.md:
--------------------------------------------------------------------------------
1 | # Release History
2 |
3 | ## 1.3.3
4 | * Send Message to a Batch of Rooms API
5 |
6 | ## 1.3.2
7 | * Add Room Messages API
8 |
9 | ## 1.3.1
10 | * Add Specialties API
11 | * Add Skills V2 API
12 |
13 | ## 1.3.0
14 | * Stop supporting deprecated Teamrooms API
15 | * Migrate Workdiaries, Workdays and Snapshots API to v3
16 |
17 | ## 1.2.2
18 | * Fix wrong method usage in updateRoomSettings and updateRoomMetadata
19 |
20 | ## 1.2.1
21 | * Applications API has moved from v3 to v4
22 |
23 | ## 1.2.0
24 | * Added Messages API (new)
25 | * Message API (V1) is now fully depricated
26 |
27 | ## 1.1.1
28 | * Add optional parameter to support pagination in getTrayByType
29 |
30 | ## 1.1.0
31 | * Get Categories (V1) is now fully depricated
32 | * Added new Activities API - Assign to specific engagement the list of activities
33 |
34 | ## 1.0.2
35 | * bug fixes
36 |
37 | ## 1.0.1
38 | * Added new Workdays API - Get Workdays by Comppany
39 | * Added new Workdays API - Get Workdays by Contract
40 |
41 | ## 1.0.0
42 | * welcome to Upwork!
43 |
44 | ## 0.1.14
45 | * Added new Snapshot API - Get Snapshot by Contract
46 | * Added new Snapshot API - Update Snapshot memo by Contract
47 | * Added new Snapshot API - Delete Snapshot by Contract
48 |
49 | ## 0.1.13
50 | * Added new Offer API - Accept or decline an offer
51 |
52 | ## 0.1.12
53 | * Added new Metadata API - List categories (v2)
54 | * Added new Team API - Get Work Diary by Contract)
55 |
56 | ## 0.1.11
57 | * Added new Milestone API - Get Active Milestone for specific Contract
58 | * Added new Milestone API - Get all Submissions for specific Milestone
59 | * Added new Milestone API - Create a new Milestone
60 | * Added new Milestone API - Edit the Milestone
61 | * Added new Milestone API - Approve the Milestone
62 | * Added new Milestone API - Activate the Milestone
63 | * Added new Milestone API - Delete the Milestone
64 | * Added new Submission API - Submit for Approval
65 | * Added new Submission API - Approve the Submission
66 | * Added new Submission API - Reject the Submission
67 | * Fixed issue in Workdiary API
68 |
69 | ## 0.1.10
70 | * Added new call for Referenced User API
71 |
72 | ## 0.1.9
73 | * Fixed issue #5 (encoding of post parameters)
74 |
75 | ## 0.1.8
76 | * Added new API - Suspend Contract
77 | * Added new API - Resume Contract
78 | * Un/archive Activities start supporting a list of codes
79 | * Added new method client.getAuthorizationUrl(oauthCallback), supported in mobile applications
80 |
81 | ## 0.1.7
82 | * Added new API - Get brief profile summary
83 | * Added new API - Update bulk of activities
84 |
85 | ## 0.1.6
86 | * Deprecated Get Full List in oTasks API
87 | * Deprecated Delete Codes in oTasks API
88 | * Deprecated company's level in oTasks API
89 | * Added new API - Get MC Thread by Context
90 | * Added new API - Get Last Posts by Context
91 |
92 | ## 0.1.5
93 | * Added archive/unarchive oTasks API
94 | * Added Get Codes by Activity for oTasks
95 | * Deprecated Get Codes for specific user in oTasks API
96 | * Fixed Client Job Applications API
97 |
98 | ## 0.1.4
99 | * Code cleanup - drop unsupported API
100 | * Fix Config to support custom properties
101 |
102 | ## 0.1.3
103 | * Fix issue with page/paging parameter
104 | * Fix issue with limited number of parameters
105 | * Fix double encoding of parameters
106 |
107 | ## 0.1.2
108 | * Fix for Activities resources
109 |
110 | ## 0.1.1
111 | * Fix for Snapshot resources
112 |
113 | ## 0.1.0
114 | * Initial release
115 |
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | JAVA bindings for Upwork API
2 | Copyright 2014 Upwork Corporation. All Rights Reserved.
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | JAVA bindings for Upwork API (OAuth1) - DEPRECATED
2 | ============
3 |
4 | [](http://www.apache.org/licenses/LICENSE-2.0.html)
5 | [](https://github.com/upwork/java-upwork/releases)
6 | [](https://github.com/upwork/java-upwork/actions)
7 |
8 | # Introduction
9 | This project provides a set of resources of Upwork API from http://developers.upwork.com
10 | based on OAuth 1.0a.
11 |
12 | # Features
13 | These are the supported API resources:
14 |
15 | * My Info
16 | * Custom Payments
17 | * Hiring
18 | * Job and Freelancer Profile
19 | * Search Jobs and Freelancers
20 | * Organization
21 | * Messages
22 | * Time and Financial Reporting
23 | * Metadata
24 | * Snapshot
25 | * Team
26 | * Workd Diary
27 | * Activities
28 |
29 | # Support for Maven and others
30 | Maven support is available via Maven Central Repository, e.g.
31 | ```
32 |
33 | com.Upwork
34 | api
35 | 1.1.0
36 |
37 | ```
38 |
39 | Please, check "Dependency Information" section at [maven page](http://search.maven.org/#artifactdetails%7Ccom.Upwork%7Capi%7C1.0.1%7Cjar) for other systems (like Apache Buildr, Apache Ivy, Gradle, etc)
40 |
41 | # License
42 |
43 | Copyright 2015 Upwork Corporation. All Rights Reserved.
44 |
45 | java-upwork is licensed under the Apache License, Version 2.0 (the "License");
46 | you may not use this file except in compliance with the License.
47 | You may obtain a copy of the License at
48 |
49 | http://www.apache.org/licenses/LICENSE-2.0
50 |
51 | Unless required by applicable law or agreed to in writing, software
52 | distributed under the License is distributed on an "AS IS" BASIS,
53 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
54 | See the License for the specific language governing permissions and
55 | limitations under the License.
56 |
57 | ## SLA
58 | The usage of this API is ruled by the Terms of Use at:
59 |
60 | https://developers.upwork.com/api-tos.html
61 |
62 | ## Example
63 | See the `example` directory. To quickly run the example from the command line:
64 |
65 | cd example
66 | make
67 | make run
68 |
69 | Make sure you've added consumer key and secret to the `example/upwork.properties`.
70 |
--------------------------------------------------------------------------------
/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/java-upwork-javadoc.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/doc/java-upwork-javadoc.zip
--------------------------------------------------------------------------------
/example-android/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea/workspace.xml
4 | .DS_Store
5 | /build
6 |
--------------------------------------------------------------------------------
/example-android/.idea/.name:
--------------------------------------------------------------------------------
1 | Example - Upwork API
--------------------------------------------------------------------------------
/example-android/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/example-android/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/example-android/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/example-android/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/example-android/.idea/libraries/commons_codec_1_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example-android/.idea/libraries/httpclient_android_4_3_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example-android/.idea/libraries/java_json.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example-android/.idea/libraries/java_upwork.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example-android/.idea/libraries/signpost_commonshttp4_1_2_1_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example-android/.idea/libraries/signpost_core_1_2_1_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example-android/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example-android/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example-android/.idea/scopes/scope_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/example-android/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example-android/Example-UpworkAPI.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/example-android/README:
--------------------------------------------------------------------------------
1 | * This directory contains an example android application to demonstrate usage of
2 | JAVA bindings for Upwork API. The project is based on Android Studio.
3 | * This/these source(s) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND
4 |
--------------------------------------------------------------------------------
/example-android/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/example-android/app/app.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/example-android/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 20
5 | buildToolsVersion '20.0.0'
6 |
7 | defaultConfig {
8 | applicationId "com.upwork.example_upworkapi"
9 | minSdkVersion 19
10 | targetSdkVersion 20
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | runProguard false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | compile 'org.apache.httpcomponents:httpclient-android:4.3.3'
25 | compile 'oauth.signpost:signpost-core:1.2.1.2'
26 | compile group: 'oauth.signpost', name: 'signpost-commonshttp4', version: '1.2.1.2' exclude module: 'httpclient' exclude module: 'httpcore'
27 | }
28 |
--------------------------------------------------------------------------------
/example-android/app/libs/java-upwork.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/example-android/app/libs/java-upwork.jar
--------------------------------------------------------------------------------
/example-android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /usr/share/android-studio/data/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/example-android/app/src/androidTest/java/com/upwork/example_upworkapi/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.upwork.example_upworkapi;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/example-android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
12 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/example-android/app/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/example-android/app/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example-android/app/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/example-android/app/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example-android/app/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/example-android/app/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example-android/app/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/example-android/app/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example-android/app/src/main/res/layout/activity_my.xml:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/example-android/app/src/main/res/layout/fragment_my.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
15 |
16 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/example-android/app/src/main/res/menu/my.xml:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/example-android/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/example-android/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/example-android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Example - Upwork API
5 | Please authorize app, and press the button
6 | Settings
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example-android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example-android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:0.12.+'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/example-android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Settings specified in this file will override any Gradle settings
5 | # configured through the IDE.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/example-android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/example-android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/example-android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Apr 10 15:27:10 PDT 2013
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
7 |
--------------------------------------------------------------------------------
/example-android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/example-android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/example-android/sample-screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/example-android/sample-screen.png
--------------------------------------------------------------------------------
/example-android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/example-maven/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example-maven/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 | com.Upwork
6 | test-api
7 | 0.0.1-SNAPSHOT
8 | jar
9 |
10 | test-api
11 | http://maven.apache.org
12 |
13 |
14 | UTF-8
15 |
16 |
17 |
18 |
19 | junit
20 | junit
21 | 4.13.1
22 | test
23 |
24 |
25 | com.Upwork
26 | api
27 | 1.0.1
28 |
29 |
30 | httpcore
31 | org.apache.httpcomponents
32 |
33 |
34 |
35 |
36 | org.apache.httpcomponents
37 | httpcore
38 | 4.4.3
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/example-maven/src/main/java/com/Upwork/test_api/App.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.test_api;
2 |
3 | import java.net.URLDecoder;
4 | import java.util.HashMap;
5 | import java.util.Scanner;
6 |
7 | import org.json.JSONException;
8 | import org.json.JSONObject;
9 |
10 | import com.Upwork.api.OAuthClient;
11 | import com.Upwork.api.Routers.Organization.Users;
12 |
13 | /**
14 | * Hello world! Test Upwork API
15 | *
16 | */
17 | public class App
18 | {
19 | @SuppressWarnings("unused")
20 | public static void main( String[] args )
21 | {
22 | //assign access token-secret pair if they are already known
23 | //this process is up to application how to save and store
24 | //in secure token's data
25 | //String aToken = "xxxxxxxxxxxxxxxxxxxxxxxxx";
26 | //String aSecret = "xxxxxxxxxxx";
27 |
28 | //by default token and secret are unknown
29 | //and application must follow authorization process
30 | String aToken = null;
31 | String aSecret = null;
32 |
33 | OAuthClient client = new OAuthClient(null);
34 |
35 | // authorize application and get access token
36 | if (aToken == null && aSecret == null) {
37 | Scanner scanner = new Scanner(System.in);
38 | String authzUrl = client.getAuthorizationUrl();
39 | System.out.println(authzUrl);
40 |
41 | System.out.println("1. Copy paste the following url in your browser : ");
42 | System.out.println(authzUrl);
43 | System.out.println("2. Grant access ");
44 | System.out.println("3. Copy paste the oauth_verifier parameter here :");
45 |
46 | String oauth_verifier = scanner.nextLine();
47 |
48 | String verifier = null;
49 | try {
50 | verifier = URLDecoder.decode(oauth_verifier,"UTF-8");
51 | }
52 | catch (Exception e) {
53 | e.printStackTrace();
54 | }
55 |
56 | HashMap token = client.getAccessTokenSet(verifier);
57 |
58 | scanner.close();
59 | System.out.println(token);
60 | } else {
61 | // set known access token-secret pair
62 | client.setTokenWithSecret(aToken, aSecret);
63 | }
64 |
65 | JSONObject json1 = null;
66 | try {
67 | // Get info of authenticated user
68 | Users users = new Users(client);
69 | json1 = users.getMyInfo();
70 |
71 | // get my uid
72 | String myId = null;
73 | try {
74 | JSONObject user = json1.getJSONObject("user");
75 | myId = user.getString("id");
76 | System.out.println(myId);
77 | }
78 | catch (JSONException e) {
79 | e.printStackTrace();
80 | }
81 | }
82 | catch (JSONException e) {
83 | e.printStackTrace();
84 | }
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/example-maven/src/test/java/com/Upwork/test_api/AppTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.test_api;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest
11 | extends TestCase
12 | {
13 | /**
14 | * Create the test case
15 | *
16 | * @param testName name of the test case
17 | */
18 | public AppTest( String testName )
19 | {
20 | super( testName );
21 | }
22 |
23 | /**
24 | * @return the suite of tests being tested
25 | */
26 | public static Test suite()
27 | {
28 | return new TestSuite( AppTest.class );
29 | }
30 |
31 | /**
32 | * Rigourous Test :-)
33 | */
34 | public void testApp()
35 | {
36 | assertTrue( true );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/example-maven/upwork.properties:
--------------------------------------------------------------------------------
1 | consumerKey=xxxxxxxxxxxxxxxxxxxxxxxxxxx
2 | consumerSecret=xxxxxxxxxxxxx
3 |
--------------------------------------------------------------------------------
/example/Makefile:
--------------------------------------------------------------------------------
1 | # Makefile for Upwork API java example
2 | #
3 |
4 | SRC_PATH = src
5 | SRC_NAME = TestApi
6 | SRC = $(SRC_PATH)/$(SRC_NAME).java
7 | LIB_DIR = ./../lib
8 | CLASSPATH = "$(LIB_DIR)/httpcomponents-client-4.3.3/httpcore-4.3.2.jar:$(LIB_DIR)/httpcomponents-client-4.3.3/httpclient-4.3.3.jar:$(LIB_DIR)/httpcomponents-client-4.3.3/commons-codec-1.6.jar:$(LIB_DIR)/httpcomponents-client-4.3.3/commons-logging-1.1.3.jar:$(LIB_DIR)/signpost-1.2.1.2/signpost-core-1.2.1.2.jar:$(LIB_DIR)/signpost-1.2.1.2/signpost-commonshttp4-1.2.1.2.jar:$(LIB_DIR)/java-json.jar:$(LIB_DIR)/java-upwork.jar:../$(SRC_PATH):./$(SRC_PATH)"
9 |
10 | compile :
11 | javac -cp $(CLASSPATH) $(SRC)
12 |
13 | run :
14 | java -cp $(CLASSPATH) $(SRC_NAME)
15 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | 1. Download signpost from https://code.google.com/p/oauth-signpost/downloads/list (both core and commonhttp)
2 | 2. Download HttpClient 4 from http://hc.apache.org/
3 | 3. Download org.json from http://www.java2s.com/Code/Jar/j/Downloadjavajsonjar.htm
4 | 4. Link external jars
5 | - signpost-core-VERSION.jar,
6 | - signpost-commonhttp-VERSION.jar
7 | - httpcore-VERSION.jar,
8 | - httpclient-VERSION.jar,
9 | - commons-codec-VERSION.jar,
10 | - commons-logging-VERSION.jar,
11 | - java-json.jar
12 | 5. Finally link java-upwork.jar to your project.
13 | 6. Create upwork.properties and set up your key/secret; by default OAuthClient reads data from it.
14 | You can also overwrite super class Config and use your own as a parameter for OAuthClient constructor,
15 | in that way, keys can be stored elsewhere.
16 | 7. See TestApi.java example to build a simple application that uses Upwork API.
17 |
18 | Some steps from the above are automated already in the `Makefile`, so to run the `TestApi.java`
19 | example app you can just use:
20 |
21 | make
22 | make run
23 |
--------------------------------------------------------------------------------
/example/src/TestApi.java:
--------------------------------------------------------------------------------
1 | import com.Upwork.api.*;
2 | import com.Upwork.api.Routers.Organization.Users;
3 | import com.Upwork.api.Routers.Reports.Time;
4 |
5 | import java.util.HashMap;
6 | import java.util.Scanner;
7 | import java.net.URLDecoder;
8 |
9 | import org.json.JSONException;
10 | import org.json.JSONObject;
11 |
12 | public class TestApi {
13 | @SuppressWarnings("unused")
14 | public static void main(String[] args) {
15 | //assign access token-secret pair if they are already known
16 | //this process is up to application how to save and store
17 | //in secure token's data
18 | //String aToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxx";
19 | //String aSecret = "xxxxxxxxxxxxxx";
20 |
21 | //by default token and secret are unknown
22 | //and application must follow authorization process
23 | String aToken = null;
24 | String aSecret = null;
25 |
26 | OAuthClient client = new OAuthClient(null);
27 |
28 | // authorize application and get access token
29 | if (aToken == null && aSecret == null) {
30 | Scanner scanner = new Scanner(System.in);
31 | String authzUrl = client.getAuthorizationUrl();
32 | System.out.println(authzUrl);
33 |
34 | System.out.println("1. Copy paste the following url in your browser : ");
35 | System.out.println(authzUrl);
36 | System.out.println("2. Grant access ");
37 | System.out.println("3. Copy paste the oauth_verifier parameter here :");
38 |
39 | String oauth_verifier = scanner.nextLine();
40 |
41 | String verifier = null;
42 | try {
43 | verifier = URLDecoder.decode(oauth_verifier,"UTF-8");
44 | }
45 | catch (Exception e) {
46 | e.printStackTrace();
47 | }
48 |
49 | HashMap token = client.getAccessTokenSet(verifier);
50 |
51 | scanner.close();
52 | System.out.println(token);
53 | } else {
54 | // set known access token-secret pair
55 | client.setTokenWithSecret(aToken, aSecret);
56 | }
57 |
58 | JSONObject json1 = null;
59 | JSONObject json2 = null;
60 | JSONObject json3 = null;
61 | try {
62 | // Get info of authenticated user
63 | Users users = new Users(client);
64 | json1 = users.getMyInfo();
65 |
66 | // get my uid
67 | String myId = null;
68 | try {
69 | JSONObject user = json1.getJSONObject("user");
70 | myId = user.getString("id");
71 | System.out.println(myId);
72 | }
73 | catch (JSONException e) {
74 | e.printStackTrace();
75 | }
76 |
77 | // Get test report
78 | //Build the list of parameters
79 | HashMap params2 = new HashMap();
80 | params2.put("tqx", "out:json");
81 | params2.put("tq", "select task where worked_on >= '2014-06-01' AND worked_on <= '2014-06-03' order by worked_on");
82 | Time report = new Time(client);
83 | json2 = report.getByFreelancerLimited(myId, params2);
84 | }
85 | catch (JSONException e) {
86 | e.printStackTrace();
87 | }
88 |
89 | System.out.println(json1);
90 | System.out.println(json2);
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/example/upwork.properties:
--------------------------------------------------------------------------------
1 | consumerKey=xxxxxxxxxxxxxxxxxxxxxxxxxxxx
2 | consumerSecret=xxxxxxxxxxxxxx
3 |
--------------------------------------------------------------------------------
/lib/httpcomponents-client-4.3.3/commons-codec-1.6.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/lib/httpcomponents-client-4.3.3/commons-codec-1.6.jar
--------------------------------------------------------------------------------
/lib/httpcomponents-client-4.3.3/commons-logging-1.1.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/lib/httpcomponents-client-4.3.3/commons-logging-1.1.3.jar
--------------------------------------------------------------------------------
/lib/httpcomponents-client-4.3.3/httpclient-4.3.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/lib/httpcomponents-client-4.3.3/httpclient-4.3.3.jar
--------------------------------------------------------------------------------
/lib/httpcomponents-client-4.3.3/httpcore-4.3.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/lib/httpcomponents-client-4.3.3/httpcore-4.3.2.jar
--------------------------------------------------------------------------------
/lib/java-json.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/lib/java-json.jar
--------------------------------------------------------------------------------
/lib/java-upwork.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/lib/java-upwork.jar
--------------------------------------------------------------------------------
/lib/junit-4.11/hamcrest-core-1.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/lib/junit-4.11/hamcrest-core-1.3.jar
--------------------------------------------------------------------------------
/lib/junit-4.11/junit-4.11.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/lib/junit-4.11/junit-4.11.jar
--------------------------------------------------------------------------------
/lib/mockito-all-1.9.5.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/lib/mockito-all-1.9.5.jar
--------------------------------------------------------------------------------
/lib/powermock-mockito-junit-1.5.5/cglib-nodep-2.2.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/lib/powermock-mockito-junit-1.5.5/cglib-nodep-2.2.2.jar
--------------------------------------------------------------------------------
/lib/powermock-mockito-junit-1.5.5/javassist-3.18.2-GA.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/lib/powermock-mockito-junit-1.5.5/javassist-3.18.2-GA.jar
--------------------------------------------------------------------------------
/lib/powermock-mockito-junit-1.5.5/mockito-all-1.9.5.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/lib/powermock-mockito-junit-1.5.5/mockito-all-1.9.5.jar
--------------------------------------------------------------------------------
/lib/powermock-mockito-junit-1.5.5/objenesis-2.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/lib/powermock-mockito-junit-1.5.5/objenesis-2.1.jar
--------------------------------------------------------------------------------
/lib/powermock-mockito-junit-1.5.5/powermock-mockito-1.5.5-full.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/lib/powermock-mockito-junit-1.5.5/powermock-mockito-1.5.5-full.jar
--------------------------------------------------------------------------------
/lib/signpost-1.2.1.2/signpost-commonshttp4-1.2.1.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/lib/signpost-1.2.1.2/signpost-commonshttp4-1.2.1.2.jar
--------------------------------------------------------------------------------
/lib/signpost-1.2.1.2/signpost-core-1.2.1.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/lib/signpost-1.2.1.2/signpost-core-1.2.1.2.jar
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 | com.Upwork
5 | api
6 | 1.3.3
7 | jar
8 | java-upwork
9 | JAVA bindings for Upwork API
10 |
11 | Upwork
12 | http://www.upwork.com
13 |
14 | https://developers.upwork.com/?lang=java
15 |
16 |
17 |
18 | Apache License, Version 2.0
19 | http://www.apache.org/licenses/LICENSE-2.0.txt
20 | repo
21 |
22 |
23 |
24 |
25 | https://github.com/upwork/java-upwork/issues
26 | GitHub Issues
27 |
28 |
29 |
30 | scm:git:ssh://git@github.com/upwork/java-upwork.git
31 | scm:git:ssh://git@github.com/upwork/java-upwork.git
32 | https://github.com/upwork/java-upwork
33 |
34 |
35 |
36 |
37 | sonatype-nexus-snapshots
38 | Sonatype Nexus Snapshots
39 | https://oss.sonatype.org/content/repositories/snapshots/
40 |
41 |
42 | sonatype-nexus-staging
43 | Nexus Release Repository
44 | https://oss.sonatype.org/service/local/staging/deploy/maven2/
45 |
46 |
47 |
48 |
49 | org.sonatype.oss
50 | oss-parent
51 | 9
52 |
53 |
54 |
55 |
56 | apisupport@upwork.com
57 | Maksym Novozhylov
58 | https://github.com/mnovozhylov
59 | upwork
60 |
61 |
62 |
63 |
64 | src
65 | test
66 |
67 |
68 | org.sonatype.plugins
69 | nexus-staging-maven-plugin
70 | 1.6.6
71 | true
72 |
73 | sonatype-nexus-staging
74 | https://oss.sonatype.org/
75 | true
76 |
77 |
78 |
79 | org.apache.maven.plugins
80 | maven-surefire-plugin
81 | 2.5
82 |
83 | true
84 | false
85 | release
86 | deploy
87 |
88 |
89 |
90 | org.apache.maven.plugins
91 | maven-gpg-plugin
92 |
93 |
94 | sign-artifacts
95 | verify
96 |
97 | sign
98 |
99 |
100 |
101 |
102 |
103 | org.apache.maven.plugins
104 | maven-release-plugin
105 | 2.2.2
106 |
107 |
108 |
109 |
110 |
111 | org.apache.maven.plugins
112 | maven-release-plugin
113 | 2.2.2
114 |
115 | false
116 | -Psonatype-oss-release
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 | sonatype-oss-release
125 |
126 |
127 |
128 | org.apache.maven.plugins
129 | maven-source-plugin
130 |
131 |
132 | org.apache.maven.plugins
133 | maven-javadoc-plugin
134 |
135 |
136 | org.apache.maven.plugins
137 | maven-gpg-plugin
138 |
139 |
140 | sign-artifacts
141 | verify
142 |
143 | sign
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 | org.json
155 | org.json
156 | chargebee-1.0
157 |
158 |
159 | oauth.signpost
160 | signpost-commonshttp4
161 | 1.2.1.2
162 |
163 |
164 | oauth.signpost
165 | signpost-core
166 | 1.2.1.2
167 |
168 |
169 | org.apache.httpcomponents
170 | httpclient
171 | 4.5.13
172 |
173 |
174 | org.junit.contrib
175 | junit-theories
176 | 4.11
177 |
178 |
179 | com.liferay
180 | org.powermock.modules.junit4
181 | 1.5.6.LIFERAY-PATCHED-1
182 |
183 |
184 | org.mockito
185 | mockito-all
186 | 1.9.5
187 |
188 |
189 | org.powermock
190 | powermock-mockito-release-full
191 | 1.5.5
192 | full
193 |
194 |
195 |
196 |
--------------------------------------------------------------------------------
/src/com/Upwork/ClassPreamble.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * @author: Maksym Novozhylov
17 | */
18 |
19 | package com.Upwork;
20 |
21 | import java.lang.annotation.Documented;
22 |
23 | /**
24 | * @author Maksym Novozhylov
25 | *
26 | */
27 | @Documented
28 | public @interface ClassPreamble {
29 | String author();
30 | String date();
31 | int currentRevision() default 1;
32 | String lastModified() default "N/A";
33 | String lastModifiedBy() default "N/A";
34 | String[] reviewers();
35 | }
36 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Config.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * @author: Maksym Novozhylov
17 | */
18 | package com.Upwork.api;
19 |
20 | import java.io.FileInputStream;
21 | import java.io.IOException;
22 | import java.io.InputStream;
23 | import java.util.Properties;
24 |
25 | import com.Upwork.ClassPreamble;
26 |
27 | @ClassPreamble (
28 | author = "Maksym Novozhylov ",
29 | date = "5/30/2014",
30 | currentRevision = 1,
31 | lastModified = "6/3/2014",
32 | lastModifiedBy = "Maksym Novozhylov",
33 | reviewers = {"Yiota Tsakiri"}
34 | )
35 | public class Config {
36 | private final Properties properties;
37 |
38 | public Config(Properties properties) {
39 | if (properties == null) {
40 | this.properties = new Properties();
41 | }
42 | else {
43 | this.properties = properties;
44 | return;
45 | }
46 |
47 | InputStream input = null;
48 |
49 | try {
50 | input = new FileInputStream("upwork.properties");
51 | this.properties.load(input);
52 | } catch (IOException ex) {
53 | ex.printStackTrace();
54 | } finally {
55 | if (input != null) {
56 | try {
57 | input.close();
58 | } catch (IOException e) {
59 | e.printStackTrace();
60 | }
61 | }
62 | }
63 | }
64 |
65 | /**
66 | * Get property by name
67 | * @param key Parameter name
68 | * */
69 | public String getProperty(String key) {
70 | return this.properties.getProperty(key);
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Activities/Engagement.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers.Activities;
18 |
19 | import java.util.HashMap;
20 |
21 | import com.Upwork.ClassPreamble;
22 | import com.Upwork.api.OAuthClient;
23 |
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | @ClassPreamble (
28 | author = "Maksym Novozhylov ",
29 | date = "6/4/2014",
30 | currentRevision = 1,
31 | lastModified = "24/09/2015",
32 | lastModifiedBy = "Maksym Novozhylov",
33 | reviewers = {"Yiota Tsakiri"}
34 | )
35 | public final class Engagement {
36 |
37 | final static String ENTRY_POINT = "api";
38 |
39 | private OAuthClient oClient = null;
40 |
41 | public Engagement(OAuthClient client) {
42 | oClient = client;
43 | oClient.setEntryPoint(ENTRY_POINT);
44 | }
45 |
46 | /**
47 | * List activities for specific engagement
48 | *
49 | * @param engagement_ref Engagement reference
50 | * @throws JSONException If error occurred
51 | * @return {@link JSONObject}
52 | */
53 | public JSONObject getSpecific(String engagement_ref) throws JSONException {
54 | return oClient.get("/tasks/v2/tasks/contracts/" + engagement_ref);
55 | }
56 |
57 | /**
58 | * Assign engagements to the list of activities
59 | *
60 | * @param company Company ID
61 | * @param team Team ID
62 | * @param engagement Engagement
63 | * @param params Parameters
64 | * @throws JSONException If error occurred
65 | * @return {@link JSONObject}
66 | */
67 | public JSONObject assign(String company, String team, String engagement, HashMap params) throws JSONException {
68 | return oClient.put("/otask/v1/tasks/companies/" + company + "/teams/" + team + "/engagements/" + engagement + "/tasks", params);
69 | }
70 |
71 | /**
72 | * Assign engagements to the list of activities
73 | *
74 | * @param engagement_ref Engagement reference
75 | * @param params Parameters
76 | * @throws JSONException If error occurred
77 | * @return {@link JSONObject}
78 | */
79 | public JSONObject assignToEngagement(String engagement_ref, HashMap params) throws JSONException {
80 | return oClient.put("/tasks/v2/tasks/contracts/" + engagement_ref, params);
81 | }
82 |
83 | }
84 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Activities/Team.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers.Activities;
18 |
19 | import java.util.HashMap;
20 |
21 | import com.Upwork.ClassPreamble;
22 | import com.Upwork.api.OAuthClient;
23 |
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | @ClassPreamble (
28 | author = "Maksym Novozhylov ",
29 | date = "6/4/2014",
30 | currentRevision = 1,
31 | lastModified = "6/4/2014",
32 | lastModifiedBy = "Maksym Novozhylov",
33 | reviewers = {"Yiota Tsakiri"}
34 | )
35 | public final class Team {
36 |
37 | final static String ENTRY_POINT = "api";
38 |
39 | private OAuthClient oClient = null;
40 |
41 | public Team(OAuthClient client) {
42 | oClient = client;
43 | oClient.setEntryPoint(ENTRY_POINT);
44 | }
45 |
46 | /**
47 | * Get by type
48 | *
49 | * @param company Company ID
50 | * @param team Team ID
51 | * @param code (Optional) Code(s)
52 | * @throws JSONException If error occurred
53 | * @return {@link JSONObject}
54 | */
55 | private JSONObject _getByType(String company, String team, String code) throws JSONException {
56 | String url = "";
57 | if (code != null) {
58 | url = "/" + code;
59 | }
60 |
61 | return oClient.get("/otask/v1/tasks/companies/" + company + "/teams/" + team + "/tasks" + url);
62 | }
63 |
64 | /**
65 | * List all oTask/Activity records within a team
66 | *
67 | * @param company Company ID
68 | * @throws JSONException If error occurred
69 | * @return {@link JSONObject}
70 | */
71 | public JSONObject getList(String company, String team) throws JSONException {
72 | return _getByType(company, team, null);
73 | }
74 |
75 | /**
76 | * List all oTask/Activity records within a team by specified code(s)
77 | *
78 | * @param company Company ID
79 | * @param team Team ID
80 | * @param code Specific code(s)
81 | * @throws JSONException If error occurred
82 | * @return {@link JSONObject}
83 | */
84 | public JSONObject getSpecificList(String company, String team, String code) throws JSONException {
85 | return _getByType(company, team, code);
86 | }
87 |
88 | /**
89 | * Create an oTask/Activity record within a team
90 | *
91 | * @param company Company ID
92 | * @param team Team ID
93 | * @param params Parameters
94 | * @throws JSONException If error occurred
95 | * @return {@link JSONObject}
96 | */
97 | public JSONObject addActivity(String company, String team, HashMap params) throws JSONException {
98 | return oClient.post("/otask/v1/tasks/companies/" + company + "/teams/" + team + "/tasks", params);
99 | }
100 |
101 | /**
102 | * Update specific oTask/Activity record within a team
103 | *
104 | * @param company Company ID
105 | * @param team Team ID
106 | * @param code Specific code
107 | * @param params Parameters
108 | * @throws JSONException If error occurred
109 | * @return {@link JSONObject}
110 | */
111 | public JSONObject updateActivity(String company, String team, String code, HashMap params) throws JSONException {
112 | return oClient.put("/otask/v1/tasks/companies/" + company + "/teams/" + team + "/tasks/" + code, params);
113 | }
114 |
115 | /**
116 | * Archive specific oTask/Activity record within a team
117 | *
118 | * @param company Company ID
119 | * @param team Team ID
120 | * @param code Specific code(s)
121 | * @throws JSONException If error occurred
122 | * @return {@link JSONObject}
123 | */
124 | public JSONObject archiveActivity(String company, String team, String code) throws JSONException {
125 | return oClient.put("/otask/v1/tasks/companies/" + company + "/teams/" + team + "/archive/" + code);
126 | }
127 |
128 | /**
129 | * Unarchive specific oTask/Activity record within a team
130 | *
131 | * @param company Company ID
132 | * @param team Team ID
133 | * @param code Specific code(s)
134 | * @throws JSONException If error occurred
135 | * @return {@link JSONObject}
136 | */
137 | public JSONObject unarchiveActivity(String company, String team, String code) throws JSONException {
138 | return oClient.put("/otask/v1/tasks/companies/" + company + "/teams/" + team + "/unarchive/" + code);
139 | }
140 |
141 | /**
142 | * Update a group of oTask/Activity records
143 | *
144 | * @param company Company ID
145 | * @param params Parameters
146 | * @throws JSONException If error occurred
147 | * @return {@link JSONObject}
148 | */
149 | public JSONObject updateBatch(String company, HashMap params) throws JSONException {
150 | return oClient.put("/otask/v1/tasks/companies/" + company + "/tasks/batch", params);
151 | }
152 |
153 | }
154 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Auth.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers;
18 |
19 | import com.Upwork.ClassPreamble;
20 | import com.Upwork.api.OAuthClient;
21 |
22 | import org.json.JSONException;
23 | import org.json.JSONObject;
24 |
25 | @ClassPreamble (
26 | author = "Maksym Novozhylov ",
27 | date = "6/3/2014",
28 | currentRevision = 1,
29 | lastModified = "6/3/2014",
30 | lastModifiedBy = "Maksym Novozhylov",
31 | reviewers = {"Yiota Tsakiri"}
32 | )
33 | public final class Auth {
34 |
35 | final static String ENTRY_POINT = "api";
36 |
37 | private OAuthClient oClient = null;
38 |
39 | public Auth(OAuthClient client) {
40 | oClient = client;
41 | oClient.setEntryPoint(ENTRY_POINT);
42 | }
43 |
44 | /**
45 | * Get My Info
46 | *
47 | * @throws JSONException If error occurred
48 | * @return {@link JSONObject}
49 | * */
50 | public JSONObject getUserInfo() throws JSONException {
51 | return oClient.get("/auth/v1/info");
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Freelancers/Profile.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers.Freelancers;
18 |
19 | import com.Upwork.ClassPreamble;
20 | import com.Upwork.api.OAuthClient;
21 |
22 | import org.json.JSONException;
23 | import org.json.JSONObject;
24 |
25 | @ClassPreamble (
26 | author = "Maksym Novozhylov ",
27 | date = "6/4/2014",
28 | currentRevision = 1,
29 | lastModified = "6/4/2014",
30 | lastModifiedBy = "Maksym Novozhylov",
31 | reviewers = {"Yiota Tsakiri"}
32 | )
33 | public final class Profile {
34 |
35 | final static String ENTRY_POINT = "api";
36 |
37 | private OAuthClient oClient = null;
38 |
39 | public Profile(OAuthClient client) {
40 | oClient = client;
41 | oClient.setEntryPoint(ENTRY_POINT);
42 | }
43 |
44 | /**
45 | * Get specific Freelancer's Profile
46 | *
47 | * @param key Profile key
48 | * @throws JSONException If error occurred
49 | * @return {@link JSONObject}
50 | */
51 | public JSONObject getSpecific(String key) throws JSONException {
52 | return oClient.get("/profiles/v1/providers/" + key);
53 | }
54 |
55 | /**
56 | * Get brief info for the specific Freelancer's Profile
57 | *
58 | * @param key Profile key
59 | * @throws JSONException If error occurred
60 | * @return {@link JSONObject}
61 | */
62 | public JSONObject getSpecificBrief(String key) throws JSONException {
63 | return oClient.get("/profiles/v1/providers/" + key + "/brief");
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Freelancers/Search.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers.Freelancers;
18 |
19 | import java.util.HashMap;
20 |
21 | import com.Upwork.ClassPreamble;
22 | import com.Upwork.api.OAuthClient;
23 |
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | @ClassPreamble (
28 | author = "Maksym Novozhylov ",
29 | date = "6/4/2014",
30 | currentRevision = 1,
31 | lastModified = "6/4/2014",
32 | lastModifiedBy = "Maksym Novozhylov",
33 | reviewers = {"Yiota Tsakiri"}
34 | )
35 | public final class Search {
36 |
37 | final static String ENTRY_POINT = "api";
38 |
39 | private OAuthClient oClient = null;
40 |
41 | public Search(OAuthClient client) {
42 | oClient = client;
43 | oClient.setEntryPoint(ENTRY_POINT);
44 | }
45 |
46 | /**
47 | * Search freelancers
48 | *
49 | * @param params (Optional) Parameters
50 | * @throws JSONException If error occurred
51 | * @return {@link JSONObject}
52 | */
53 | public JSONObject find(HashMap params) throws JSONException {
54 | return oClient.get("/profiles/v2/search/providers", params);
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Hr/Clients/Applications.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers.Hr.Clients;
18 |
19 | import java.util.HashMap;
20 |
21 | import com.Upwork.ClassPreamble;
22 | import com.Upwork.api.OAuthClient;
23 |
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | @ClassPreamble (
28 | author = "Maksym Novozhylov ",
29 | date = "6/4/2014",
30 | currentRevision = 1,
31 | lastModified = "2/15/2014",
32 | lastModifiedBy = "Maksym Novozhylov",
33 | reviewers = {"Yiota Tsakiri"}
34 | )
35 | public final class Applications {
36 |
37 | final static String ENTRY_POINT = "api";
38 |
39 | private OAuthClient oClient = null;
40 |
41 | public Applications(OAuthClient client) {
42 | oClient = client;
43 | oClient.setEntryPoint(ENTRY_POINT);
44 | }
45 |
46 | /**
47 | * Get list of applications
48 | *
49 | * @param params Parameters
50 | * @return object
51 | */
52 | public JSONObject getList(HashMap params) throws JSONException {
53 | return oClient.get("/hr/v4/clients/applications", params);
54 | }
55 |
56 | /**
57 | * Get specific application
58 | *
59 | * @param reference Application reference
60 | * @param params Parameters
61 | * @return object
62 | */
63 | public JSONObject getSpecific(String reference, HashMap params) throws JSONException {
64 | return oClient.get("/hr/v4/clients/applications/" + reference, params);
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Hr/Clients/Offers.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers.Hr.Clients;
18 |
19 | import java.util.HashMap;
20 |
21 | import com.Upwork.ClassPreamble;
22 | import com.Upwork.api.OAuthClient;
23 |
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | @ClassPreamble (
28 | author = "Maksym Novozhylov ",
29 | date = "6/4/2014",
30 | currentRevision = 1,
31 | lastModified = "6/4/2014",
32 | lastModifiedBy = "Maksym Novozhylov",
33 | reviewers = {"Yiota Tsakiri"}
34 | )
35 | public final class Offers {
36 |
37 | final static String ENTRY_POINT = "api";
38 |
39 | private OAuthClient oClient = null;
40 |
41 | public Offers(OAuthClient client) {
42 | oClient = client;
43 | oClient.setEntryPoint(ENTRY_POINT);
44 | }
45 |
46 | /**
47 | * Get list of offers
48 | *
49 | * @param params Parameters
50 | * @throws JSONException If error occurred
51 | * @return {@link JSONObject}
52 | */
53 | public JSONObject getList(HashMap params) throws JSONException {
54 | return oClient.get("/offers/v1/clients/offers", params);
55 | }
56 |
57 | /**
58 | * Get specific offer
59 | *
60 | * @param reference Offer reference
61 | * @param params Parameters
62 | * @throws JSONException If error occurred
63 | * @return {@link JSONObject}
64 | */
65 | public JSONObject getSpecific(String reference, HashMap params) throws JSONException {
66 | return oClient.get("/offers/v1/clients/offers/" + reference, params);
67 | }
68 |
69 | /**
70 | * Send offer
71 | *
72 | * @param params Parameters
73 | * @throws JSONException If error occurred
74 | * @return {@link JSONObject}
75 | */
76 | public JSONObject makeOffer(HashMap params) throws JSONException {
77 | return oClient.post("/offers/v1/clients/offers", params);
78 | }
79 |
80 | }
81 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Hr/Contracts.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers.Hr;
18 |
19 | import java.util.HashMap;
20 |
21 | import com.Upwork.ClassPreamble;
22 | import com.Upwork.api.OAuthClient;
23 |
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | @ClassPreamble (
28 | author = "Maksym Novozhylov ",
29 | date = "6/4/2014",
30 | currentRevision = 1,
31 | lastModified = "19/9/2014",
32 | lastModifiedBy = "Maksym Novozhylov",
33 | reviewers = {"Yiota Tsakiri"}
34 | )
35 | public final class Contracts {
36 |
37 | final static String ENTRY_POINT = "api";
38 |
39 | private OAuthClient oClient = null;
40 |
41 | public Contracts(OAuthClient client) {
42 | oClient = client;
43 | oClient.setEntryPoint(ENTRY_POINT);
44 | }
45 |
46 | /**
47 | * Suspend Contract
48 | *
49 | * @param reference Contract reference
50 | * @param params Parameters
51 | * @throws JSONException If error occurred
52 | * @return {@link JSONObject}
53 | */
54 | public JSONObject suspendContract(String reference, HashMap params) throws JSONException {
55 | return oClient.put("/hr/v2/contracts/" + reference + "/suspend", params);
56 | }
57 |
58 | /**
59 | * Restart Contract
60 | *
61 | * @param reference Contract reference
62 | * @param params Parameters
63 | * @throws JSONException If error occurred
64 | * @return {@link JSONObject}
65 | */
66 | public JSONObject restartContract(String reference, HashMap params) throws JSONException {
67 | return oClient.put("/hr/v2/contracts/" + reference + "/restart", params);
68 | }
69 |
70 | /**
71 | * End Contract
72 | *
73 | * @param reference Contract reference
74 | * @param params Parameters
75 | * @throws JSONException If error occurred
76 | * @return {@link JSONObject}
77 | */
78 | public JSONObject endContract(String reference, HashMap params) throws JSONException {
79 | return oClient.delete("/hr/v2/contracts/" + reference, params);
80 | }
81 |
82 | }
83 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Hr/Engagements.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers.Hr;
18 |
19 | import java.util.HashMap;
20 |
21 | import com.Upwork.ClassPreamble;
22 | import com.Upwork.api.OAuthClient;
23 |
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | @ClassPreamble (
28 | author = "Maksym Novozhylov ",
29 | date = "6/4/2014",
30 | currentRevision = 1,
31 | lastModified = "6/4/2014",
32 | lastModifiedBy = "Maksym Novozhylov",
33 | reviewers = {"Yiota Tsakiri"}
34 | )
35 | public final class Engagements {
36 |
37 | final static String ENTRY_POINT = "api";
38 |
39 | private OAuthClient oClient = null;
40 |
41 | public Engagements(OAuthClient client) {
42 | oClient = client;
43 | oClient.setEntryPoint(ENTRY_POINT);
44 | }
45 |
46 | /**
47 | * Get list of engagements
48 | *
49 | * @param params Parameters
50 | * @throws JSONException If error occurred
51 | * @return {@link JSONObject}
52 | */
53 | public JSONObject getList(HashMap params) throws JSONException {
54 | return oClient.get("/hr/v2/engagements", params);
55 | }
56 |
57 | /**
58 | * Get specific engagement
59 | *
60 | * @param reference Engagement's reference
61 | * @throws JSONException If error occurred
62 | * @return {@link JSONObject}
63 | */
64 | public JSONObject getSpecific(String reference) throws JSONException {
65 | return oClient.get("/hr/v2/engagements/" + reference);
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Hr/Freelancers/Applications.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers.Hr.Freelancers;
18 |
19 | import java.util.HashMap;
20 |
21 | import com.Upwork.ClassPreamble;
22 | import com.Upwork.api.OAuthClient;
23 |
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | @ClassPreamble (
28 | author = "Maksym Novozhylov ",
29 | date = "6/4/2014",
30 | currentRevision = 1,
31 | lastModified = "2/15/2014",
32 | lastModifiedBy = "Maksym Novozhylov",
33 | reviewers = {"Yiota Tsakiri"}
34 | )
35 | public final class Applications {
36 |
37 | final static String ENTRY_POINT = "api";
38 |
39 | private OAuthClient oClient = null;
40 |
41 | public Applications(OAuthClient client) {
42 | oClient = client;
43 | oClient.setEntryPoint(ENTRY_POINT);
44 | }
45 |
46 | /**
47 | * Get list of applications
48 | *
49 | * @param params Parameters
50 | * @throws JSONException If error occurred
51 | * @return {@link JSONObject}
52 | */
53 | public JSONObject getList(HashMap params) throws JSONException {
54 | return oClient.get("/hr/v4/contractors/applications", params);
55 | }
56 |
57 | /**
58 | * Get specific application
59 | *
60 | * @param reference Application reference
61 | * @throws JSONException If error occurred
62 | * @return {@link JSONObject}
63 | */
64 | public JSONObject getSpecific(String reference) throws JSONException {
65 | return oClient.get("/hr/v4/contractors/applications/" + reference);
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Hr/Freelancers/Offers.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers.Hr.Freelancers;
18 |
19 | import java.util.HashMap;
20 |
21 | import com.Upwork.ClassPreamble;
22 | import com.Upwork.api.OAuthClient;
23 |
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | @ClassPreamble (
28 | author = "Maksym Novozhylov ",
29 | date = "6/4/2014",
30 | currentRevision = 1,
31 | lastModified = "6/4/2014",
32 | lastModifiedBy = "Maksym Novozhylov",
33 | reviewers = {"Yiota Tsakiri"}
34 | )
35 | public final class Offers {
36 |
37 | final static String ENTRY_POINT = "api";
38 |
39 | private OAuthClient oClient = null;
40 |
41 | public Offers(OAuthClient client) {
42 | oClient = client;
43 | oClient.setEntryPoint(ENTRY_POINT);
44 | }
45 |
46 | /**
47 | * Get list of applications
48 | *
49 | * @param params Parameters
50 | * @throws JSONException If error occurred
51 | * @return {@link JSONObject}
52 | */
53 | public JSONObject getList(HashMap params) throws JSONException {
54 | return oClient.get("/offers/v1/contractors/offers", params);
55 | }
56 |
57 | /**
58 | * Get specific application
59 | *
60 | * @param reference Offer reference
61 | * @throws JSONException If error occurred
62 | * @return {@link JSONObject}
63 | */
64 | public JSONObject getSpecific(String reference) throws JSONException {
65 | return oClient.get("/offers/v1/contractors/offers/" + reference);
66 | }
67 |
68 | /**
69 | * Run a specific action
70 | *
71 | * @param reference Offer reference
72 | * @param params Parameters
73 | * @throws JSONException If error occurred
74 | * @return {@link JSONObject}
75 | */
76 | public JSONObject actions(String reference, HashMap params) throws JSONException {
77 | return oClient.post("/offers/v1/contractors/offers/" + reference, params);
78 | }
79 |
80 | }
81 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Hr/Interviews.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers.Hr;
18 |
19 | import java.util.HashMap;
20 |
21 | import com.Upwork.ClassPreamble;
22 | import com.Upwork.api.OAuthClient;
23 |
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | @ClassPreamble (
28 | author = "Maksym Novozhylov ",
29 | date = "6/4/2014",
30 | currentRevision = 1,
31 | lastModified = "6/4/2014",
32 | lastModifiedBy = "Maksym Novozhylov",
33 | reviewers = {"Yiota Tsakiri"}
34 | )
35 | public final class Interviews {
36 |
37 | final static String ENTRY_POINT = "api";
38 |
39 | private OAuthClient oClient = null;
40 |
41 | public Interviews(OAuthClient client) {
42 | oClient = client;
43 | oClient.setEntryPoint(ENTRY_POINT);
44 | }
45 |
46 | /**
47 | * Invite to Interview
48 | *
49 | * @param jobKey Job key
50 | * @param params Parameters
51 | * @throws JSONException If error occurred
52 | * @return {@link JSONObject}
53 | */
54 | public JSONObject invite(String jobKey, HashMap params) throws JSONException {
55 | return oClient.post("/hr/v1/jobs/" + jobKey + "/candidates", params);
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Hr/Jobs.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers.Hr;
18 |
19 | import java.util.HashMap;
20 |
21 | import com.Upwork.ClassPreamble;
22 | import com.Upwork.api.OAuthClient;
23 |
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | @ClassPreamble (
28 | author = "Maksym Novozhylov ",
29 | date = "6/4/2014",
30 | currentRevision = 1,
31 | lastModified = "6/4/2014",
32 | lastModifiedBy = "Maksym Novozhylov",
33 | reviewers = {"Yiota Tsakiri"}
34 | )
35 | public final class Jobs {
36 |
37 | final static String ENTRY_POINT = "api";
38 |
39 | private OAuthClient oClient = null;
40 |
41 | public Jobs(OAuthClient client) {
42 | oClient = client;
43 | oClient.setEntryPoint(ENTRY_POINT);
44 | }
45 |
46 | /**
47 | * Get list of jobs
48 | *
49 | * @param params Parameters
50 | * @throws JSONException If error occurred
51 | * @return {@link JSONObject}
52 | */
53 | public JSONObject getList(HashMap params) throws JSONException {
54 | return oClient.get("/hr/v2/jobs", params);
55 | }
56 |
57 | /**
58 | * Get specific job by key
59 | *
60 | * @param key Job key
61 | * @throws JSONException If error occurred
62 | * @return {@link JSONObject}
63 | */
64 | public JSONObject getSpecific(String key) throws JSONException {
65 | return oClient.get("/hr/v2/jobs/" + key);
66 | }
67 |
68 | /**
69 | * Post a new job
70 | *
71 | * @param params Parameters
72 | * @throws JSONException If error occurred
73 | * @return {@link JSONObject}
74 | */
75 | public JSONObject postJob(HashMap params) throws JSONException {
76 | return oClient.post("/hr/v2/jobs", params);
77 | }
78 |
79 | /**
80 | * Edit existent job
81 | *
82 | * @param key Job key
83 | * @param params Parameters
84 | * @throws JSONException If error occurred
85 | * @return {@link JSONObject}
86 | */
87 | public JSONObject editJob(String key, HashMap params) throws JSONException {
88 | return oClient.put("/hr/v2/jobs/" + key, params);
89 | }
90 |
91 | /**
92 | * Delete existent job
93 | *
94 | * @param key Job key
95 | * @param params Parameters
96 | * @throws JSONException If error occurred
97 | * @return {@link JSONObject}
98 | */
99 | public JSONObject deleteJob(String key, HashMap params) throws JSONException {
100 | return oClient.delete("/hr/v2/jobs/" + key, params);
101 | }
102 |
103 | }
104 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Hr/Milestones.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * http://developers.upwork.com/API-Terms-of-Use
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers.Hr;
18 |
19 | import java.util.HashMap;
20 |
21 | import com.Upwork.ClassPreamble;
22 | import com.Upwork.api.OAuthClient;
23 |
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | @ClassPreamble (
28 | author = "Maksym Novozhylov ",
29 | date = "11/17/2014",
30 | currentRevision = 1,
31 | lastModified = "11/17/2014",
32 | lastModifiedBy = "Maksym Novozhylov",
33 | reviewers = {"Yiota Tsakiri"}
34 | )
35 | public final class Milestones {
36 |
37 | final static String ENTRY_POINT = "api";
38 |
39 | private OAuthClient oClient = null;
40 |
41 | public Milestones(OAuthClient client) {
42 | oClient = client;
43 | oClient.setEntryPoint(ENTRY_POINT);
44 | }
45 |
46 | /**
47 | * Get active Milestone for the Contract
48 | *
49 | * @param contractId Contract reference
50 | * @throws JSONException If error occurred
51 | * @return {@link JSONObject}
52 | */
53 | public JSONObject getActiveMilestone(String contractId) throws JSONException {
54 | return oClient.get("/hr/v3/fp/milestones/statuses/active/contracts/" + contractId);
55 | }
56 |
57 | /**
58 | * Get all submissions for the active Milestone
59 | *
60 | * @param milestoneId Milestone ID
61 | * @throws JSONException If error occurred
62 | * @return {@link JSONObject}
63 | */
64 | public JSONObject getSubmissions(String milestoneId) throws JSONException {
65 | return oClient.get("/hr/v3/fp/milestones/" + milestoneId + "/submissions");
66 | }
67 |
68 | /**
69 | * Create a new Milestone
70 | *
71 | * @param params Parameters
72 | * @throws JSONException If error occurred
73 | * @return {@link JSONObject}
74 | */
75 | public JSONObject create(HashMap params) throws JSONException {
76 | return oClient.post("/hr/v3/fp/milestones", params);
77 | }
78 |
79 | /**
80 | * Edit an existing Milestone
81 | *
82 | * @param milestoneId Milestone ID
83 | * @param params Parameters
84 | * @throws JSONException If error occurred
85 | * @return {@link JSONObject}
86 | */
87 | public JSONObject edit(String milestoneId, HashMap params) throws JSONException {
88 | return oClient.put("/hr/v3/fp/milestones/" + milestoneId, params);
89 | }
90 |
91 | /**
92 | * Activate an existing Milestone
93 | *
94 | * @param milestoneId Milestone ID
95 | * @param params Parameters
96 | * @throws JSONException If error occurred
97 | * @return {@link JSONObject}
98 | */
99 | public JSONObject activate(String milestoneId, HashMap params) throws JSONException {
100 | return oClient.put("/hr/v3/fp/milestones/" + milestoneId + "/activate", params);
101 | }
102 |
103 | /**
104 | * Approve an existing Milestone
105 | *
106 | * @param milestoneId Milestone ID
107 | * @param params Parameters
108 | * @throws JSONException If error occurred
109 | * @return {@link JSONObject}
110 | */
111 | public JSONObject approve(String milestoneId, HashMap params) throws JSONException {
112 | return oClient.put("/hr/v3/fp/milestones/" + milestoneId + "/approve", params);
113 | }
114 |
115 | /**
116 | * Delete an existing Milestone
117 | *
118 | * @param milestoneId Milestone ID
119 | * @throws JSONException If error occurred
120 | * @return {@link JSONObject}
121 | */
122 | public JSONObject delete(String milestoneId) throws JSONException {
123 | return oClient.delete("/hr/v3/fp/milestones/" + milestoneId);
124 | }
125 |
126 | }
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Hr/Roles.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers.Hr;
18 |
19 | import com.Upwork.ClassPreamble;
20 | import com.Upwork.api.OAuthClient;
21 |
22 | import org.json.JSONException;
23 | import org.json.JSONObject;
24 |
25 | @ClassPreamble (
26 | author = "Maksym Novozhylov ",
27 | date = "6/4/2014",
28 | currentRevision = 1,
29 | lastModified = "6/4/2014",
30 | lastModifiedBy = "Maksym Novozhylov",
31 | reviewers = {"Yiota Tsakiri"}
32 | )
33 | public final class Roles {
34 |
35 | final static String ENTRY_POINT = "api";
36 |
37 | private OAuthClient oClient = null;
38 |
39 | public Roles(OAuthClient client) {
40 | oClient = client;
41 | oClient.setEntryPoint(ENTRY_POINT);
42 | }
43 |
44 | /**
45 | * Get user roles
46 | *
47 | * @throws JSONException If error occurred
48 | * @return {@link JSONObject}
49 | */
50 | public JSONObject getAll() throws JSONException {
51 | return oClient.get("/hr/v2/userroles");
52 | }
53 |
54 | /**
55 | * Get by specific user
56 | *
57 | * @param reference User reference
58 | * @throws JSONException If error occurred
59 | * @return {@link JSONObject}
60 | */
61 | public JSONObject getBySpecificUser(String reference) throws JSONException {
62 | return oClient.get("/hr/v2/userroles/" + reference);
63 | }
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Hr/Submissions.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * http://developers.upwork.com/API-Terms-of-Use
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers.Hr;
18 |
19 | import java.util.HashMap;
20 |
21 | import com.Upwork.ClassPreamble;
22 | import com.Upwork.api.OAuthClient;
23 |
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | @ClassPreamble (
28 | author = "Maksym Novozhylov ",
29 | date = "11/17/2014",
30 | currentRevision = 1,
31 | lastModified = "11/17/2014",
32 | lastModifiedBy = "Maksym Novozhylov",
33 | reviewers = {"Yiota Tsakiri"}
34 | )
35 | public final class Submissions {
36 |
37 | final static String ENTRY_POINT = "api";
38 |
39 | private OAuthClient oClient = null;
40 |
41 | public Submissions(OAuthClient client) {
42 | oClient = client;
43 | oClient.setEntryPoint(ENTRY_POINT);
44 | }
45 |
46 | /**
47 | * Freelancer submits work for the client to approve
48 | *
49 | * @param params Parameters
50 | * @throws JSONException If error occurred
51 | * @return {@link JSONObject}
52 | */
53 | public JSONObject requestApproval(HashMap params) throws JSONException {
54 | return oClient.post("/hr/v3/fp/submissions", params);
55 | }
56 |
57 | /**
58 | * Approve an existing Submission
59 | *
60 | * @param submissionId Submission ID
61 | * @param params Parameters
62 | * @throws JSONException If error occurred
63 | * @return {@link JSONObject}
64 | */
65 | public JSONObject approve(String submissionId, HashMap params) throws JSONException {
66 | return oClient.put("/hr/v3/fp/submissions/" + submissionId + "/approve", params);
67 | }
68 |
69 | /**
70 | * Reject an existing Submission
71 | *
72 | * @param submissionId Submission ID
73 | * @param params Parameters
74 | * @throws JSONException If error occurred
75 | * @return {@link JSONObject}
76 | */
77 | public JSONObject reject(String submissionId, HashMap params) throws JSONException {
78 | return oClient.put("/hr/v3/fp/submissions/" + submissionId + "/reject", params);
79 | }
80 |
81 | }
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Jobs/Profile.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers.Jobs;
18 |
19 | import com.Upwork.ClassPreamble;
20 | import com.Upwork.api.OAuthClient;
21 |
22 | import org.json.JSONException;
23 | import org.json.JSONObject;
24 |
25 | @ClassPreamble (
26 | author = "Maksym Novozhylov ",
27 | date = "6/4/2014",
28 | currentRevision = 1,
29 | lastModified = "6/4/2014",
30 | lastModifiedBy = "Maksym Novozhylov",
31 | reviewers = {"Yiota Tsakiri"}
32 | )
33 | public final class Profile {
34 |
35 | final static String ENTRY_POINT = "api";
36 |
37 | private OAuthClient oClient = null;
38 |
39 | public Profile(OAuthClient client) {
40 | oClient = client;
41 | oClient.setEntryPoint(ENTRY_POINT);
42 | }
43 |
44 | /**
45 | * Get specific Job's Profile
46 | *
47 | * @param key Profile key
48 | * @throws JSONException If error occurred
49 | * @return {@link JSONObject}
50 | */
51 | public JSONObject getSpecific(String key) throws JSONException {
52 | return oClient.get("/profiles/v1/jobs/" + key);
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Jobs/Search.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers.Jobs;
18 |
19 | import java.util.HashMap;
20 |
21 | import com.Upwork.ClassPreamble;
22 | import com.Upwork.api.OAuthClient;
23 |
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | @ClassPreamble (
28 | author = "Maksym Novozhylov ",
29 | date = "6/4/2014",
30 | currentRevision = 1,
31 | lastModified = "6/4/2014",
32 | lastModifiedBy = "Maksym Novozhylov",
33 | reviewers = {"Yiota Tsakiri"}
34 | )
35 | public final class Search {
36 |
37 | final static String ENTRY_POINT = "api";
38 |
39 | private OAuthClient oClient = null;
40 |
41 | public Search(OAuthClient client) {
42 | oClient = client;
43 | oClient.setEntryPoint(ENTRY_POINT);
44 | }
45 |
46 | /**
47 | * Search jobs
48 | *
49 | * @param params (Optional) Parameters
50 | * @throws JSONException If error occurred
51 | * @return {@link JSONObject}
52 | */
53 | public JSONObject find(HashMap params) throws JSONException {
54 | return oClient.get("/profiles/v2/search/jobs", params);
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Messages.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers;
2 |
3 | import java.util.HashMap;
4 |
5 | import com.Upwork.ClassPreamble;
6 | import com.Upwork.api.OAuthClient;
7 |
8 | import org.json.JSONException;
9 | import org.json.JSONObject;
10 |
11 | @ClassPreamble (
12 | author = "Maksym Novozhylov ",
13 | date = "6/6/2014",
14 | currentRevision = 1,
15 | lastModified = "6/6/2014",
16 | lastModifiedBy = "Maksym Novozhylov",
17 | reviewers = {"Yiota Tsakiri"}
18 | )
19 | public final class Messages {
20 |
21 | final static String ENTRY_POINT = "api";
22 |
23 | private OAuthClient oClient = null;
24 |
25 | public Messages(OAuthClient client) {
26 | oClient = client;
27 | oClient.setEntryPoint(ENTRY_POINT);
28 | }
29 |
30 | /**
31 | * Retrieve rooms information
32 | *
33 | * @param company Company ID
34 | * @throws JSONException If error occurred
35 | * @return {@link JSONObject}
36 | */
37 | public JSONObject getRooms(String company) throws JSONException {
38 | return oClient.get("/messages/v3/" + company + "/rooms");
39 | }
40 |
41 | /**
42 | * Retrieve rooms information with params
43 | *
44 | * @param company Company ID
45 | * @param params Parameters
46 | * @throws JSONException If error occurred
47 | * @return {@link JSONObject}
48 | */
49 | public JSONObject getRooms(String company, HashMap params) throws JSONException {
50 | return oClient.get("/messages/v3/" + company + "/rooms", params);
51 | }
52 |
53 | /**
54 | * Get a specific room information
55 | *
56 | * @param company Company ID
57 | * @param roomId Room ID
58 | * @param params Parameters
59 | * @throws JSONException If error occurred
60 | * @return {@link JSONObject}
61 | */
62 | public JSONObject getRoomDetails(String company, String roomId, HashMap params) throws JSONException {
63 | return oClient.get("/messages/v3/" + company + "/rooms/" + roomId, params);
64 | }
65 |
66 | /**
67 | * Get messages from a specific room
68 | *
69 | * @param company Company ID
70 | * @param roomId Room ID
71 | * @param params Parameters
72 | * @throws JSONException If error occurred
73 | * @return {@link JSONObject}
74 | */
75 | public JSONObject getRoomMessages(String company, String roomId, HashMap params) throws JSONException {
76 | return oClient.get("/messages/v3/" + company + "/rooms/" + roomId + "/stories", params);
77 | }
78 |
79 | /**
80 | * Get a specific room by offer ID
81 | *
82 | * @param company Company ID
83 | * @param offerId Offer ID
84 | * @param params Parameters
85 | * @throws JSONException If error occurred
86 | * @return {@link JSONObject}
87 | */
88 | public JSONObject getRoomByOffer(String company, String offerId, HashMap params) throws JSONException {
89 | return oClient.get("/messages/v3/" + company + "/rooms/offers/" + offerId, params);
90 | }
91 |
92 | /**
93 | * Get a specific room by application ID
94 | *
95 | * @param company Company ID
96 | * @param applicationId Application ID
97 | * @param params Parameters
98 | * @throws JSONException If error occurred
99 | * @return {@link JSONObject}
100 | */
101 | public JSONObject getRoomByApplication(String company, String applicationId, HashMap params) throws JSONException {
102 | return oClient.get("/messages/v3/" + company + "/rooms/appications/" + applicationId, params);
103 | }
104 |
105 | /**
106 | * Get a specific room by contract ID
107 | *
108 | * @param company Company ID
109 | * @param contractId Contract ID
110 | * @param params Parameters
111 | * @throws JSONException If error occurred
112 | * @return {@link JSONObject}
113 | */
114 | public JSONObject getRoomByContract(String company, String contractId, HashMap params) throws JSONException {
115 | return oClient.get("/messages/v3/" + company + "/rooms/contracts/" + contractId, params);
116 | }
117 |
118 | /**
119 | * Create a new room
120 | *
121 | * @param company Company ID
122 | * @param params Parameters
123 | * @throws JSONException If error occurred
124 | * @return {@link JSONObject}
125 | */
126 | public JSONObject createRoom(String company, HashMap params) throws JSONException {
127 | return oClient.post("/messages/v3/" + company + "/rooms", params);
128 | }
129 |
130 | /**
131 | * Send a message to a room
132 | *
133 | * @param company Company ID
134 | * @param roomId Room ID
135 | * @param params Parameters
136 | * @throws JSONException If error occurred
137 | * @return {@link JSONObject}
138 | */
139 | public JSONObject sendMessageToRoom(String company, String roomId, HashMap params) throws JSONException {
140 | return oClient.post("/messages/v3/" + company + "/rooms/" + roomId + "/stories", params);
141 | }
142 |
143 | /**
144 | * Send a message to a batch of rooms
145 | *
146 | * @param company Company ID
147 | * @param params Parameters
148 | * @throws JSONException If error occurred
149 | * @return {@link JSONObject}
150 | */
151 | public JSONObject sendMessageToRooms(String company, HashMap params) throws JSONException {
152 | return oClient.post("/messages/v3/" + company + "/stories/batch", params);
153 | }
154 |
155 | /**
156 | * Update a room settings
157 | *
158 | * @param company Company ID
159 | * @param roomId Room ID
160 | * @param username User ID
161 | * @param params Parameters
162 | * @throws JSONException If error occurred
163 | * @return {@link JSONObject}
164 | */
165 | public JSONObject updateRoomSettings(String company, String roomId, String username, HashMap params) throws JSONException {
166 | return oClient.put("/messages/v3/" + company + "/rooms/" + roomId + "/users/" + username, params);
167 | }
168 |
169 | /**
170 | * Update the metadata of a room
171 | *
172 | * @param company Company ID
173 | * @param roomId Room ID
174 | * @param params Parameters
175 | * @throws JSONException If error occurred
176 | * @return {@link JSONObject}
177 | */
178 | public JSONObject updateRoomMetadata(String company, String roomId, HashMap params) throws JSONException {
179 | return oClient.put("/messages/v3/" + company + "/rooms/" + roomId, params);
180 | }
181 |
182 | }
183 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Metadata.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * http://developers.upwork.com/API-Terms-of-Use
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers;
18 |
19 | import java.util.HashMap;
20 |
21 | import com.Upwork.ClassPreamble;
22 | import com.Upwork.api.OAuthClient;
23 |
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | @ClassPreamble (
28 | author = "Maksym Novozhylov ",
29 | date = "6/4/2014",
30 | currentRevision = 1,
31 | lastModified = "6/4/2014",
32 | lastModifiedBy = "Maksym Novozhylov",
33 | reviewers = {"Yiota Tsakiri"}
34 | )
35 | public final class Metadata {
36 |
37 | final static String ENTRY_POINT = "api";
38 |
39 | private OAuthClient oClient = null;
40 |
41 | public Metadata(OAuthClient client) {
42 | oClient = client;
43 | oClient.setEntryPoint(ENTRY_POINT);
44 | }
45 |
46 | /**
47 | * Get Categories
48 | *
49 | * @throws JSONException If error occurred
50 | * @return {@link JSONObject}
51 | */
52 | public JSONObject getCategories() throws JSONException {
53 | return oClient.get("/profiles/v1/metadata/categories");
54 | }
55 |
56 | /**
57 | * Get Categories (v2)
58 | *
59 | * @throws JSONException If error occurred
60 | * @return {@link JSONObject}
61 | */
62 | public JSONObject getCategoriesV2() throws JSONException {
63 | return oClient.get("/profiles/v2/metadata/categories");
64 | }
65 |
66 | /**
67 | * Get Skills
68 | *
69 | * @throws JSONException If error occurred
70 | * @return {@link JSONObject}
71 | */
72 | public JSONObject getSkills() throws JSONException {
73 | return oClient.get("/profiles/v1/metadata/skills");
74 | }
75 |
76 | /**
77 | * Get Skills V2
78 | *
79 | * @throws JSONException If error occurred
80 | * @return {@link JSONObject}
81 | */
82 | public JSONObject getSkillsV2() throws JSONException {
83 | return oClient.get("/profiles/v2/metadata/skills");
84 | }
85 |
86 | /**
87 | * Get Specialties
88 | *
89 | * @throws JSONException If error occurred
90 | * @return {@link JSONObject}
91 | */
92 | public JSONObject getSpecialties() throws JSONException {
93 | return oClient.get("/profiles/v1/metadata/specialties");
94 | }
95 |
96 | /**
97 | * Get regions
98 | *
99 | * @throws JSONException If error occurred
100 | * @return {@link JSONObject}
101 | */
102 | public JSONObject getRegions() throws JSONException {
103 | return oClient.get("/profiles/v1/metadata/regions");
104 | }
105 |
106 | /**
107 | * Get tests
108 | *
109 | * @throws JSONException If error occurred
110 | * @return {@link JSONObject}
111 | */
112 | public JSONObject getTests() throws JSONException {
113 | return oClient.get("/profiles/v1/metadata/tests");
114 | }
115 |
116 | /**
117 | * Get reasons
118 | *
119 | * @param params Parameters
120 | * @throws JSONException If error occurred
121 | * @return {@link JSONObject}
122 | */
123 | public JSONObject getReasons(HashMap params) throws JSONException {
124 | return oClient.get("/profiles/v1/metadata/reasons", params);
125 | }
126 |
127 | }
128 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Organization/Companies.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers.Organization;
18 |
19 | import com.Upwork.ClassPreamble;
20 | import com.Upwork.api.OAuthClient;
21 |
22 | import org.json.JSONException;
23 | import org.json.JSONObject;
24 |
25 | @ClassPreamble (
26 | author = "Maksym Novozhylov ",
27 | date = "6/4/2014",
28 | currentRevision = 1,
29 | lastModified = "6/4/2014",
30 | lastModifiedBy = "Maksym Novozhylov",
31 | reviewers = {"Yiota Tsakiri"}
32 | )
33 | public final class Companies {
34 |
35 | final static String ENTRY_POINT = "api";
36 |
37 | private OAuthClient oClient = null;
38 |
39 | public Companies(OAuthClient client) {
40 | oClient = client;
41 | oClient.setEntryPoint(ENTRY_POINT);
42 | }
43 |
44 | /**
45 | * Get Companies Info
46 | *
47 | * @throws JSONException If error occurred
48 | * @return {@link JSONObject}
49 | */
50 | public JSONObject getList() throws JSONException {
51 | return oClient.get("/hr/v2/companies");
52 | }
53 |
54 | /**
55 | * Get Specific Company
56 | *
57 | * @param cmpReference Company reference
58 | * @throws JSONException If error occurred
59 | * @return {@link JSONObject}
60 | */
61 | public JSONObject getSpecific(String cmpReference) throws JSONException {
62 | return oClient.get("/hr/v2/companies/" + cmpReference);
63 | }
64 |
65 | /**
66 | * Get Teams in Company
67 | *
68 | * @param cmpReference Company reference
69 | * @throws JSONException If error occurred
70 | * @return {@link JSONObject}
71 | */
72 | public JSONObject getTeams(String cmpReference) throws JSONException {
73 | return oClient.get("/hr/v2/companies/" + cmpReference + "/teams");
74 | }
75 |
76 | /**
77 | * Get Users in Company
78 | *
79 | * @param cmpReference Company reference
80 | * @throws JSONException If error occurred
81 | * @return {@link JSONObject}
82 | */
83 | public JSONObject getUsers(String cmpReference) throws JSONException {
84 | return oClient.get("/hr/v2/companies/" + cmpReference + "/users");
85 | }
86 |
87 | }
88 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Organization/Teams.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers.Organization;
18 |
19 | import com.Upwork.ClassPreamble;
20 | import com.Upwork.api.OAuthClient;
21 |
22 | import org.json.JSONException;
23 | import org.json.JSONObject;
24 |
25 | @ClassPreamble (
26 | author = "Maksym Novozhylov ",
27 | date = "6/4/2014",
28 | currentRevision = 1,
29 | lastModified = "6/4/2014",
30 | lastModifiedBy = "Maksym Novozhylov",
31 | reviewers = {"Yiota Tsakiri"}
32 | )
33 | public final class Teams {
34 |
35 | final static String ENTRY_POINT = "api";
36 |
37 | private OAuthClient oClient = null;
38 |
39 | public Teams(OAuthClient client) {
40 | oClient = client;
41 | oClient.setEntryPoint(ENTRY_POINT);
42 | }
43 |
44 | /**
45 | * Get Teams info
46 | *
47 | * @throws JSONException If error occurred
48 | * @return {@link JSONObject}
49 | */
50 | public JSONObject getList() throws JSONException {
51 | return oClient.get("/hr/v2/teams");
52 | }
53 |
54 | /**
55 | * Get Users in Team
56 | *
57 | * @param teamReference Team reference
58 | * @throws JSONException If error occurred
59 | * @return {@link JSONObject}
60 | */
61 | public JSONObject getUsersInTeam(String teamReference) throws JSONException {
62 | return oClient.get("/hr/v2/teams/" + teamReference + "/users");
63 | }
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Organization/Users.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers.Organization;
18 |
19 | import com.Upwork.ClassPreamble;
20 | import com.Upwork.api.OAuthClient;
21 |
22 | import org.json.JSONException;
23 | import org.json.JSONObject;
24 |
25 | @ClassPreamble (
26 | author = "Maksym Novozhylov ",
27 | date = "6/4/2014",
28 | currentRevision = 1,
29 | lastModified = "10/13/2014",
30 | lastModifiedBy = "Maksym Novozhylov",
31 | reviewers = {"Yiota Tsakiri"}
32 | )
33 | public final class Users {
34 |
35 | final static String ENTRY_POINT = "api";
36 |
37 | private OAuthClient oClient = null;
38 |
39 | public Users(OAuthClient client) {
40 | oClient = client;
41 | oClient.setEntryPoint(ENTRY_POINT);
42 | }
43 |
44 | /**
45 | * Get Auth User Info
46 | *
47 | * @throws JSONException If error occurred
48 | * @return {@link JSONObject}
49 | */
50 | public JSONObject getMyInfo() throws JSONException {
51 | return oClient.get("/hr/v2/users/me");
52 | }
53 |
54 | /**
55 | * Get Specific User Info
56 | *
57 | * @param userReference User reference
58 | * @throws JSONException If error occurred
59 | * @return {@link JSONObject}
60 | */
61 | public JSONObject getSpecific(String userReference) throws JSONException {
62 | return oClient.get("/hr/v2/users/" + userReference);
63 | }
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Payments.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers;
18 |
19 | import java.util.HashMap;
20 |
21 | import com.Upwork.ClassPreamble;
22 | import com.Upwork.api.OAuthClient;
23 |
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | @ClassPreamble (
28 | author = "Maksym Novozhylov ",
29 | date = "6/4/2014",
30 | currentRevision = 1,
31 | lastModified = "6/4/2014",
32 | lastModifiedBy = "Maksym Novozhylov",
33 | reviewers = {"Yiota Tsakiri"}
34 | )
35 | public final class Payments {
36 |
37 | final static String ENTRY_POINT = "api";
38 |
39 | private OAuthClient oClient = null;
40 |
41 | public Payments(OAuthClient client) {
42 | oClient = client;
43 | oClient.setEntryPoint(ENTRY_POINT);
44 | }
45 |
46 | /**
47 | * Submit a Custom Payment
48 | *
49 | * @param teamReference Team reference
50 | * @param params Parameters
51 | * @throws JSONException If error occurred
52 | * @return {@link JSONObject}
53 | */
54 | public JSONObject submitBonus(String teamReference, HashMap params) throws JSONException {
55 | return oClient.post("/hr/v2/teams/" + teamReference + "/adjustments", params);
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Reports/Finance/Accounts.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers.Reports.Finance;
18 |
19 | import java.util.HashMap;
20 |
21 | import com.Upwork.ClassPreamble;
22 | import com.Upwork.api.OAuthClient;
23 |
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | @ClassPreamble (
28 | author = "Maksym Novozhylov ",
29 | date = "6/4/2014",
30 | currentRevision = 1,
31 | lastModified = "6/4/2014",
32 | lastModifiedBy = "Maksym Novozhylov",
33 | reviewers = {"Yiota Tsakiri"}
34 | )
35 | public final class Accounts {
36 |
37 | final static String ENTRY_POINT = "gds";
38 |
39 | private OAuthClient oClient = null;
40 |
41 | public Accounts(OAuthClient client) {
42 | oClient = client;
43 | oClient.setEntryPoint(ENTRY_POINT);
44 | }
45 |
46 | /**
47 | * Generate Financial Reports for an owned Account
48 | *
49 | * @param freelancerReference Freelancer's reference
50 | * @param params Parameters
51 | * @throws JSONException If error occurred
52 | * @return {@link JSONObject}
53 | */
54 | public JSONObject getOwned(String freelancerReference, HashMap params) throws JSONException {
55 | return oClient.get("/finreports/v2/financial_account_owner/" + freelancerReference, params);
56 | }
57 |
58 | /**
59 | * Generate Financial Reports for a Specific Account
60 | *
61 | * @param entityReference Entity reference
62 | * @param params Parameters
63 | * @throws JSONException If error occurred
64 | * @return {@link JSONObject}
65 | */
66 | public JSONObject getSpecific(String entityReference, HashMap params) throws JSONException {
67 | return oClient.get("/finreports/v2/financial_accounts/" + entityReference, params);
68 | }
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Reports/Finance/Billings.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers.Reports.Finance;
18 |
19 | import java.util.HashMap;
20 |
21 | import com.Upwork.ClassPreamble;
22 | import com.Upwork.api.OAuthClient;
23 |
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | @ClassPreamble (
28 | author = "Maksym Novozhylov ",
29 | date = "6/4/2014",
30 | currentRevision = 1,
31 | lastModified = "6/4/2014",
32 | lastModifiedBy = "Maksym Novozhylov",
33 | reviewers = {"Yiota Tsakiri"}
34 | )
35 | public final class Billings {
36 |
37 | final static String ENTRY_POINT = "gds";
38 |
39 | private OAuthClient oClient = null;
40 |
41 | public Billings(OAuthClient client) {
42 | oClient = client;
43 | oClient.setEntryPoint(ENTRY_POINT);
44 | }
45 |
46 | /**
47 | * Generate Billing Reports for a Specific Freelancer
48 | *
49 | * @param freelancerReference Freelancer's reference
50 | * @param params Parameters
51 | * @throws JSONException If error occurred
52 | * @return {@link JSONObject}
53 | */
54 | public JSONObject getByFreelancer(String freelancerReference, HashMap params) throws JSONException {
55 | return oClient.get("/finreports/v2/providers/" + freelancerReference + "/billings", params);
56 | }
57 |
58 | /**
59 | * Generate Billing Reports for a Specific Freelancer's Team
60 | *
61 | * @param freelancerTeamReference Freelancer's team reference
62 | * @param params Parameters
63 | * @throws JSONException If error occurred
64 | * @return {@link JSONObject}
65 | */
66 | public JSONObject getByFreelancersTeam(String freelancerTeamReference, HashMap params) throws JSONException {
67 | return oClient.get("/finreports/v2/provider_teams/" + freelancerTeamReference + "/billings", params);
68 | }
69 |
70 | /**
71 | * Generate Billing Reports for a Specific Freelancer's Company
72 | *
73 | * @param freelancerCompanyReference Freelancer's company reference
74 | * @param params Parameters
75 | * @throws JSONException If error occurred
76 | * @return {@link JSONObject}
77 | */
78 | public JSONObject getByFreelancersCompany(String freelancerCompanyReference, HashMap params) throws JSONException {
79 | return oClient.get("/finreports/v2/provider_companies/" + freelancerCompanyReference + "/billings", params);
80 | }
81 |
82 | /**
83 | * Generate Billing Reports for a Specific Buyer's Team
84 | *
85 | * @param buyerTeamReference Buyer team reference
86 | * @param params Parameters
87 | * @throws JSONException If error occurred
88 | * @return {@link JSONObject}
89 | */
90 | public JSONObject getByBuyersTeam(String buyerTeamReference, HashMap params) throws JSONException {
91 | return oClient.get("/finreports/v2/buyer_teams/" + buyerTeamReference + "/billings", params);
92 | }
93 |
94 | /**
95 | * Generate Billing Reports for a Specific Buyer's Company
96 | *
97 | * @param buyerCompanyReference Buyer company reference
98 | * @param params Parameters
99 | * @throws JSONException If error occurred
100 | * @return {@link JSONObject}
101 | */
102 | public JSONObject getByBuyersCompany(String buyerCompanyReference, HashMap params) throws JSONException {
103 | return oClient.get("/finreports/v2/buyer_companies/" + buyerCompanyReference + "/billings", params);
104 | }
105 |
106 | }
107 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Reports/Finance/Earnings.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers.Reports.Finance;
18 |
19 | import java.util.HashMap;
20 |
21 | import com.Upwork.ClassPreamble;
22 | import com.Upwork.api.OAuthClient;
23 |
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | @ClassPreamble (
28 | author = "Maksym Novozhylov ",
29 | date = "6/4/2014",
30 | currentRevision = 1,
31 | lastModified = "6/4/2014",
32 | lastModifiedBy = "Maksym Novozhylov",
33 | reviewers = {"Yiota Tsakiri"}
34 | )
35 | public final class Earnings {
36 |
37 | final static String ENTRY_POINT = "gds";
38 |
39 | private OAuthClient oClient = null;
40 |
41 | public Earnings(OAuthClient client) {
42 | oClient = client;
43 | oClient.setEntryPoint(ENTRY_POINT);
44 | }
45 |
46 | /**
47 | * Generate Earning Reports for a Specific Freelancer
48 | *
49 | * @param freelancerReference Freelancer's reference
50 | * @param params Parameters
51 | * @throws JSONException If error occurred
52 | * @return {@link JSONObject}
53 | */
54 | public JSONObject getByFreelancer(String freelancerReference, HashMap params) throws JSONException {
55 | return oClient.get("/finreports/v2/providers/" + freelancerReference + "/earnings", params);
56 | }
57 |
58 | /**
59 | * Generate Earning Reports for a Specific Freelancer's Team
60 | *
61 | * @param freelancerTeamReference Freelancer's team reference
62 | * @param params Parameters
63 | * @throws JSONException If error occurred
64 | * @return {@link JSONObject}
65 | */
66 | public JSONObject getByFreelancersTeam(String freelancerTeamReference, HashMap params) throws JSONException {
67 | return oClient.get("/finreports/v2/provider_teams/" + freelancerTeamReference + "/earnings", params);
68 | }
69 |
70 | /**
71 | * Generate Earning Reports for a Specific Freelancer's Company
72 | *
73 | * @param freelancerCompanyReference Freelancer's company reference
74 | * @param params Parameters
75 | * @throws JSONException If error occurred
76 | * @return {@link JSONObject}
77 | */
78 | public JSONObject getByFreelancersCompany(String freelancerCompanyReference, HashMap params) throws JSONException {
79 | return oClient.get("/finreports/v2/provider_companies/" + freelancerCompanyReference + "/earnings", params);
80 | }
81 |
82 | /**
83 | * Generate Earning Reports for a Specific Buyer's Team
84 | *
85 | * @param buyerTeamReference Buyer team reference
86 | * @param params Parameters
87 | * @throws JSONException If error occurred
88 | * @return {@link JSONObject}
89 | */
90 | public JSONObject getByBuyersTeam(String buyerTeamReference, HashMap params) throws JSONException {
91 | return oClient.get("/finreports/v2/buyer_teams/" + buyerTeamReference + "/earnings", params);
92 | }
93 |
94 | /**
95 | * Generate Earning Reports for a Specific Buyer's Company
96 | *
97 | * @param buyerCompanyReference Buyer company reference
98 | * @param params Parameters
99 | * @throws JSONException If error occurred
100 | * @return {@link JSONObject}
101 | */
102 | public JSONObject getByBuyersCompany(String buyerCompanyReference, HashMap params) throws JSONException {
103 | return oClient.get("/finreports/v2/buyer_companies/" + buyerCompanyReference + "/earnings", params);
104 | }
105 |
106 | }
107 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Reports/Time.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers.Reports;
18 |
19 | import java.util.HashMap;
20 |
21 | import com.Upwork.ClassPreamble;
22 | import com.Upwork.api.OAuthClient;
23 |
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | @ClassPreamble (
28 | author = "Maksym Novozhylov ",
29 | date = "6/4/2014",
30 | currentRevision = 1,
31 | lastModified = "6/4/2014",
32 | lastModifiedBy = "Maksym Novozhylov",
33 | reviewers = {"Yiota Tsakiri"}
34 | )
35 | public final class Time {
36 |
37 | final static String ENTRY_POINT = "gds";
38 |
39 | private OAuthClient oClient = null;
40 |
41 | public Time(OAuthClient client) {
42 | oClient = client;
43 | oClient.setEntryPoint(ENTRY_POINT);
44 | }
45 |
46 | /**
47 | * Generate Time Reports for a Specific Team/Comapny/Agency
48 | *
49 | * @param company Company ID
50 | * @param team (Optional) Team ID
51 | * @param agency (Optional) Agency ID
52 | * @param params (Optional) Parameters
53 | * @param hideFinDetails (Optional) Hides all financial details
54 | * @throws JSONException If error occurred
55 | * @return {@link JSONObject}
56 | */
57 | private JSONObject _getByType(String company, String team, String agency, HashMap params, Boolean hideFinDetails) throws JSONException {
58 | String url = "";
59 | if (team != null) {
60 | url = "/teams/" + team;
61 | if (hideFinDetails) {
62 | url = url + "/hours";
63 | }
64 | } else if (agency != null) {
65 | url = "/agencies/" + agency;
66 | }
67 |
68 | return oClient.get("/timereports/v1/companies/" + company + url, params);
69 | }
70 |
71 | /**
72 | * Generate Time Reports for a Specific Team (with financial info)
73 | *
74 | * @param company Company ID
75 | * @param team Team ID
76 | * @param params Parameters
77 | * @throws JSONException If error occurred
78 | * @return {@link JSONObject}
79 | */
80 | public JSONObject getByTeamFull(String company, String team, HashMap params) throws JSONException {
81 | return _getByType(company, team, null, params, false);
82 | }
83 |
84 | /**
85 | * Generate Time Reports for a Specific Team (hide financial info)
86 | *
87 | * @param company Company ID
88 | * @param team Team ID
89 | * @param params Parameters
90 | * @throws JSONException If error occurred
91 | * @return {@link JSONObject}
92 | */
93 | public JSONObject getByTeamLimited(String company, String team, HashMap params) throws JSONException {
94 | return _getByType(company, team, null, params, true);
95 | }
96 |
97 | /**
98 | * Generating Agency Specific Reports
99 | *
100 | * @param company Company ID
101 | * @param agency Agency ID
102 | * @param params Parameters
103 | * @throws JSONException If error occurred
104 | * @return {@link JSONObject}
105 | */
106 | public JSONObject getByAgency(String company, String agency, HashMap params) throws JSONException {
107 | return _getByType(company, null, agency, params, false);
108 | }
109 |
110 | /**
111 | * Generating Company Wide Reports
112 | *
113 | * @param company Company ID
114 | * @param params Parameters
115 | * @throws JSONException If error occurred
116 | * @return {@link JSONObject}
117 | */
118 | public JSONObject getByCompany(String company, HashMap params) throws JSONException {
119 | return _getByType(company, null, null, params, false);
120 | }
121 |
122 | /**
123 | * Generating Freelancer's Specific Reports (hide financial info)
124 | *
125 | * @param freelancerId Freelancer's ID
126 | * @param params Parameters
127 | * @throws JSONException If error occurred
128 | * @return {@link JSONObject}
129 | */
130 | public JSONObject getByFreelancerLimited(String freelancerId, HashMap params) throws JSONException {
131 | return oClient.get("/timereports/v1/providers/" + freelancerId + "/hours", params);
132 | }
133 |
134 | /**
135 | * Generating Freelancer's Specific Reports (with financial info)
136 | *
137 | * @param freelancerId Freelancer's ID
138 | * @param params Parameters
139 | * @throws JSONException If error occurred
140 | * @return {@link JSONObject}
141 | */
142 | public JSONObject getByFreelancerFull(String freelancerId, HashMap params) throws JSONException {
143 | return oClient.get("/timereports/v1/providers/" + freelancerId, params);
144 | }
145 |
146 | }
147 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Snapshot.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers;
18 |
19 | import java.util.HashMap;
20 |
21 | import com.Upwork.ClassPreamble;
22 | import com.Upwork.api.OAuthClient;
23 |
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | @ClassPreamble (
28 | author = "Maksym Novozhylov ",
29 | date = "6/4/2014",
30 | currentRevision = 1,
31 | lastModified = "24/5/2014",
32 | lastModifiedBy = "Maksym Novozhylov",
33 | reviewers = {"Yiota Tsakiri"}
34 | )
35 | public final class Snapshot {
36 |
37 | final static String ENTRY_POINT = "api";
38 |
39 | private OAuthClient oClient = null;
40 |
41 | public Snapshot(OAuthClient client) {
42 | oClient = client;
43 | oClient.setEntryPoint(ENTRY_POINT);
44 | }
45 |
46 | /**
47 | * Get snapshot info by specific contract
48 | *
49 | * @param contractId Contract ID
50 | * @param ts Timestamp
51 | * @throws JSONException If error occurred
52 | * @return {@link JSONObject}
53 | */
54 | public JSONObject getByContract(String contractId, String ts) throws JSONException {
55 | return oClient.get("/team/v3/snapshots/contracts/" + contractId + "/" + ts);
56 | }
57 |
58 | /**
59 | * Update snapshot by specific contract
60 | *
61 | * @param contractId Contract ID
62 | * @param ts Timestamp
63 | * @param params Parameters
64 | * @throws JSONException If error occurred
65 | * @return {@link JSONObject}
66 | */
67 | public JSONObject updateByContract(String contractId, String ts, HashMap params) throws JSONException {
68 | return oClient.put("/team/v3/snapshots/contracts/" + contractId + "/" + ts, params);
69 | }
70 |
71 | /**
72 | * Delete snapshot by specific contract
73 | *
74 | * @param contractId Contract ID
75 | * @param ts Timestamp
76 | * @throws JSONException If error occurred
77 | * @return {@link JSONObject}
78 | */
79 | public JSONObject deleteByContract(String contractId, String ts) throws JSONException {
80 | return oClient.delete("/team/v3/snapshots/contracts/" + contractId + "/" + ts);
81 | }
82 |
83 | }
84 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Workdays.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2015 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers;
18 |
19 | import java.util.HashMap;
20 |
21 | import com.Upwork.ClassPreamble;
22 | import com.Upwork.api.OAuthClient;
23 |
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | @ClassPreamble (
28 | author = "Maksym Novozhylov ",
29 | date = "14/7/2015",
30 | currentRevision = 1,
31 | lastModified = "24/5/2018",
32 | lastModifiedBy = "Maksym Novozhylov",
33 | reviewers = {"Yiota Tsakiri"}
34 | )
35 | public final class Workdays {
36 |
37 | final static String ENTRY_POINT = "api";
38 |
39 | private OAuthClient oClient = null;
40 |
41 | public Workdays(OAuthClient client) {
42 | oClient = client;
43 | oClient.setEntryPoint(ENTRY_POINT);
44 | }
45 |
46 | /**
47 | * Get Workdays by Company
48 | *
49 | * @param company Company ID
50 | * @param fromDate Start date
51 | * @param tillDate End date
52 | * @param params (Optional) Parameters
53 | * @throws JSONException If error occurred
54 | * @return {@link JSONObject}
55 | */
56 | public JSONObject getByCompany(String company, String fromDate, String tillDate, HashMap params) throws JSONException {
57 | return oClient.get("/team/v3/workdays/companies/" + company + "/" + fromDate + "," + tillDate, params);
58 | }
59 |
60 | /**
61 | * Get Workdays by Contract
62 | *
63 | * @param contract Contract ID
64 | * @param fromDate Start date
65 | * @param tillDate End date
66 | * @param params (Optional) Parameters
67 | * @throws JSONException If error occurred
68 | * @return {@link JSONObject}
69 | */
70 | public JSONObject getByContract(String contract, String fromDate, String tillDate, HashMap params) throws JSONException {
71 | return oClient.get("/team/v3/workdays/contracts/" + contract + "/" + fromDate + "," + tillDate, params);
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/src/com/Upwork/api/Routers/Workdiary.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Upwork
3 | *
4 | * Licensed under the Upwork's API Terms of Use;
5 | * you may not use this file except in compliance with the Terms.
6 | * You may obtain a copy of the Terms at
7 | *
8 | * https://developers.upwork.com/api-tos.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.Upwork.api.Routers;
18 |
19 | import java.util.HashMap;
20 |
21 | import com.Upwork.ClassPreamble;
22 | import com.Upwork.api.OAuthClient;
23 |
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | @ClassPreamble (
28 | author = "Maksym Novozhylov ",
29 | date = "6/3/2014",
30 | currentRevision = 1,
31 | lastModified = "24/5/2018",
32 | lastModifiedBy = "Maksym Novozhylov",
33 | reviewers = {"Yiota Tsakiri"}
34 | )
35 | public final class Workdiary {
36 |
37 | final static String ENTRY_POINT = "api";
38 |
39 | private OAuthClient oClient = null;
40 |
41 | public Workdiary(OAuthClient client) {
42 | oClient = client;
43 | oClient.setEntryPoint(ENTRY_POINT);
44 | }
45 |
46 | /**
47 | * Get Workdiary
48 | *
49 | * @param company Company ID
50 | * @param date Date
51 | * @param params (Optional) Parameters
52 | * @throws JSONException If error occurred
53 | * @return {@link JSONObject}
54 | */
55 | public JSONObject get(String company, String date, HashMap params) throws JSONException {
56 | return oClient.get("/team/v3/workdiaries/companies/" + company + "/" + date, params);
57 | }
58 |
59 | /**
60 | * Get Work Diary by Contract
61 | *
62 | * @param contract Contract ID
63 | * @param date Date
64 | * @param params (Optional) Parameters
65 | * @throws JSONException If error occurred
66 | * @return {@link JSONObject}
67 | */
68 | public JSONObject getByContract(String contract, String date, HashMap params) throws JSONException {
69 | return oClient.get("/team/v3/workdiaries/contracts/" + contract + "/" + date, params);
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/test/com/Upwork/api/ConfigTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import org.junit.Test;
6 | import org.junit.runner.RunWith;
7 | import org.mockito.Matchers;
8 | import org.mockito.Spy;
9 | import org.powermock.api.mockito.PowerMockito;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.*;
12 |
13 | import static org.mockito.Mockito.*;
14 |
15 | import java.io.FileInputStream;
16 | import java.util.Properties;
17 |
18 | import com.Upwork.api.Config;
19 |
20 | @RunWith(PowerMockRunner.class)
21 | @PrepareForTest({
22 | Config.class
23 | })
24 | public class ConfigTest {
25 | @Spy private final Properties properties = new Properties();
26 |
27 | @Test public void getProperty() throws Exception {
28 | when(properties.getProperty("key")).thenReturn("value");
29 |
30 | final FileInputStream fileInputStreamMock = PowerMockito.mock(FileInputStream.class);
31 | PowerMockito.whenNew(FileInputStream.class).withArguments(Matchers.anyString())
32 | .thenReturn(fileInputStreamMock);
33 |
34 | Config config = new Config(properties);
35 | String test = config.getProperty("key");
36 |
37 | assertEquals("get config property", "value", test);
38 | }
39 | }
--------------------------------------------------------------------------------
/test/com/Upwork/api/OAuthClientTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api;
2 |
3 | import static org.junit.Assert.*;
4 | import oauth.signpost.commonshttp.CommonsHttpOAuthProvider;
5 |
6 | import org.junit.Before;
7 | import org.junit.Ignore;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.mockito.Matchers;
11 | import org.mockito.Spy;
12 | import org.powermock.api.mockito.PowerMockito;
13 | import org.powermock.core.classloader.annotations.PrepareForTest;
14 | import org.powermock.modules.junit4.*;
15 |
16 | import static org.mockito.Mockito.*;
17 |
18 | import java.io.FileInputStream;
19 | import java.util.HashMap;
20 | import java.util.Properties;
21 |
22 | import oauth.signpost.commonshttp.CommonsHttpOAuthConsumer;
23 |
24 | import com.Upwork.api.Config;
25 | import com.Upwork.api.OAuthClient;
26 |
27 | @RunWith(PowerMockRunner.class)
28 | @PrepareForTest({
29 | Config.class,
30 | OAuthClient.class
31 | })
32 | public class OAuthClientTest {
33 | @Spy private final Properties properties = new Properties();
34 |
35 | private HashMap expectedToken;
36 | private final CommonsHttpOAuthConsumer CommonsHttpOAuthConsumerMock = PowerMockito.mock(CommonsHttpOAuthConsumer.class);
37 | private final CommonsHttpOAuthProvider CommonsHttpOAuthProviderMock = PowerMockito.mock(CommonsHttpOAuthProvider.class);
38 |
39 | @Before
40 | public void setUp() {
41 | expectedToken = new HashMap();
42 | expectedToken.put("token", "atoken");
43 | expectedToken.put("secret", "asecret");
44 | }
45 |
46 | private OAuthClient getMockedClient() throws Exception {
47 | when(properties.getProperty("consumerKey")).thenReturn("key");
48 | when(properties.getProperty("consumerSecret")).thenReturn("secret");
49 |
50 | final FileInputStream fileInputStreamMock = PowerMockito.mock(FileInputStream.class);
51 | PowerMockito.whenNew(FileInputStream.class).withArguments(Matchers.anyString())
52 | .thenReturn(fileInputStreamMock);
53 |
54 | PowerMockito.whenNew(CommonsHttpOAuthConsumer.class).withArguments(Matchers.anyString(), Matchers.anyString())
55 | .thenReturn(CommonsHttpOAuthConsumerMock);
56 |
57 | PowerMockito.whenNew(CommonsHttpOAuthProvider.class).withArguments(Matchers.anyString(), Matchers.anyString(), Matchers.anyString())
58 | .thenReturn(CommonsHttpOAuthProviderMock);
59 |
60 | Config config = new Config(properties);
61 |
62 | OAuthClient client = new OAuthClient(config);
63 |
64 | return client;
65 | }
66 |
67 | @Ignore("weird behavior in Travis") @Test public void getAuthorizationUrl() throws Exception {
68 | when(CommonsHttpOAuthProviderMock.retrieveRequestToken(CommonsHttpOAuthConsumerMock, "")).thenReturn("url");
69 |
70 | OAuthClient client = getMockedClient();
71 | String authzUrl = client.getAuthorizationUrl();
72 |
73 | assertEquals("get authorization url", "url", authzUrl);
74 | }
75 |
76 | @Test public void getAccessTokenSet() throws Exception {
77 | when(CommonsHttpOAuthConsumerMock.getToken()).thenReturn("atoken");
78 | when(CommonsHttpOAuthConsumerMock.getTokenSecret()).thenReturn("asecret");
79 |
80 | OAuthClient client = getMockedClient();
81 | HashMap token = client.getAccessTokenSet("verifier");
82 |
83 | assertEquals(expectedToken, token);
84 | }
85 |
86 | @Test public void setTokenWithSecret() throws Exception {
87 | OAuthClient client = getMockedClient();
88 | HashMap token = client.setTokenWithSecret("atoken", "asecret");
89 |
90 | assertEquals(expectedToken, token);
91 | }
92 | }
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Activities/EngagementTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers.Activities;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import java.util.HashMap;
6 |
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.PowerMockRunner;
12 |
13 | import com.Upwork.api.Routers.Helper;
14 | import com.Upwork.api.Routers.Activities.Engagement;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest({
18 | Engagement.class
19 | })
20 | public class EngagementTest extends Helper {
21 | @Test public void getSpecific() throws Exception {
22 | Engagement activities = new Engagement(client);
23 | JSONObject json = activities.getSpecific("1234");
24 |
25 | assertTrue(json instanceof JSONObject);
26 | }
27 |
28 | @Test public void assign() throws Exception {
29 | Engagement activities = new Engagement(client);
30 | JSONObject json = activities.assign("company", "team", "1234", new HashMap());
31 |
32 | assertTrue(json instanceof JSONObject);
33 | }
34 |
35 | @Test public void assignToEngagement() throws Exception {
36 | Engagement activities = new Engagement(client);
37 | JSONObject json = activities.assignToEngagement("1234", new HashMap());
38 |
39 | assertTrue(json instanceof JSONObject);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Activities/TeamTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers.Activities;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import java.util.HashMap;
6 |
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.PowerMockRunner;
12 |
13 | import com.Upwork.api.Routers.Helper;
14 | import com.Upwork.api.Routers.Activities.Team;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest({
18 | Team.class
19 | })
20 | public class TeamTest extends Helper {
21 | @Test public void getList() throws Exception {
22 | Team activities = new Team(client);
23 | JSONObject json = activities.getList("company", "team");
24 |
25 | assertTrue(json instanceof JSONObject);
26 | }
27 |
28 | @Test public void getSpecificList() throws Exception {
29 | Team activities = new Team(client);
30 | JSONObject json = activities.getSpecificList("company", "team", "code");
31 | assertTrue(json instanceof JSONObject);
32 | }
33 |
34 | @Test public void addActivity() throws Exception {
35 | Team activities = new Team(client);
36 | JSONObject json = activities.addActivity("company", "team", new HashMap());
37 |
38 | assertTrue(json instanceof JSONObject);
39 | }
40 |
41 | @Test public void updateActivity() throws Exception {
42 | Team activities = new Team(client);
43 | JSONObject json = activities.updateActivity("company", "team", "code", new HashMap());
44 |
45 | assertTrue(json instanceof JSONObject);
46 | }
47 |
48 | @Test public void archiveActivity() throws Exception {
49 | Team activities = new Team(client);
50 | JSONObject json = activities.archiveActivity("company", "team", "code");
51 |
52 | assertTrue(json instanceof JSONObject);
53 | }
54 |
55 | @Test public void unarchiveActivity() throws Exception {
56 | Team activities = new Team(client);
57 | JSONObject json = activities.unarchiveActivity("company", "team", "code");
58 |
59 | assertTrue(json instanceof JSONObject);
60 | }
61 |
62 | @Test public void updateBatch() throws Exception {
63 | Team activities = new Team(client);
64 | JSONObject json = activities.updateBatch("company", new HashMap());
65 |
66 | assertTrue(json instanceof JSONObject);
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/AuthTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import org.json.JSONObject;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 | import org.powermock.core.classloader.annotations.PrepareForTest;
9 | import org.powermock.modules.junit4.PowerMockRunner;
10 |
11 | import com.Upwork.api.Routers.Helper;
12 | import com.Upwork.api.Routers.Auth;
13 |
14 | @RunWith(PowerMockRunner.class)
15 | @PrepareForTest({
16 | Auth.class
17 | })
18 | public class AuthTest extends Helper {
19 | @Test public void getUserInfo() throws Exception {
20 | Auth auth = new Auth(client);
21 | JSONObject json = auth.getUserInfo();
22 |
23 | assertTrue(json instanceof JSONObject);
24 | }
25 | }
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Freelancers/ProfileTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers.Freelancers;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import org.json.JSONObject;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 | import org.powermock.core.classloader.annotations.PrepareForTest;
9 | import org.powermock.modules.junit4.PowerMockRunner;
10 |
11 | import com.Upwork.api.Routers.Helper;
12 | import com.Upwork.api.Routers.Freelancers.Profile;
13 |
14 | @RunWith(PowerMockRunner.class)
15 | @PrepareForTest({
16 | Profile.class
17 | })
18 | public class ProfileTest extends Helper {
19 | @Test public void getSpecific() throws Exception {
20 | Profile profile = new Profile(client);
21 | JSONObject json = profile.getSpecific("key");
22 |
23 | assertTrue(json instanceof JSONObject);
24 | }
25 |
26 | @Test public void getSpecificBrief() throws Exception {
27 | Profile profile = new Profile(client);
28 | JSONObject json = profile.getSpecificBrief("key");
29 |
30 | assertTrue(json instanceof JSONObject);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Freelancers/SearchTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers.Freelancers;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import java.util.HashMap;
6 |
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.PowerMockRunner;
12 |
13 | import com.Upwork.api.Routers.Helper;
14 | import com.Upwork.api.Routers.Freelancers.Search;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest({
18 | Search.class
19 | })
20 | public class SearchTest extends Helper {
21 | @Test public void find() throws Exception {
22 | Search search = new Search(client);
23 | JSONObject json = search.find(new HashMap());
24 |
25 | assertTrue(json instanceof JSONObject);
26 | }
27 | }
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Helper.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers;
2 |
3 | import java.util.HashMap;
4 |
5 | import org.json.JSONException;
6 | import org.json.JSONObject;
7 | import org.junit.Before;
8 | import org.junit.runner.RunWith;
9 | import org.mockito.Matchers;
10 | import org.mockito.Mock;
11 | import org.mockito.MockitoAnnotations;
12 | import org.powermock.modules.junit4.*;
13 |
14 | import static org.mockito.Mockito.*;
15 |
16 | import com.Upwork.api.OAuthClient;
17 |
18 | @RunWith(PowerMockRunner.class)
19 | public class Helper {
20 | @Mock
21 | protected OAuthClient client;
22 |
23 | @Before
24 | public void setUp() throws JSONException {
25 | MockitoAnnotations.initMocks(this);
26 | when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
27 | when(client.get(Matchers.anyString(), (HashMap) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
28 | when(client.post(Matchers.anyString(), (HashMap) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
29 | when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
30 | when(client.put(Matchers.anyString(), (HashMap) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
31 | when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
32 | when(client.delete(Matchers.anyString(), (HashMap) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
33 | }
34 | }
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Hr/Clients/ApplicationsTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers.Hr.Clients;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import java.util.HashMap;
6 |
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.PowerMockRunner;
12 |
13 | import com.Upwork.api.Routers.Helper;
14 | import com.Upwork.api.Routers.Hr.Clients.Applications;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest({
18 | Applications.class
19 | })
20 | public class ApplicationsTest extends Helper {
21 | @Test public void getList() throws Exception {
22 | Applications applications = new Applications(client);
23 | JSONObject json = applications.getList(new HashMap());
24 |
25 | assertTrue(json instanceof JSONObject);
26 | }
27 |
28 | @Test public void getSpecific() throws Exception {
29 | Applications applications = new Applications(client);
30 | JSONObject json = applications.getSpecific("1234", new HashMap());
31 |
32 | assertTrue(json instanceof JSONObject);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Hr/Clients/OffersTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers.Hr.Clients;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import java.util.HashMap;
6 |
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.PowerMockRunner;
12 |
13 | import com.Upwork.api.Routers.Helper;
14 | import com.Upwork.api.Routers.Hr.Clients.Offers;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest({
18 | Offers.class
19 | })
20 | public class OffersTest extends Helper {
21 | @Test public void getList() throws Exception {
22 | Offers offers = new Offers(client);
23 | JSONObject json = offers.getList(new HashMap());
24 |
25 | assertTrue(json instanceof JSONObject);
26 | }
27 |
28 | @Test public void getSpecific() throws Exception {
29 | Offers offers = new Offers(client);
30 | JSONObject json = offers.getSpecific("1234", new HashMap());
31 |
32 | assertTrue(json instanceof JSONObject);
33 | }
34 |
35 | @Test public void makeOffer() throws Exception {
36 | Offers offers = new Offers(client);
37 | JSONObject json = offers.makeOffer(new HashMap());
38 |
39 | assertTrue(json instanceof JSONObject);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Hr/ContractsTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers.Hr;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import java.util.HashMap;
6 |
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.PowerMockRunner;
12 |
13 | import com.Upwork.api.Routers.Helper;
14 | import com.Upwork.api.Routers.Hr.Contracts;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest({
18 | Contracts.class
19 | })
20 | public class ContractsTest extends Helper {
21 | @Test public void suspendContract() throws Exception {
22 | Contracts contracts = new Contracts(client);
23 | JSONObject json = contracts.suspendContract("1234", new HashMap());
24 |
25 | assertTrue(json instanceof JSONObject);
26 | }
27 |
28 | @Test public void restartContract() throws Exception {
29 | Contracts contracts = new Contracts(client);
30 | JSONObject json = contracts.restartContract("1234", new HashMap());
31 |
32 | assertTrue(json instanceof JSONObject);
33 | }
34 |
35 | @Test public void endContract() throws Exception {
36 | Contracts contracts = new Contracts(client);
37 | JSONObject json = contracts.endContract("1234", new HashMap());
38 |
39 | assertTrue(json instanceof JSONObject);
40 | }
41 | }
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Hr/EngagementsTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers.Hr;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import java.util.HashMap;
6 |
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.PowerMockRunner;
12 |
13 | import com.Upwork.api.Routers.Helper;
14 | import com.Upwork.api.Routers.Hr.Engagements;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest({
18 | Engagements.class
19 | })
20 | public class EngagementsTest extends Helper {
21 | @Test public void getList() throws Exception {
22 | Engagements engagements = new Engagements(client);
23 | JSONObject json = engagements.getList(new HashMap());
24 |
25 | assertTrue(json instanceof JSONObject);
26 | }
27 |
28 | @Test public void getSpecific() throws Exception {
29 | Engagements engagements = new Engagements(client);
30 | JSONObject json = engagements.getSpecific("1234");
31 |
32 | assertTrue(json instanceof JSONObject);
33 | }
34 | }
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Hr/Freelancers/ApplicationsTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers.Hr.Freelancers;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import java.util.HashMap;
6 |
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.PowerMockRunner;
12 |
13 | import com.Upwork.api.Routers.Helper;
14 | import com.Upwork.api.Routers.Hr.Freelancers.Applications;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest({
18 | Applications.class
19 | })
20 | public class ApplicationsTest extends Helper {
21 | @Test public void getList() throws Exception {
22 | Applications applications = new Applications(client);
23 | JSONObject json = applications.getList(new HashMap());
24 |
25 | assertTrue(json instanceof JSONObject);
26 | }
27 |
28 | @Test public void getSpecific() throws Exception {
29 | Applications applications = new Applications(client);
30 | JSONObject json = applications.getSpecific("1234");
31 |
32 | assertTrue(json instanceof JSONObject);
33 | }
34 | }
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Hr/Freelancers/OffersTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers.Hr.Freelancers;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import java.util.HashMap;
6 |
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.PowerMockRunner;
12 |
13 | import com.Upwork.api.Routers.Helper;
14 | import com.Upwork.api.Routers.Hr.Freelancers.Offers;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest({
18 | Offers.class
19 | })
20 | public class OffersTest extends Helper {
21 | @Test public void getList() throws Exception {
22 | Offers offers = new Offers(client);
23 | JSONObject json = offers.getList(new HashMap());
24 |
25 | assertTrue(json instanceof JSONObject);
26 | }
27 |
28 | @Test public void getSpecific() throws Exception {
29 | Offers offers = new Offers(client);
30 | JSONObject json = offers.getSpecific("1234");
31 |
32 | assertTrue(json instanceof JSONObject);
33 | }
34 |
35 | @Test public void actions() throws Exception {
36 | Offers offers = new Offers(client);
37 | JSONObject json = offers.actions("1234", new HashMap());
38 |
39 | assertTrue(json instanceof JSONObject);
40 | }
41 | }
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Hr/InterviewsTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers.Hr;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import java.util.HashMap;
6 |
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.PowerMockRunner;
12 |
13 | import com.Upwork.api.Routers.Helper;
14 | import com.Upwork.api.Routers.Hr.Interviews;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest({
18 | Interviews.class
19 | })
20 | public class InterviewsTest extends Helper {
21 | @Test public void invite() throws Exception {
22 | Interviews interviews = new Interviews(client);
23 | JSONObject json = interviews.invite("key", new HashMap());
24 |
25 | assertTrue(json instanceof JSONObject);
26 | }
27 | }
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Hr/JobsTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers.Hr;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import java.util.HashMap;
6 |
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.PowerMockRunner;
12 |
13 | import com.Upwork.api.Routers.Helper;
14 | import com.Upwork.api.Routers.Hr.Jobs;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest({
18 | Jobs.class
19 | })
20 | public class JobsTest extends Helper {
21 | @Test public void getList() throws Exception {
22 | Jobs jobs = new Jobs(client);
23 | JSONObject json = jobs.getList(new HashMap());
24 |
25 | assertTrue(json instanceof JSONObject);
26 | }
27 |
28 | @Test public void getSpecific() throws Exception {
29 | Jobs jobs = new Jobs(client);
30 | JSONObject json = jobs.getSpecific("key");
31 |
32 | assertTrue(json instanceof JSONObject);
33 | }
34 |
35 | @Test public void postJob() throws Exception {
36 | Jobs jobs = new Jobs(client);
37 | JSONObject json = jobs.postJob(new HashMap());
38 |
39 | assertTrue(json instanceof JSONObject);
40 | }
41 |
42 | @Test public void editJob() throws Exception {
43 | Jobs jobs = new Jobs(client);
44 | JSONObject json = jobs.editJob("key", new HashMap());
45 |
46 | assertTrue(json instanceof JSONObject);
47 | }
48 |
49 | @Test public void deleteJob() throws Exception {
50 | Jobs jobs = new Jobs(client);
51 | JSONObject json = jobs.deleteJob("key", new HashMap());
52 |
53 | assertTrue(json instanceof JSONObject);
54 | }
55 | }
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Hr/MilestonesTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers.Hr;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import java.util.HashMap;
6 |
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.PowerMockRunner;
12 |
13 | import com.Upwork.api.Routers.Helper;
14 | import com.Upwork.api.Routers.Hr.Milestones;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest({
18 | Milestones.class
19 | })
20 | public class MilestonesTest extends Helper {
21 | @Test public void getActiveMilestone() throws Exception {
22 | Milestones milestones = new Milestones(client);
23 | JSONObject json = milestones.getActiveMilestone("1234");
24 |
25 | assertTrue(json instanceof JSONObject);
26 | }
27 |
28 | @Test public void getSubmissions() throws Exception {
29 | Milestones milestones = new Milestones(client);
30 | JSONObject json = milestones.getSubmissions("1234");
31 |
32 | assertTrue(json instanceof JSONObject);
33 | }
34 |
35 | @Test public void create() throws Exception {
36 | Milestones milestones = new Milestones(client);
37 | JSONObject json = milestones.create(new HashMap());
38 |
39 | assertTrue(json instanceof JSONObject);
40 | }
41 |
42 | @Test public void edit() throws Exception {
43 | Milestones milestones = new Milestones(client);
44 | JSONObject json = milestones.edit("1234", new HashMap());
45 |
46 | assertTrue(json instanceof JSONObject);
47 | }
48 |
49 | @Test public void activate() throws Exception {
50 | Milestones milestones = new Milestones(client);
51 | JSONObject json = milestones.activate("1234", new HashMap());
52 |
53 | assertTrue(json instanceof JSONObject);
54 | }
55 |
56 | @Test public void approve() throws Exception {
57 | Milestones milestones = new Milestones(client);
58 | JSONObject json = milestones.approve("1234", new HashMap());
59 |
60 | assertTrue(json instanceof JSONObject);
61 | }
62 |
63 | @Test public void delete() throws Exception {
64 | Milestones milestones = new Milestones(client);
65 | JSONObject json = milestones.delete("1234");
66 |
67 | assertTrue(json instanceof JSONObject);
68 | }
69 | }
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Hr/RolesTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers.Hr;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import org.json.JSONObject;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 | import org.powermock.core.classloader.annotations.PrepareForTest;
9 | import org.powermock.modules.junit4.PowerMockRunner;
10 |
11 | import com.Upwork.api.Routers.Helper;
12 | import com.Upwork.api.Routers.Hr.Roles;
13 |
14 | @RunWith(PowerMockRunner.class)
15 | @PrepareForTest({
16 | Roles.class
17 | })
18 | public class RolesTest extends Helper {
19 | @Test public void getAll() throws Exception {
20 | Roles roles = new Roles(client);
21 | JSONObject json = roles.getAll();
22 |
23 | assertTrue(json instanceof JSONObject);
24 | }
25 |
26 | @Test public void getBySpecificUser() throws Exception {
27 | Roles roles = new Roles(client);
28 | JSONObject json = roles.getBySpecificUser("1234");
29 |
30 | assertTrue(json instanceof JSONObject);
31 | }
32 | }
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Hr/SubmissionsTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers.Hr;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import java.util.HashMap;
6 |
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.PowerMockRunner;
12 |
13 | import com.Upwork.api.Routers.Helper;
14 | import com.Upwork.api.Routers.Hr.Submissions;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest({
18 | Submissions.class
19 | })
20 | public class SubmissionsTest extends Helper {
21 | @Test public void requestApproval() throws Exception {
22 | Submissions submissions = new Submissions(client);
23 | JSONObject json = submissions.requestApproval(new HashMap());
24 |
25 | assertTrue(json instanceof JSONObject);
26 | }
27 |
28 | @Test public void approve() throws Exception {
29 | Submissions submissions = new Submissions(client);
30 | JSONObject json = submissions.approve("1234", new HashMap());
31 |
32 | assertTrue(json instanceof JSONObject);
33 | }
34 |
35 | @Test public void reject() throws Exception {
36 | Submissions submissions = new Submissions(client);
37 | JSONObject json = submissions.reject("1234", new HashMap());
38 |
39 | assertTrue(json instanceof JSONObject);
40 | }
41 | }
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Jobs/ProfileTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers.Jobs;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import org.json.JSONObject;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 | import org.powermock.core.classloader.annotations.PrepareForTest;
9 | import org.powermock.modules.junit4.PowerMockRunner;
10 |
11 | import com.Upwork.api.Routers.Helper;
12 | import com.Upwork.api.Routers.Jobs.Profile;
13 |
14 | @RunWith(PowerMockRunner.class)
15 | @PrepareForTest({
16 | Profile.class
17 | })
18 | public class ProfileTest extends Helper {
19 | @Test public void getSpecific() throws Exception {
20 | Profile profile = new Profile(client);
21 | JSONObject json = profile.getSpecific("key");
22 |
23 | assertTrue(json instanceof JSONObject);
24 | }
25 | }
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Jobs/SearchTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers.Jobs;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import java.util.HashMap;
6 |
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.PowerMockRunner;
12 |
13 | import com.Upwork.api.Routers.Helper;
14 | import com.Upwork.api.Routers.Jobs.Search;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest({
18 | Search.class
19 | })
20 | public class SearchTest extends Helper {
21 | @Test public void find() throws Exception {
22 | Search search = new Search(client);
23 | JSONObject json = search.find(new HashMap());
24 |
25 | assertTrue(json instanceof JSONObject);
26 | }
27 | }
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/MessagesTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import java.util.HashMap;
6 |
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.PowerMockRunner;
12 |
13 | import com.Upwork.api.Routers.Helper;
14 | import com.Upwork.api.Routers.Messages;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest({
18 | Messages.class
19 | })
20 | public class MessagesTest extends Helper {
21 | @Test public void getRooms() throws Exception {
22 | Messages messages = new Messages(client);
23 | JSONObject json = messages.getRooms("company");
24 |
25 | assertTrue(json instanceof JSONObject);
26 |
27 | JSONObject json2 = messages.getRooms("company", new HashMap());
28 |
29 | assertTrue(json2 instanceof JSONObject);
30 | }
31 |
32 | @Test public void getRoomDetails() throws Exception {
33 | Messages messages = new Messages(client);
34 | JSONObject json1 = messages.getRoomDetails("company", "room-id", new HashMap());
35 |
36 | assertTrue(json1 instanceof JSONObject);
37 | }
38 |
39 | @Test public void getRoomMessages() throws Exception {
40 | Messages messages = new Messages(client);
41 | JSONObject json1 = messages.getRoomMessages("company", "room-id", new HashMap());
42 |
43 | assertTrue(json1 instanceof JSONObject);
44 | }
45 |
46 | @Test public void getRoomByOffer() throws Exception {
47 | Messages messages = new Messages(client);
48 | JSONObject json = messages.getRoomByOffer("company", "1234", new HashMap());
49 |
50 | assertTrue(json instanceof JSONObject);
51 | }
52 |
53 | @Test public void getRoomByApplication() throws Exception {
54 | Messages messages = new Messages(client);
55 | JSONObject json = messages.getRoomByApplication("company", "1234", new HashMap());
56 |
57 | assertTrue(json instanceof JSONObject);
58 | }
59 |
60 | @Test public void getRoomByContract() throws Exception {
61 | Messages messages = new Messages(client);
62 | JSONObject json = messages.getRoomByContract("company", "1234", new HashMap());
63 |
64 | assertTrue(json instanceof JSONObject);
65 | }
66 |
67 | @Test public void createRoom() throws Exception {
68 | Messages messages = new Messages(client);
69 | JSONObject json = messages.createRoom("company", new HashMap());
70 |
71 | assertTrue(json instanceof JSONObject);
72 | }
73 |
74 | @Test public void sendMessageToRoom() throws Exception {
75 | Messages messages = new Messages(client);
76 | JSONObject json = messages.sendMessageToRoom("company", "room-id", new HashMap());
77 |
78 | assertTrue(json instanceof JSONObject);
79 | }
80 |
81 | @Test public void sendMessageToRooms() throws Exception {
82 | Messages messages = new Messages(client);
83 | JSONObject json = messages.sendMessageToRooms("company", new HashMap());
84 |
85 | assertTrue(json instanceof JSONObject);
86 | }
87 |
88 | @Test public void updateRoomSettings() throws Exception {
89 | Messages messages = new Messages(client);
90 | JSONObject json = messages.updateRoomSettings("company", "room-id", "username", new HashMap());
91 |
92 | assertTrue(json instanceof JSONObject);
93 | }
94 |
95 | @Test public void updateRoomMetadata() throws Exception {
96 | Messages messages = new Messages(client);
97 | JSONObject json = messages.updateRoomMetadata("company", "room-id", new HashMap());
98 |
99 | assertTrue(json instanceof JSONObject);
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/MetadataTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import java.util.HashMap;
6 |
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.PowerMockRunner;
12 |
13 | import com.Upwork.api.Routers.Helper;
14 | import com.Upwork.api.Routers.Metadata;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest({
18 | Metadata.class
19 | })
20 | public class MetadataTest extends Helper {
21 | @Test public void getCategories() throws Exception {
22 | Metadata metadata = new Metadata(client);
23 | JSONObject json = metadata.getCategories();
24 |
25 | assertTrue(json instanceof JSONObject);
26 | }
27 |
28 | @Test public void getCategoriesV2() throws Exception {
29 | Metadata metadata = new Metadata(client);
30 | JSONObject json = metadata.getCategoriesV2();
31 |
32 | assertTrue(json instanceof JSONObject);
33 | }
34 |
35 | @Test public void getSkills() throws Exception {
36 | Metadata metadata = new Metadata(client);
37 | JSONObject json = metadata.getSkills();
38 |
39 | assertTrue(json instanceof JSONObject);
40 | }
41 |
42 | @Test public void getSkillsV2() throws Exception {
43 | Metadata metadata = new Metadata(client);
44 | JSONObject json = metadata.getSkillsV2();
45 |
46 | assertTrue(json instanceof JSONObject);
47 | }
48 |
49 | @Test public void getSpecialties() throws Exception {
50 | Metadata metadata = new Metadata(client);
51 | JSONObject json = metadata.getSpecialties();
52 |
53 | assertTrue(json instanceof JSONObject);
54 | }
55 |
56 | @Test public void getRegions() throws Exception {
57 | Metadata metadata = new Metadata(client);
58 | JSONObject json = metadata.getRegions();
59 |
60 | assertTrue(json instanceof JSONObject);
61 | }
62 |
63 | @Test public void getTests() throws Exception {
64 | Metadata metadata = new Metadata(client);
65 | JSONObject json = metadata.getTests();
66 |
67 | assertTrue(json instanceof JSONObject);
68 | }
69 |
70 | @Test public void getReasons() throws Exception {
71 | Metadata metadata = new Metadata(client);
72 | JSONObject json = metadata.getReasons(new HashMap());
73 |
74 | assertTrue(json instanceof JSONObject);
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Organization/CompaniesTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers.Organization;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import org.json.JSONObject;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 | import org.powermock.core.classloader.annotations.PrepareForTest;
9 | import org.powermock.modules.junit4.PowerMockRunner;
10 |
11 | import com.Upwork.api.Routers.Helper;
12 | import com.Upwork.api.Routers.Organization.Companies;
13 |
14 | @RunWith(PowerMockRunner.class)
15 | @PrepareForTest({
16 | Companies.class
17 | })
18 | public class CompaniesTest extends Helper {
19 | @Test public void getList() throws Exception {
20 | Companies companies = new Companies(client);
21 | JSONObject json = companies.getList();
22 |
23 | assertTrue(json instanceof JSONObject);
24 | }
25 |
26 | @Test public void getSpecific() throws Exception {
27 | Companies companies = new Companies(client);
28 | JSONObject json = companies.getSpecific("1234");
29 |
30 | assertTrue(json instanceof JSONObject);
31 | }
32 |
33 | @Test public void getTeams() throws Exception {
34 | Companies companies = new Companies(client);
35 | JSONObject json = companies.getTeams("1234");
36 |
37 | assertTrue(json instanceof JSONObject);
38 | }
39 |
40 | @Test public void getUsers() throws Exception {
41 | Companies companies = new Companies(client);
42 | JSONObject json = companies.getUsers("1234");
43 |
44 | assertTrue(json instanceof JSONObject);
45 | }
46 | }
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Organization/TeamsTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers.Organization;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import org.json.JSONObject;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 | import org.powermock.core.classloader.annotations.PrepareForTest;
9 | import org.powermock.modules.junit4.PowerMockRunner;
10 |
11 | import com.Upwork.api.Routers.Helper;
12 | import com.Upwork.api.Routers.Organization.Teams;
13 |
14 | @RunWith(PowerMockRunner.class)
15 | @PrepareForTest({
16 | Teams.class
17 | })
18 | public class TeamsTest extends Helper {
19 | @Test public void getList() throws Exception {
20 | Teams teams = new Teams(client);
21 | JSONObject json = teams.getList();
22 |
23 | assertTrue(json instanceof JSONObject);
24 | }
25 |
26 | @Test public void getUsersInTeam() throws Exception {
27 | Teams teams = new Teams(client);
28 | JSONObject json = teams.getUsersInTeam("1234");
29 |
30 | assertTrue(json instanceof JSONObject);
31 | }
32 | }
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Organization/UsersTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers.Organization;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import org.json.JSONObject;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 | import org.powermock.core.classloader.annotations.PrepareForTest;
9 | import org.powermock.modules.junit4.PowerMockRunner;
10 |
11 | import com.Upwork.api.Routers.Helper;
12 | import com.Upwork.api.Routers.Organization.Users;
13 |
14 | @RunWith(PowerMockRunner.class)
15 | @PrepareForTest({
16 | Users.class
17 | })
18 | public class UsersTest extends Helper {
19 | @Test public void getMyInfo() throws Exception {
20 | Users users = new Users(client);
21 | JSONObject json = users.getMyInfo();
22 |
23 | assertTrue(json instanceof JSONObject);
24 | }
25 |
26 | @Test public void getSpecific() throws Exception {
27 | Users users = new Users(client);
28 | JSONObject json = users.getSpecific("12");
29 |
30 | assertTrue(json instanceof JSONObject);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/PaymentsTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import java.util.HashMap;
6 |
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.PowerMockRunner;
12 |
13 | import com.Upwork.api.Routers.Helper;
14 | import com.Upwork.api.Routers.Payments;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest({
18 | Payments.class
19 | })
20 | public class PaymentsTest extends Helper {
21 | @Test public void submitBonus() throws Exception {
22 | Payments payments = new Payments(client);
23 | JSONObject json = payments.submitBonus("1234", new HashMap());
24 |
25 | assertTrue(json instanceof JSONObject);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Reports/Finance/AccountsTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers.Reports.Finance;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import java.util.HashMap;
6 |
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.PowerMockRunner;
12 |
13 | import com.Upwork.api.Routers.Helper;
14 | import com.Upwork.api.Routers.Reports.Finance.Accounts;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest({
18 | Accounts.class
19 | })
20 | public class AccountsTest extends Helper {
21 | @Test public void getOwned() throws Exception {
22 | Accounts accounts = new Accounts(client);
23 | JSONObject json = accounts.getOwned("1234", new HashMap());
24 |
25 | assertTrue(json instanceof JSONObject);
26 | }
27 |
28 | @Test public void getSpecific() throws Exception {
29 | Accounts accounts = new Accounts(client);
30 | JSONObject json = accounts.getSpecific("1234", new HashMap());
31 |
32 | assertTrue(json instanceof JSONObject);
33 | }
34 | }
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Reports/Finance/BillingsTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers.Reports.Finance;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import java.util.HashMap;
6 |
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.PowerMockRunner;
12 |
13 | import com.Upwork.api.Routers.Helper;
14 | import com.Upwork.api.Routers.Reports.Finance.Billings;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest({
18 | Billings.class
19 | })
20 | public class BillingsTest extends Helper {
21 | @Test public void getByFreelancer() throws Exception {
22 | Billings billings = new Billings(client);
23 | JSONObject json = billings.getByFreelancer("1234", new HashMap());
24 |
25 | assertTrue(json instanceof JSONObject);
26 | }
27 |
28 | @Test public void getByFreelancersTeam() throws Exception {
29 | Billings billings = new Billings(client);
30 | JSONObject json = billings.getByFreelancersTeam("1234", new HashMap());
31 |
32 | assertTrue(json instanceof JSONObject);
33 | }
34 |
35 | @Test public void getByFreelancersCompany() throws Exception {
36 | Billings billings = new Billings(client);
37 | JSONObject json = billings.getByFreelancersCompany("1234", new HashMap());
38 |
39 | assertTrue(json instanceof JSONObject);
40 | }
41 |
42 | @Test public void getByBuyersTeam() throws Exception {
43 | Billings billings = new Billings(client);
44 | JSONObject json = billings.getByBuyersTeam("1234", new HashMap());
45 |
46 | assertTrue(json instanceof JSONObject);
47 | }
48 |
49 | @Test public void getByBuyersCompany() throws Exception {
50 | Billings billings = new Billings(client);
51 | JSONObject json = billings.getByBuyersCompany("1234", new HashMap());
52 |
53 | assertTrue(json instanceof JSONObject);
54 | }
55 | }
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Reports/Finance/EarningsTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers.Reports.Finance;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import java.util.HashMap;
6 |
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.PowerMockRunner;
12 |
13 | import com.Upwork.api.Routers.Helper;
14 | import com.Upwork.api.Routers.Reports.Finance.Earnings;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest({
18 | Earnings.class
19 | })
20 | public class EarningsTest extends Helper {
21 | @Test public void getByFreelancer() throws Exception {
22 | Earnings earnings = new Earnings(client);
23 | JSONObject json = earnings.getByFreelancer("1234", new HashMap());
24 |
25 | assertTrue(json instanceof JSONObject);
26 | }
27 |
28 | @Test public void getByFreelancersTeam() throws Exception {
29 | Earnings earnings = new Earnings(client);
30 | JSONObject json = earnings.getByFreelancersTeam("1234", new HashMap());
31 |
32 | assertTrue(json instanceof JSONObject);
33 | }
34 |
35 | @Test public void getByFreelancersCompany() throws Exception {
36 | Earnings earnings = new Earnings(client);
37 | JSONObject json = earnings.getByFreelancersCompany("1234", new HashMap());
38 |
39 | assertTrue(json instanceof JSONObject);
40 | }
41 |
42 | @Test public void getByBuyersTeam() throws Exception {
43 | Earnings earnings = new Earnings(client);
44 | JSONObject json = earnings.getByBuyersTeam("1234", new HashMap());
45 |
46 | assertTrue(json instanceof JSONObject);
47 | }
48 |
49 | @Test public void getByBuyersCompany() throws Exception {
50 | Earnings earnings = new Earnings(client);
51 | JSONObject json = earnings.getByBuyersCompany("1234", new HashMap());
52 |
53 | assertTrue(json instanceof JSONObject);
54 | }
55 | }
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/Reports/TimeTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers.Reports;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import java.util.HashMap;
6 |
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.PowerMockRunner;
12 |
13 | import com.Upwork.api.Routers.Helper;
14 | import com.Upwork.api.Routers.Reports.Time;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest({
18 | Time.class
19 | })
20 | public class TimeTest extends Helper {
21 | @Test public void getByTeamFull() throws Exception {
22 | Time time = new Time(client);
23 | JSONObject json = time.getByTeamFull("company", "team", new HashMap());
24 |
25 | assertTrue(json instanceof JSONObject);
26 | }
27 |
28 | @Test public void getByTeamLimited() throws Exception {
29 | Time time = new Time(client);
30 | JSONObject json = time.getByTeamLimited("company", "team", new HashMap());
31 |
32 | assertTrue(json instanceof JSONObject);
33 | }
34 |
35 | @Test public void getByAgency() throws Exception {
36 | Time time = new Time(client);
37 | JSONObject json = time.getByAgency("company", "agency", new HashMap());
38 |
39 | assertTrue(json instanceof JSONObject);
40 | }
41 |
42 | @Test public void getByCompany() throws Exception {
43 | Time time = new Time(client);
44 | JSONObject json = time.getByCompany("company", new HashMap());
45 |
46 | assertTrue(json instanceof JSONObject);
47 | }
48 |
49 | @Test public void getByFreelancerLimited() throws Exception {
50 | Time time = new Time(client);
51 | JSONObject json = time.getByFreelancerLimited("freelancer_id", new HashMap());
52 |
53 | assertTrue(json instanceof JSONObject);
54 | }
55 |
56 | @Test public void getByFreelancerFull() throws Exception {
57 | Time time = new Time(client);
58 | JSONObject json = time.getByFreelancerFull("freelancer_id", new HashMap());
59 |
60 | assertTrue(json instanceof JSONObject);
61 | }
62 | }
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/SnapshotTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import java.util.HashMap;
6 |
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.PowerMockRunner;
12 |
13 | import com.Upwork.api.Routers.Helper;
14 | import com.Upwork.api.Routers.Snapshot;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest({
18 | Snapshot.class
19 | })
20 | public class SnapshotTest extends Helper {
21 | @Test public void getByContract() throws Exception {
22 | Snapshot snapshot = new Snapshot(client);
23 | JSONObject json = snapshot.getByContract("1234", "date");
24 |
25 | assertTrue(json instanceof JSONObject);
26 | }
27 |
28 | @Test public void updateByContract() throws Exception {
29 | Snapshot snapshot = new Snapshot(client);
30 | JSONObject json = snapshot.updateByContract("1234", "date", new HashMap());
31 |
32 | assertTrue(json instanceof JSONObject);
33 | }
34 |
35 | @Test public void deleteByContract() throws Exception {
36 | Snapshot snapshot = new Snapshot(client);
37 | JSONObject json = snapshot.deleteByContract("1234", "date");
38 |
39 | assertTrue(json instanceof JSONObject);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/WorkdaysTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import java.util.HashMap;
6 |
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.PowerMockRunner;
12 |
13 | import com.Upwork.api.Routers.Helper;
14 | import com.Upwork.api.Routers.Workdays;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest({
18 | Workdiary.class
19 | })
20 | public class WorkdaysTest extends Helper {
21 | @Test public void getByCompany() throws Exception {
22 | Workdays workdays = new Workdays(client);
23 | JSONObject json = workdays.getByCompany("company", "20140101", "20140131", new HashMap());
24 |
25 | assertTrue(json instanceof JSONObject);
26 | }
27 |
28 | @Test public void getByContract() throws Exception {
29 | Workdays workdays = new Workdays(client);
30 | JSONObject json = workdays.getByContract("company", "20140101", "20140131", new HashMap());
31 |
32 | assertTrue(json instanceof JSONObject);
33 | }
34 | }
--------------------------------------------------------------------------------
/test/com/Upwork/api/Routers/WorkdiaryTest.java:
--------------------------------------------------------------------------------
1 | package com.Upwork.api.Routers;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import java.util.HashMap;
6 |
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.core.classloader.annotations.PrepareForTest;
11 | import org.powermock.modules.junit4.PowerMockRunner;
12 |
13 | import com.Upwork.api.Routers.Helper;
14 | import com.Upwork.api.Routers.Workdiary;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest({
18 | Workdiary.class
19 | })
20 | public class WorkdiaryTest extends Helper {
21 | @Test public void get() throws Exception {
22 | Workdiary workdiary = new Workdiary(client);
23 | JSONObject json = workdiary.get("company", "date", new HashMap());
24 |
25 | assertTrue(json instanceof JSONObject);
26 | }
27 |
28 | @Test public void getByContract() throws Exception {
29 | Workdiary workdiary = new Workdiary(client);
30 | JSONObject json = workdiary.getByContract("1234", "date", new HashMap());
31 |
32 | assertTrue(json instanceof JSONObject);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/vendor-lib/README:
--------------------------------------------------------------------------------
1 | * This directory contains sources non-related to Upwork php code, like Signpost, and others.
2 | * See usage, license(s) and copyright(s) of this/these source(s) under proper location.
3 | * This/these source(s) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND"
4 |
--------------------------------------------------------------------------------
/vendor-lib/httpcomponents-client-4.3.3/commons-codec-1.6.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/vendor-lib/httpcomponents-client-4.3.3/commons-codec-1.6.jar
--------------------------------------------------------------------------------
/vendor-lib/httpcomponents-client-4.3.3/commons-logging-1.1.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/vendor-lib/httpcomponents-client-4.3.3/commons-logging-1.1.3.jar
--------------------------------------------------------------------------------
/vendor-lib/httpcomponents-client-4.3.3/httpclient-4.3.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/vendor-lib/httpcomponents-client-4.3.3/httpclient-4.3.3.jar
--------------------------------------------------------------------------------
/vendor-lib/httpcomponents-client-4.3.3/httpcore-4.3.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/vendor-lib/httpcomponents-client-4.3.3/httpcore-4.3.2.jar
--------------------------------------------------------------------------------
/vendor-lib/java-json.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/vendor-lib/java-json.jar
--------------------------------------------------------------------------------
/vendor-lib/signpost-1.2.1.2/signpost-commonshttp4-1.2.1.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/vendor-lib/signpost-1.2.1.2/signpost-commonshttp4-1.2.1.2.jar
--------------------------------------------------------------------------------
/vendor-lib/signpost-1.2.1.2/signpost-core-1.2.1.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upwork/java-upwork/5de3e13ce2852fb0f6ea4f4f8edee3c6fd48e23b/vendor-lib/signpost-1.2.1.2/signpost-core-1.2.1.2.jar
--------------------------------------------------------------------------------