示例#1
0
        public async Task <ProfilePictureResult> GetProfilePictureAsync(string userAccessToken, string id = "me", UserProfilePictureOptions profilePictureOptions = null)
        {
            var url = FacebookUrl.GetUrl(FacebookUrl.UserPictureUrl, FacebookApiVersion.Version5, id);

            List <KeyValuePair <string, string> > options;

            if (profilePictureOptions != null)
            {
                options = ModelHelper.GetOptionsAsKeyValue(profilePictureOptions).ToList();
            }
            else
            {
                options = new List <KeyValuePair <string, string> >();
            }

            // By default the picture edge will return a picture instead of a JSON response.
            // If you want the picture edge to return JSON that describes the image set redirect=0 when you make the request.
            options.Add(new KeyValuePair <string, string>("redirect", "0"));

            var request = GraphApiRequestBuilder
                          .BuildRequestTo(url)
                          .WithMethod(HttpMethod.Get)
                          .WithUrlParameters(options)
                          .WithUrlPatameter("fields", string.Join(",", ModelHelper.GetAllModelFields <ProfilePictureResult>()))
                          .WithAccessToken(userAccessToken)
                          .WithAppSecretProof(facebookClient.AppSecret, userAccessToken)
                          .GetHttpRequestMessage();

            return((await facebookClient.SendRequestAsync <DataWrapper <ProfilePictureResult> >(request)).Data);
        }
        public async Task <DebugTokenResult> DebugTokenAsync(string inputToken)
        {
            var debugTokenUrl = FacebookUrl.GetUrl(FacebookUrl.DebugTokenUrl, facebookApiVersion);

            return((await facebookClient.SendRequestAsync <DataWrapper <DebugTokenResult> >(
                        GraphApiRequestBuilder
                        .BuildRequestTo(debugTokenUrl)
                        .WithMethod(HttpMethod.Get)
                        .WithUrlPatameter("input_token", inputToken)
                        .WithAccessToken(await facebookClient.GetApplicationAccessTokenAsync())
                        .GetHttpRequestMessage())).Data);
        }
示例#3
0
        private HttpRequestMessage GetAccessTokenRequest(string grantType, string exchangeToken)
        {
            var url = FacebookUrl.GetUrl(FacebookUrl.TokenUrl, FacebookApiVersion.Version5);

            return(GraphApiRequestBuilder
                   .BuildRequestTo(url)
                   .WithMethod(HttpMethod.Get)
                   .WithUrlPatameter("fb_exchange_token", exchangeToken)
                   .WithUrlPatameter("grant_type", grantType)
                   .WithClientIdAndClientSecret((facebookClient.AppId, facebookClient.AppSecret))
                   .GetHttpRequestMessage());
        }
        public async Task <IEnumerable <TestUserResult> > GetTestUsers()
        {
            var url = FacebookUrl.GetUrl(FacebookUrl.TestUserUrl, FacebookApiVersion.Version5, this.facebookClient.AppId);

            var request = GraphApiRequestBuilder
                          .BuildRequestTo(url)
                          .WithMethod(HttpMethod.Get)
                          .WithAccessToken(await facebookClient.GetApplicationAccessTokenAsync())
                          .GetHttpRequestMessage();

            return((await facebookClient.SendRequestAsync <DataWrapper <IEnumerable <TestUserResult> > >(request)).Data);
        }
