Exemple #1
0
        /// <summary>
        /// Gets detailed information about a specific platform account.
        /// More information at: https://nextcaller.com/platform/documentation/v2.1/#/accounts/get-platform-account/curl.
        /// </summary>
        /// <param name="accountId">ID of the platform account to get info about.</param>
        /// <returns>Platform account, associated with the particular account ID, in json.</returns>
        public string GetPlatformAccountJson(string accountId)
        {
            string url = BuildUrl(platformUrl + accountId,
                                  new UrlParameter(formatParameterName, DefaultResponseType.ToString()));

            return(httpTransport.Request(url, DefaultResponseType));
        }
Exemple #2
0
        /// <summary>
        /// Gets list of profiles, associated with the particular name-address or name-zip pair.
        /// Throws an exception if response status is 404.
        /// More information at: https://nextcaller.com/platform/documentation/v2.1/#/profiles/get-profile-name-and-address/curl.
        /// </summary>
        /// <param name="nameAddressData">Pair of name and address or name and zip code.</param>
        /// <param name="accountId">Platform account ID.</param>
        /// <returns>Profiles, associated with the particular name-address or name-zip pair.</returns>
        public string GetByNameAddressJson(NameAddress nameAddressData, string accountId = null)
        {
            var headers = PrepareAccountIdHeader(accountId);

            var parameters = new[]
            {
                new UrlParameter(nameAddressFirstNameParameterName, nameAddressData.FirstName ?? ""),
                new UrlParameter(nameAddressLastNameParameterName, nameAddressData.LastName ?? ""),
                new UrlParameter(nameAddressAddressParameterName, nameAddressData.AddressLine ?? ""),
                new UrlParameter(formatParameterName, DefaultResponseType.ToString())
            };
            var additional = nameAddressData.ZipCode != 0
                ? new[]
            {
                new UrlParameter(nameAddressZipParameterName, nameAddressData.ZipCode.ToString(CultureInfo.InvariantCulture))
            }
                : new[]
            {
                new UrlParameter(nameAddressCityParameterName, nameAddressData.City ?? ""),
                new UrlParameter(nameAddressStateParameterName, nameAddressData.State ?? "")
            };

            string url = BuildUrl(phoneUrl, parameters.Concat(additional).ToArray());

            return(httpTransport.Request(url, DefaultResponseType, headers: headers));
        }
Exemple #3
0
        /// <summary>
        /// Gets fraud level for the particular phone number.
        /// More info at: https://nextcaller.com/platform/documentation/v2.1/#/fraud-levels/curl.
        /// </summary>
        /// <param name="phone">Phone number.</param>
        /// <param name="accountId">Platform account ID.</param>
        /// <returns>Fraud level, associated with the given phone number, in json.</returns>
        public string GetFraudLevelJson(string phone, string accountId = null)
        {
            var headers = PrepareAccountIdHeader(accountId);

            string url = BuildUrl(fraudUrl, new UrlParameter(phoneParameterName, phone),
                                  new UrlParameter(formatParameterName, DefaultResponseType.ToString()));

            return(httpTransport.Request(url, DefaultResponseType, headers: headers));
        }
Exemple #4
0
        /// <summary>
        /// Gets list of profiles, associated with the particular email.
        /// More information at: https://nextcaller.com/platform/documentation/v2.1/#/profiles/get-profile-email/curl.
        /// </summary>
        /// <param name="email">Email to search by.</param>
        /// <param name="accountId">Platform account ID.</param>
        /// <returns>Profiles, associated with the given email, in json.</returns>
        public string GetByEmailJson(string email, string accountId = null)
        {
            var headers = PrepareAccountIdHeader(accountId);

            string url = BuildUrl(phoneUrl, new UrlParameter(emailParameterName, email ?? ""),
                                  new UrlParameter(formatParameterName, DefaultResponseType.ToString()));

            return(httpTransport.Request(url, DefaultResponseType, headers: headers));
        }
Exemple #5
0
        /// <summary>
        /// Gets a summary of all API calls made and all users
        /// More information at: https://nextcaller.com/platform/documentation/v2.1/#/accounts/get-summary/curl.
        /// </summary>
        /// <param name="page">Pagination page number.</param>
        /// <returns>Platform statistics in json.</returns>
        public string GetPlatformStatisticsJson(int?page = null)
        {
            var parameters = new List <UrlParameter> {
                new UrlParameter(formatParameterName, DefaultResponseType.ToString())
            };

            if (page != null)
            {
                parameters.Add(new UrlParameter(pageParameterName, page.ToString()));
            }
            string url = BuildUrl(platformUrl, parameters.ToArray());

            return(httpTransport.Request(url, DefaultResponseType));
        }
Exemple #6
0
        /// <summary>
        /// Get the profile associated with the particular user ID.
        /// More information at: https://nextcaller.com/platform/documentation/v2.1/#/profiles/get-profile-id/curl.
        /// </summary>
        /// <param name="profileId">Profile ID.</param>
        /// <param name="accountId">Platform account ID.</param>
        /// <returns>Profile, associated with the given profile ID, in json.</returns>
        public string GetByProfileIdJson(string profileId, string accountId = null)
        {
            var headers = PrepareAccountIdHeader(accountId);

            string url = BuildUrl(usersUrl + profileId, new UrlParameter(formatParameterName, DefaultResponseType.ToString()));

            return(httpTransport.Request(url, DefaultResponseType, headers: headers));
        }