Class SocialNetwork
  
  Defines an abstraction for social networks
    Inheritance
    System.Object
    
    
    
    
    
    SocialNetwork
      
      
      
      
      
   
  
    Implements
    
    System.IDisposable
    
    
    
    
    
    
    
    
    
   
  
    Inherited Members
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
      System.Object.Equals(System.Object, System.Object)
    
    
      System.Object.GetType()
    
    
      System.Object.MemberwiseClone()
    
    
      System.Object.ReferenceEquals(System.Object, System.Object)
    
   
  
  Assembly: NFX.Web.dll
  Syntax
  
    public abstract class SocialNetwork : ServiceWithInstrumentationBase<object>, IApplicationComponent, IDisposable, IService, ILocalizedTimeProvider, IWebClientCaller, ISocialNetworkImplementation, ISocialNetwork, INamed, IConfigurable, IInstrumentable, IExternallyParameterized
   
  Constructors
  
  
  
  
  SocialNetwork(String, IConfigSectionNode)
  
  
  Declaration
  
    protected SocialNetwork(string name = null, IConfigSectionNode cfg = null)
   
  Parameters
  
  Fields
  
  
  
  CONFIG_AUTO_START_ATTR
  
  
  Declaration
  
    public const string CONFIG_AUTO_START_ATTR = "auto-start"
   
  Field Value
  
    
      
        | Type | Description | 
    
    
      
        | System.String |  | 
    
  
  
  
  DEFAULT_TIMEOUT_MS_DEFAULT
  
  
  Declaration
  
    public const int DEFAULT_TIMEOUT_MS_DEFAULT = 30000
   
  Field Value
  
    
      
        | Type | Description | 
    
    
      
        | System.Int32 |  | 
    
  
  
  
  SOCIAL_ACTION_PARAMNAME
  
  
  Declaration
  
    public const string SOCIAL_ACTION_PARAMNAME = "socialaction"
   
  Field Value
  
    
      
        | Type | Description | 
    
    
      
        | System.String |  | 
    
  
  
  
  SOCIAL_PARAMNAME
  
  
  Declaration
  
    public const string SOCIAL_PARAMNAME = "social"
   
  Field Value
  
    
      
        | Type | Description | 
    
    
      
        | System.String |  | 
    
  
  
  
  SOCIALACTION_SPECIFYURL_PARAMVALUE
  
  
  Declaration
  
    public const string SOCIALACTION_SPECIFYURL_PARAMVALUE = "specifyurl"
   
  Field Value
  
    
      
        | Type | Description | 
    
    
      
        | System.String |  | 
    
  
  
  
  SOCIALPOST_PARAMNAME
  
  
  Declaration
  
    public const string SOCIALPOST_PARAMNAME = "socialpost"
   
  Field Value
  
    
      
        | Type | Description | 
    
    
      
        | System.String |  | 
    
  
  
  
  SOCIALPOSTMESSAGE_PARAMNAME
  
  
  Declaration
  
    public const string SOCIALPOSTMESSAGE_PARAMNAME = "message"
   
  Field Value
  
    
      
        | Type | Description | 
    
    
      
        | System.String |  | 
    
  
  Properties
  
  
  
  
  CanPost
  Defines if a meeesage can be post to this social network
