#region S# License
/******************************************************************************************
NOTICE!!! This program and source code is owned and licensed by
StockSharp, LLC, www.stocksharp.com
Viewing or use of this code requires your acceptance of the license
agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
Removal of this comment is a violation of the license agreement.
Project: StockSharp.Community.Community
File: ProfileClient.cs
Created: 2015, 11, 11, 2:32 PM
Copyright 2010 by StockSharp, LLC
*******************************************************************************************/
#endregion S# License
namespace StockSharp.Community
{
using System;
using Ecng.Common;
///
/// The client for access to the registration service.
///
public class ProfileClient : BaseCommunityClient
{
///
/// Initializes a new instance of the .
///
public ProfileClient()
: this("http://stocksharp.com/services/profileservice.svc".To())
{
}
///
/// Initializes a new instance of the .
///
/// Service address.
public ProfileClient(Uri address)
: base(address, "profile")
{
}
///
/// To start the registration.
///
/// The profile information.
public void CreateProfile(Profile profile)
{
ValidateError(Invoke(f => f.CreateProfile(profile)));
}
///
/// To send an e-mail message.
///
/// E-mail address.
public void SendEmail(string email)
{
ValidateError(Invoke(f => f.SendEmail(email)));
}
///
/// To confirm the e-mail address.
///
/// E-mail address.
/// The e-mail confirmation code.
public void ValidateEmail(string email, string emailCode)
{
ValidateError(Invoke(f => f.ValidateEmail(email, emailCode)));
}
///
/// To send SMS.
///
/// E-mail address.
/// Phone.
public void SendSms(string email, string phone)
{
ValidateError(Invoke(f => f.SendSms(email, phone)));
}
///
/// To confirm the phone number.
///
/// E-mail address.
/// SMS verification code.
public void ValidatePhone(string email, string smsCode)
{
ValidateError(Invoke(f => f.ValidatePhone(email, smsCode)));
}
///
/// To update profile information.
///
/// The profile information.
public void UpdateProfile(Profile profile)
{
ValidateError(Invoke(f => f.UpdateProfile(SessionId, profile)));
}
///
/// To get profile information.
///
/// The profile information.
public Profile GetProfile()
{
return Invoke(f => f.GetProfile(SessionId));
}
///
/// To get user information.
///
/// User ID.
/// The user information.
public Profile GetUserProfile(long userId)
{
return Invoke(f => f.GetUserProfile(userId));
}
private static void ValidateError(byte errorCode)
{
((ErrorCodes)errorCode).ThrowIfError();
}
}
}