Class AvatarUtilities
Utilities for getting avatar.
Namespace: TehGM.Wolfringo.Utilities
Assembly: Wolfringo.Utilities.dll
Syntax
public static class AvatarUtilities
Methods
| Improve this Doc View SourceDownloadAvatarAsync(WolfGroup, HttpClient, UInt32, CancellationToken)
Downloads bytes of group avatar.
Declaration
public static Task<byte[]> DownloadAvatarAsync(this WolfGroup group, HttpClient client, uint size = 500U, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
WolfGroup | group | Group to download avatar of. |
HttpClient | client | Http Client to request avatar bytes with. |
UInt32 | size | Size of the avatar to request. |
CancellationToken | cancellationToken | Token to cancel the request. |
Returns
Type | Description |
---|---|
Task<Byte[]> | Bytes of group avatar. Null if group of avatar not found. |
DownloadAvatarAsync(WolfGroup, UInt32, CancellationToken)
Downloads bytes of group avatar.
Declaration
public static async Task<byte[]> DownloadAvatarAsync(this WolfGroup group, uint size = 500U, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
WolfGroup | group | Group to download avatar of. |
UInt32 | size | Size of the avatar to request. |
CancellationToken | cancellationToken | Token to cancel the request. |
Returns
Type | Description |
---|---|
Task<Byte[]> | Bytes of group avatar. Null if group of avatar not found. |
Remarks
This method creates a temporary HttpClient just for the request. This might be performance heavy, and therefore it's recommended to provide your own client from own cache, or using a client factory.
DownloadAvatarAsync(WolfUser, HttpClient, UInt32, CancellationToken)
Downloads bytes of user avatar.
Declaration
public static Task<byte[]> DownloadAvatarAsync(this WolfUser user, HttpClient client, uint size = 500U, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
WolfUser | user | User to download avatar of. |
HttpClient | client | Http Client to request avatar bytes with. |
UInt32 | size | Size of the avatar to request. |
CancellationToken | cancellationToken | Token to cancel the request. |
Returns
Type | Description |
---|---|
Task<Byte[]> | Bytes of user avatar. Null if user of avatar not found. |
DownloadAvatarAsync(WolfUser, UInt32, CancellationToken)
Downloads bytes of user avatar.
Declaration
public static async Task<byte[]> DownloadAvatarAsync(this WolfUser user, uint size = 500U, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
WolfUser | user | User to download avatar of. |
UInt32 | size | Size of the avatar to request. |
CancellationToken | cancellationToken | Token to cancel the request. |
Returns
Type | Description |
---|---|
Task<Byte[]> | Bytes of user avatar. Null if user of avatar not found. |
Remarks
This method creates a temporary HttpClient just for the request. This might be performance heavy, and therefore it's recommended to provide your own client from own cache, or using a client factory.
GetAvatarURL(WolfGroup, UInt32)
Gets URL for retrieving group avatar.
Declaration
public static string GetAvatarURL(this WolfGroup group, uint size = 500U)
Parameters
Type | Name | Description |
---|---|---|
WolfGroup | group | Group to get avatar URL for. |
UInt32 | size | Size of the avatar to retrieve. |
Returns
Type | Description |
---|---|
String | URL to group's avatar. |
Remarks
This method will return URL to group avatar. You can use this URL with HttpClient to download the avatar, or use for any other purpose.
size
is only a requested size of the avatar. It is not guaranteed that URL will contain avatar with this size.
GetAvatarURL(WolfUser, UInt32)
Gets URL for retrieving user avatar.
Declaration
public static string GetAvatarURL(this WolfUser user, uint size = 500U)
Parameters
Type | Name | Description |
---|---|---|
WolfUser | user | User to get avatar URL for. |
UInt32 | size | Size of the avatar to retrieve. |
Returns
Type | Description |
---|---|
String | URL to user's avatar. |
Remarks
This method will return URL to user avatar. You can use this URL with HttpClient to download the avatar, or use for any other purpose.
size
is only a requested size of the avatar. It is not guaranteed that URL will contain avatar with this size.
GetGroupAvatarURL(UInt32, Nullable<Int32>, UInt32)
Gets URL for retrieving group avatar.
Declaration
public static string GetGroupAvatarURL(uint groupID, int? iconID = null, uint size = 500U)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | groupID | ID of the group. |
Nullable<Int32> | iconID | Icon ID |
UInt32 | size | Size of the avatar to retrieve. |
Returns
Type | Description |
---|---|
String | URL to group's avatar. |
Remarks
This method will return URL to group avatar. You can use this URL with HttpClient to download the avatar, or use for any other purpose.
size
is only a requested size of the avatar. It is not guaranteed that URL will contain avatar with this size.
Currently, changing iconID
to an invalid value seems to not cause error when the URL is used. However it is not guaranteed to always be the case, so a valid Icon value is recommended.
GetUserAvatarURL(UInt32, Nullable<Int32>, UInt32)
Gets URL for retrieving user avatar.
Declaration
public static string GetUserAvatarURL(uint userID, int? iconID = null, uint size = 500U)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | userID | ID of the user. |
Nullable<Int32> | iconID | Icon ID |
UInt32 | size | Size of the avatar to retrieve. |
Returns
Type | Description |
---|---|
String | URL to user's avatar. |
Remarks
This method will return URL to user avatar. You can use this URL with HttpClient to download the avatar, or use for any other purpose.
size
is only a requested size of the avatar. It is not guaranteed that URL will contain avatar with this size.
Currently, changing iconID
to an invalid value seems to not cause error when the URL is used. However it is not guaranteed to always be the case, so a valid Icon value is recommended.