Package net.worcade.client
Interface Worcade
-
- All Known Implementing Classes:
WorcadeClient
@CheckReturnValue public interface Worcade
Entry point to the Worcade API client library. Create a Worcade client using either of the #create methods
-
-
Method Summary
-
-
-
Field Detail
-
VERSION
static final Version VERSION
The minimal Worcade API version for this version of the client library. The library is compatible with all later minor and patch versions, but not with later major versions.
-
-
Method Detail
-
builder
static WorcadeBuilder builder()
-
loginUserByEmail
Result<ReferenceWithName> loginUserByEmail(String email, String password)
Login a user by email address. This call replaces all existing authentications.- Returns:
- A reference to the logged in user
-
loginUserById
Result<ReferenceWithName> loginUserById(String userId, String password)
Login a user by id. This call replaces all existing authentications.- Returns:
- A reference to the logged in user
-
setUserApiKey
Result<ReferenceWithName> setUserApiKey(String apiKey)
-
logoutUser
Result<?> logoutUser()
Logout the current logged in user, invalidating the session token.
-
loginApplication
Result<ReferenceWithName> loginApplication(String applicationId, PrivateKey applicationPrivateKey, PublicKey worcadePublicKey)
Login an application. This call replaces all existing authentications.- Returns:
- A reference to the logged in application
-
setApplicationApiKey
Result<ReferenceWithName> setApplicationApiKey(String apiKey)
-
logoutApplication
Result<?> logoutApplication()
Logout the current logged in user, invalidating the session token.
-
setApplicationSourceAuth
Result<ReferenceWithName> setApplicationSourceAuth(String id)
-
setTrustedUser
Result<? extends Authentication> setTrustedUser(Reference user)
Set a trusted user for the logged in application- Returns:
- a failed result if the application does not trust the user, and a successful one otherwise
- Throws:
IllegalStateException- if there is no logged in application
-
probeUserTrust
Result<Boolean> probeUserTrust(String userId, String applicationId)
Checks if the given user trusts the given application. The application must be authenticated to use this endpoint.- Returns:
- a result of `true` if the user trusts the application
-
getAuthentication
Result<? extends Authentication> getAuthentication()
-
loginAdmin
Result<? extends Authentication> loginAdmin(String token, String userId, String applicationId)
-
upgradeToAdmin
Result<? extends Authentication> upgradeToAdmin(String userId, String applicationId)
-
logoutAdmin
Result<?> logoutAdmin()
-
getNotifications
Result<? extends Collection<? extends Notification>> getNotifications()
-
createExternalNumber
ExternalNumber createExternalNumber(String number, String description)
-
createWebhookHeader
Webhook.Header createWebhookHeader(String name, String value)
-
createWorkOrderRow
WorkOrder.Row createWorkOrderRow(String name, Duration duration, Double cost, Currency currency)
-
getApplicationApi
ApplicationApi getApplicationApi()
-
getAssetApi
AssetApi getAssetApi()
-
getAttachmentApi
AttachmentApi getAttachmentApi()
-
getChecklistApi
ChecklistApi getChecklistApi()
-
getCompanyApi
CompanyApi getCompanyApi()
-
getContactsApi
ContactsApi getContactsApi()
-
getConversationApi
ConversationApi getConversationApi()
-
getGroupApi
GroupApi getGroupApi()
-
getLabelApi
LabelApi getLabelApi()
-
getReclaimApi
ReclaimApi getReclaimApi()
-
getRoomApi
RoomApi getRoomApi()
-
getSearchApi
SearchApi getSearchApi()
-
getSiteApi
SiteApi getSiteApi()
-
getUserApi
UserApi getUserApi()
-
getWebhookApi
WebhookApi getWebhookApi()
-
getWorkOrderApi
WorkOrderApi getWorkOrderApi()
-
copyWithSameAuth
Worcade copyWithSameAuth()
-
close
void close()
-
-