AvatarService
Service for managing Gravatar avatars.
Parameters
okHttpClient
The OkHttp client to use for making network requests. This client will be extended with Gravatar interceptors to set either API key or OAuth token.
Functions
Link copied to clipboard
suspend fun retrieveCatching(oauthToken: String, hash: Hash): GravatarResult<List<Avatar>, ErrorType>
Retrieves a list of available avatars for the authenticated user. This method will catch any exception that occurs during the execution and return it as a GravatarResult.Failure.
Link copied to clipboard
suspend fun setAvatarCatching(hash: String, avatarId: String, oauthToken: String): GravatarResult<Unit, ErrorType>
Sets the avatar for the given email (hash). This method will catch any exception that occurs during the execution and return it as a GravatarResult.Failure.
Link copied to clipboard
suspend fun uploadCatching(file: File, oauthToken: String, hash: Hash? = null, selectAvatar: Boolean? = null): GravatarResult<Avatar, ErrorType>
Uploads an image to be used as Gravatar avatar. This method will catch any exception that occurs during the execution and return it as a GravatarResult.Failure.