Exemplo n.º 1
0
        public InstaAccountDetails Convert()
        {
            if (SourceObject == null)
            {
                throw new ArgumentNullException("Source object");
            }

            var details = new InstaAccountDetails
            {
                DateJoined = InstaDateTimeHelper.FromUnixTimeSeconds(SourceObject.DateJoined ?? 0)
            };

            if (SourceObject.FormerUsernameInfo != null)
            {
                details.HasFormerUsernames = SourceObject.FormerUsernameInfo.HasFormerUsernames ?? false;
            }

            if (SourceObject.SharedFollowerAccountsInfo != null)
            {
                details.HasSharedFollowerAccounts =
                    SourceObject.SharedFollowerAccountsInfo.HasSharedFollowerAccounts ?? false;
            }

            if (SourceObject.AdsInfo != null)
            {
                try
                {
                    details.AdsInfo = InstaConvertersFabric.Instance.GetAdsInfoConverter(SourceObject.AdsInfo).Convert();
                }
                catch
                {
                }
            }

            if (SourceObject.PrimaryCountryInfo != null)
            {
                try
                {
                    details.PrimaryCountryInfo = InstaConvertersFabric.Instance
                                                 .GetPrimaryCountryInfoConverter(SourceObject.PrimaryCountryInfo)
                                                 .Convert();
                }
                catch
                {
                }
            }

            return(details);
        }
Exemplo n.º 2
0
        public InstaDiscoverSearches Convert()
        {
            if (SourceObject == null)
            {
                throw new ArgumentNullException("Source object");
            }

            var searches = new InstaDiscoverSearches
            {
                ClientTime = InstaDateTimeHelper.FromUnixTimeSeconds(SourceObject.ClientTime ?? 0),
                Position   = SourceObject.Position,
                User       = InstaConvertersFabric.Instance.GetUserConverter(SourceObject.User).Convert()
            };

            return(searches);
        }