Retrieves an image of a the user's avatar.
This operation is performed by calling function get_user_avatar
.
See the endpoint docs at API Reference.
client.avatars.get_user_avatar(user.id)
- user_id
str
- The ID of the user. Example: "12345"
- extra_headers
Optional[Dict[str, Optional[str]]]
- Extra headers that will be included in the HTTP request.
This function returns a value of type ByteStream
.
When an avatar can be found for the user the image data will be returned in the body of the response.
Adds or updates a user avatar.
This operation is performed by calling function create_user_avatar
.
See the endpoint docs at API Reference.
client.avatars.create_user_avatar(
user.id,
decode_base_64_byte_stream(
"iVBORw0KGgoAAAANSUhEUgAAAQAAAAEAAQMAAABmvDolAAAAA1BMVEW10NBjBBbqAAAAH0lEQVRoge3BAQ0AAADCoPdPbQ43oAAAAAAAAAAAvg0hAAABmmDh1QAAAABJRU5ErkJggg=="
),
pic_file_name="avatar.png",
pic_content_type="image/png",
)
- user_id
str
- The ID of the user. Example: "12345"
- pic
ByteStream
- The image file to be uploaded to Box. Accepted file extensions are
.jpg
or.png
. The maximum file size is 1MB.
- The image file to be uploaded to Box. Accepted file extensions are
- extra_headers
Optional[Dict[str, Optional[str]]]
- Extra headers that will be included in the HTTP request.
This function returns a value of type UserAvatar
.
ok
: Returns thepic_urls
object with URLs to existing user avatars that were updated.*created
: Returns thepic_urls
object with URLS to user avatars uploaded to Box with the request.
Removes an existing user avatar. You cannot reverse this operation.
This operation is performed by calling function delete_user_avatar
.
See the endpoint docs at API Reference.
client.avatars.delete_user_avatar(user.id)
- user_id
str
- The ID of the user. Example: "12345"
- extra_headers
Optional[Dict[str, Optional[str]]]
- Extra headers that will be included in the HTTP request.
This function returns a value of type None
.
no_content
: Removes the avatar and returns an empty response.