Interface ISocialNetwork
Describes an entity that can perform social functions (i.e. login, post)
Inherited Members
Namespace: NFX.Web.Social
Assembly: NFX.Web.dll
Syntax
public interface ISocialNetwork : INamed
Properties
CanPost
Defines if a meeesage can be post to this social network
Declaration
bool CanPost { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
CredentialsEntry
Specifies how service takes user credentials
Declaration
CredentialsEntryMethod CredentialsEntry { get; }
Property Value
Type | Description |
---|---|
CredentialsEntryMethod |
Description
Provides social network description, this default implementation returns the name of the class
Declaration
string Description { get; }
Property Value
Type | Description |
---|---|
System.String |
ID
Globally uniquelly identifies social network architype
Declaration
SocialNetID ID { get; }
Property Value
Type | Description |
---|---|
SocialNetID |
RequiresSpecifiedExternalLoginReference
Specifies if this provider requires to obtain temporary token before redirecting to social network login page. Currently only Twitter requires this routine
Declaration
bool RequiresSpecifiedExternalLoginReference { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
ServiceURL
Returns the root public URL for the service
Declaration
string ServiceURL { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
CreateSocialUserInfo(Nullable<SocialUserInfoToken>)
Create an instance of social user info class. If parameters are null then creates new non-logged-in instance, otherwise, if parameters are set, then connects to network and tries to re-initializes SocialUser info with fresh data from the network (i.e. name, gender etc.) using the supplied net tokens, or throws if tokens are invalid (i.e. expired). This returned instance is usually stored in session for later use
Declaration
SocialUserInfo CreateSocialUserInfo(SocialUserInfoToken? existingToken = default (SocialUserInfoToken? ))
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<SocialUserInfoToken> | existingToken |
Returns
Type | Description |
---|---|
SocialUserInfo | SocialUserInfo instance |
GetExternalLoginReference(String)
Returns href to login via social system/site
Declaration
string GetExternalLoginReference(string returnURL)
Parameters
Type | Name | Description |
---|---|---|
System.String | returnURL |
Returns
Type | Description |
---|---|
System.String |
GetPicture(SocialUserInfo, out String, String)
Returns user profile image or null if no image available. Picture kind specifies classification of pictures within profile i.e. "main", "small-icon" etc.
Declaration
Image GetPicture(SocialUserInfo userInfo, out string contentType, string pictureKind = null)
Parameters
Type | Name | Description |
---|---|---|
SocialUserInfo | userInfo | |
System.String | contentType | |
System.String | pictureKind |
Returns
Type | Description |
---|---|
Image |
GetPictureData(SocialUserInfo, out String, String)
Returns user profile image data along with content type or null if no image available. Picture kind specifies classification of pictures within profile i.e. "main", "small-icon" etc.
Declaration
byte[] GetPictureData(SocialUserInfo userInfo, out string contentType, string pictureKind = null)
Parameters
Type | Name | Description |
---|---|---|
SocialUserInfo | userInfo | |
System.String | contentType | |
System.String | pictureKind |
Returns
Type | Description |
---|---|
System.Byte[] |
GetSpecifiedExternalLoginReference(SocialUserInfo, String)
Returns social service login URL for "two-stage" login networks. Currently twitter only requires this
Declaration
string GetSpecifiedExternalLoginReference(SocialUserInfo userInfo, string returnURL)
Parameters
Type | Name | Description |
---|---|---|
SocialUserInfo | userInfo | Context |
System.String | returnURL | Social site redirects browser here after login |
Returns
Type | Description |
---|---|
System.String | Social site login URL |
ObtainTokensAndFillInfo(SocialUserInfo, JSONDataMap, String)
Fills user info with values from social network
Declaration
void ObtainTokensAndFillInfo(SocialUserInfo userInfo, JSONDataMap request, string returnURL)
Parameters
Type | Name | Description |
---|---|---|
SocialUserInfo | userInfo | Context user info |
JSONDataMap | request | Context http request |
System.String | returnURL | Social network login URL (sometimes needed by social site just to ensure correct call) |
PostMessage(SocialUserInfo, String)
Post message to social network
Declaration
void PostMessage(SocialUserInfo userInfo, string text)
Parameters
Type | Name | Description |
---|---|---|
SocialUserInfo | userInfo | Context social user info |
System.String | text | Message to send |
PrepareReturnURLParameter(String, Boolean)
Declaration
string PrepareReturnURLParameter(string returnURL, bool escape = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | returnURL | |
System.Boolean | escape |
Returns
Type | Description |
---|---|
System.String |
RenewLongTermTokens(SocialUserInfo)
Refreshes long term tokens (if provider needs them). Should be used in scenario like background server-side token renew routine
Declaration
void RenewLongTermTokens(SocialUserInfo userInfo)
Parameters
Type | Name | Description |
---|---|---|
SocialUserInfo | userInfo |
RetrieveUserInfo(SocialUserInfo)
Retrieves all user fields (e.g. screen name, email) but tokens.
Declaration
void RetrieveUserInfo(SocialUserInfo userInfo)
Parameters
Type | Name | Description |
---|---|---|
SocialUserInfo | userInfo |