Show / Hide Table of Contents

Class SocialNetwork

Defines an abstraction for social networks

Inheritance
System.Object
DisposableObject
ApplicationComponent
Service
Service<System.Object>
ServiceWithInstrumentationBase<System.Object>
SocialNetwork
Facebook
GooglePlus
LinkedIn
Twitter
VKontakte
Implements
IApplicationComponent
System.IDisposable
IService
ILocalizedTimeProvider
IWebClientCaller
ISocialNetworkImplementation
ISocialNetwork
INamed
IConfigurable
IInstrumentable
IExternallyParameterized
Inherited Members
ServiceWithInstrumentationBase<Object>.ExternalParameters
ServiceWithInstrumentationBase<Object>.ExternalParametersForGroups(String[])
ServiceWithInstrumentationBase<Object>.ExternalGetParameter(String, Object, String[])
ServiceWithInstrumentationBase<Object>.ExternalSetParameter(String, Object, String[])
Service<Object>.ComponentDirector
Service.CONFIG_NAME_ATTR
Service.ApplicationDontAutoStartService
Service.Status
Service.Running
Service.Name
Service.TimeLocation
Service.LocalizedTime
Service.Configure(IConfigSectionNode)
Service.Start()
Service.SignalStop()
Service.CheckForCompleteStop()
Service.WaitForCompleteStop()
Service.AcceptManagerVisit(Object, DateTime)
Service.UniversalTimeToLocalizedTime(DateTime)
Service.LocalizedTimeToUniversalTime(DateTime)
Service.AbortStart()
Service.DoSignalStop()
Service.DoCheckForCompleteStop()
Service.DoConfigure(IConfigSectionNode)
Service.CheckServiceInactive()
Service.CheckServiceActive()
Service.CheckServiceActiveOrStarting()
Service.____ObtainPrivateServiceStatusLockObject()
ApplicationComponent.AllComponents
ApplicationComponent.GetAppComponentBySID(UInt64)
ApplicationComponent.GetAppComponentByCommonName(String)
ApplicationComponent.ComponentSID
ApplicationComponent.ComponentStartTime
DisposableObject.DisposeAndNull<T>(T)
DisposableObject.DisposeStarted
DisposableObject.Disposed
DisposableObject.EnsureObjectNotDisposed()
DisposableObject.Dispose()
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: NFX.Web.Social
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
Type Name Description
System.String name
IConfigSectionNode cfg

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
ApplicationComponent.ComponentCommonName

CredentialsEntry

Specifies how service takes user credentials

Declaration
public abstract CredentialsEntryMethod CredentialsEntry { get; }
Property Value
Type Description
CredentialsEntryMethod

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
Type Description
SocialNetID

Instances

Returns the read-only registry of social networks currently activated

Declaration
public static IRegistry<ISocialNetwork> Instances { get; }
Property Value
Type Description
IRegistry<ISocialNetwork>

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
Type Name Description
System.Nullable<SocialUserInfoToken> existingToken
Returns
Type Description
SocialUserInfo

SocialUserInfo instance

Destructor()

Declaration
protected override void Destructor()
Overrides
Service.Destructor()

DoAcceptManagerVisit(Object, DateTime)

Declaration
protected override void DoAcceptManagerVisit(object manager, DateTime managerNow)
Parameters
Type Name Description
System.Object manager
System.DateTime managerNow
Overrides
Service.DoAcceptManagerVisit(Object, DateTime)

DoObtainTokens(SocialUserInfo, JSONDataMap, String)

Declaration
protected abstract void DoObtainTokens(SocialUserInfo userInfo, JSONDataMap request, string returnURL)
Parameters
Type Name Description
SocialUserInfo userInfo
JSONDataMap request
System.String returnURL

DoPostMessage(String, SocialUserInfo)

Declaration
protected virtual void DoPostMessage(string text, SocialUserInfo userInfo)
Parameters
Type Name Description
System.String text
SocialUserInfo userInfo

DoRetrieveLongTermTokens(SocialUserInfo)

Declaration
protected abstract void DoRetrieveLongTermTokens(SocialUserInfo userInfo)
Parameters
Type Name Description
SocialUserInfo userInfo

DoRetrieveUserInfo(SocialUserInfo)

Declaration
protected abstract void DoRetrieveUserInfo(SocialUserInfo userInfo)
Parameters
Type Name Description
SocialUserInfo userInfo

DoStart()

Declaration
protected override void DoStart()
Overrides
Service.DoStart()

DoWaitForCompleteStop()

Declaration
protected override void DoWaitForCompleteStop()
Overrides
Service.DoWaitForCompleteStop()

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
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
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
Type Name Description
SocialUserInfo userInfo

RetrieveUserInfo(SocialUserInfo)

Retrieves all user fields (e.g. screen name, email) but tokens.

Declaration
public void RetrieveUserInfo(SocialUserInfo userInfo)
Parameters
Type Name Description
SocialUserInfo userInfo

ToString()

Declaration
public override string ToString()
Returns
Type Description
System.String
Overrides
System.Object.ToString()

Implements

