MCPcopy Index your code
hub / github.com/apache/devlake / GetUser

Method GetUser

backend/plugins/org/api/user.go:39–63  ·  view source on GitHub ↗

GetUser returns all user in csv format @Summary Get users.csv file @Description get users.csv file @Tags plugins/org @Produce text/csv @Param fake_data query bool false "return fake data or not" @Success 200 @Failure 400 {object} shared.ApiBody "Bad Request" @Fail

(input *plugin.ApiResourceInput)

Source from the content-addressed store, hash-verified

37// @Failure 500 {object} shared.ApiBody "Internal Error"
38// @Router /plugins/org/users.csv [get]
39func (h *Handlers) GetUser(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) {
40 var users []user
41 var u *user
42 var err errors.Error
43 if input.Query.Get("fake_data") == "true" {
44 users = u.fakeData()
45 } else {
46 users, err = h.store.findAllUsers()
47 if err != nil {
48 return nil, err
49 }
50 }
51 blob, err := errors.Convert01(gocsv.MarshalBytes(users))
52 if err != nil {
53 return nil, err
54 }
55 return &plugin.ApiResourceOutput{
56 Body: nil,
57 Status: http.StatusOK,
58 File: &plugin.OutputFile{
59 ContentType: "text/csv",
60 Data: blob,
61 },
62 }, nil
63}
64
65// CreateUser accepts a CSV file containing user information mapping and saves it to the database
66// @Summary Upload users.csv file

Callers 3

handlePluginCallFunction · 0.80
PutApiKeyFunction · 0.80
PostApiKeyFunction · 0.80

Calls 3

fakeDataMethod · 0.95
GetMethod · 0.65
findAllUsersMethod · 0.65

Tested by

no test coverage detected