public class WorkTrailAppApi
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
java.lang.Object |
setServerUrl |
static java.lang.String |
WORKTRAIL_SERVER |
| Constructor and Description |
|---|
WorkTrailAppApi(java.lang.String appKey,
java.lang.String secretApiKey,
java.lang.String authToken)
Creates a new api accessor instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cleanHubEntries() |
CreateAuthResponse |
createAuthRequest(WorkTrailAccessType accessType,
WorkTrailScope[] scopes)
Will request a new authentication request.
|
CreateHubEntriesResponse |
createHubEntries(java.util.Collection<HubEntry> hubEntries) |
Company |
fetchCompany() |
EmployeeListResponse |
fetchEmployees() |
WorkEntryListResponse |
fetchWorkEntries(long lastModifyDate,
long page) |
java.lang.String |
generateTestUser(WorkTrailAccessType accessType,
WorkTrailScope[] scopes)
generates a test user - will NOT work on https://worktrail.net !
|
java.lang.String |
getAuthToken() |
void |
setAuthToken(java.lang.String authToken) |
void |
setServerUrl(java.lang.String serverUrl) |
boolean |
verifyAuthorization(java.lang.String requestKey)
Checks whether the auth token which is represented by the request key was already authorized.
|
public static final java.lang.String WORKTRAIL_SERVER
public java.lang.Object setServerUrl
public WorkTrailAppApi(java.lang.String appKey,
java.lang.String secretApiKey,
java.lang.String authToken)
appKey - Application key, provided by WorkTrail - https://worktrail.net/en/api/apps/secretApiKey - When registering your app, you will also receive a secret api key.authToken - Auth token is required to access secure api endpoints - ie. everything except createAuthRequest(WorkTrailAccessType, WorkTrailScope[]) (see linked documentation for auth details)public java.lang.String getAuthToken()
public void setAuthToken(java.lang.String authToken)
public CreateAuthResponse createAuthRequest(WorkTrailAccessType accessType, WorkTrailScope[] scopes) throws RequestErrorException
CreateAuthResponse will
contain a URL your users will have to open in their browser to authenticate this app.
See API documentation at https://worktrail.net/en/api/ for details about this parameters!accessType - Which access type is required - company or employee level access.scopes - All required scopes this app requires.CreateAuthResponse with a URL where the user can grant access to the app.RequestErrorException - if an error happens during authentication.public EmployeeListResponse fetchEmployees() throws RequestErrorException
RequestErrorExceptionpublic WorkEntryListResponse fetchWorkEntries(long lastModifyDate, long page) throws RequestErrorException
RequestErrorExceptionpublic CreateHubEntriesResponse createHubEntries(java.util.Collection<HubEntry> hubEntries) throws RequestErrorException
RequestErrorExceptionpublic void cleanHubEntries()
throws RequestErrorException
RequestErrorExceptionpublic boolean verifyAuthorization(java.lang.String requestKey)
throws RequestErrorException
requestKey - RequestErrorExceptionpublic void setServerUrl(java.lang.String serverUrl)
public java.lang.String generateTestUser(WorkTrailAccessType accessType, WorkTrailScope[] scopes) throws RequestErrorException
RequestErrorExceptionpublic Company fetchCompany() throws RequestErrorException
RequestErrorException