IApplicationComponent
System.IDisposable
IService
ILocalizedTimeProvider
IWebClientCaller
ISocialNetworkImplementation
ISocialNetwork
INamed
IConfigurable
IInstrumentable
IExternallyParameterized

Extension Methods

MiscUtils.NonNull<T>(T, Func<Exception>, String)
ObjectValueConversion.AsString(Object, String, ConvertErrorHandling)
ObjectValueConversion.AsNonNullOrEmptyString(Object)
ObjectValueConversion.AsLaconicConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsJSONConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsXMLConfig(Object, ConfigSectionNode, ConvertErrorHandling)
ObjectValueConversion.AsChar(Object, Char, ConvertErrorHandling)
ObjectValueConversion.AsNullableChar(Object, Nullable<Char>, ConvertErrorHandling)
ObjectValueConversion.AsByte(Object, Byte, ConvertErrorHandling)
ObjectValueConversion.AsNullableByte(Object, Nullable<Byte>, ConvertErrorHandling)
ObjectValueConversion.AsSByte(Object, SByte, ConvertErrorHandling)
ObjectValueConversion.AsNullableSByte(Object, Nullable<SByte>, ConvertErrorHandling)
ObjectValueConversion.AsShort(Object, Int16, ConvertErrorHandling)
ObjectValueConversion.AsNullableShort(Object, Nullable<Int16>, ConvertErrorHandling)
ObjectValueConversion.AsUShort(Object, UInt16, ConvertErrorHandling)
ObjectValueConversion.AsNullableUShort(Object, Nullable<UInt16>, ConvertErrorHandling)
ObjectValueConversion.AsInt(Object, Int32, ConvertErrorHandling)
ObjectValueConversion.AsNullableInt(Object, Nullable<Int32>, ConvertErrorHandling)
ObjectValueConversion.AsUInt(Object, UInt32, ConvertErrorHandling)
ObjectValueConversion.AsNullableUInt(Object, Nullable<UInt32>, ConvertErrorHandling)
ObjectValueConversion.AsLong(Object, Int64, ConvertErrorHandling)
ObjectValueConversion.AsNullableLong(Object, Nullable<Int64>, ConvertErrorHandling)
ObjectValueConversion.AsULong(Object, UInt64, ConvertErrorHandling)
ObjectValueConversion.AsNullableULong(Object, Nullable<UInt64>, ConvertErrorHandling)
ObjectValueConversion.AsDouble(Object, Double, ConvertErrorHandling)
ObjectValueConversion.AsNullableDouble(Object, Nullable<Double>, ConvertErrorHandling)
ObjectValueConversion.AsFloat(Object, Single, ConvertErrorHandling)
ObjectValueConversion.AsNullableFloat(Object, Nullable<Single>, ConvertErrorHandling)
ObjectValueConversion.AsDecimal(Object, Decimal, ConvertErrorHandling)
ObjectValueConversion.AsNullableDecimal(Object, Nullable<Decimal>, ConvertErrorHandling)
ObjectValueConversion.AsBool(Object, Boolean, ConvertErrorHandling)
ObjectValueConversion.AsNullableBool(Object, Nullable<Boolean>, ConvertErrorHandling)
ObjectValueConversion.AsGUID(Object, Guid, ConvertErrorHandling)
ObjectValueConversion.AsNullableGUID(Object, Nullable<Guid>, ConvertErrorHandling)
ObjectValueConversion.AsDateTime(Object)
ObjectValueConversion.AsDateTime(Object, DateTime, ConvertErrorHandling)
ObjectValueConversion.AsNullableDateTime(Object, Nullable<DateTime>, ConvertErrorHandling)
ObjectValueConversion.AsGDID(Object)
ObjectValueConversion.AsGDID(Object, GDID, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDID(Object, Nullable<GDID>, ConvertErrorHandling)
ObjectValueConversion.AsGDIDSymbol(Object)
ObjectValueConversion.AsGDIDSymbol(Object, GDIDSymbol, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDIDSymbol(Object, Nullable<GDIDSymbol>, ConvertErrorHandling)
ObjectValueConversion.AsTimeSpan(Object)
ObjectValueConversion.AsTimeSpan(Object, TimeSpan, ConvertErrorHandling)
ObjectValueConversion.AsNullableTimeSpan(Object, Nullable<TimeSpan>, ConvertErrorHandling)
ObjectValueConversion.AsEnum<TEnum>(Object, TEnum, ConvertErrorHandling)
ObjectValueConversion.AsNullableEnum<TEnum>(Object, Nullable<TEnum>, ConvertErrorHandling)
ObjectValueConversion.AsUri(Object, Uri, ConvertErrorHandling)
JSONExtensions.ToJSON(Object, JSONWritingOptions)
JSONExtensions.ToJSON(Object, TextWriter, JSONWritingOptions)
JSONExtensions.ToJSON(Object, Stream, JSONWritingOptions, Encoding)
ErlObject.ToErlObject(Object)
ErlObject.ToErlObject(Object, ErlTypeOrder, Boolean)
Back to top Copyright © 2006-2018 Agnicore Inc
Generated by DocFX