示例#5
0
        public async Task <UserResult> GetUserAsync(string userAccessToken, string id)
        {
            var url = FacebookUrl.GetUrl(FacebookUrl.UserUrl, FacebookApiVersion.Version5, id);

            var request = GraphApiRequestBuilder
                          .BuildRequestTo(url)
                          .WithMethod(HttpMethod.Get)
                          .WithUrlPatameter("fields", string.Join(",", ModelHelper.GetAllModelFields <UserResult>()))
                          .WithAccessToken(userAccessToken)
                          .WithAppSecretProof(facebookClient.AppSecret, userAccessToken)
                          .GetHttpRequestMessage();

            return(await facebookClient.SendRequestAsync <UserResult>(request));
        }
 public AboutDataModel Clone()
 {
     return(new AboutDataModel
     {
         _id = _id,
         Title = (string)Title.Clone(),
         SubTitle = (string)SubTitle.Clone(),
         Description = Description.Select(d => d.Clone()).Cast <string>().ToList(),
         FacebookUrl = (string)FacebookUrl.Clone(),
         GooglePlusUrl = (string)GooglePlusUrl.Clone(),
         Image = Image.Clone(),
         LinkedInUrl = (string)LinkedInUrl.Clone(),
         TwitterUrl = (string)TwitterUrl.Clone()
     });
 }
 public UpdateSomeDataCommand(Guid someDataId,
                              string firstName,
                              string middleName,
                              string lastName,
                              string title,
                              Color color,
                              DateTime creationDate,
                              FacebookUrl facebookUrl)
 {
     SomeDataId   = someDataId;
     FirstName    = firstName;
     MiddleName   = middleName;
     LastName     = lastName;
     Title        = title;
     Color        = color;
     CreationDate = creationDate;
     FacebookUrl  = facebookUrl;
 }
 public CreateSomeDataCommand(Guid id,
                              string firstName,
                              string middleName,
                              string lastName,
                              string title,
                              Color color,
                              DateTime creationDate,
                              FacebookUrl facebookUrl,
                              ApplicationUserId applicationUserId)
 {
     Id                = id;
     FirstName         = firstName;
     MiddleName        = middleName;
     LastName          = lastName;
     Title             = title;
     Color             = color;
     CreationDate      = creationDate;
     FacebookUrl       = facebookUrl;
     ApplicationUserId = applicationUserId;
 }
示例#9
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is Location other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((Name == null && other.Name == null) || (Name?.Equals(other.Name) == true)) &&
                   ((Address == null && other.Address == null) || (Address?.Equals(other.Address) == true)) &&
                   ((Timezone == null && other.Timezone == null) || (Timezone?.Equals(other.Timezone) == true)) &&
                   ((Capabilities == null && other.Capabilities == null) || (Capabilities?.Equals(other.Capabilities) == true)) &&
                   ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((MerchantId == null && other.MerchantId == null) || (MerchantId?.Equals(other.MerchantId) == true)) &&
                   ((Country == null && other.Country == null) || (Country?.Equals(other.Country) == true)) &&
                   ((LanguageCode == null && other.LanguageCode == null) || (LanguageCode?.Equals(other.LanguageCode) == true)) &&
                   ((Currency == null && other.Currency == null) || (Currency?.Equals(other.Currency) == true)) &&
                   ((PhoneNumber == null && other.PhoneNumber == null) || (PhoneNumber?.Equals(other.PhoneNumber) == true)) &&
                   ((BusinessName == null && other.BusinessName == null) || (BusinessName?.Equals(other.BusinessName) == true)) &&
                   ((Type == null && other.Type == null) || (Type?.Equals(other.Type) == true)) &&
                   ((WebsiteUrl == null && other.WebsiteUrl == null) || (WebsiteUrl?.Equals(other.WebsiteUrl) == true)) &&
                   ((BusinessHours == null && other.BusinessHours == null) || (BusinessHours?.Equals(other.BusinessHours) == true)) &&
                   ((BusinessEmail == null && other.BusinessEmail == null) || (BusinessEmail?.Equals(other.BusinessEmail) == true)) &&
                   ((Description == null && other.Description == null) || (Description?.Equals(other.Description) == true)) &&
                   ((TwitterUsername == null && other.TwitterUsername == null) || (TwitterUsername?.Equals(other.TwitterUsername) == true)) &&
                   ((InstagramUsername == null && other.InstagramUsername == null) || (InstagramUsername?.Equals(other.InstagramUsername) == true)) &&
                   ((FacebookUrl == null && other.FacebookUrl == null) || (FacebookUrl?.Equals(other.FacebookUrl) == true)) &&
                   ((Coordinates == null && other.Coordinates == null) || (Coordinates?.Equals(other.Coordinates) == true)) &&
                   ((LogoUrl == null && other.LogoUrl == null) || (LogoUrl?.Equals(other.LogoUrl) == true)) &&
                   ((PosBackgroundUrl == null && other.PosBackgroundUrl == null) || (PosBackgroundUrl?.Equals(other.PosBackgroundUrl) == true)) &&
                   ((Mcc == null && other.Mcc == null) || (Mcc?.Equals(other.Mcc) == true)) &&
                   ((FullFormatLogoUrl == null && other.FullFormatLogoUrl == null) || (FullFormatLogoUrl?.Equals(other.FullFormatLogoUrl) == true)));
        }