Declaration
  
    public virtual bool CanPost { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | System.Boolean |  | 
    
  
  
  
  
  ComponentCommonName
  
  
  Declaration
  
    public override string ComponentCommonName { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | System.String |  | 
    
  
  Overrides
  
  
  
  
  CredentialsEntry
  Specifies how service takes user credentials
Declaration
  
    public abstract CredentialsEntryMethod CredentialsEntry { get; }
   
  Property Value
  
  
  
  
  Description
  Provides social network description, this default implementation returns the name of the class
Declaration
  
    public virtual string Description { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | System.String |  | 
    
  
  
  
  
  GrantAccessFriends
  
  
  Declaration
  
    [Config(Default = true)]
public bool GrantAccessFriends { get; set; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | System.Boolean |  | 
    
  
  
  
  
  GrantAccessProfile
  
  
  Declaration
  
    [Config(Default = true)]
public bool GrantAccessProfile { get; set; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | System.Boolean |  | 
    
  
  
  
  
  GrantPost
  
  
  Declaration
  
    [Config(Default = true)]
public bool GrantPost { get; set; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | System.Boolean |  | 
    
  
  
  
  
  GrantViewEmail
  
  
  Declaration
  
    [Config(Default = true)]
public bool GrantViewEmail { get; set; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | System.Boolean |  | 
    
  
  
  
  
  ID
  Globally uniquelly identifies social network architype
Declaration
  
    public abstract SocialNetID ID { get; }
   
  Property Value
  
  
  
  
  Instances
  Returns the read-only registry of social networks currently activated
Declaration
  
    public static IRegistry<ISocialNetwork> Instances { get; }
   
  Property Value
  
  
  
  
  InstrumentationEnabled
  Implements IInstrumentable
Declaration
  
    [Config]
[ExternalParameter(new string[]{"instrumentation", "social"})]
public override bool InstrumentationEnabled { get; set; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | System.Boolean |  | 
    
  
  Overrides
  NFX.ServiceModel.ServiceWithInstrumentationBase<System.Object>.InstrumentationEnabled
  
  
  
  KeepAlive
  Sets if pipelining should be used for web request
Declaration
  
    [Config(Default = true)]
public bool KeepAlive { get; set; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | System.Boolean |  | 
    
  
  
  
  
  Pipelined
  Sets keepalive option for web request
Declaration
  
    [Config(Default = true)]
public bool Pipelined { get; set; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | System.Boolean |  | 
    
  
  
  
  
  RequiresSpecifiedExternalLoginReference
  Specifies if this provider requires to obtain temporary token before redirecting to social network login page.
Currently only Twitter requires this routine
Declaration
  
    public virtual bool RequiresSpecifiedExternalLoginReference { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | System.Boolean |  | 
    
  
  
  
  
  ServiceURL
  Returns the root public URL for the service
Declaration
  
    public abstract string ServiceURL { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | System.String |  | 
    
  
  
  
  
  WebServiceCallTimeoutMs
  Sets timeout for calls to external service that imlements this social network
Declaration
  
    [Config]
public int WebServiceCallTimeoutMs { get; set; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | System.Int32 |  | 
    
  
  Methods
  
  
  
  
  AutoStartNetworks()
  
  
  Declaration
  
    public static void AutoStartNetworks()
   
  
  
  
  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
  
    public abstract SocialUserInfo CreateSocialUserInfo(SocialUserInfoToken? existingToken = default (SocialUserInfoToken? ))
   
  Parameters
  
  Returns
  
  
  
  
  Destructor()
  
  
  Declaration
  
    protected override void Destructor()
   
  Overrides
  
  
  
  
  DoAcceptManagerVisit(Object, DateTime)
  
  
  Declaration
  
    protected override void DoAcceptManagerVisit(object manager, DateTime managerNow)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Object | manager |  | 
      
        | System.DateTime | managerNow |  | 
    
  
  Overrides
  
  
  
  
  DoObtainTokens(SocialUserInfo, JSONDataMap, String)
  
  
  Declaration
  
    protected abstract void DoObtainTokens(SocialUserInfo userInfo, JSONDataMap request, string returnURL)
   
  Parameters
  
  
  
  
  DoPostMessage(String, SocialUserInfo)
  
  
  Declaration
  
    protected virtual void DoPostMessage(string text, SocialUserInfo userInfo)
   
  Parameters
  
  
  
  
  DoRetrieveLongTermTokens(SocialUserInfo)
  
  
  Declaration
  
    protected abstract void DoRetrieveLongTermTokens(SocialUserInfo userInfo)
   
  Parameters
  
  
  
  
  DoRetrieveUserInfo(SocialUserInfo)
  
  
  Declaration
  
    protected abstract void DoRetrieveUserInfo(SocialUserInfo userInfo)
   
  Parameters
  
  
  
  
  DoStart()
  
  
  Declaration
  
    protected override void DoStart()
   
  Overrides
  
  
  
  
  DoWaitForCompleteStop()
  
  
  Declaration
  
    protected override void DoWaitForCompleteStop()
   
  Overrides
  
  
  
  
  Equals(Object)
  
  
  Declaration
  
    public override bool Equals(object obj)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Object | obj |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.Boolean |  | 
    
  
  Overrides
  System.Object.Equals(System.Object)
  
  
  
  GenerateNonce()
  
  
  Declaration
  
    protected static string GenerateNonce()
   
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.String |  | 
    
  
  
  
  
  GetExternalLoginReference(String)
  Returns href to login via social system/site
Declaration
  
    public abstract string GetExternalLoginReference(string returnURL)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.String | returnURL |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.String |  | 
    
  
  
  
  
  GetHashCode()
  
  
  Declaration
  
    public override int GetHashCode()
   
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.Int32 |  | 
    
  
  Overrides
  System.Object.GetHashCode()
  
  
  
  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
  
    public Image GetPicture(SocialUserInfo userInfo, out string contentType, string pictureKind = null)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | SocialUserInfo | userInfo |  | 
      
        | System.String | contentType |  | 
      
        | System.String | pictureKind |  | 
    
  
  Returns
  
  
  
  
  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
  
    public virtual 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
  
    public virtual 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
  
    public 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
  
    public 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
  
    public 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
  
    public void RenewLongTermTokens(SocialUserInfo userInfo)
   
  Parameters
  
  
  
  
  RetrieveUserInfo(SocialUserInfo)
  Retrieves all user fields (e.g. screen name, email) but tokens.
Declaration
  
    public void RetrieveUserInfo(SocialUserInfo userInfo)
   
  Parameters
  
  
  
  
  ToString()
  
  
  Declaration
  
    public override string ToString()
   
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.String |  | 
    
  
  Overrides
  System.Object.ToString()
  Implements
  
  
      System.IDisposable
  
  
  
  
  
  
  
  
  
  
  Extension Methods