Example: Changing e-mail settings¶
Frequency of use | Common |
---|---|
Actors |
|
Communication Flow: Kotlin
MailDescriptions.retrieveEmailSettings.call(
RetrieveEmailSettingsRequest(
username = null,
),
user
).orThrow()
/*
RetrieveEmailSettingsResponse(
settings = EmailSettings(
applicationStatusChange = true,
applicationTransfer = true,
grantApplicationApproved = true,
grantApplicationRejected = true,
grantApplicationUpdated = true,
grantApplicationWithdrawn = true,
jobStarted = false,
jobStopped = false,
lowFunds = true,
newCommentOnApplication = true,
newGrantApplication = true,
projectUserInvite = true,
projectUserRemoved = true,
userLeft = true,
userRoleChange = true,
verificationReminder = true,
),
)
*/
MailDescriptions.toggleEmailSettings.call(
bulkRequestOf(EmailSettingsItem(
settings = EmailSettings(
applicationStatusChange = true,
applicationTransfer = true,
grantApplicationApproved = true,
grantApplicationRejected = true,
grantApplicationUpdated = true,
grantApplicationWithdrawn = true,
jobStarted = false,
jobStopped = false,
lowFunds = true,
newCommentOnApplication = true,
newGrantApplication = true,
projectUserInvite = true,
projectUserRemoved = true,
userLeft = true,
userRoleChange = true,
verificationReminder = false,
),
username = null,
)),
user
).orThrow()
/*
Unit
*/
MailDescriptions.retrieveEmailSettings.call(
RetrieveEmailSettingsRequest(
username = null,
),
user
).orThrow()
/*
RetrieveEmailSettingsResponse(
settings = EmailSettings(
applicationStatusChange = true,
applicationTransfer = true,
grantApplicationApproved = true,
grantApplicationRejected = true,
grantApplicationUpdated = true,
grantApplicationWithdrawn = true,
jobStarted = false,
jobStopped = false,
lowFunds = true,
newCommentOnApplication = true,
newGrantApplication = true,
projectUserInvite = true,
projectUserRemoved = true,
userLeft = true,
userRoleChange = true,
verificationReminder = false,
),
)
*/
Communication Flow: Curl
# ------------------------------------------------------------------------------------------------------
# $host is the UCloud instance to contact. Example: 'http://localhost:8080' or 'https://cloud.sdu.dk'
# $accessToken is a valid access-token issued by UCloud
# ------------------------------------------------------------------------------------------------------
# Authenticated as user
curl -XGET -H "Authorization: Bearer $accessToken" "$host/api/mail/retrieveEmailSettings?"
# {
# "settings": {
# "newGrantApplication": true,
# "grantApplicationUpdated": true,
# "grantApplicationApproved": true,
# "grantApplicationRejected": true,
# "grantApplicationWithdrawn": true,
# "newCommentOnApplication": true,
# "applicationTransfer": true,
# "applicationStatusChange": true,
# "projectUserInvite": true,
# "projectUserRemoved": true,
# "verificationReminder": true,
# "userRoleChange": true,
# "userLeft": true,
# "lowFunds": true,
# "jobStarted": false,
# "jobStopped": false
# }
# }
curl -XPOST -H "Authorization: Bearer $accessToken" -H "Content-Type: content-type: application/json; charset=utf-8" "$host/api/mail/toggleEmailSettings" -d '{
"items": [
{
"username": null,
"settings": {
"newGrantApplication": true,
"grantApplicationUpdated": true,
"grantApplicationApproved": true,
"grantApplicationRejected": true,
"grantApplicationWithdrawn": true,
"newCommentOnApplication": true,
"applicationTransfer": true,
"applicationStatusChange": true,
"projectUserInvite": true,
"projectUserRemoved": true,
"verificationReminder": false,
"userRoleChange": true,
"userLeft": true,
"lowFunds": true,
"jobStarted": false,
"jobStopped": false
}
}
]
}'
# {
# }
curl -XGET -H "Authorization: Bearer $accessToken" "$host/api/mail/retrieveEmailSettings?"
# {
# "settings": {
# "newGrantApplication": true,
# "grantApplicationUpdated": true,
# "grantApplicationApproved": true,
# "grantApplicationRejected": true,
# "grantApplicationWithdrawn": true,
# "newCommentOnApplication": true,
# "applicationTransfer": true,
# "applicationStatusChange": true,
# "projectUserInvite": true,
# "projectUserRemoved": true,
# "verificationReminder": false,
# "userRoleChange": true,
# "userLeft": true,
# "lowFunds": true,
# "jobStarted": false,
# "jobStopped": false
# }
# }