Ex.Pnut v0.1.0 ExPnut.User.Profile View Source

Receive or update user data.

Endpoints:

  • Completely update a user
  • Partially update a user
  • Get user avatar
  • Update user avatar
  • Get user cover
  • Update user cover

https://pnut.io/docs/api/resources/users/profile

Link to this section Summary

Functions

This endpoint will return an HTTP 302 redirect to the user’s current avatar image. It will include any query string parameters you pass to the endpoint.

This endpoint will return an HTTP 302 redirect to the user’s current cover image. It will include any query string parameters you pass to the endpoint.

Updates only specified parts of the authenticated user's profile.

Uploads a new avatar image for the authenticated user.

Uploads a new cover image for the authenticated user.

Replaces the authenticated user's profile. Anything not included is removed.

Link to this section Functions

Link to this function

get_avatar(client, user_id, user_params \\ %UserParams{}) View Source

This endpoint will return an HTTP 302 redirect to the user’s current avatar image. It will include any query string parameters you pass to the endpoint.

Parameters

  • user_id: ID of the user whose avatar to retrieve.
Link to this function

get_cover(client, user_id, user_params \\ %UserParams{}) View Source

This endpoint will return an HTTP 302 redirect to the user’s current cover image. It will include any query string parameters you pass to the endpoint.

Parameters

  • user_id: ID of the user whose cover image to retrieve.
Link to this function

patch_user(client, user_profile, user_params \\ %UserParams{}) View Source

Updates only specified parts of the authenticated user's profile.

Requires a user object with "application/json" content type. "name", "text", "timezone", and "locale" are current options.

"text" must be a child key of "content".

Returns the updated user object.

Link to this function

set_avatar(client, avatar, user_params \\ %UserParams{}) View Source

Uploads a new avatar image for the authenticated user.

The uploaded image will be cropped to square and must be smaller than 2MiB.

Can specify "Content-Type" of "application/json" with the key "{from_url}", or a "Content-Type" of "multipart/form-data", with the file as key "avatar". "Content-Length" header must also be set.

Link to this function

set_cover(client, cover, user_params \\ %UserParams{}) View Source

Uploads a new cover image for the authenticated user.

The uploaded image must be smaller than 4MiB, with a width of at least 960px and height of at least 223px.

If the width / height ratio is less than 2 to 1, the height will be cropped to height / 4.3. A 10000x10000px image would be cropped to 10000x2326px.

Can specify "Content-Type" of "application/json" with the key "{from_url}", or a "Content-Type" of "multipart/form-data", with the file as key "avatar". "Content-Length" header must also be set.

Link to this function

update_profile(client, user_profile, user_params \\ %UserParams{}) View Source

Replaces the authenticated user's profile. Anything not included is removed.

Requires a user object with "application/json" Content-Type. "timezone" and "locale" are required. Not including "name" or "text" will remove them from the profile.

"text" must be a child key of "content".

Returns the updated user object.