示例#10
0
 public static SomeAggregate Create(Guid id,
                                    string firstName,
                                    string middleName,
                                    string lastName,
                                    string title,
                                    Color color,
                                    DateTime creationDate,
                                    FacebookUrl facebookUrl,
                                    Guid businessUserId)
 {
     return(new SomeAggregate
     {
         Id = id,
         FirstName = firstName,
         MiddleName = middleName,
         LastName = lastName,
         Title = title,
         Color = color,
         CreationDate = creationDate,
         FacebookUrl = facebookUrl,
         BusinessUserId = businessUserId
     });
 }
示例#11
0
        public override int GetHashCode()
        {
            int hashCode = -255518735;

            if (Id != null)
            {
                hashCode += Id.GetHashCode();
            }

            if (Name != null)
            {
                hashCode += Name.GetHashCode();
            }

            if (Address != null)
            {
                hashCode += Address.GetHashCode();
            }

            if (Timezone != null)
            {
                hashCode += Timezone.GetHashCode();
            }

            if (Capabilities != null)
            {
                hashCode += Capabilities.GetHashCode();
            }

            if (Status != null)
            {
                hashCode += Status.GetHashCode();
            }

            if (CreatedAt != null)
            {
                hashCode += CreatedAt.GetHashCode();
            }

            if (MerchantId != null)
            {
                hashCode += MerchantId.GetHashCode();
            }

            if (Country != null)
            {
                hashCode += Country.GetHashCode();
            }

            if (LanguageCode != null)
            {
                hashCode += LanguageCode.GetHashCode();
            }

            if (Currency != null)
            {
                hashCode += Currency.GetHashCode();
            }

            if (PhoneNumber != null)
            {
                hashCode += PhoneNumber.GetHashCode();
            }

            if (BusinessName != null)
            {
                hashCode += BusinessName.GetHashCode();
            }

            if (Type != null)
            {
                hashCode += Type.GetHashCode();
            }

            if (WebsiteUrl != null)
            {
                hashCode += WebsiteUrl.GetHashCode();
            }

            if (BusinessHours != null)
            {
                hashCode += BusinessHours.GetHashCode();
            }

            if (BusinessEmail != null)
            {
                hashCode += BusinessEmail.GetHashCode();
            }

            if (Description != null)
            {
                hashCode += Description.GetHashCode();
            }

            if (TwitterUsername != null)
            {
                hashCode += TwitterUsername.GetHashCode();
            }

            if (InstagramUsername != null)
            {
                hashCode += InstagramUsername.GetHashCode();
            }

            if (FacebookUrl != null)
            {
                hashCode += FacebookUrl.GetHashCode();
            }

            if (Coordinates != null)
            {
                hashCode += Coordinates.GetHashCode();
            }

            if (LogoUrl != null)
            {
                hashCode += LogoUrl.GetHashCode();
            }

            if (PosBackgroundUrl != null)
            {
                hashCode += PosBackgroundUrl.GetHashCode();
            }

            if (Mcc != null)
            {
                hashCode += Mcc.GetHashCode();
            }

            if (FullFormatLogoUrl != null)
            {
                hashCode += FullFormatLogoUrl.GetHashCode();
            }

            return(hashCode);
        }