Skip to content

Commit c02c754

Browse files
committed
Update swagger
1 parent c8c39ec commit c02c754

File tree

10 files changed

+128
-126
lines changed

10 files changed

+128
-126
lines changed

coderd/apidoc/docs.go

Lines changed: 27 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 22 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/coderd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ func New(options *Options) *API {
665665
apiKeyMiddleware,
666666
)
667667
// Get without a specific external auth ID will return all external auths.
668-
r.Get("/", api.userExternalAuths)
668+
r.Get("/", api.listUserExternalAuths)
669669
r.Route("/{externalauth}", func(r chi.Router) {
670670
r.Use(
671671
httpmw.ExtractExternalAuthParam(options.ExternalAuthConfigs),

coderd/database/dbmem/dbmem.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ func (*FakeQuerier) DeleteCoordinator(context.Context, uuid.UUID) error {
10191019
return ErrUnimplemented
10201020
}
10211021

1022-
func (q *FakeQuerier) DeleteExternalAuthLink(ctx context.Context, arg database.DeleteExternalAuthLinkParams) error {
1022+
func (q *FakeQuerier) DeleteExternalAuthLink(_ context.Context, arg database.DeleteExternalAuthLinkParams) error {
10231023
err := validateDatabaseType(arg)
10241024
if err != nil {
10251025
return err

coderd/externalauth.go

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import (
2121
// @Summary Get external auth by ID
2222
// @ID get-external-auth-by-id
2323
// @Security CoderSessionToken
24-
// @Produce json
2524
// @Tags Git
25+
// @Produce json
2626
// @Param externalauth path string true "Git Provider ID" format(string)
2727
// @Success 200 {object} codersdk.ExternalAuth
2828
// @Router /external-auth/{externalauth} [get]
@@ -78,14 +78,15 @@ func (api *API) externalAuthByID(w http.ResponseWriter, r *http.Request) {
7878
httpapi.Write(ctx, w, http.StatusOK, res)
7979
}
8080

81+
// deleteExternalAuthByID only deletes the link on the Coder side, does not revoke the token on the provider side.
82+
//
8183
// @Summary Delete external auth user link by ID
8284
// @ID delete-external-auth-user-link-by-id
8385
// @Security CoderSessionToken
84-
// @Produce json
85-
// @Param externalauth path string true "Git Provider ID" format(string)
86+
// @Tags Git
8687
// @Success 200
88+
// @Param externalauth path string true "Git Provider ID" format(string)
8789
// @Router /external-auth/{externalauth} [delete]
88-
// deleteExternalAuthByID only deletes the link on the Coder side, does not revoke the token on the provider side.
8990
func (api *API) deleteExternalAuthByID(w http.ResponseWriter, r *http.Request) {
9091
config := httpmw.ExternalAuthParam(r)
9192
apiKey := httpmw.APIKey(r)
@@ -309,14 +310,17 @@ func (api *API) externalAuthCallback(externalAuthConfig *externalauth.Config) ht
309310
}
310311
}
311312

313+
// listUserExternalAuths lists all external auths available to a user and
314+
// their auth links if they exist.
315+
//
312316
// @Summary Get user external auths
313317
// @ID get-user-external-auths
314318
// @Security CoderSessionToken
315319
// @Produce json
316-
// @Tags Users
320+
// @Tags Git
317321
// @Success 200 {object} codersdk.ExternalAuthLink
318-
// @Router /users/external-auths [get]
319-
func (api *API) userExternalAuths(rw http.ResponseWriter, r *http.Request) {
322+
// @Router /external-auth [get]
323+
func (api *API) listUserExternalAuths(rw http.ResponseWriter, r *http.Request) {
320324
ctx := r.Context()
321325
key := httpmw.APIKey(r)
322326

@@ -335,7 +339,9 @@ func (api *API) userExternalAuths(rw http.ResponseWriter, r *http.Request) {
335339

336340
// Note: It would be really nice if we could cfg.Validate() the links and
337341
// return their authenticated status. To do this, we would also have to
338-
// refresh expired tokens too.
342+
// refresh expired tokens too. For now, I do not want to cause the excess
343+
// traffic on this request, so the user will have to do this with a separate
344+
// call.
339345
httpapi.Write(ctx, rw, http.StatusOK, codersdk.ListUserExternalAuthResponse{
340346
Providers: ExternalAuthConfigs(api.ExternalAuthConfigs),
341347
Links: db2sdk.ExternalAuths(links),

codersdk/externalauth.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ type ListUserExternalAuthResponse struct {
6262
Providers []ExternalAuthLinkProvider `json:"providers"`
6363
// Links are all the authenticated links for the user.
6464
// If a link has a provider ID that does not exist, then that provider
65-
// is no longer configured, rendering it unusable.
65+
// is no longer configured, rendering it unusable. It is still valuable
66+
// to include these links so that the user can unlink them.
6667
Links []ExternalAuthLink `json:"links"`
6768
}
6869

docs/api/default.md

Lines changed: 0 additions & 27 deletions
This file was deleted.

docs/api/git.md

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/api/users.md

Lines changed: 0 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/manifest.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,10 +523,6 @@
523523
"title": "Debug",
524524
"path": "./api/debug.md"
525525
},
526-
{
527-
"title": "Default",
528-
"path": "./api/default.md"
529-
},
530526
{
531527
"title": "Enterprise",
532528
"path": "./api/enterprise.md"

0 commit comments

Comments
 (0)