mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-02-09 21:48:50 -06:00
groupware: actually add total and limit to the email summary endpoint
This commit is contained in:
@@ -2070,6 +2070,10 @@ type Email struct {
|
||||
// Note that this is not part of the JMAP specification, and is only calculated when requested.
|
||||
ThreadSize int `json:"threadSize,omitzero"`
|
||||
|
||||
// The account ID this email belongs to.
|
||||
// Note that this is not part of the JMAP specification, and is only contained in all-account operations.
|
||||
AccountId string `json:"accountId,omitempty"`
|
||||
|
||||
// The set of Mailbox ids this Email belongs to.
|
||||
//
|
||||
// An Email in the mail store MUST belong to one or more Mailboxes at all times (until it is destroyed).
|
||||
|
||||
@@ -1696,6 +1696,14 @@ type SwaggerGetLatestEmailsSummaryForAllAccountsParams struct {
|
||||
Undesirable bool `json:"undesirable"`
|
||||
}
|
||||
|
||||
type EmailSummaries struct {
|
||||
Emails []EmailSummary `json:"emails,omitempty"`
|
||||
Total uint `json:"total,omitzero"`
|
||||
Limit uint `json:"limit,omitzero"`
|
||||
Offset uint `json:"offset,omitzero"`
|
||||
State jmap.State `json:"state,omitempty"`
|
||||
}
|
||||
|
||||
// swagger:route GET /groupware/accounts/all/emails/latest/summary email get_latest_emails_summary_for_all_accounts
|
||||
// Get a summary of the latest emails across all the mailboxes, across all of a user's accounts.
|
||||
//
|
||||
@@ -1725,6 +1733,17 @@ func (g *Groupware) GetLatestEmailsSummaryForAllAccounts(w http.ResponseWriter,
|
||||
l = l.Uint(QueryParamLimit, limit)
|
||||
}
|
||||
|
||||
offset, ok, err := req.parseUIntParam(QueryParamOffset, 0)
|
||||
if err != nil {
|
||||
return errorResponse(err)
|
||||
}
|
||||
if offset > 0 {
|
||||
return notImplementesResponse()
|
||||
}
|
||||
if ok {
|
||||
l = l.Uint(QueryParamOffset, limit)
|
||||
}
|
||||
|
||||
seen, ok, err := req.parseBoolParam(QueryParamSeen, false)
|
||||
if err != nil {
|
||||
return errorResponse(err)
|
||||
@@ -1784,7 +1803,12 @@ func (g *Groupware) GetLatestEmailsSummaryForAllAccounts(w http.ResponseWriter,
|
||||
summaries[i] = summarizeEmail(all[i].accountId, all[i].email)
|
||||
}
|
||||
|
||||
return response(summaries, sessionState, lang)
|
||||
return response(EmailSummaries{
|
||||
Emails: summaries,
|
||||
Total: total,
|
||||
Limit: limit,
|
||||
Offset: offset,
|
||||
}, sessionState, lang)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user