MCPcopy Index your code
hub / github.com/coder/coder / getUserSkills

Method getUserSkills

coderd/userskills.go:125–140  ·  view source on GitHub ↗

@Summary List user skills @ID list-user-skills @Security CoderSessionToken @Produce json @Tags Users @Param user path string true "User ID, username, or me" @Success 200 {array} codersdk.UserSkillMetadata @Router /api/experimental/users/{user}/skills [get] @x-apidocgen {"skip": true}

(rw http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

123// @Router /api/experimental/users/{user}/skills [get]
124// @x-apidocgen {"skip": true}
125func (api *API) getUserSkills(rw http.ResponseWriter, r *http.Request) { //nolint:revive // Method name matches route.
126 ctx := r.Context()
127 user := httpmw.UserParam(r)
128
129 rows, err := api.Database.ListUserSkillMetadataByUserID(ctx, user.ID)
130 if err != nil {
131 if httpapi.Is404Error(err) {
132 httpapi.ResourceNotFound(rw)
133 return
134 }
135 httpapi.InternalServerError(rw, err)
136 return
137 }
138
139 httpapi.Write(ctx, rw, http.StatusOK, db2sdk.UserSkillMetadataList(rows))
140}
141
142// @Summary Get a user skill by name
143// @ID get-a-user-skill-by-name

Callers 1

userSkillsFunction · 0.80

Calls 8

UserParamFunction · 0.92
Is404ErrorFunction · 0.92
ResourceNotFoundFunction · 0.92
InternalServerErrorFunction · 0.92
WriteFunction · 0.92
UserSkillMetadataListFunction · 0.92
ContextMethod · 0.65

Tested by

no test coverage detected