groupware: remove remnants of go-swagger documentation, since we are switching to using our own tool instead

This commit is contained in:
Pascal Bleser
2026-02-06 09:44:33 +01:00
parent f705cc0b87
commit 23e696e7d0
14 changed files with 22 additions and 581 deletions

View File

@@ -1924,8 +1924,6 @@ type EmailBodyPart struct {
//
// This is scoped to the `emailId` and has no meaning outside of the JMAP Email object representation.
// This is null if, and only if, the part is of type `multipart/*`.
//
// example: $attachmentPartId
PartId string `json:"partId,omitempty"`
// The id representing the raw octets of the contents of the part, after decoding any known

View File

@@ -1554,8 +1554,6 @@ type TimeZoneRule struct {
// Negative numbers represent time zones west of the prime meridian, or behind UTC.
//
// Mandatory.
//
// example: -0500
OffsetFrom string `json:"offsetFrom" doc:"req"`
// This is the TZOFFSETTO property from iCalendar: specifies the offset that is in use in this time zone observance.
@@ -1571,8 +1569,6 @@ type TimeZoneRule struct {
// Negative numbers represent time zones west of the prime meridian, or behind UTC.
//
// Mandatory.
//
// example: +1245
OffsetTo string `json:"offsetTo" doc:"req"`
// This is the `RRULE` property mapped.

View File

@@ -215,8 +215,6 @@ type PersonalInfoLevel string
// * `location`: a named location
// * `device`: a device such as an appliance, a computer, or a network element
// * `application`: a software application
//
// example: individual
type ContactCardKind string
// The kind of the `Directory` resource.
@@ -366,8 +364,6 @@ type LinkContext string
// The JSContact version of this Card.
//
// The value MUST be one of the IANA-registered JSContact Version values for the version property.
//
// example: 1.0
type JSContactVersion string
type TypeOfAddress string
@@ -2038,7 +2034,7 @@ type ContactCard struct {
// The id uniquely identifies a Card with a particular “uid” within a particular account.
//
// This is a JMAP extension and not part of [RFC9553].
Id string `json:"id,omitempty"`
Id string `json:"id,omitempty" doc:"!request,req"`
// The set of AddressBook ids this Card belongs to.
//

View File

@@ -9,24 +9,7 @@ import (
"github.com/opencloud-eu/opencloud/pkg/structs"
)
// When the request succeeds.
// swagger:response GetAccountResponse200
type SwaggerGetAccountResponse struct {
// in: body
Body struct {
*jmap.Account
}
}
// swagger:route GET /groupware/accounts/{account} account account
// Get attributes of a given account.
//
// responses:
//
// 200: GetAccountResponse200
// 400: ErrorResponse400
// 404: ErrorResponse404
// 500: ErrorResponse500
func (g *Groupware) GetAccount(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
accountId, account, err := req.GetAccountForMail()
@@ -38,22 +21,7 @@ func (g *Groupware) GetAccount(w http.ResponseWriter, r *http.Request) {
})
}
// When the request succeeds.
// swagger:response GetAccountsResponse200
type SwaggerGetAccountsResponse struct {
// in: body
Body map[string]jmap.Account
}
// swagger:route GET /groupware/accounts account accounts
// Get the list of all of the user's accounts.
//
// responses:
//
// 200: GetAccountsResponse200
// 400: ErrorResponse400
// 404: ErrorResponse404
// 500: ErrorResponse500
func (g *Groupware) GetAccounts(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
list := make([]AccountWithId, len(req.session.Accounts))
@@ -72,6 +40,7 @@ func (g *Groupware) GetAccounts(w http.ResponseWriter, r *http.Request) {
})
}
// Get the list of all of the user's accounts, along with the list of all the identities for each of those accounts.
func (g *Groupware) GetAccountsWithTheirIdentities(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
allAccountIds := req.AllAccountIds()

View File

@@ -8,22 +8,7 @@ import (
"github.com/opencloud-eu/opencloud/pkg/log"
)
// When the request succeeds.
// swagger:response GetCalendars200
type SwaggerGetCalendars200 struct {
// in: body
Body []jmap.Calendar
}
// swagger:route GET /groupware/accounts/{account}/calendars calendar calendars
// Get all calendars of an account.
//
// responses:
//
// 200: GetCalendars200
// 400: ErrorResponse400
// 404: ErrorResponse404
// 500: ErrorResponse500
func (g *Groupware) GetCalendars(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
ok, accountId, resp := req.needCalendarWithAccount()
@@ -40,24 +25,7 @@ func (g *Groupware) GetCalendars(w http.ResponseWriter, r *http.Request) {
})
}
// When the request succeeds.
// swagger:response GetCalendarById200
type SwaggerGetCalendarById200 struct {
// in: body
Body struct {
*jmap.Calendar
}
}
// swagger:route GET /groupware/accounts/{account}/calendars/{calendarid} calendar calendar_by_id
// Get a calendar of an account by its identifier.
//
// responses:
//
// 200: GetCalendarById200
// 400: ErrorResponse400
// 404: ErrorResponse404
// 500: ErrorResponse500
func (g *Groupware) GetCalendarById(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
ok, accountId, resp := req.needCalendarWithAccount()
@@ -87,22 +55,7 @@ func (g *Groupware) GetCalendarById(w http.ResponseWriter, r *http.Request) {
})
}
// When the request succeeds.
// swagger:response GetEventsInCalendar200
type SwaggerGetEventsInCalendar200 struct {
// in: body
Body []jmap.CalendarEvent
}
// swagger:route GET /groupware/accounts/{account}/calendars/{calendarid}/events event events_in_addressbook
// Get all the events in a calendar of an account by its identifier.
//
// responses:
//
// 200: GetEventsInCalendar200
// 400: ErrorResponse400
// 404: ErrorResponse404
// 500: ErrorResponse500
func (g *Groupware) GetEventsInCalendar(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
ok, accountId, resp := req.needCalendarWithAccount()
@@ -177,7 +130,6 @@ func (g *Groupware) CreateCalendarEvent(w http.ResponseWriter, r *http.Request)
})
}
// @api:tag XYZ
func (g *Groupware) DeleteCalendarEvent(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
ok, accountId, resp := req.needCalendarWithAccount()

View File

@@ -8,22 +8,7 @@ import (
"github.com/opencloud-eu/opencloud/pkg/log"
)
// When the request succeeds.
// swagger:response GetAddressbooks200
type SwaggerGetAddressbooks200 struct {
// in: body
Body []jmap.AddressBook
}
// swagger:route GET /groupware/accounts/{account}/addressbooks addressbook addressbooks
// Get all addressbooks of an account.
//
// responses:
//
// 200: GetAddressbooks200
// 400: ErrorResponse400
// 404: ErrorResponse404
// 500: ErrorResponse500
func (g *Groupware) GetAddressbooks(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
ok, accountId, resp := req.needContactWithAccount()
@@ -40,24 +25,7 @@ func (g *Groupware) GetAddressbooks(w http.ResponseWriter, r *http.Request) {
})
}
// When the request succeeds.
// swagger:response GetAddressbookById200
type SwaggerGetAddressbookById200 struct {
// in: body
Body struct {
*jmap.AddressBook
}
}
// swagger:route GET /groupware/accounts/{account}/addressbooks/{addressbookid} addressbook addressbook_by_id
// Get an addressbook of an account by its identifier.
//
// responses:
//
// 200: GetAddressbookById200
// 400: ErrorResponse400
// 404: ErrorResponse404
// 500: ErrorResponse500
func (g *Groupware) GetAddressbook(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
ok, accountId, resp := req.needContactWithAccount()
@@ -82,27 +50,12 @@ func (g *Groupware) GetAddressbook(w http.ResponseWriter, r *http.Request) {
if len(addressbooks.NotFound) > 0 {
return notFoundResponse(single(accountId), sessionState)
} else {
return etagResponse(single(accountId), addressbooks, sessionState, AddressBookResponseObjectType, state, lang)
return etagResponse(single(accountId), addressbooks.AddressBooks[0], sessionState, AddressBookResponseObjectType, state, lang)
}
})
}
// When the request succeeds.
// swagger:response GetContactsInAddressbook200
type SwaggerGetContactsInAddressbook200 struct {
// in: body
Body []jscontact.ContactCard
}
// swagger:route GET /groupware/accounts/{account}/addressbooks/{addressbookid}/contacts contact contacts_in_addressbook
// Get all the contacts in an addressbook of an account by its identifier.
//
// responses:
//
// 200: GetContactsInAddressbook200
// 400: ErrorResponse400
// 404: ErrorResponse404
// 500: ErrorResponse500
func (g *Groupware) GetContactsInAddressbook(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
ok, accountId, resp := req.needContactWithAccount()

View File

@@ -20,25 +20,6 @@ import (
"github.com/opencloud-eu/opencloud/services/groupware/pkg/metrics"
)
// When the request succeeds without a "since" query parameter.
// swagger:response GetAllEmailsInMailbox200
type SwaggerGetAllEmailsInMailbox200 struct {
// in: body
Body struct {
*jmap.Emails
}
}
// When the request succeeds with a "since" query parameter.
// swagger:response GetAllEmailsInMailboxSince200
type SwaggerGetAllEmailsInMailboxSince200 struct {
// in: body
Body struct {
*jmap.MailboxChanges
}
}
// swagger:route GET /groupware/accounts/{account}/mailboxes/{mailbox}/emails/since/{since} email get_all_emails_in_mailbox_since
// Get all the emails in a mailbox since a given state.
//
// Retrieve the list of all the emails that are in a given mailbox since a given state.
@@ -47,13 +28,6 @@ type SwaggerGetAllEmailsInMailboxSince200 struct {
//
// A limit and an offset may be specified using the query parameters 'limit' and 'offset',
// respectively.
//
// responses:
//
// 200: GetAllEmailsInMailboxSince200
// 400: ErrorResponse400
// 404: ErrorResponse404
// 500: ErrorResponse500
func (g *Groupware) GetAllEmailsInMailboxSince(w http.ResponseWriter, r *http.Request) {
maxChanges := uint(0)
@@ -86,7 +60,6 @@ func (g *Groupware) GetAllEmailsInMailboxSince(w http.ResponseWriter, r *http.Re
}
// swagger:route GET /groupware/accounts/{account}/mailboxes/{mailbox}/emails email get_all_emails_in_mailbox
// Get all the emails in a mailbox.
//
// Retrieve the list of all the emails that are in a given mailbox.
@@ -95,13 +68,6 @@ func (g *Groupware) GetAllEmailsInMailboxSince(w http.ResponseWriter, r *http.Re
//
// A limit and an offset may be specified using the query parameters 'limit' and 'offset',
// respectively.
//
// responses:
//
// 200: GetAllEmailsInMailbox200
// 400: ErrorResponse400
// 404: ErrorResponse404
// 500: ErrorResponse500
func (g *Groupware) GetAllEmailsInMailbox(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
l := req.logger.With()
@@ -921,14 +887,6 @@ func (g *Groupware) ReplaceEmail(w http.ResponseWriter, r *http.Request) {
})
}
// swagger:parameters update_email
type SwaggerUpdateEmailBody struct {
// List of identifiers of emails to delete.
// in: body
// example: ["caen3iujoo8u", "aec8phaetaiz", "bohna0me"]
Body map[string]string
}
func (g *Groupware) UpdateEmail(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
l := req.logger.With()
@@ -1043,15 +1001,7 @@ func (g *Groupware) UpdateEmailKeywords(w http.ResponseWriter, r *http.Request)
})
}
// swagger:route POST /groupware/accounts/{account}/emails/{emailid}/keywords email add_email_keywords
// Add keywords to an email by its unique identifier.
//
// responses:
//
// 204: Success204
// 400: ErrorResponse400
// 404: ErrorResponse404
// 500: ErrorResponse500
func (g *Groupware) AddEmailKeywords(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
l := req.logger.With()
@@ -1111,15 +1061,7 @@ func (g *Groupware) AddEmailKeywords(w http.ResponseWriter, r *http.Request) {
})
}
// swagger:route DELETE /groupware/accounts/{account}/emails/{emailid}/keywords email remove_email_keywords
// Remove keywords of an email by its unique identifier.
//
// responses:
//
// 204: Success204
// 400: ErrorResponse400
// 404: ErrorResponse404
// 500: ErrorResponse500
func (g *Groupware) RemoveEmailKeywords(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
l := req.logger.With()
@@ -1179,15 +1121,7 @@ func (g *Groupware) RemoveEmailKeywords(w http.ResponseWriter, r *http.Request)
})
}
// swagger:route DELETE /groupware/accounts/{account}/emails/{emailid} email delete_email
// Delete an email by its unique identifier.
//
// responses:
//
// 204: Success204
// 400: ErrorResponse400
// 404: ErrorResponse404
// 500: ErrorResponse500
func (g *Groupware) DeleteEmail(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
l := req.logger.With()
@@ -1230,26 +1164,10 @@ func (g *Groupware) DeleteEmail(w http.ResponseWriter, r *http.Request) {
})
}
// swagger:parameters delete_emails
type SwaggerDeleteEmailsBody struct {
// List of identifiers of emails to delete.
// in: body
// example: ["caen3iujoo8u", "aec8phaetaiz", "bohna0me"]
Body []string
}
// swagger:route DELETE /groupware/accounts/{account}/emails email delete_emails
// Delete a set of emails by their unique identifiers.
//
// The identifiers of the emails to delete are specified as part of the request
// body, as an array of strings.
//
// responses:
//
// 204: Success204
// 400: ErrorResponse400
// 404: ErrorResponse404
// 500: ErrorResponse500
func (g *Groupware) DeleteEmails(w http.ResponseWriter, r *http.Request) {
/// @api body
g.respond(w, r, func(req Request) Response {
@@ -1511,23 +1429,14 @@ func (g *Groupware) RelatedToEmail(w http.ResponseWriter, r *http.Request) {
type EmailSummary struct {
// The id of the account this Email summary pertains to.
// required: true
// example: $accountId
AccountId string `json:"accountId,omitempty"`
// The id of the Email object.
//
// Note that this is the JMAP object id, NOT the Message-ID header field value of the message [RFC5322].
//
// [RFC5322]: https://www.rfc-editor.org/rfc/rfc5322.html
//
// required: true
// example: $emailId
Id string `json:"id,omitempty"`
// The id of the Thread to which this Email belongs.
//
// example: $threadId
ThreadId string `json:"threadId,omitempty"`
// The number of emails in the thread, including this one.
@@ -1539,8 +1448,6 @@ type EmailSummary struct {
// The set is represented as an object, with each key being a Mailbox id.
//
// The value for each key in the object MUST be true.
//
// example: $mailboxIds
MailboxIds map[string]bool `json:"mailboxIds,omitempty"`
// A set of keywords that apply to the Email.
@@ -1572,8 +1479,8 @@ type EmailSummary struct {
//
// Because JSON is case sensitive, servers MUST return keywords in lowercase.
//
// The [IMAP and JMAP Keywords] registry as established in [RFC5788] assigns semantic meaning to some other
// keywords in common use.
// The [IMAP and JMAP Keywords](https://www.iana.org/assignments/imap-jmap-keywords/) registry as established in
// [RFC5788] assigns semantic meaning to some other keywords in common use.
//
// New keywords may be established here in the future. In particular, note:
//
@@ -1584,54 +1491,36 @@ type EmailSummary struct {
// Clients SHOULD set this flag when users report spam to help train automated spam-detection systems.
// - $notjunk: The Email is definitely not spam.
// Clients SHOULD set this flag when users indicate an Email is legitimate, to help train automated spam-detection systems.
//
// [IMAP and JMAP Keywords]: https://www.iana.org/assignments/imap-jmap-keywords/
// [RFC5788]: https://www.rfc-editor.org/rfc/rfc5788.html
//
// example: $emailKeywords
Keywords map[string]bool `json:"keywords,omitempty"`
// The size, in octets, of the raw data for the message [RFC5322]
// (as referenced by the blobId, i.e., the number of octets in the file the user would download).
//
// [RFC5322]: https://www.rfc-editor.org/rfc/rfc5322.html
Size int `json:"size"`
// The date the Email was received by the message store.
//
// This is the internal date in IMAP [RFC3501].
//
// [RFC3501]: https://www.rfc-editor.org/rfc/rfc3501.html
//
// example: $emailReceivedAt
ReceivedAt time.Time `json:"receivedAt,omitzero"`
// The value is identical to the value of header:Sender:asAddresses.
// example: $emailSenders
// The value is identical to the value of `header:Sender:asAddresses`.
Sender []jmap.EmailAddress `json:"sender,omitempty"`
// The value is identical to the value of header:From:asAddresses.
// example: $emailFroms
// The value is identical to the value of `header:From:asAddresses`.
From []jmap.EmailAddress `json:"from,omitempty"`
// The value is identical to the value of header:To:asAddresses.
// example: $emailTos
// The value is identical to the value of `header:To:asAddresses`.
To []jmap.EmailAddress `json:"to,omitempty"`
// The value is identical to the value of header:Cc:asAddresses.
// example: $emailCCs
// The value is identical to the value of `header:Cc:asAddresses`.
Cc []jmap.EmailAddress `json:"cc,omitempty"`
// The value is identical to the value of header:Bcc:asAddresses.
// example: $emailBCCs
// The value is identical to the value of `header:Bcc:asAddresses`.
Bcc []jmap.EmailAddress `json:"bcc,omitempty"`
// The value is identical to the value of header:Subject:asText.
// example: $emailSubject
// The value is identical to the value of `header:Subject:asText`.
Subject string `json:"subject,omitempty"`
// The value is identical to the value of header:Date:asDate.
// example: $emailSentAt
// The value is identical to the value of `header:Date:asDate`.
SentAt time.Time `json:"sentAt,omitzero"`
// This is true if there are one or more parts in the message that a client UI should offer as downloadable.
@@ -1643,26 +1532,21 @@ type EmailSummary struct {
// as embedded images in one of the text/html parts of the message.
//
// The server MAY set hasAttachment based on implementation-defined or site-configurable heuristics.
// example: true
HasAttachment bool `json:"hasAttachment,omitempty"`
// A list, traversing depth-first, of all parts in bodyStructure.
//
// They must satisfy either of the following conditions:
//
// - not of type multipart/* and not included in textBody or htmlBody
// - of type image/*, audio/*, or video/* and not in both textBody and htmlBody
// - not of type `multipart/*` and not included in textBody or htmlBody
// - of type `image/*`, `audio/*`, or `video/*` and not in both textBody and htmlBody
//
// None of these parts include subParts, including message/* types.
// None of these parts include subParts, including `message/*` types.
//
// Attached messages may be fetched using the Email/parse method and the blobId.
//
// Note that a text/html body part HTML may reference image parts in attachments by using cid:
// Note that a `text/html` body part HTML may reference image parts in attachments by using cid:
// links to reference the Content-Id, as defined in [RFC2392], or by referencing the Content-Location.
//
// [RFC2392]: https://www.rfc-editor.org/rfc/rfc2392.html
//
// example: $emailAttachments
Attachments []jmap.EmailBodyPart `json:"attachments,omitempty"`
// A plaintext fragment of the message body.
@@ -1679,8 +1563,6 @@ type EmailSummary struct {
// time, fetching this for an Email a second time MAY return a different result.
// However, the previous value is not considered incorrect, and the change SHOULD NOT cause the Email object
// to be considered as changed by the server.
//
// example: $emailPreview
Preview string `json:"preview,omitempty"`
}
@@ -1712,34 +1594,6 @@ type emailWithAccountId struct {
email jmap.Email
}
// When the request succeeds.
// swagger:response GetLatestEmailsSummaryForAllAccounts200
type SwaggerGetLatestEmailsSummaryForAllAccounts200 struct {
// in: body
Body []EmailSummary
}
// swagger:parameters get_latest_emails_summary_for_all_accounts
type SwaggerGetLatestEmailsSummaryForAllAccountsParams struct {
// The maximum amount of email summaries to return.
// in: query
// example: 10
// default: 10
Limit uint `json:"limit"`
// Whether to include emails that have already been seen (read) or not.
// in: query
// example: true
// default: false
Seen bool `json:"seen"`
// Whether to include emails that have been flagged as junk or phishing.
// in: query
// example: false
// default: false
Undesirable bool `json:"undesirable"`
}
type EmailSummaries struct {
Emails []EmailSummary `json:"emails,omitempty"`
Total uint `json:"total,omitzero"`
@@ -1748,7 +1602,6 @@ type EmailSummaries struct {
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.
//
// Retrieves summaries of the latest emails of a user, in all accounts, across all mailboxes.
@@ -1757,15 +1610,8 @@ type EmailSummaries struct {
//
// The following additional query parameters may be specified to further filter the emails to summarize:
//
// !- `seen`: when `true`, emails that have already been seen (read) will be included as well (default is to only include emails that have not been read yet)
// !- `undesirable`: when `true`, emails that are flagged as spam or phishing will also be summarized (default is to ignore those)
//
// responses:
//
// 200: GetLatestEmailsSummaryForAllAccounts200
// 400: ErrorResponse400
// 404: ErrorResponse404
// 500: ErrorResponse500
// * `seen`: when `true`, emails that have already been seen (read) will be included as well (default is to only include emails that have not been read yet)
// * `undesirable`: when `true`, emails that are flagged as spam or phishing will also be summarized (default is to ignore those)
func (g *Groupware) GetLatestEmailsSummaryForAllAccounts(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
l := req.logger.With()

View File

@@ -10,22 +10,7 @@ import (
"github.com/opencloud-eu/opencloud/pkg/structs"
)
// When the request suceeds.
// swagger:response GetIdentitiesResponse
type SwaggerGetIdentitiesResponse struct {
// in: body
Body []jmap.Identity
}
// swagger:route GET /groupware/accounts/{account}/identities identity identities
// Get the list of identities that are associated with an account.
//
// responses:
//
// 200: GetIdentitiesResponse
// 400: ErrorResponse400
// 404: ErrorResponse404
// 500: ErrorResponse500
func (g *Groupware) GetIdentities(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
accountId, err := req.GetAccountIdForMail()

View File

@@ -142,22 +142,8 @@ type IndexResponse struct {
PrimaryAccounts IndexPrimaryAccounts `json:"primaryAccounts"`
}
// When the request suceeds.
// swagger:response IndexResponse
type SwaggerIndexResponse struct {
// in: body
Body struct {
*IndexResponse
}
}
// swagger:route GET /groupware bootstrap index
// Get initial bootstrapping information for a user.
// @api:tag bootstrap
//
// responses:
//
// 200: IndexResponse
func (g *Groupware) Index(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
accountIds := req.AllAccountIds()
@@ -167,14 +153,14 @@ func (g *Groupware) Index(w http.ResponseWriter, r *http.Request) {
return req.errorResponseFromJmap(accountIds, err)
}
var RBODY IndexResponse = IndexResponse{
var body IndexResponse = IndexResponse{
Version: Version,
Capabilities: Capabilities,
Limits: buildIndexLimits(req.session),
Accounts: buildIndexAccounts(req.session, boot),
PrimaryAccounts: buildIndexPrimaryAccounts(req.session),
}
return etagResponse(accountIds, RBODY, sessionState, IndexResponseObjectType, state, lang)
return etagResponse(accountIds, body, sessionState, IndexResponseObjectType, state, lang)
})
}

View File

@@ -11,28 +11,12 @@ import (
"github.com/opencloud-eu/opencloud/pkg/log"
)
// When the request succeeds.
// swagger:response MailboxResponse200
type SwaggerGetMailboxById200 struct {
// in: body
Body struct {
*jmap.Mailbox
}
}
// swagger:route GET /groupware/accounts/{account}/mailboxes/{mailbox} mailbox mailboxes_by_id
// Get a specific mailbox by its identifier.
//
// A Mailbox represents a named set of Emails.
//
// This is the primary mechanism for organising Emails within an account.
// It is analogous to a folder or a label in other systems.
//
// responses:
//
// 200: MailboxResponse200
// 400: ErrorResponse400
// 404: ErrorResponse404
// 500: ErrorResponse500
func (g *Groupware) GetMailbox(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
accountId, err := req.GetAccountIdForMail()
@@ -58,42 +42,15 @@ func (g *Groupware) GetMailbox(w http.ResponseWriter, r *http.Request) {
})
}
// swagger:parameters mailboxes
type SwaggerMailboxesParams struct {
// The name of the mailbox, with substring matching.
// in: query
Name string `json:"name,omitempty"`
// The role of the mailbox.
// in: query
Role string `json:"role,omitempty"`
// Whether the mailbox is subscribed by the user or not.
// When omitted, the subscribed and unsubscribed mailboxes are returned.
// in: query
Subscribed bool `json:"subscribed,omitempty"`
}
// When the request succeeds.
// swagger:response MailboxesResponse200
type SwaggerMailboxesResponse200 struct {
// in: body
Body []jmap.Mailbox
}
// swagger:route GET /groupware/accounts/{account}/mailboxes mailbox mailboxes
// Get the list of all the mailboxes of an account, potentially filtering on the
// name and/or role of the mailbox.
//
// A Mailbox represents a named set of Emails.
//
// This is the primary mechanism for organising Emails within an account.
// It is analogous to a folder or a label in other systems.
//
// When none of the query parameters are specified, all the mailboxes are returned.
//
// responses:
//
// 200: MailboxesResponse200
// 400: ErrorResponse400
// 500: ErrorResponse500
func (g *Groupware) GetMailboxes(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
var filter jmap.MailboxFilterCondition
@@ -151,21 +108,7 @@ func (g *Groupware) GetMailboxes(w http.ResponseWriter, r *http.Request) {
})
}
// When the request succeeds.
// swagger:response MailboxesForAllAccountsResponse200
type SwaggerMailboxesForAllAccountsResponse200 struct {
// in: body
Body map[string][]jmap.Mailbox
}
// swagger:route GET /groupware/accounts/all/mailboxes mailboxesforallaccounts mailbox
// Get the list of all the mailboxes of all accounts of a user, potentially filtering on the role of the mailboxes.
//
// responses:
//
// 200: MailboxesForAllAccountsResponse200
// 400: ErrorResponse400
// 500: ErrorResponse500
func (g *Groupware) GetMailboxesForAllAccounts(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
accountIds := req.AllAccountIds()
@@ -232,21 +175,7 @@ func (g *Groupware) GetMailboxByRoleForAllAccounts(w http.ResponseWriter, r *htt
})
}
// When the request succeeds.
// swagger:response MailboxChangesResponse200
type SwaggerMailboxChangesResponse200 struct {
// in: body
Body *jmap.MailboxChanges
}
// swagger:route GET /groupware/accounts/{account}/mailboxes/{mailbox}/changes mailbox mailboxchanges
// Get the changes that occured in a given mailbox since a certain state.
//
// responses:
//
// 200: MailboxChangesResponse200
// 400: ErrorResponse400
// 500: ErrorResponse500
func (g *Groupware) GetMailboxChanges(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
l := req.logger.With()
@@ -287,21 +216,7 @@ func (g *Groupware) GetMailboxChanges(w http.ResponseWriter, r *http.Request) {
})
}
// When the request succeeds.
// swagger:response MailboxChangesForAllAccountsResponse200
type SwaggerMailboxChangesForAllAccountsResponse200 struct {
// in: body
Body map[string]jmap.MailboxChanges
}
// swagger:route GET /groupware/accounts/all/mailboxes/changes mailbox mailboxchangesforallaccounts
// Get the changes that occured in all the mailboxes of all accounts.
//
// responses:
//
// 200: MailboxChangesForAllAccountsResponse200
// 400: ErrorResponse400
// 500: ErrorResponse500
func (g *Groupware) GetMailboxChangesForAllAccounts(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
l := req.logger.With()

View File

@@ -7,25 +7,11 @@ import (
"github.com/opencloud-eu/opencloud/pkg/log"
)
// When the request succeeds.
// swagger:response GetQuotaResponse200
type SwaggerGetQuotaResponse200 struct {
// in: body
Body []jmap.Quota
}
// swagger:route GET /groupware/accounts/{account}/quota quota get_quota
// Get quota limits.
//
// Retrieves the list of Quota configurations for a given account.
//
// Note that there may be multiple Quota objects for different resource types.
//
// responses:
//
// 200: GetQuotaResponse200
// 400: ErrorResponse400
// 500: ErrorResponse500
func (g *Groupware) GetQuota(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
accountId, err := req.GetAccountIdForQuota()
@@ -51,24 +37,10 @@ type AccountQuota struct {
State jmap.State `json:"state"`
}
// When the request succeeds.
// swagger:response GetQuotaForAllAccountsResponse200
type SwaggerGetQuotaForAllAccountsResponse200 struct {
// in: body
Body map[string]AccountQuota
}
// swagger:route GET /groupware/accounts/all/quota quota get_quota_for_all_accounts
// Get quota limits for all accounts.
//
// Retrieves the Quota configuration for all the accounts the user currently has access to,
// as a dictionary that has the account identifier as its key and an array of Quotas as its value.
//
// responses:
//
// 200: GetQuotaForAllAccountsResponse200
// 400: ErrorResponse400
// 500: ErrorResponse500
func (g *Groupware) GetQuotaForAllAccounts(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
accountIds := req.AllAccountIds()

View File

@@ -6,22 +6,7 @@ import (
"github.com/opencloud-eu/opencloud/pkg/jmap"
)
// When the request succeeds.
// swagger:response GetTaskLists200
type SwaggerGetTaskLists200 struct {
// in: body
Body []jmap.TaskList
}
// swagger:route GET /groupware/accounts/{account}/tasklists tasklist tasklists
// Get all tasklists of an account.
//
// responses:
//
// 200: GetTaskLists200
// 400: ErrorResponse400
// 404: ErrorResponse404
// 500: ErrorResponse500
func (g *Groupware) GetTaskLists(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
ok, accountId, resp := req.needTaskWithAccount()
@@ -35,24 +20,7 @@ func (g *Groupware) GetTaskLists(w http.ResponseWriter, r *http.Request) {
})
}
// When the request succeeds.
// swagger:response GetTaskListById200
type SwaggerGetTaskListById200 struct {
// in: body
Body struct {
*jmap.TaskList
}
}
// swagger:route GET /groupware/accounts/{account}/tasklists/{tasklistid} tasklist tasklist_by_id
// Get a tasklist by its identifier.
//
// responses:
//
// 200: GetTaskListById200
// 400: ErrorResponse400
// 404: ErrorResponse404
// 500: ErrorResponse500
func (g *Groupware) GetTaskListById(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
ok, accountId, resp := req.needTaskWithAccount()
@@ -75,22 +43,7 @@ func (g *Groupware) GetTaskListById(w http.ResponseWriter, r *http.Request) {
})
}
// When the request succeeds.
// swagger:response GetTasksInTaskList200
type SwaggerGetTasksInTaskList200 struct {
// in: body
Body []jmap.Task
}
// swagger:route GET /groupware/accounts/{account}/tasklists/{tasklistid}/tasks task tasks_in_tasklist
// Get all the tasks in a tasklist of an account by its identifier.
//
// responses:
//
// 200: GetTasksInTaskList200
// 400: ErrorResponse400
// 404: ErrorResponse404
// 500: ErrorResponse500
func (g *Groupware) GetTasksInTaskList(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
ok, accountId, resp := req.needTaskWithAccount()

View File

@@ -7,28 +7,12 @@ import (
"github.com/opencloud-eu/opencloud/pkg/log"
)
// When the request succeeds.
// swagger:response GetVacationResponse200
type SwaggerGetVacationResponse200 struct {
// in: body
Body struct {
*jmap.VacationResponseGetResponse
}
}
// swagger:route GET /groupware/accounts/{account}/vacation vacation getvacation
// Get vacation notice information.
//
// A vacation response sends an automatic reply when a message is delivered to the mail store, informing the original
// sender that their message may not be read for some time.
//
// The VacationResponse object represents the state of vacation-response-related settings for an account.
//
// responses:
//
// 200: GetVacationResponse200
// 400: ErrorResponse400
// 500: ErrorResponse500
func (g *Groupware) GetVacation(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
accountId, err := req.GetAccountIdForVacationResponse()
@@ -45,26 +29,10 @@ func (g *Groupware) GetVacation(w http.ResponseWriter, r *http.Request) {
})
}
// When the request succeeds.
// swagger:response SetVacationResponse200
type SwaggerSetVacationResponse200 struct {
// in: body
Body struct {
*jmap.VacationResponse
}
}
// swagger:route PUT /groupware/accounts/{account}/vacation vacation setvacation
// Set the vacation notice information.
//
// A vacation response sends an automatic reply when a message is delivered to the mail store, informing the original
// sender that their message may not be read for some time.
//
// responses:
//
// 200: SetVacationResponse200
// 400: ErrorResponse400
// 500: ErrorResponse500
func (g *Groupware) SetVacation(w http.ResponseWriter, r *http.Request) {
g.respond(w, r, func(req Request) Response {
accountId, err := req.GetAccountIdForVacationResponse()

View File

@@ -1,48 +0,0 @@
// OpenCloud Groupware API
//
// Documentation for the OpenCloud Groupware API
//
// Schemes: https
// BasePath: /
// Version: 1.0.0
// Host:
//
// Consumes:
// - application/json
//
// Produces:
// - application/json
//
// Security:
// - bearer
//
// swagger:meta
package groupware
// When the request contains invalid parameters.
// swagger:response ErrorResponse400
type SwaggerErrorResponse400 struct {
// in: body
Body struct {
*ErrorResponse
}
}
// When the requested object does not exist.
// swagger:response ErrorResponse404
type SwaggerErrorResponse404 struct {
}
// When the server was unable to complete the request.
// swagger:response ErrorResponse500
type SwaggerErrorResponse500 struct {
// in: body
Body struct {
*ErrorResponse
}
}
// When the request succeeds.
// swagger:response Success204
type SwaggerSuccess204 struct {
}