Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GetUserPhotoURLEndpoint ¶
type GetUserPhotoURLEndpoint struct{}
Returns a temporary link that can be used to fetch the user's profile photo image.
The link expires one hour after it is issued, and no link is returned for a user who has never uploaded a photo. Users may always fetch their own photo; fetching another user's photo requires read access to team users.
func (*GetUserPhotoURLEndpoint) Materialize ¶
func (e *GetUserPhotoURLEndpoint) Materialize() *apiendpoint.APIEndpoint[*GetUserPhotoURLRequest, *apiresource.UserPhotoURL]
type GetUserPhotoURLRequest ¶
type GetUserPhotoURLRequest struct {
// User ID.
UserID string `path:"id" validate:"required"`
}
Request for a temporary link to a user's profile photo.
type RetrieveUserEndpoint ¶
type RetrieveUserEndpoint struct{}
Retrieves a user's global profile.
The profile is shared across every account the user belongs to; account-specific details such as their status, role, and department live on the account user record instead.
func (*RetrieveUserEndpoint) Materialize ¶
func (e *RetrieveUserEndpoint) Materialize() *apiendpoint.APIEndpoint[*RetrieveUserRequest, *apiresource.User]
type RetrieveUserRequest ¶
type RetrieveUserRequest struct {
// Identifier for the user.
//
// Accepts the user's ID, email address, or username, tried in that order.
UserID string `path:"id" validate:"required"`
}
Request to retrieve a user.
type UpdateUserEndpoint ¶
type UpdateUserEndpoint struct{}
Updates a user's global profile.
Changes apply everywhere the user appears, in every account they belong to. Account-specific details such as their status, role, and department are changed on the account user record instead.
func (*UpdateUserEndpoint) Materialize ¶
func (e *UpdateUserEndpoint) Materialize() *apiendpoint.APIEndpoint[*UpdateUserRequest, *apiresource.User]
type UpdateUserRequest ¶
type UpdateUserRequest struct {
// User ID.
UserID string `path:"id" validate:"required"`
// The user's full display name.
Name field.Optional[string] `json:"name,omitzero" validate:"omitempty,max=255"`
// Location of the user's profile image.
//
// Uploading a photo through Upload User Photo overwrites whatever is set here.
ImageUrl field.Optional[string] `json:"image_url,omitzero" validate:"omitempty,max=2083"`
// When the user's email address was verified.
//
// Setting this marks the address as verified outright; no verification email is sent and no verification link is checked.
EmailVerified field.Optional[time.Time] `json:"email_verified,omitzero"`
}
Request to update a user.
func (*UpdateUserRequest) SchemaExample ¶
func (*UpdateUserRequest) SchemaExample() any
type UploadUserPhotoEndpoint ¶
type UploadUserPhotoEndpoint struct{}
Uploads a profile photo for a user.
The photo replaces any existing one, and the user's `image_url` is repointed at an internal path rather than a fetchable image URL. Because the stored image is not publicly readable, use Get User Photo URL to obtain a temporary link for displaying it.
func (*UploadUserPhotoEndpoint) Materialize ¶
func (e *UploadUserPhotoEndpoint) Materialize() *apiendpoint.APIEndpoint[*UploadUserPhotoRequest, *apiresource.UserPhotoUploadResult]
type UploadUserPhotoRequest ¶
type UploadUserPhotoRequest struct {
// User ID.
UserID string `path:"id" validate:"required"`
// The image itself, sent as the raw request body rather than as JSON or a multipart form.
RawBody []byte `rawbody:"true"`
// MIME type of the image (e.g. `image/png`).
ContentType string `header:"Content-Type"`
}
Request to upload a user profile photo.
type UserSvc ¶
type UserSvc interface {
GetUser(ctx context.Context, req *RetrieveUserRequest) (*apiresource.User, *apierror.APIError)
UpdateUser(ctx context.Context, req *UpdateUserRequest) (*apiresource.User, *apierror.APIError)
UploadUserPhoto(ctx context.Context, req *UploadUserPhotoRequest) (*apiresource.UserPhotoUploadResult, *apierror.APIError)
GetUserPhotoURL(ctx context.Context, req *GetUserPhotoURLRequest) (*apiresource.UserPhotoURL, *apierror.APIError)
}
func NewUserSvc ¶
func NewUserSvc(config *UserSvcConfig) UserSvc
type UserSvcConfig ¶
type UserSvcConfig struct {
// CoreClient (required) is the core-service gRPC client.
CoreClient pb.CoreServiceClient
}