GetClients returns all clients a user has. swagger:operation GET /client client getClients Return all clients. --- consumes: [application/json] produces: [application/json] security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []] responses:
(ctx *gin.Context)
| 177 | // schema: |
| 178 | // $ref: "#/definitions/Error" |
| 179 | func (a *ClientAPI) GetClients(ctx *gin.Context) { |
| 180 | userID := auth.GetUserID(ctx) |
| 181 | clients, err := a.DB.GetClientsByUser(userID) |
| 182 | if success := successOrAbort(ctx, 500, err); !success { |
| 183 | return |
| 184 | } |
| 185 | ctx.JSON(200, clients) |
| 186 | } |
| 187 | |
| 188 | // DeleteClient deletes a client by its id. |
| 189 | // swagger:operation DELETE /client/{id} client deleteClient |