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

Method getUserSkill

coderd/userskills.go:152–171  ·  view source on GitHub ↗

@Summary Get a user skill by name @ID get-a-user-skill-by-name @Security CoderSessionToken @Produce json @Tags Users @Param user path string true "User ID, username, or me" @Param skillName path string true "Skill name" @Success 200 {object} codersdk.UserSkill @Router /api/experimental/users/{user}/

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

Source from the content-addressed store, hash-verified

150// @Router /api/experimental/users/{user}/skills/{skillName} [get]
151// @x-apidocgen {"skip": true}
152func (api *API) getUserSkill(rw http.ResponseWriter, r *http.Request) { //nolint:revive // Method name matches route.
153 ctx := r.Context()
154 user := httpmw.UserParam(r)
155 name := chi.URLParam(r, "skillName")
156
157 skill, err := api.Database.GetUserSkillByUserIDAndName(ctx, database.GetUserSkillByUserIDAndNameParams{
158 UserID: user.ID,
159 Name: name,
160 })
161 if err != nil {
162 if httpapi.Is404Error(err) {
163 httpapi.ResourceNotFound(rw)
164 return
165 }
166 httpapi.InternalServerError(rw, err)
167 return
168 }
169
170 httpapi.Write(ctx, rw, http.StatusOK, db2sdk.UserSkill(skill))
171}
172
173// @Summary Update a user skill
174// @ID update-a-user-skill

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected