Files
opencloud/services/groupware/pkg/groupware/groupware_api_identity.go
Pascal Bleser 082ad6c848 docs(groupware): OpenAPI improvements
* refactor some pkg/jmap and groupware methods to make more sense from
   an API point-of-view

 * add path parameter documentation, but automate it by injecting their
   definition into the OpenAPI YAML tree that is extracted from the
   source code using go-swagger as it is too cumbersome, repetitive and
   error-prine to document them in the source code; wrote a TypeScript
   file apidoc-process.ts to do so

 * add generating an offline HTML file for the OpenAPI documentation
   using redocly, and injecting a favicon into the resulting HTML; wrote
   a TypeScript file apidoc-postprocess-html.ts to do so
2026-07-09 14:15:49 +02:00

42 lines
1.1 KiB
Go

package groupware
import (
"net/http"
"github.com/opencloud-eu/opencloud/pkg/jmap"
"github.com/opencloud-eu/opencloud/pkg/log"
)
// When the request suceeds.
// swagger:response GetIdentitiesResponse
type SwaggerGetIdentitiesResponse struct {
// in: body
Body struct {
*jmap.Identities
}
}
// 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.GetAccountIdWithoutFallback()
if err != nil {
return errorResponse(err)
}
logger := log.From(req.logger.With().Str(logAccountId, accountId))
res, sessionState, jerr := g.jmap.GetIdentity(accountId, req.session, req.ctx, logger)
if jerr != nil {
return req.errorResponseFromJmap(jerr)
}
return etagResponse(res, sessionState, res.State)
})
}