UserService represents a service for managing users.
| 49 | |
| 50 | // UserService represents a service for managing users. |
| 51 | type UserService interface { |
| 52 | // Retrieves a user by ID along with their associated auth objects. |
| 53 | // Returns ENOTFOUND if user does not exist. |
| 54 | FindUserByID(ctx context.Context, id int) (*User, error) |
| 55 | |
| 56 | // Retrieves a list of users by filter. Also returns total count of matching |
| 57 | // users which may differ from returned results if filter.Limit is specified. |
| 58 | FindUsers(ctx context.Context, filter UserFilter) ([]*User, int, error) |
| 59 | |
| 60 | // Creates a new user. This is only used for testing since users are typically |
| 61 | // created during the OAuth creation process in AuthService.CreateAuth(). |
| 62 | CreateUser(ctx context.Context, user *User) error |
| 63 | |
| 64 | // Updates a user object. Returns EUNAUTHORIZED if current user is not |
| 65 | // the user that is being updated. Returns ENOTFOUND if user does not exist. |
| 66 | UpdateUser(ctx context.Context, id int, upd UserUpdate) (*User, error) |
| 67 | |
| 68 | // Permanently deletes a user and all owned dials. Returns EUNAUTHORIZED |
| 69 | // if current user is not the user being deleted. Returns ENOTFOUND if |
| 70 | // user does not exist. |
| 71 | DeleteUser(ctx context.Context, id int) error |
| 72 | } |
| 73 | |
| 74 | // UserFilter represents a filter passed to FindUsers(). |
| 75 | type UserFilter struct { |
no outgoing calls
no test coverage detected