diff --git a/BrightLocal/src/BrightLocal/BlService.cs b/BrightLocal/src/BrightLocal/BlService.cs new file mode 100644 index 0000000..bfaaa23 --- /dev/null +++ b/BrightLocal/src/BrightLocal/BlService.cs @@ -0,0 +1,15 @@ +namespace BrightLocal +{ + public class BlService + { + // Decalre Variables + public string api_key; + public string api_secret; + + protected BlService(string apiKey, string apiSecret) + { + api_key = apiKey; + api_secret = apiSecret; + } + } +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlBatchRankings.cs b/BrightLocal/src/BrightLocal/Entities/BlBatchRankings.cs new file mode 100644 index 0000000..cf5b9cf --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlBatchRankings.cs @@ -0,0 +1,27 @@ + +//using System.Collections.Generic; + +//namespace BrightLocal +//{ +// public class BrightLocalBatchRankings +// { +// public bool success { get; set; } +// public RankingsResults results { get; set; } +// public RankingsStatuses statuses { get; set; } +// public string status { get; set; } +// } + +// public class RankingsResults +// { +// public List SearchRankV2Api { get; set; } +// } + +// public class SearchRankV2Api +// { +// public List results { get; set; } +// public Payload payload { get; set; } +// public string status { get; set; } +// public int __invalid_name__job-id { get; set; } +//} + +//} diff --git a/BrightLocal/src/BrightLocal/Entities/BlBatchSuccess.cs b/BrightLocal/src/BrightLocal/Entities/BlBatchSuccess.cs new file mode 100644 index 0000000..5843b5c --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlBatchSuccess.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal +{ + public class BlBatchSuccess + { + public int batchId { get; set; } + public JobIds jobids { get; set; } + } + + public class JobIds : Dictionary + { + + } +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlCbAllCampaigns.cs b/BrightLocal/src/BrightLocal/Entities/BlCbAllCampaigns.cs new file mode 100644 index 0000000..0f4b9e4 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlCbAllCampaigns.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal +{ + public class BlCbAllCampaigns + { + public CbResponse response { get; set; } + } + + public class CbResponse + { + public List results { get; set; } + } + + public class CampaignsCitation + { + public string name { get; set; } + public string status { get; set; } + public string site_type { get; set; } + public string citation_url { get; set; } + public string domain_authority { get; set; } + public string citation_value { get; set; } + } + + public class CbAggregator + { + public string name { get; set; } + public string status { get; set; } + public string site_type { get; set; } + public string citation_url { get; set; } + public string domain_authority { get; set; } + public string citation_value { get; set; } + } + + public class CbResult + { + public string campaign_id { get; set; } + public string location_id { get; set; } + public string campaign_name { get; set; } + public string date_purchased { get; set; } + public string date_completed { get; set; } + public string email { get; set; } + public string username { get; set; } + public string password { get; set; } + public List citations { get; set; } + public List aggregators { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlCbCampaign.cs b/BrightLocal/src/BrightLocal/Entities/BlCbCampaign.cs new file mode 100644 index 0000000..c396a4b --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlCbCampaign.cs @@ -0,0 +1,145 @@ +using System.Collections.Generic; + +namespace BrightLocal +{ + public class BlCbCampaign + { + public CampaignResponse response { get; set; } + } + + public class CampaignResponse + { + public CampaignResults results { get; set; } + } + + public class CampaignResults + { + public string campaign_id { get; set; } + public int location_id { get; set; } + public string campaign_name { get; set; } + public string creation_date { get; set; } + public string package_id { get; set; } + public string selection_type { get; set; } + public string paid { get; set; } + public string status { get; set; } + public string submission_date { get; set; } + public string purchase_date { get; set; } + public string completion_date { get; set; } + public string username { get; set; } + public string email { get; set; } + public string password { get; set; } + public string campaign_note { get; set; } + public string customer_note { get; set; } + public string white_label_profile_id { get; set; } + public string num_citations { get; set; } + public string package_price { get; set; } + public string website_address { get; set; } + public string campaign_country { get; set; } + public string campaign_state { get; set; } + public string campaign_city { get; set; } + public string business_category_id { get; set; } + public string business_category_name { get; set; } + public CampaignAddress address { get; set; } + public CampaignContact contact { get; set; } + public string mobile_number { get; set; } + public string fax_number { get; set; } + public CampaignDescriptions descriptions { get; set; } + public string num_employees { get; set; } + public string start_year { get; set; } + public ServiceNames service_names { get; set; } + public WorkingHours working_hours { get; set; } + public PaymentMethods payment_methods { get; set; } + public object company_logo { get; set; } + public CampaignPhotos photos { get; set; } + public CbEmailAlerts email_alerts { get; set; } + public string old_business_name { get; set; } + public List specialist_info { get; set; } + public List stats { get; set; } + public List citations { get; set; } + public List aggregators { get; set; } + public CampaignUrls urls { get; set; } + } + + public class Stat + { + public string start_date { get; set; } + public int citations_count { get; set; } + public int scheduled { get; set; } + public int submitted { get; set; } + public int live { get; set; } + public int updated { get; set; } + public int replaced { get; set; } + } + + public class CampaignCitation + { + public string site { get; set; } + public string type { get; set; } + public string domain_authority { get; set; } + public string status { get; set; } + public string link { get; set; } + public string notes { get; set; } + } + + public class CampaignAggregator + { + public string site { get; set; } + public string type { get; set; } + public string domain_authority { get; set; } + public string status { get; set; } + public string link { get; set; } + public string notes { get; set; } + } + + public class CampaignUrls + { + public string interactive_url { get; set; } + public string pdf_url { get; set; } + public string csv_url { get; set; } + } + + public class CbEmailAlerts + { + public string enabled { get; set; } + public List addresses { get; set; } + } + + public class CampaignPhotos : Dictionary + { + + } + + public class PaymentMethods : Dictionary + { + + } + + public class ServiceNames : Dictionary + { + + } + + public class CampaignDescriptions + { + public string brief { get; set; } + public string full { get; set; } + } + + public class CampaignContact + { + public string last_name { get; set; } + public string first_name { get; set; } + public string email { get; set; } + public string telephone { get; set; } + } + + public class CampaignAddress + { + public string street_address_1 { get; set; } + public object street_address_2 { get; set; } + public object city { get; set; } + public object region { get; set; } + public string postcode { get; set; } + } + +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlCitationTracker.cs b/BrightLocal/src/BrightLocal/Entities/BlCitationTracker.cs new file mode 100644 index 0000000..1005273 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlCitationTracker.cs @@ -0,0 +1,53 @@ +using Newtonsoft.Json; + +namespace BrightLocal +{ + public class BlCitationTracker + { + [JsonProperty("report-id")] + public int reportId { get; set; } + [JsonProperty("location-id")] + public int locationId { get; set; } + [JsonProperty("report-name")] + public string reportName { get; set; } + [JsonProperty("business-name")] + public string businessName { get; set; } + [JsonProperty("business-location")] + public string businessLocation { get; set; } + [JsonProperty("old-business-name-1")] + public string oldBusinessName1 { get; set; } + [JsonProperty("old-business-name-2")] + public string oldBusinessName2 { get; set; } + [JsonProperty("postcode")] + public string postcode { get; set; } + [JsonProperty("old-postcode-1")] + public string oldPostcode1 { get; set; } + [JsonProperty("old-postcode-2")] + public string oldPostcode2 { get; set; } + [JsonProperty("country")] + public string country { get; set; } + [JsonProperty("phone")] + public string phone { get; set; } + [JsonProperty("website")] + public string website { get; set; } + [JsonProperty("business-type")] + public string businessType { get; set; } + [JsonProperty("state-code")] + public string stateCode { get; set; } + [JsonProperty("monthly-run")] + public int monthlyRun { get; set; } + [JsonProperty("weekly-run")] + public int weeklyRun { get; set; } + [JsonProperty("white-label-profile-id")] + public int whiteLabelProfileId { get; set; } + [JsonProperty("active-only")] + public string activeOnly { get; set; } + public string notify { get; set; } + [JsonProperty("email-addresses")] + public string emailAddresses { get; set; } + [JsonProperty("is-public")] + public string isPublic { get; set; } + [JsonProperty("status")] + public string status { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlCitationTrackerReport.cs b/BrightLocal/src/BrightLocal/Entities/BlCitationTrackerReport.cs new file mode 100644 index 0000000..3b549dc --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlCitationTrackerReport.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal +{ + public class BlCitationTrackerReport + { + public bool success { get; set; } + public CtReport report { get; set; } + } + + public class CtReport + { + public string report_id { get; set; } + public string customer_id { get; set; } + public string location_id { get; set; } + public string weekly_run { get; set; } + public string monthly_run { get; set; } + public string report_name { get; set; } + public string website_address { get; set; } + public string business_name { get; set; } + public string business_location { get; set; } + public string postcode { get; set; } + public string country { get; set; } + public object state_code { get; set; } + public string address1 { get; set; } + public string address2 { get; set; } + public string telephone { get; set; } + public string business_type { get; set; } + public string primary_location { get; set; } + public string last_run_id { get; set; } + public string old_business_name_1 { get; set; } + public string old_postcode_1 { get; set; } + public string old_business_name_2 { get; set; } + public string old_postcode_2 { get; set; } + public string last_run { get; set; } + public string company_name { get; set; } + public string white_label_profile_id { get; set; } + public string notify { get; set; } + public string email_addresses { get; set; } + public string active_only { get; set; } + public string is_public { get; set; } + public string public_key { get; set; } + public string created { get; set; } + public string status { get; set; } + public CtUrls urls { get; set; } + } + + public class CtUrls + { + public string interactive_url { get; set; } + public string pdf_url { get; set; } + public string csv_url { get; set; } + public string public_interactive_url { get; set; } + public string public_pdf_url { get; set; } + public string public_csv_url { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlCitationTrackerResults.cs b/BrightLocal/src/BrightLocal/Entities/BlCitationTrackerResults.cs new file mode 100644 index 0000000..acd3709 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlCitationTrackerResults.cs @@ -0,0 +1,181 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal +{ + public class BlCitationTrackerResults + { + public CtResponse response { get; set; } + } + + public class CtResponse + { + public CtResults results { get; set; } + } + + public class CtResults + { + public List active { get; set; } + + [JsonProperty("possible")] + public PossibleCitations possible { get; set; } + public List pending { get; set; } + public Domains activeDomains { get; set; } + public List pendingDomains { get; set; } + public Dictionary possibleDomains { get; set; } + public List topDirectories { get; set; } + public Flags flags { get; set; } + public List competitors { get; set; } + public CtUrls urls { get; set; } + } + + public class Active + { + public string id { get; set; } + public string citation_id { get; set; } + public string customer_id { get; set; } + public string report_id { get; set; } + [JsonProperty("citation-status")] + public string citationStatus { get; set; } + public string source { get; set; } + public string url { get; set; } + [JsonProperty("citation-notes")] + public string citationNotes { get; set; } + public object status_smile { get; set; } + public object need_to_fix { get; set; } + public string status { get; set; } + [JsonProperty("date-identified-sorting")] + public string dateIdentifiedSorting { get; set; } + [JsonProperty("date-identified")] + public string dateIdentified { get; set; } + [JsonProperty("domain-authority")] + public string domainAuthority { get; set; } + [JsonProperty("citation-value")] + public string citationValue { get; set; } + [JsonProperty("moz-rank")] + public string mozRank { get; set; } + [JsonProperty("site-type")] + public string siteType { get; set; } + [JsonProperty("listing-type")] + public string listingType { get; set; } + [JsonProperty("seomoz-lookup-complete")] + public string seomozLookupComplete { get; set; } + [JsonProperty("business-name")] + public string businessName { get; set; } + public string postcode { get; set; } + } + + public class PossibleCitations : Dictionary + { + + } + + public class Possible + { + public string id { get; set; } + public string citation_id { get; set; } + public string customer_id { get; set; } + public string report_id { get; set; } + [JsonProperty("citation-status")] + public string citationStatus { get; set; } + public string source { get; set; } + public string url { get; set; } + [JsonProperty("citation-notes")] + public string citationNotes { get; set; } + public string status_smile { get; set; } + public string need_to_fix { get; set; } + public string status { get; set; } + [JsonProperty("date-identified-sorting")] + public string dateIdentifiedSorting { get; set; } + [JsonProperty("date-identified")] + public string dateIdentified { get; set; } + [JsonProperty("domain-authority")] + public string domainAuthority { get; set; } + [JsonProperty("citation-value")] + public string citationValue { get; set; } + [JsonProperty("moz-rank")] + public string mozRank { get; set; } + [JsonProperty("site-type")] + public string siteType { get; set; } + [JsonProperty("listing-type")] + public string listingType { get; set; } + [JsonProperty("seomoz-lookup-complete")] + public string seomozLookupComplete { get; set; } + [JsonProperty("business-name")] + public string businessName { get; set; } + [JsonProperty("is-citation-burst-available")] + public bool isCitationBurstAvailable { get; set; } + [JsonProperty("get-citation-url")] + public string getCitationUrl { get; set; } + } + + + public class Domains : Dictionary + { + + } + + public class TopDirectory + { + public string citation_id { get; set; } + public string customer_id { get; set; } + public string report_id { get; set; } + [JsonProperty("citation-status")] + public string citationStatus { get; set; } + public string source { get; set; } + public string url { get; set; } + [JsonProperty("citation-notes")] + public string citationNotes { get; set; } + public string status_smile { get; set; } + public string need_to_fix { get; set; } + public string status { get; set; } + public string dateIdentifiedSorting { get; set; } + [JsonProperty("date-identified")] + public string dateIdentified { get; set; } + [JsonProperty("domain-authority")] + public string domainAuthority { get; set; } + [JsonProperty("citation-value")] + public string citationValue { get; set; } + [JsonProperty("moz-rank")] + public string mozRank { get; set; } + [JsonProperty("site-type")] + public string siteType { get; set; } + [JsonProperty("listing-type")] + public string listingType { get; set; } + [JsonProperty("seomoz-lookup-complete")] + public string seomozLookupComplete { get; set; } + [JsonProperty("business-name")] + public string businessName { get; set; } + public string address { get; set; } + public string postcode { get; set; } + public string telephone { get; set; } + } + + public class Flags + { + public Customer customer { get; set; } + public Competitor competitor { get; set; } + } + + public class Customer + { + public List @new { get; set; } + public List disappeared { get; set; } + } + + public class Competitor + { + public List @new { get; set; } + public List disappeared { get; set; } + } + + public class Competitors + { + public string business_name { get; set; } + public Domains domains { get; set; } + } + +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlCitations.cs b/BrightLocal/src/BrightLocal/Entities/BlCitations.cs new file mode 100644 index 0000000..b78b73c --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlCitations.cs @@ -0,0 +1,49 @@ +using System.Collections.Generic; + +namespace BrightLocal +{ + public class BlCitations + { + public bool error { get; set; } + public int campaignId { get; set; } + public Citations citations { get; set; } + public List aggregators { get; set; } + } + + public class Citations : Dictionary + { + + } + + public class Citation + { + public string citation_value { get; set; } + public string domain_authority { get; set; } + public string type { get; set; } + public string phone_verification { get; set; } + public string client_verification { get; set; } + public string notes { get; set; } + public string no_update { get; set; } + public string no_photos { get; set; } + public string part_of_yext_network { get; set; } + public string quick_listing { get; set; } + public string secondary_campaign_id { get; set; } + public string status { get; set; } + } + + public class Aggregator + { + public string citation { get; set; } + public string domain_authority { get; set; } + public string type { get; set; } + public string phone_verification { get; set; } + public string client_verification { get; set; } + public string notes { get; set; } + public string no_update { get; set; } + public string no_photos { get; set; } + public string part_of_yext_network { get; set; } + public string quick_listing { get; set; } + public string secondary_campaign_id { get; set; } + public string status { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlClient.cs b/BrightLocal/src/BrightLocal/Entities/BlClient.cs new file mode 100644 index 0000000..7bedbbf --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlClient.cs @@ -0,0 +1,18 @@ +using Newtonsoft.Json; + +namespace BrightLocal +{ + public class BlClient + { + [JsonProperty("client-id")] + public int clientId { get; set; } + [JsonProperty("company-name")] + public string companyName { get; set; } + [JsonProperty("company-url")] + public string companyUrl { get; set; } + [JsonProperty("business-category-id")] + public int? businessCategoryId { get; set; } + [JsonProperty("reference-number")] + public string referenceNumber { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlClientSearch.cs b/BrightLocal/src/BrightLocal/Entities/BlClientSearch.cs new file mode 100644 index 0000000..1d3dbca --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlClientSearch.cs @@ -0,0 +1,30 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal +{ + public class BlClientSearch + { + [JsonProperty("success")] + public bool success { get; set; } + [JsonProperty("clients")] + public List clients { get; set; } + } + + public class ClientSearch + { + [JsonProperty("client-id")] + public int clientId { get; set; } + [JsonProperty("company-name")] + public string companyName { get; set; } + [JsonProperty("status")] + public string status { get; set; } + [JsonProperty("client-reference")] + public string clientReference { get; set; } + [JsonProperty("business-category-id")] + public int businessCategoryId { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlCtGetAllResults.cs b/BrightLocal/src/BrightLocal/Entities/BlCtGetAllResults.cs new file mode 100644 index 0000000..5cf01c5 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlCtGetAllResults.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal +{ + public class BlCtGetAllResults + { + public CtGetAllResponse response { get; set; } + } + public class CtGetAllResponse + { + public List results { get; set; } + } + + public class CtResult + { + public string report_id { get; set; } + public string customer_id { get; set; } + public string location_id { get; set; } + public string report_run_id { get; set; } + public string report_name { get; set; } + public string website_address { get; set; } + public string business_name { get; set; } + public string business_location { get; set; } + public string postcode { get; set; } + public string country { get; set; } + public string state_code { get; set; } + public string cancel_run { get; set; } + public string address1 { get; set; } + public string address2 { get; set; } + public string telephone { get; set; } + public string business_type { get; set; } + public string primary_location { get; set; } + public string old_business_name_1 { get; set; } + public string old_postcode_1 { get; set; } + public string old_business_name_2 { get; set; } + public string old_postcode_2 { get; set; } + public string currently_running { get; set; } + public string generation_error { get; set; } + public string terminal_fail { get; set; } + public string last_run { get; set; } + public object report_status { get; set; } + public string your_ct_count { get; set; } + public string your_ct_count_up { get; set; } + public string your_ct_count_down { get; set; } + public string total_ct_sources { get; set; } + public string total_ct_sources_up { get; set; } + public string competitor_ct_count { get; set; } + public string competitor_ct_count_diff { get; set; } + public string old_ct_count { get; set; } + public object company_name { get; set; } + public object branding_profile_id { get; set; } + public string notify { get; set; } + public string email_addresses { get; set; } + public int your_ct_count_diff { get; set; } + public int competitor_ct_count_up { get; set; } + public int competitor_ct_count_down { get; set; } + public int total_ct_sources_diff { get; set; } + public string successful_runs { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlGetAllResults.cs b/BrightLocal/src/BrightLocal/Entities/BlGetAllResults.cs new file mode 100644 index 0000000..44887c2 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlGetAllResults.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; + +namespace BrightLocal +{ + public class BlGetAllResults + { + public LsrcGetAllResponse response { get; set; } + } + public class LsrcGetAllResponse + { + public List results { get; set; } + } + public class ResultsList + { + public string campaign_id { get; set; } + public string name { get; set; } + public string schedule { get; set; } + public string day_of_week { get; set; } + public string day_of_month { get; set; } + public string location_id { get; set; } + } + +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlGpwGetAllResults.cs b/BrightLocal/src/BrightLocal/Entities/BlGpwGetAllResults.cs new file mode 100644 index 0000000..2549067 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlGpwGetAllResults.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal +{ + public class BlGpwGetAllResults + { + public GpwResponse response { get; set; } + } + + public class GpwResponse + { + public List results { get; set; } + } + + public class GpwGetAllResult + { + public string report_id { get; set; } + public string report_name { get; set; } + public string schedule { get; set; } + public string is_running { get; set; } + public string running_message { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlGpwReport.cs b/BrightLocal/src/BrightLocal/Entities/BlGpwReport.cs new file mode 100644 index 0000000..9f0f995 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlGpwReport.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; + + +namespace BrightLocal +{ + public class BlGpwReport + { + public bool success { get; set; } + public GpwReport report { get; set; } + } + + public class GpwReport + { + public string report_id { get; set; } + public string report_name { get; set; } + public string customer_id { get; set; } + public string location_id { get; set; } + public string schedule { get; set; } + public string day_of_month { get; set; } + public string white_label_profile_id { get; set; } + public string report_type { get; set; } + public List business_names { get; set; } + public string postcode { get; set; } + public string country { get; set; } + public string state_code { get; set; } + public string address1 { get; set; } + public string address2 { get; set; } + public string city { get; set; } + public string telephone { get; set; } + public string profile_url { get; set; } + public List search_terms { get; set; } + public string google_location { get; set; } + public string notify { get; set; } + public List email_addresses { get; set; } + public string last_run_id { get; set; } + public string is_public { get; set; } + public string public_key { get; set; } + public string status { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlGpwReportResults.cs b/BrightLocal/src/BrightLocal/Entities/BlGpwReportResults.cs new file mode 100644 index 0000000..8d263a3 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlGpwReportResults.cs @@ -0,0 +1,103 @@ +using System.Collections.Generic; + +namespace BrightLocal +{ + public class BlGpwReportResults + { + public bool success { get; set; } + public GpwReportResults results { get; set; } + } + + public class GpwReportResults + { + public GpwSummary summary { get; set; } + public GpwKeywords keywords { get; set; } + public GpwReportUrls urls { get; set; } + } + + public class GpwSummary + { + public string business_name { get; set; } + public string address { get; set; } + public string telephone { get; set; } + public string website_address { get; set; } + public List opening_hours { get; set; } + public string profile_url { get; set; } + public bool claimed { get; set; } + public int citations_count { get; set; } + public double domain_authority { get; set; } + public int backlinks { get; set; } + public int num_reviews { get; set; } + public int star_rating { get; set; } + public string review_content { get; set; } + public int num_photos { get; set; } + public List categories { get; set; } + } + + public class GpwKeywords : Dictionary + { + + } + + public class GpwKeywordsResults + { + public int client_rank { get; set; } + public List top_10 { get; set; } + public List citations_matrix { get; set; } + public List nap_comparison { get; set; } + public TopCategories top_categories { get; set; } + public List other_ranking_factors { get; set; } + } + + public class GpwTop10 + { + public string business_name { get; set; } + public string rank { get; set; } + public bool client_business { get; set; } + public string profile_url { get; set; } + public bool claimed { get; set; } + public int citations_count { get; set; } + public string domain_authority { get; set; } + public int backlinks { get; set; } + public int num_reviews { get; set; } + public string star_rating { get; set; } + public int num_photos { get; set; } + public List categories { get; set; } + } + + public class CitationsMatrix + { + public string domain { get; set; } + public string authority { get; set; } + public int count { get; set; } + public List businesses { get; set; } + } + + public class GpwBusiness + { + public string business_name { get; set; } + public string citations_count { get; set; } + public string url { get; set; } + } + + public class NapComparison + { + public string taken_from { get; set; } + public string business_name { get; set; } + public string address { get; set; } + public string postcode { get; set; } + public string telephone { get; set; } + } + + public class TopCategories : Dictionary + { + + } + + public class GpwReportUrls + { + public string report_url { get; set; } + public string wl_url { get; set; } + } + +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlLocation.cs b/BrightLocal/src/BrightLocal/Entities/BlLocation.cs new file mode 100644 index 0000000..d2f0e53 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlLocation.cs @@ -0,0 +1,80 @@ +using Newtonsoft.Json; +using RestSharp; +using System.Collections.Generic; + +namespace BrightLocal +{ + public class BlLocation + { + [JsonProperty("location-name")] + public string locationName { get; set; } + [JsonProperty("client-id")] + public int clientId { get; set; } + [JsonProperty("location-url")] + public string locationUrl { get; set; } + [JsonProperty("business-category-id")] + public int businessCategoryId { get; set; } + [JsonProperty("country")] + public string country { get; set; } + [JsonProperty("address1")] + public string address1 { get; set; } + [JsonProperty("address2")] + public string address2 { get; set; } + [JsonProperty("region")] + public string region { get; set; } + [JsonProperty("town")] + public string town { get; set; } + [JsonProperty("postcode")] + public string postcode { get; set; } + [JsonProperty("telephone")] + public string telephone { get; set; } + [JsonProperty("location-reference")] + public string locationReference { get; set; } + [JsonProperty("contact-first-name")] + public string contactFirstName { get; set; } + [JsonProperty("contact-last-name")] + public string contactLastName { get; set; } + [JsonProperty("contact-mobile")] + public string contactMobile { get; set; } + [JsonProperty("contact-telephone")] + public string contactTelephone { get; set; } + [JsonProperty("contact-email")] + public string contactEmail { get; set; } + [JsonProperty("contact-fax")] + public string contactFax { get; set; } + [JsonProperty("number-of-employees")] + public string numberOfEmployees { get; set; } + [JsonProperty("year-of-formation")] + public string yearOfFormation { get; set; } + [JsonProperty("extra-business-categories")] + public List extraBusinessCategories { get; set; } + [JsonProperty("working-hours")] + public List workingHours { get; set; } + [JsonProperty("payment-methods")] + public List paymentMethods { get; set; } + [JsonProperty("short-description")] + public string shortDescription { get; set; } + [JsonProperty("long-description")] + public string longDescription { get; set; } + [JsonProperty("services-of-products")] + public List servicesOfProducts { get; set; } + } + + public class WorkingHours : Dictionary + { + //public string mon_start { get; set; } + //public string mon_end { get; set; } + //public string tue_start { get; set; } + //public string tue_end { get; set; } + //public string wed_start { get; set; } + //public string wed_end { get; set; } + //public string thu_start { get; set; } + //public string thu_end { get; set; } + //public string fri_start { get; set; } + //public string fri_end { get; set; } + //public string sat_start { get; set; } + //public string sat_end { get; set; } + //public string sun_start { get; set; } + //public string sun_end { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlLocationSearch.cs b/BrightLocal/src/BrightLocal/Entities/BlLocationSearch.cs new file mode 100644 index 0000000..a4c8a42 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlLocationSearch.cs @@ -0,0 +1,26 @@ + +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace BrightLocal +{ + public class BlLocationSearch + { + [JsonProperty("success")] + public bool success { get; set; } + [JsonProperty("locations")] + public List locations { get; set; } + } + + public class LocationSearch + { + [JsonProperty("location-id")] + public int locationId { get; set; } + [JsonProperty("location-name")] + public string locationName { get; set; } + [JsonProperty("client-id")] + public int clientId { get; set; } + [JsonProperty("location-reference")] + public string locationReference { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlLscu.cs b/BrightLocal/src/BrightLocal/Entities/BlLscu.cs new file mode 100644 index 0000000..1be1954 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlLscu.cs @@ -0,0 +1,61 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace BrightLocal +{ + public class BlLscu + { + [JsonProperty("report-id")] + public string reportId { get; set; } + [JsonProperty("report-name")] + public string reportName { get; set; } + [JsonProperty("location-id")] + public int locationId { get; set; } + [JsonProperty("white-label-profile-id")] + public int whiteLabelProfileId { get; set; } + [JsonProperty("business-names")] + public List businessNames { get; set; } + [JsonProperty("website-address")] + public string websiteAddress { get; set; } + [JsonProperty("address1")] + public string address1 { get; set; } + [JsonProperty("address2")] + public string address2 { get; set; } + [JsonProperty("area")] + public string area { get; set; } + [JsonProperty("city")] + public string city { get; set; } + [JsonProperty("state-code")] + public string stateCode { get; set; } + [JsonProperty("postcode")] + public string postcode { get; set; } + [JsonProperty("telephone")] + public string telephone { get; set; } + [JsonProperty("country")] + public string country { get; set; } + [JsonProperty("business-category")] + public string businessCategory { get; set; } + [JsonProperty("primary-business-location")] + public string primaryBusinessLocation { get; set; } + [JsonProperty("search-terms")] + public List searchTerms { get; set; } + [JsonProperty("google-location")] + public string googleLocation { get; set; } + [JsonProperty("bing-location")] + public string bingLocation { get; set; } + [JsonProperty("notify")] + public string notify { get; set; } + [JsonProperty("email-addresses")] + public string emailAddresses { get; set; } + [JsonProperty("facebook-url")] + public string facebookUrl { get; set; } + [JsonProperty("twitter-url")] + public string twitterUrl { get; set; } + [JsonProperty("is-public")] + public string isPublic { get; set; } + [JsonProperty("local-directory-urls")] + public LocalDirectoryUrls localDirectoryUrls { get; set; } + [JsonProperty("run-report")] + public string runReport { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlLscuReport.cs b/BrightLocal/src/BrightLocal/Entities/BlLscuReport.cs new file mode 100644 index 0000000..f004fc9 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlLscuReport.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; + +namespace BrightLocal +{ + public class BlLscuReport + { + public bool success { get; set; } + public LscuReport report { get; set; } + } + + public class LscuReport + { + public string report_id { get; set; } + public string customer_id { get; set; } + public string client_id { get; set; } + public string company_name { get; set; } + public string report_name { get; set; } + public string white_label_profile_id { get; set; } + public List business_names { get; set; } + public string website_address { get; set; } + public string telephone { get; set; } + public string address_1 { get; set; } + public string address_2 { get; set; } + public string city { get; set; } + public string state_code { get; set; } + public string postcode { get; set; } + public string country { get; set; } + public string business_category { get; set; } + public string primary_business_location { get; set; } + public List search_terms { get; set; } + public string notify { get; set; } + public List email_addresses { get; set; } + public string date_added { get; set; } + public string last_start_time { get; set; } + public string last_end_time { get; set; } + public string last_message { get; set; } + public string generation_error { get; set; } + public string currently_running { get; set; } + public string facebook { get; set; } + public string twitter { get; set; } + public string google_location { get; set; } + public string bing_location { get; set; } + public string previous_bing_location { get; set; } + public string is_public { get; set; } + public string public_key { get; set; } + public List local_directory_urls { get; set; } + public LatestRun latest_run { get; set; } + } + + public class LatestRun + { + public string interactive_url { get; set; } + public string pdf_url { get; set; } + public string public_interactive_url { get; set; } + public string public_pdf_url { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlLscuSearch.cs b/BrightLocal/src/BrightLocal/Entities/BlLscuSearch.cs new file mode 100644 index 0000000..529b2be --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlLscuSearch.cs @@ -0,0 +1,34 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal +{ + public class BlLscuSearch + { + [JsonProperty("success")] + public bool success { get; set; } + [JsonProperty("reports")] + public List reports { get; set; } + } + + public class LscuReports + { + [JsonProperty("report_id")] + public string report_id { get; set; } + [JsonProperty("report_name")] + public string report_name { get; set; } + [JsonProperty("location_id")] + public string location_id { get; set; } + [JsonProperty("date_added")] + public string date_added { get; set; } + [JsonProperty("last_run_date")] + public string last_run_date { get; set; } + [JsonProperty("last_message")] + public string last_message { get; set; } + [JsonProperty("currently_running")] + public string currently_running { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlLsrc.cs b/BrightLocal/src/BrightLocal/Entities/BlLsrc.cs new file mode 100644 index 0000000..aa6b45f --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlLsrc.cs @@ -0,0 +1,63 @@ +using Newtonsoft.Json; +using RestSharp; +using System.Collections.Generic; + +namespace BrightLocal +{ + public class BlLsrc + { + [JsonProperty("campaign-id")] + public string campaignId { get; set; } + [JsonProperty("name")] + public string name { get; set; } + [JsonProperty("schedule")] + public string schedule { get; set; } + [JsonProperty("day-of-week")] + public string dayOfWeek { get; set; } + [JsonProperty("day-of-month")] + public int dayOfMonth { get; set; } + [JsonProperty("location-id")] + public int locationId { get; set; } + [JsonProperty("white-label-profile-id")] + public int whiteLabelProfileId { get; set; } + [JsonProperty("tags")] + public string tags { get; set; } + [JsonProperty("search-terms")] + public string searchTerms { get; set; } + [JsonProperty("website-addresses")] + public List websiteAddresses { get; set; } + [JsonProperty("website-address")] + public string websiteAddress { get; set; } + [JsonProperty("website-address-2")] + public string websiteAddress2 { get; set; } + [JsonProperty("website-address-3")] + public string websiteAddress3 { get; set; } + [JsonProperty("country")] + public string country { get; set; } + [JsonProperty("google-location")] + public string googleLocation { get; set; } + [JsonProperty("bing-location")] + public string bingLocation { get; set; } + [JsonProperty("business-names")] + public string businessNames { get; set; } + [JsonProperty("postcode")] + public string postcode { get; set; } + [JsonProperty("telephone")] + public string telephone { get; set; } + [JsonProperty("search-engines")] + public string searchEngines { get; set; } + [JsonProperty("include-local-directory-results")] + public string includeLocalDirectoryResults { get; set; } + [JsonProperty("notify")] + public string notify { get; set; } + [JsonProperty("emailAddresses")] + public string emailAddresses { get; set; } + [JsonProperty("is-public")] + public string isPublic { get; set; } + [JsonProperty("status")] + public string status { get; set; } + [JsonProperty("credits")] + public string credits { get; set; } + + } +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlLsrcHistory.cs b/BrightLocal/src/BrightLocal/Entities/BlLsrcHistory.cs new file mode 100644 index 0000000..92b5ade --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlLsrcHistory.cs @@ -0,0 +1,31 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal +{ + public class BlLsrcHistory + { + public LsrcHistoryResponse response { get; set; } + } + public class LsrcHistoryResponse + { + public List results { get; set; } + } + + public class LsrcHistory + { + [JsonProperty("campaign_history_id")] + public string campaignHistoryId { get; set; } + [JsonProperty("campaign_id")] + public string campaignId { get; set; } + [JsonProperty("location_id")] + public string locationId { get; set; } + [JsonProperty("hystory_type")] + public string historyType { get; set; } + [JsonProperty("generation_date")] + public string genrationDate { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlLsrcReport.cs b/BrightLocal/src/BrightLocal/Entities/BlLsrcReport.cs new file mode 100644 index 0000000..9511191 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlLsrcReport.cs @@ -0,0 +1,85 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace BrightLocal +{ + public class BlLsrcReport + { + public LsrcResponse response { get; set; } + } + public class LsrcResponse + { + public LsrcResult result { get; set; } + } + public class LsrcResult + { + [JsonProperty("campaign_id")] + public string campaign_id { get; set; } + [JsonProperty("customer_id")] + public string customer_id { get; set; } + [JsonProperty("white_label_profile_id")] + public string white_label_profile_id { get; set; } + [JsonProperty("location_id")] + public string location_id { get; set; } + [JsonProperty("name")] + public string name { get; set; } + [JsonProperty("schedule")] + public string schedule { get; set; } + [JsonProperty("day_of_week")] + public string day_of_week { get; set; } + [JsonProperty("day_of_month")] + public object day_of_month { get; set; } + [JsonProperty("search_terms")] + public List search_terms { get; set; } + [JsonProperty("ppc_search_terms")] + public object ppc_search_terms { get; set; } + [JsonProperty("lookup_ppc")] + public string lookup_ppc { get; set; } + [JsonProperty("website-addresses")] + public List websiteAddresses { get; set; } + [JsonProperty("website_address")] + public string website_address { get; set; } + [JsonProperty("website_address_2")] + public object website_address_2 { get; set; } + [JsonProperty("website_address_3")] + public object website_address_3 { get; set; } + [JsonProperty("country")] + public string country { get; set; } + [JsonProperty("google_location")] + public string google_location { get; set; } + [JsonProperty("bing_location")] + public object bing_location { get; set; } + [JsonProperty("business_names")] + public List business_names { get; set; } + [JsonProperty("postcode")] + public string postcode { get; set; } + [JsonProperty("telephone")] + public string telephone { get; set; } + [JsonProperty("search_engines")] + public List search_engines { get; set; } + [JsonProperty("include_local_directory_results")] + public string include_local_directory_results { get; set; } + [JsonProperty("notify")] + public string notify { get; set; } + [JsonProperty("email_addresses")] + public List email_addresses { get; set; } + [JsonProperty("created")] + public string created { get; set; } + [JsonProperty("last_processed")] + public string last_processed { get; set; } + [JsonProperty("last_message")] + public string last_message { get; set; } + [JsonProperty("currently_running")] + public string currently_running { get; set; } + [JsonProperty("status")] + public string status { get; set; } + [JsonProperty("red_flag")] + public string red_flag { get; set; } + [JsonProperty("is_public")] + public string is_public { get; set; } + [JsonProperty("public_key")] + public object public_key { get; set; } + [JsonProperty("tags")] + public List tags { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlLsrcReportResults.cs b/BrightLocal/src/BrightLocal/Entities/BlLsrcReportResults.cs new file mode 100644 index 0000000..2492c45 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlLsrcReportResults.cs @@ -0,0 +1,267 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal +{ + public class BlLsrcReportResults + { + public LsrcResultResponse response { get; set; } + } + + public class LsrcResultResponse + { + public LsrcReportResult result { get; set; } + } + + public class LsrcReportResult + { + public LsrcCampaignDetails campaign_details { get; set; } + public LsrcResultsUrls urls { get; set; } + public LsrcResultsRankings rankings { get; set; } + [JsonProperty("serp-screenshots")] + public List serpScreenshots { get; set; } + } + + public class LsrcCampaignDetails + { + public string campaign_id { get; set; } + public string customer_id { get; set; } + public string white_label_profile_id { get; set; } + public string location_id { get; set; } + public string name { get; set; } + public string schedule { get; set; } + public string day_of_week { get; set; } + public string day_of_month { get; set; } + public List search_terms { get; set; } + public string ppc_search_terms { get; set; } + public string lookup_ppc { get; set; } + public List website_addresses { get; set; } + public string country { get; set; } + public string google_location { get; set; } + public string bing_location { get; set; } + public object previous_bing_location { get; set; } + public List business_names { get; set; } + public string postcode { get; set; } + public string telephone { get; set; } + public List search_engines { get; set; } + public string include_local_directory_results { get; set; } + public string notify { get; set; } + public string email_addresses { get; set; } + public string created { get; set; } + public string last_processed { get; set; } + public string last_message { get; set; } + public string currently_running { get; set; } + public string status { get; set; } + public string red_flag { get; set; } + public string is_public { get; set; } + public string public_key { get; set; } + public string show_advanced_settings { get; set; } + public string last_batch_id { get; set; } + public List tags { get; set; } + } + + public class LsrcResultsUrls + { + public string interactive_url { get; set; } + public string pdf_url { get; set; } + public string csv_url { get; set; } + public string public_interactive_url { get; set; } + public string public_pdf_url { get; set; } + public string public_csv_url { get; set; } + } + + public class LsrcResultsRankings + { + public List keywords { get; set; } + public KeywordsNumRankings keywords_num_rankings { get; set; } + public List search_engines { get; set; } + public LsrcResultsRankings2 rankings { get; set; } + public LsrcHashes hashes { get; set; } + public LsrcByPosition byPosition { get; set; } + public Dictionary starred_keywords { get; set; } + public LsrcSummary summary { get; set; } + } + + public class KeywordsNumRankings: Dictionary + { + + } + + public class LsrcResultsRankings2: Dictionary + { + + } + + public class LsrcKeyword: Dictionary> + { + + } + public class LsrcEngines + { + public string id { get; set; } + public string url { get; set; } + public string orig_url { get; set; } + public string rank { get; set; } + public string page { get; set; } + public string type { get; set; } + public string match { get; set; } + public string directory { get; set; } + public string date { get; set; } + public string hash { get; set; } + public string search_url { get; set; } + public string search_engine { get; set; } + } + + public class LsrcHashes: Dictionary + { + + } + + public class HashKeyword: Dictionary> + { + + } + + public class LsrcByPosition + { + [JsonProperty("Position 1")] + public List Position1 { get; set; } + [JsonProperty("Positions 2-5")] + public List Positions2_5 { get; set; } + [JsonProperty("Positions 6-10")] + public List Positions6_10 { get; set; } + [JsonProperty("Positions 11-20")] + public List Positions11_20 { get; set; } + [JsonProperty("Positions 21-50")] + public List Positions21_50 { get; set; } + [JsonProperty("Positions 51+")] + public LsrcPositionValues Positions51Up { get; set; } + } + + public class LsrcPositions + { + + } + + public class LsrcPositionValues: Dictionary + { + + } + + public class LsrcPositionDetails + { + public string id { get; set; } + public string url { get; set; } + public string orig_url { get; set; } + public string rank { get; set; } + public string page { get; set; } + public string type { get; set; } + public string match { get; set; } + public object directory { get; set; } + public string date { get; set; } + public string hash { get; set; } + public string search_url { get; set; } + public string search_engine { get; set; } + } + + public class LsrcSummary + { + public LsrcAllSearchEngines all_search_engines { get; set; } + public LsrcGoogle google { get; set; } + [JsonProperty("google-places")] + public LsrcGooglePlaces googlePlaces { get; set; } + public LsrcYahoo yahoo { get; set; } + [JsonProperty("yahoo-local")] + public LsrcYahooLocal yahooLocal { get; set; } + public LsrcBing bing { get; set; } + [JsonProperty("bing-local")] + public LsrcBingLocal bingLocal { get; set; } + } + + public class LsrcAllSearchEngines + { + public int up { get; set; } + public int down { get; set; } + public int no_change { get; set; } + public List gained_hashes { get; set; } + public List lost_hashes { get; set; } + } + + public class LsrcGoogle + { + public int up { get; set; } + public int down { get; set; } + public int no_change { get; set; } + public List gained_hashes { get; set; } + public List lost_hashes { get; set; } + } + + public class LsrcGooglePlaces + { + public int up { get; set; } + public int down { get; set; } + public int no_change { get; set; } + public List gained_hashes { get; set; } + public List lost_hashes { get; set; } + } + + public class LsrcYahoo + { + public int up { get; set; } + public int down { get; set; } + public int no_change { get; set; } + public List gained_hashes { get; set; } + public List lost_hashes { get; set; } + } + + public class LsrcYahooLocal + { + public int up { get; set; } + public int down { get; set; } + public int no_change { get; set; } + public List gained_hashes { get; set; } + public List lost_hashes { get; set; } + } + + public class LsrcBing + { + public int up { get; set; } + public int down { get; set; } + public int no_change { get; set; } + public List gained_hashes { get; set; } + public List lost_hashes { get; set; } + } + + public class LsrcBingLocal + { + public int up { get; set; } + public int down { get; set; } + public int no_change { get; set; } + public List gained_hashes { get; set; } + public List lost_hashes { get; set; } + } + + public class LsrcSerpScreenshots: Dictionary + { + + } + + public class ScreenshotEngine: Dictionary + { + + } + + public class ScreenshotKeyword: Dictionary + { + + } + + public class ScreenshotPosition + { + public string url { get; set; } + public string expiry_date { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlRfDirectories.cs b/BrightLocal/src/BrightLocal/Entities/BlRfDirectories.cs new file mode 100644 index 0000000..923e934 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlRfDirectories.cs @@ -0,0 +1,58 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal +{ + public class BlRfDirectories + { + public bool success { get; set; } + public RflowDirectories directories { get; set; } + } + + public class BrightLocalRfDirectoryStats + { + public bool success { get; set; } + public RflowDirectories stats { get; set; } + } + + public class BrightLocalRfStarCounts + { + public bool success { get; set; } + public StarCounts counts { get; set; } + } + + public class RflowDirectories : Dictionary + { + + } + + public class ReviewfDirectories + { + public string directory { get; set; } + public string name { get; set; } + public bool use { get; set; } + public string url { get; set; } + public bool searched { get; set; } + public int reviews { get; set; } + } + + public class StarCounts + { + [JsonProperty("0star")] + public string star0 { get; set; } + [JsonProperty("1star")] + public string star1 { get; set; } + [JsonProperty("2star")] + public string star2 { get; set; } + [JsonProperty("3star")] + public string star3 { get; set; } + [JsonProperty("4star")] + public string star4 { get; set; } + [JsonProperty("5star")] + public string star5 { get; set; } + + } +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlRfGetAll.cs b/BrightLocal/src/BrightLocal/Entities/BlRfGetAll.cs new file mode 100644 index 0000000..e81c779 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlRfGetAll.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; + +namespace BrightLocal +{ + public class BlRfGetAll + { + public bool success { get; set; } + public List reports { get; set; } + } + + public class RfReports + { + public string report_id { get; set; } + public string report_name { get; set; } + public string location_id { get; set; } + public string created_at { get; set; } + public string last_update { get; set; } + public bool is_running { get; set; } + public string running_message { get; set; } + public bool fetching { get; set; } + public bool complete { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlRfReport.cs b/BrightLocal/src/BrightLocal/Entities/BlRfReport.cs new file mode 100644 index 0000000..678cc13 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlRfReport.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal +{ + public class BlRfReport + { + public bool success { get; set; } + public RfReport report { get; set; } + } + + public class RfReport + { + public string report_id { get; set; } + public string report_name { get; set; } + public string location_id { get; set; } + public string customer_id { get; set; } + public string business_name { get; set; } + public string contact_telephone { get; set; } + public string address1 { get; set; } + public string address2 { get; set; } + public string city { get; set; } + public string postcode { get; set; } + public string country { get; set; } + public bool receive_email_alerts { get; set; } + public List alert_email_addresses { get; set; } + public string last_update { get; set; } + public string created_at { get; set; } + public string schedule { get; set; } + public string run_on { get; set; } + public string reviews_count { get; set; } + public string rating { get; set; } + public bool is_running { get; set; } + public string white_label_profile_id { get; set; } + public bool is_public { get; set; } + public string public_key { get; set; } + public RfDirectories directories { get; set; } + public RfUrls urls { get; set; } + } + + public class RfUrls + { + public string interactive_url { get; set; } + public string pdf_url { get; set; } + public string public_interactive_url { get; set; } + public string public_pdf_url { get; set; } + } + + public class RfDirectories : Dictionary + { + + } + + public class RfDirectoryUrls + { + public string url { get; set; } + public bool searched { get; set; } + public bool include { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlRfReviews.cs b/BrightLocal/src/BrightLocal/Entities/BlRfReviews.cs new file mode 100644 index 0000000..4b2fef4 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlRfReviews.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; + +namespace BrightLocal +{ + public class BlRfReviews + { + public bool success { get; set; } + public List reviews { get; set; } + } + + public class Review + { + public string dt { get; set; } + public string report_id { get; set; } + public string directory { get; set; } + public string timestamp { get; set; } + public string rating { get; set; } + public string title { get; set; } + public string author { get; set; } + public string text { get; set; } + public string link { get; set; } + public string url { get; set; } + public string source { get; set; } + public string name { get; set; } + public string report_run_id { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Entities/BlSuccess.cs b/BrightLocal/src/BrightLocal/Entities/BlSuccess.cs new file mode 100644 index 0000000..6edc739 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Entities/BlSuccess.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal +{ + public class BlSuccess: Dictionary + { + + } +} diff --git a/BrightLocal/src/BrightLocal/Examples-version2/Account-Methods/citationBurstExamples.cs b/BrightLocal/src/BrightLocal/Examples-version2/Account-Methods/citationBurstExamples.cs new file mode 100644 index 0000000..aece904 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Examples-version2/Account-Methods/citationBurstExamples.cs @@ -0,0 +1,170 @@ +using System.Collections.Generic; + +namespace BrightLocal.Examples_version2.Account_Methods +{ + public class CitationBurstExamples + { + public static BlSuccess Create() + { + string brief_description = "Born in Paris in 1972 by sibling duo Maguy and Gilbert Le Coze, Le Bernardin only served fish: Fresh, simple and prepared with respect. After receiving its first Michelin star in 1976, and two more in 1980, the Le Coze’s set to open Le Bernardin in New York in 1986."; + string full_description = "The restaurant has held three stars from the Michelin Guide since its 2005 New York launch and currently ranks 24 on the World’s 50 Best Restaurants list. The New York Zagat Guide has recognized Le Bernardin as top rated in the category of “Best Food” for the last nine consecutive years, and in 2015 was rated by the guide as New York City’s top restaurant for food and service. Le Bernardin has earned seven James Beard Awards since 1998 including “Outstanding Restaurant of the Year,” “Top Chef in New York City,” “Outstanding Service,” “Outstanding Chef in the United States,” “Outstanding Pastry Chef,” “Outstanding Wine Service,” and “Best Restaurant Design” in 2012. Most recently, the Foundation named Maguy Le Coze as Outstanding."; + + CitationBurst cb = new CitationBurst(); + cb.businessName = "Le Bernardin"; + cb.campaignName = "Sample Citation Burst Campaign"; + cb.websiteAddress = "le-bernardin.com"; + cb.campaignCountry = "USA"; + cb.campaignState = "NY"; + cb.campaignCity = "New York"; + cb.businessCategoryId = 605; + cb.businessCategories = new List() { "restaurant", "cafe" }; + cb.address1 = "155 Weest 51st Street"; + cb.address2 = ""; + cb.postcode = "10019"; + cb.contactName = "Hanane Moshe"; + cb.contactFirstName = "Hanane"; + cb.contactTelephone = "+1 212-554-1515"; + cb.briefDescription = brief_description; + cb.fullDescription = full_description; + cb.employeesNumber = 35; + cb.startYear = 1976; + cb.workingHoursApplyToAll = 0; + cb.workingHoursMonStart = 0800; + cb.workingHoursMonEnd = 2200; + cb.workingHoursTueStart = 0800; + cb.workingHoursTueEnd = 2200; + cb.workingHoursWedStart = 0800; + cb.workingHoursWedEnd = 2200; + cb.workingHoursThuStart = 0800; + cb.workingHoursThuEnd = 2200; + cb.workingHoursFriStart = 0800; + cb.workingHoursFriEnd = 2200; + cb.workingHoursSatStart = 1000; + cb.workingHoursSatEnd = 2400; + cb.workingHoursSunStart = 1000; + cb.workingHoursSunEnd = 2400; + cb.paymentMethods = "Cash|Visa"; + + var CitationBurstService = new CitationBurstService(); + + BlSuccess newCb = CitationBurstService.Create(cb); + + return newCb; + } + + public static BlSuccess Update() + { + string brief_description = "Born in Paris in 1972 by sibling duo Maguy and Gilbert Le Coze, Le Bernardin only served fish: Fresh, simple and prepared with respect. After receiving its first Michelin star in 1976, and two more in 1980, the Le Coze’s set to open Le Bernardin in New York in 1986."; + string full_description = "The restaurant has held three stars from the Michelin Guide since its 2005 New York launch and currently ranks 24 on the World’s 50 Best Restaurants list. The New York Zagat Guide has recognized Le Bernardin as top rated in the category of “Best Food” for the last nine consecutive years, and in 2015 was rated by the guide as New York City’s top restaurant for food and service. Le Bernardin has earned seven James Beard Awards since 1998 including “Outstanding Restaurant of the Year,” “Top Chef in New York City,” “Outstanding Service,” “Outstanding Chef in the United States,” “Outstanding Pastry Chef,” “Outstanding Wine Service,” and “Best Restaurant Design” in 2012. Most recently, the Foundation named Maguy Le Coze as Outstanding."; + + UpdateCitationBurst cb = new UpdateCitationBurst(); + cb.campaignId = 1; + cb.businessName = "Le Bernardin"; + cb.campaignName = "Sample Citation Burst Campaign"; + cb.websiteAddress = "le-bernardin.com"; + cb.campaignCountry = "USA"; + cb.campaignState = "NY"; + cb.campaignCity = "New York"; + cb.businessCategoryId = 605; + cb.businessCategories = new List() { "restaurant", "cafe" }; + cb.address1 = "155 Weest 51st Street"; + cb.address2 = ""; + cb.postcode = "10019"; + cb.contactName = "Hanane Moshe"; + cb.contactFirstName = "Hanane"; + cb.contactTelephone = "+1 212-554-1515"; + cb.briefDescription = brief_description; + cb.fullDescription = full_description; + cb.employeesNumber = 35; + cb.startYear = 1976; + cb.workingHoursApplyToAll = 0; + cb.workingHoursMonStart = 0800; + cb.workingHoursMonEnd = 2200; + cb.workingHoursTueStart = 0800; + cb.workingHoursTueEnd = 2200; + cb.workingHoursWedStart = 0800; + cb.workingHoursWedEnd = 2200; + cb.workingHoursThuStart = 0800; + cb.workingHoursThuEnd = 2200; + cb.workingHoursFriStart = 0800; + cb.workingHoursFriEnd = 2200; + cb.workingHoursSatStart = 1000; + cb.workingHoursSatEnd = 2400; + cb.workingHoursSunStart = 1000; + cb.workingHoursSunEnd = 2400; + cb.paymentMethods = "Cash|Visa"; + + var CitationBurstService = new CitationBurstService(); + + BlSuccess newCb = CitationBurstService.Update(cb); + + return newCb; + } + + public static BlSuccess UploadImage() + { + CbUploadImage image = new CbUploadImage(); + image.campaignId = 1; + image.file = "/path/to/image.jpg"; + image.imageType = "logo"; + + var CitationBurstService = new CitationBurstService(); + + BlSuccess cbImage = CitationBurstService.UploadImage(image); + + return cbImage; + } + + public static BlCitations GetCitations() + { + int campaingId = 1; + + var CitationBurstService = new CitationBurstService(); + + BlCitations citations = CitationBurstService.GetCitations(campaingId); + + return citations; + } + + public static BlSuccess ConfirmAndPay() + { + BrightLocalCbPay confirmPay = new BrightLocalCbPay(); + confirmPay.campaign_id = 1; + confirmPay.package_id = "cb15"; + + var CitationBurstService = new CitationBurstService(); + + BlSuccess confirm = CitationBurstService.ConfirmAndPay(confirmPay); + + return confirm; + } + + public static BlCbAllCampaigns GetAll() + { + var CitationBurstService = new CitationBurstService(); + + BlCbAllCampaigns results = CitationBurstService.GetCampaigns(); + + return results; + } + + public static BlCbCampaign GetCampaign() + { + int campaignId = 1; + var CitationBurstService = new CitationBurstService(); + + BlCbCampaign results = CitationBurstService.GetCampaign(campaignId); + + return results; + } + + public static BlSuccess GetCredits() + { + var CitationBurstService = new CitationBurstService(); + + BlSuccess credits = CitationBurstService.GetCredits(); + + return credits; + } + } +} diff --git a/BrightLocal/src/BrightLocal/Examples-version2/Account-Methods/citationTrackerExamples.cs b/BrightLocal/src/BrightLocal/Examples-version2/Account-Methods/citationTrackerExamples.cs new file mode 100644 index 0000000..e463c27 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Examples-version2/Account-Methods/citationTrackerExamples.cs @@ -0,0 +1,97 @@ +namespace BrightLocal.Examples_version2.Account_Methods +{ + public class citationTrackerExamples + { + public static BlSuccess Create() + { + CitationTracker ct = new CitationTracker(); + ct.reportName = "Sample Citation Tracker Report"; + ct.businessName = "Le Bernardin"; + ct.website = "le-bernardin.com"; + ct.businessType = "Restaurant"; + ct.stateCode = "NY"; + ct.postcode = "10019"; + ct.phone = "+1 212-554-1515"; + ct.country = "USA"; + + var citationTrackerService = new CitationTrackerService(); + + BlSuccess newCt = citationTrackerService.Create(ct); + + return newCt; + } + + public static BlSuccess Update() + { + UpdateCitationTracker ct = new UpdateCitationTracker(); + ct.reportId = 682; + ct.reportName = "Sample Citation Tracker Report"; + ct.businessName = "Le Bernardin"; + ct.website = "le-bernardin.com"; + ct.businessType = "Restaurant"; + ct.stateCode = "NY"; + ct.postcode = "10019"; + ct.phone = "+1 212-554-1515"; + ct.country = "USA"; + + var citationTrackerService = new CitationTrackerService(); + + BlSuccess updateCt = citationTrackerService.Update(ct); + + return updateCt; + } + + public static BlCitationTrackerReport Get() + { + int reportId = 682; + + var citationTrackerService = new CitationTrackerService(); + + BlCitationTrackerReport ct = citationTrackerService.Get(reportId); + + return ct; + } + + public static BlSuccess Run() + { + int reportId = 682; + + var citationTrackerService = new CitationTrackerService(); + + BlSuccess ct = citationTrackerService.Run(reportId); + + return ct; + } + + public static BlSuccess Delete() + { + int reportId = 682; + + var citationTrackerService = new CitationTrackerService(); + + BlSuccess ct = citationTrackerService.Delete(reportId); + + return ct; + } + + public static BlCtGetAllResults GetAll() + { + + var citationTrackerService = new CitationTrackerService(); + + BlCtGetAllResults ctResults = citationTrackerService.GetAll(); + + return ctResults; + } + + public static BlCitationTrackerResults GetReportResults() + { + var reportId = 1; + var citationTrackerService = new CitationTrackerService(); + + BlCitationTrackerResults ctResults = citationTrackerService.GetReportResults(reportId); + + return ctResults; + } + } +} diff --git a/BrightLocal/src/BrightLocal/Examples-version2/Account-Methods/clientExamples.cs b/BrightLocal/src/BrightLocal/Examples-version2/Account-Methods/clientExamples.cs new file mode 100644 index 0000000..be09ee4 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Examples-version2/Account-Methods/clientExamples.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; + +namespace BrightLocal.Examples_version2.Account_Methods +{ + public class clientExamples + { + public static BlSuccess Create() + { + var client = new Client(); + client.name = "Le Bernardin"; + client.companyUrl = "le-bernardin.com"; + client.businessCategoryId = 791; + + var clientService = new ClientService(); + + BlSuccess newClient = clientService.Create(client); + return newClient; + } + + public static BlSuccess Update() + { + var client = new UpdateClient(); + client.clientId = 36447; + client.name = "Le Bernardin"; + client.companyUrl = "le-bernardin.com"; + client.businessCategoryId = 791; + + var clientService = new ClientService(); + + BlSuccess updateClient = clientService.Update(client); + return updateClient; + } + + public static BlSuccess Delete() + { + var clientId = 1; + var clientService = new ClientService(); + + BlSuccess deleteClient = clientService.Delete(clientId); + return deleteClient; + } + + public static BlClient Get() + { + var clientId = 1; + var clientService = new ClientService(); + + BlClient client = clientService.Get(clientId); + return client; + } + + public static BlClientSearch Search() + { + var searchQuery = "le-bernardin"; + var clientService = new ClientService(); + + BlClientSearch results = clientService.Search(searchQuery); + return results; + } + } +} diff --git a/BrightLocal/src/BrightLocal/Examples-version2/Account-Methods/gpwExamples.cs b/BrightLocal/src/BrightLocal/Examples-version2/Account-Methods/gpwExamples.cs new file mode 100644 index 0000000..c98442b --- /dev/null +++ b/BrightLocal/src/BrightLocal/Examples-version2/Account-Methods/gpwExamples.cs @@ -0,0 +1,102 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal.Examples_version2.Account_Methods +{ + public class gpwExamples + { + public static BlSuccess Create() + { + var gpwReport = new Gpw(); + gpwReport.reportName = "Sample Citation Tracker Report"; + gpwReport.businessNames = "Le Bernardin"; + gpwReport.schedule = "Adhoc"; + gpwReport.dayOfMonth = "2"; + gpwReport.reportType = "with"; + gpwReport.address1 = "155 Weest 51st Street"; + gpwReport.address2 = ""; + gpwReport.city = "NYC"; + gpwReport.stateCode = "NY"; + gpwReport.postcode = "10019"; + gpwReport.phoneNumber = "+1 212-554-1515"; + gpwReport.country = "USA"; + gpwReport.searchTerms = JsonConvert.SerializeObject(new List() { "restaurant manhattan", "cafe new york" }); + + var gpwService = new GpwService(); + + BlSuccess gpwReportResults = gpwService.Create(gpwReport); + return gpwReportResults; + } + + public static BlSuccess Update() + { + var gpwReport = new UpdateGpw(); + gpwReport.reportId = 1; + gpwReport.reportName = "Sample Citation Tracker Report"; + gpwReport.businessNames = "Le Bernardin"; + gpwReport.schedule = "Adhoc"; + gpwReport.dayOfMonth = "2"; + gpwReport.reportType = "with"; + gpwReport.address1 = "155 Weest 51st Street"; + gpwReport.address2 = ""; + gpwReport.city = "NYC"; + gpwReport.stateCode = "NY"; + gpwReport.postcode = "10019"; + gpwReport.phoneNumber = "+1 212-554-1515"; + gpwReport.country = "USA"; + gpwReport.searchTerms = JsonConvert.SerializeObject(new List() { "restaurant manhattan", "cafe new york" }); + + var gpwService = new GpwService(); + + BlSuccess gpwReportResults = gpwService.Update(gpwReport); + return gpwReportResults; + } + + public static BlGpwReport Get() + { + var reportId = 1; + var gpwService = new GpwService(); + + BlGpwReport gpwReport = gpwService.Get(reportId); + return gpwReport; + } + + public static BlSuccess Delete() + { + var reportId = 1; + var gpwService = new GpwService(); + + BlSuccess gpwReport = gpwService.Delete(reportId); + return gpwReport; + } + + public static BlGpwGetAllResults GetAll() + { + var gpwService = new GpwService(); + + BlGpwGetAllResults gpwGetAllResults = gpwService.GetAll(); + return gpwGetAllResults; + } + + public static BlSuccess Run() + { + var reportId = 1; + var gpwService = new GpwService(); + + BlSuccess gpwReport = gpwService.Run(reportId); + return gpwReport; + } + + public static BlGpwReportResults GetResults() + { + var reportId = 1; + var gpwService = new GpwService(); + + BlGpwReportResults gpwReport = gpwService.GetReportResults(reportId); + return gpwReport; + } + } +} diff --git a/BrightLocal/src/BrightLocal/Examples-version2/Account-Methods/locationExamples.cs b/BrightLocal/src/BrightLocal/Examples-version2/Account-Methods/locationExamples.cs new file mode 100644 index 0000000..bca43c7 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Examples-version2/Account-Methods/locationExamples.cs @@ -0,0 +1,76 @@ + +using System.Collections.Generic; + +namespace BrightLocal.Examples_version2.Account_Methods +{ + public class locationExamples + { + public static BlSuccess Create() + { + var location = new Location(); + location.name = "Le Bernardin"; + location.url = "le-bernardin.com"; + location.businessCategoryId = 791; + location.country = "USA"; + location.address1 = "155 Weest 51st Street"; + location.address2 = ""; + location.region = "NY"; // state or region + location.city = "New York"; + location.postcode = "10019"; + location.telephone = "+1 212-554-1515"; + + var locationService = new LocationService(); + + BlSuccess newLocation = locationService.Create(location); + return newLocation; + } + + public static BlSuccess Update() + { + var location = new UpdateLocation(); + location.locationId = 1; + location.name = "Le Bernardin"; + location.url = "le-bernardin.com"; + location.businessCategoryId = 791; + location.country = "USA"; + location.address1 = "155 Weest 51st Street"; + location.address2 = ""; + location.region = "NY"; // state or region + location.city = "New York"; + location.postcode = "10019"; + location.telephone = "+1 212-554-1515"; + + var locationService = new LocationService(); + + BlSuccess updateLocation = locationService.Update(location); + return updateLocation; + } + + public static BlSuccess Delete() + { + var locationId = 1; + var locationService = new LocationService(); + + BlSuccess deleteLocation = locationService.Delete(locationId); + return deleteLocation; + } + + public static BlLocation Get() + { + var locationId = 1; + var locationService = new LocationService(); + + BlLocation getLocation = locationService.Get(locationId); + return getLocation; + } + + public static BlLocationSearch Search() + { + var searchQuery = "le-bernardin"; + var locationService = new LocationService(); + + BlLocationSearch results = locationService.Search(searchQuery); + return results; + } + } +} diff --git a/BrightLocal/src/BrightLocal/Examples-version2/Account-Methods/lscuExamples.cs b/BrightLocal/src/BrightLocal/Examples-version2/Account-Methods/lscuExamples.cs new file mode 100644 index 0000000..5754876 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Examples-version2/Account-Methods/lscuExamples.cs @@ -0,0 +1,115 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal.Examples_version2.Account_Methods +{ + public class lscuExamples + { + public static BlSuccess Create() + { + Lscu lscu = new Lscu(); + lscu.reportName = "Sample SEO Chek-Up Report"; + lscu.businessNames = JsonConvert.SerializeObject(new List() {"Le Bernardin", "Le Bernardin Cafe"}); + lscu.websiteAddress = "le-bernardin.com"; + lscu.address1 = "155 Weest 51st Street"; + lscu.address2 = ""; + lscu.city = "New York"; + lscu.stateCode = "NY"; + lscu.postcode = "10019"; + lscu.telephone = "+1 212-554-1515"; + lscu.country = "USA"; + lscu.businessCategory = "Restaurant"; + lscu.primaryBusinessLocation = "NY, New York"; + lscu.searchTerms = JsonConvert.SerializeObject(new List() { "restaurant manhattan", "cafe new york" }); + + + // Example for supplying Local Directory URLs (see local-directory-urls parameter) + lscu.localDirectoryUrls = new LocalDirectoryUrls(); + lscu.localDirectoryUrls.Add( + "citysearch", + new DirectoryUrls + { + url = null, + include = "yes" + }); + lscu.localDirectoryUrls.Add( + "dexknows", + new DirectoryUrls + { + url = null, + include = "yes" + }); + + var lscuService = new LscuService(); + + BlSuccess newLscu = lscuService.Create(lscu); + + return newLscu; + } + + public static BlSuccess Update() + { + UpdateLscu lscu = new UpdateLscu(); + lscu.reportId = 1; + lscu.reportName = "Sample SEO Chek-Up Report"; + lscu.businessNames = JsonConvert.SerializeObject(new List() { "Le Bernardin", "Le Bernardin Cafe" }); + lscu.websiteAddress = "le-bernardin.com"; + lscu.address1 = "155 Weest 51st Street"; + lscu.address2 = ""; + lscu.city = "New York"; + lscu.stateCode = "NY"; + lscu.postcode = "10019"; + lscu.telephone = "+1 212-554-1515"; + lscu.country = "USA"; + lscu.businessCategory = "Restaurant"; + lscu.primaryBusinessLocation = "NY, New York"; + lscu.searchTerms = JsonConvert.SerializeObject(new List() { "restaurant manhattan", "cafe new york" }); + + var lscuService = new LscuService(); + + BlSuccess updateLscu = lscuService.Update(lscu); + + return updateLscu; + } + + public static BlLscuReport Get() + { + var reportId = 1; + var lscuService = new LscuService(); + + BlLscuReport lscuReport = lscuService.Get(reportId); + return lscuReport; + + } + + public static BlSuccess Run() + { + var reportId = 1; + var lscuService = new LscuService(); + + var success = lscuService.Run(reportId); + return success; + } + + public static BlSuccess Delete() + { + var reportId = 1; + var lscuService = new LscuService(); + + var success = lscuService.Delete(reportId); + return success; + } + + public static BlLscuSearch Search() + { + var searchQuery = "Bodega Wine Bar"; + var lscuService = new LscuService(); + + BlLscuSearch lscuSearch = lscuService.Search(searchQuery); + return lscuSearch; + } + } +} diff --git a/BrightLocal/src/BrightLocal/Examples-version2/Account-Methods/lsrcExamples.cs b/BrightLocal/src/BrightLocal/Examples-version2/Account-Methods/lsrcExamples.cs new file mode 100644 index 0000000..e979bc4 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Examples-version2/Account-Methods/lsrcExamples.cs @@ -0,0 +1,97 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal.Examples_version2.Account_Methods +{ + public class lsrcExamples + { + public static BlSuccess Create() + { + var lsrc = new Lsrc(); + lsrc.name = "Le Bernardin"; + lsrc.websiteAddresses = JsonConvert.SerializeObject(new List() {"le-bernardin.com", "www.le-bernadin.com"}); + lsrc.searchTerms = "Restaurant, food+nyc, delivery+midtown+manhattan"; + lsrc.schedule = "Adhoc"; + lsrc.searchEngines = "google, google-mobile, google-local, yahoo, yahoo-local, bing, bing-local"; + + var lsrcService = new LsrcService(); + + BlSuccess newLsrc = lsrcService.Create(lsrc); + return newLsrc; + } + + public static BlSuccess Update() + { + var lsrc = new UpdateLsrc(); + lsrc.campaignId = 1; + lsrc.name = "Le Bernardin"; + lsrc.websiteAddresses = JsonConvert.SerializeObject(new List() { "le-bernardin.com", "www.le-bernadin.com" }); + lsrc.searchTerms = "Restaurant, food+nyc, delivery+midtown+manhattan"; + lsrc.schedule = "Adhoc"; + lsrc.searchEngines = "google, google-mobile, google-local, yahoo, yahoo-local, bing, bing-local"; + + var lsrcService = new LsrcService(); + + BlSuccess updatedLsrc = lsrcService.Update(lsrc); + return updatedLsrc; + } + + public static BlSuccess Delete() + { + var campaignId = 1; + var lsrcService = new LsrcService(); + + BlSuccess deletedLsrc = lsrcService.Delete(campaignId); + return deletedLsrc; + } + + public static BlGetAllResults GetAll() + { + var lsrcService = new LsrcService(); + + BlGetAllResults lsrcList = lsrcService.GetAll(); + return lsrcList; + } + + public static BlLsrcReport GetReport() + { + var campaignId = 1; + var lsrcService = new LsrcService(); + + BlLsrcReport lsrc = lsrcService.Get(campaignId); + return lsrc; + } + + public static BlSuccess Run() + { + var campaignId = 1; + var lsrcService = new LsrcService(); + + BlSuccess lsrc = lsrcService.Run(campaignId); + return lsrc; + } + + public static BlLsrcHistory GetHistory() + { + var campaignId = 1; + var lsrcService = new LsrcService(); + + BlLsrcHistory lsrcHistory = lsrcService.GetHistory(campaignId); + return lsrcHistory; + } + + public static BlLsrcReportResults GetReportResults() + { + var lsrc = new GetResultsLsrc(); + lsrc.campaignId = 1; + + var lsrcService = new LsrcService(); + + var lsrcResults = lsrcService.GetResults(lsrc); + return lsrcResults; + } + } +} diff --git a/BrightLocal/src/BrightLocal/Examples-version2/Account-Methods/rFExamples.cs b/BrightLocal/src/BrightLocal/Examples-version2/Account-Methods/rFExamples.cs new file mode 100644 index 0000000..6266ac8 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Examples-version2/Account-Methods/rFExamples.cs @@ -0,0 +1,169 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal.Examples_version2.Account_Methods +{ + public class rFExamples + { + public static BlSuccess Create() + { + var reviewReport = new ReviewFlow(); + reviewReport.reportName = "Sample Citation Tracker Report"; + reviewReport.businessName = "Le Bernardin"; + reviewReport.contactTelephone = "+1 212-554-1515"; + reviewReport.address1 = "155 Weest 51st Street"; + reviewReport.address2 = ""; + reviewReport.city = "NYC"; + reviewReport.postcode = "10019"; + reviewReport.country = "USA"; + + // Example for supplying Local Directory URLs (see local-directory-urls parameter) + reviewReport.directories.Add( + "citysearch", + new Directories + { + url = "http://www.yelp.co.uk/biz/greens-restaurant-san-francisco-3", + include = true + }); + reviewReport.directories.Add( + "dexknows", + new Directories + { + url = "", + include = true + }); + + var rfService = new ReviewFlowService(); + + BlSuccess newReviewReport = rfService.Create(reviewReport); + return newReviewReport; + } + + public static BlSuccess Update() + { + var reviewReport = new UpdateReviewFlow(); + reviewReport.reportId = 1; + reviewReport.reportName = "Sample Citation Tracker Report"; + reviewReport.businessName = "Le Bernardin"; + reviewReport.contactTelephone = "+1 212-554-1515"; + reviewReport.address1 = "155 Weest 51st Street"; + reviewReport.address2 = ""; + reviewReport.city = "NYC"; + reviewReport.postcode = "10019"; + reviewReport.country = "USA"; + + // Example for supplying Local Directory URLs (see local-directory-urls parameter) + reviewReport.directories.Add( + "citysearch", + new Directories + { + url = "http://www.yelp.co.uk/biz/greens-restaurant-san-francisco-3", + include = true + }); + reviewReport.directories.Add( + "dexknows", + new Directories + { + url = "", + include = true + }); + + var rfService = new ReviewFlowService(); + + BlSuccess updateReviewReport = rfService.Update(reviewReport); + return updateReviewReport; + } + + public static BlRfReport GetReport() + { + int reportId = 1; + var rfService = new ReviewFlowService(); + + BlRfReport reviewReport = rfService.Get(reportId); + return reviewReport; + } + + public static BlSuccess DeleteReport() + { + int reportId = 1; + var rfService = new ReviewFlowService(); + + BlSuccess deleteReport = rfService.Delete(reportId); + return deleteReport; + } + + public static BlRfGetAll GetAllReports() + { + var rfService = new ReviewFlowService(); + + BlRfGetAll results = rfService.GetAll(); + return results; + } + + public static BlRfGetAll SearchReport() + { + string query = "New York"; + var rfService = new ReviewFlowService(); + + BlRfGetAll results = rfService.Search(query); + return results; + } + + public static BlRfReviews GetReviews() + { + var reviewReport = new RfGetReviews(); + reviewReport.reportId = 1; + var rfService = new ReviewFlowService(); + + BlRfReviews reviews = rfService.GetReviews(reviewReport); + return reviews; + } + + public static BlSuccess GetReviewCount() + { + int reportId = 1; + var rfService = new ReviewFlowService(); + + BlSuccess reviewCount = rfService.GetReviewCount(reportId); + return reviewCount; + } + + public static BlSuccess GetGrowth() + { + int reportId = 1; + var rfService = new ReviewFlowService(); + + BlSuccess reviewGrowth = rfService.GetGrowth(reportId); + return reviewGrowth; + } + + public static BlRfDirectories GetDirectories() + { + int reportId = 1; + var rfService = new ReviewFlowService(); + + BlRfDirectories reviewDirectories = rfService.GetDirectories(reportId); + return reviewDirectories; + } + + public static BrightLocalRfDirectoryStats GetDirectoryStats() + { + int reportId = 1; + var rfService = new ReviewFlowService(); + + BrightLocalRfDirectoryStats reviewDirectoryStats = rfService.GetDirectoryStats(reportId); + return reviewDirectoryStats; + } + + public static BrightLocalRfStarCounts GetStarCount() + { + int reportId = 1; + var rfService = new ReviewFlowService(); + + BrightLocalRfStarCounts reviewStarCount = rfService.GetStarCount(reportId); + return reviewStarCount; + } + } +} diff --git a/BrightLocal/src/BrightLocal/Examples-version2/Batch-Methods/rankingsExamples.cs b/BrightLocal/src/BrightLocal/Examples-version2/Batch-Methods/rankingsExamples.cs new file mode 100644 index 0000000..38e1157 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Examples-version2/Batch-Methods/rankingsExamples.cs @@ -0,0 +1,59 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace BrightLocal.Examples_version2.Batch_Methods +{ + public class rankingsExamples + { + public static BlSuccess Create() + { + RankingsSearchOptions search = new RankingsSearchOptions(); + search.searches.Add(new SearchOptions() + { + searchEngine = "google", + country = "USA", + googleLocation = "New York, NY", + searchTerm = "restaurant new york", + urls = JsonConvert.SerializeObject(new List() { "le-bernardin.com" }), + businessNames = JsonConvert.SerializeObject(new List { "Le Bernardin" }) + }); + search.searches.Add(new SearchOptions() + { + searchEngine = "yahoo", + country = "USA", + googleLocation = "New York, NY", + searchTerm = "restaurant new york", + urls = JsonConvert.SerializeObject(new List() { "le-bernardin.com" }), + businessNames = JsonConvert.SerializeObject(new List { "Le Bernardin" }) + }); + + var batchRankingService = new BatchRankingsService(); + BlBatchSuccess newBatchRankings = batchRankingService.Search(search); + + var rankingsResults = batchRankingService.GetSearchResults(newBatchRankings.batchId); + + //if (rankingsResults.success) + //{ + // while (rankingResults.status != "Stopped" || rankingResults.status != "Finished") + // { + // Thread.Sleep(10000); + + // rankingsResults = batchRankingService.GetSearchResults(newBatchRankings.batchId); + // } + // return rankingsResults; + //} + //else + //{ + // const string message = "Error Retrieving batch results "; + // var batchException = new ApplicationException(message + rankingResults.errors, results.ErrorException); + // throw batchException; + //} + + return rankingsResults; + } + } +} diff --git a/BrightLocal/src/BrightLocal/Infrastructure/BlBatchRequestor.cs b/BrightLocal/src/BrightLocal/Infrastructure/BlBatchRequestor.cs new file mode 100644 index 0000000..11ee820 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Infrastructure/BlBatchRequestor.cs @@ -0,0 +1,115 @@ +using Newtonsoft.Json; +using RestSharp; +using System; +using System.Collections.Generic; +using System.Dynamic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal +{ + public class BlBatchRequestor + { + private static readonly System.Uri baseUrl = new System.Uri(Urls.BaseUrl); + private static readonly string url = "/v4/batch"; + // create an instance of restsharp client + RestClient client = new RestClient(); + + public int Create(string apiKey) + { + Method method = Method.POST; + var parameters = new Parameters.requestParameters(); + var response = this.Call(method, apiKey, parameters); + dynamic obj = JsonConvert.DeserializeObject(response.Content); + if (obj.success != "true") + { + const string message = "Error creating Batch "; + var batchException = new ApplicationException(message + obj.errors, obj.ErrorException); + throw batchException; + } + return obj["batch-id"]; + } + + public IRestResponse Commit(int batchId, string apiKey) + { + Method method = Method.PUT; + var parameters = new Parameters.requestParameters(); + parameters.Add("batch-id", batchId); + var request = this.Call(method, apiKey, parameters); + + return request; + } + + public IRestResponse GetResults(int batchId, string apiKey) + { + Method method = Method.GET; + var parameters = new Parameters.requestParameters(); + parameters.Add("batch-id", batchId); + var results = this.Call(method, apiKey, parameters); + + return results; + } + + public IRestResponse Call(Method method, string apiKey, Parameters.requestParameters apiParameters) + { + apiKey = apiKey ?? BlConfiguration.GetApiKey(); + + // create sxpires variable + + // set base url + client.BaseUrl = baseUrl; + // Generate encoded signature + + // Generate the request + var request = GetApiRequest(method, apiKey, apiParameters); + // execure the request + var response = client.Execute(request); + // check for a succesful response from server + if (response.ResponseStatus == ResponseStatus.Completed) + { + dynamic result = JsonConvert.DeserializeObject(response.Content); + if (result.success == "false") + { + string message = "Error: "; + var batchException = new ApplicationException(message + result.errors, result.ErrorException); + throw batchException; + } + return response; + } + else + { + throw new ApplicationException(response.ErrorMessage); + } + + } + + private static RestRequest GetApiRequest(Method method, string api_key, Parameters.requestParameters apiParameters) + { + // Create a new restsharp request + RestRequest request = new RestRequest(url, method); + // Add appropriate headers to request + request.AddHeader("Content-Type", "application/json"); + request.AddHeader("Accept", "application/json"); + + // Add key, sig and expires to request + request.AddParameter("api-key", api_key); + // Loop through the parameters passed in as a dictionary and add each one to a dynamic object + var eo = new ExpandoObject(); + var eoColl = (ICollection>)eo; + foreach (var kvp in apiParameters) + { + eoColl.Add(kvp); + } + dynamic eoDynamic = eo; + + // Add each parameter to restsharp request + foreach (var prop in eoDynamic) + { + request.AddParameter(prop.Key, prop.Value); + } + + return request; + + } + } +} diff --git a/BrightLocal/src/BrightLocal/Infrastructure/BlConfiguration.cs b/BrightLocal/src/BrightLocal/Infrastructure/BlConfiguration.cs new file mode 100644 index 0000000..676bbdc --- /dev/null +++ b/BrightLocal/src/BrightLocal/Infrastructure/BlConfiguration.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Configuration; + +namespace BrightLocal +{ + public static class BlConfiguration + { + // Decalre Variables + private static string api_key; + private static string api_secret; + + internal static string GetApiKey() + { + if (string.IsNullOrEmpty(api_key)) + { + api_key = ConfigurationManager.AppSettings["BrightLocalApiKey"]; + } + return api_key; + } + + internal static string GetApiSecret() + { + if (string.IsNullOrEmpty(api_secret)) + { + api_secret = ConfigurationManager.AppSettings["BrightLocalApiSecret"]; + } + return api_secret; + } + + public static void SetApiCredentials(string newApiKey, string newApiSecret) + { + api_key = newApiKey; + api_secret = newApiSecret; + } + } +} diff --git a/BrightLocal/src/BrightLocal/Infrastructure/BlRequestor.cs b/BrightLocal/src/BrightLocal/Infrastructure/BlRequestor.cs new file mode 100644 index 0000000..55679ed --- /dev/null +++ b/BrightLocal/src/BrightLocal/Infrastructure/BlRequestor.cs @@ -0,0 +1,139 @@ +using Newtonsoft.Json; +using RestSharp; +using RestSharp.Extensions.MonoHttp; +using System; +using System.Collections.Generic; +using System.Dynamic; +using System.Linq; +using System.Security.Cryptography; +using System.Threading.Tasks; + +namespace BrightLocal +{ + public class BlRequestor + { + private static readonly System.Uri baseUrl = new System.Uri(Urls.BaseUrl); + + // create an instance of restsharp client + RestClient client = new RestClient(); + + + // Create base 64 sha1 encrypted signature + private static string CreateSig(string apiKey, string secretKey, double expires) + { + var encoding = new System.Text.ASCIIEncoding(); + byte[] keyByte = encoding.GetBytes(secretKey); + byte[] messageBytes = encoding.GetBytes(apiKey + expires); + using (var hmacsha1 = new HMACSHA1(keyByte)) + { + byte[] hashmessage = hmacsha1.ComputeHash(messageBytes); + var signature = Convert.ToBase64String(hashmessage); + var sig = HttpUtility.UrlEncode(signature); + return signature; + } + + } + + // Create expires paramater for signature and api requests + private static double CreateExpiresParameter() + { + DateTime date = DateTime.Now; + DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); // The seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) + TimeSpan diff = date.ToUniversalTime() - origin; // Subtract the seconds since the Unix Epoch from today's date. + return Math.Floor(diff.TotalSeconds + 1800); // Not more than 1800 seconds + } + + + // Function that creates and sends the actual request. + public IRestResponse Call(Method method, string endPoint, Dictionary apiParameters, string apiKey, string apiSecret) + { + apiKey = apiKey ?? BlConfiguration.GetApiKey(); + apiSecret = apiSecret ?? BlConfiguration.GetApiSecret(); + // create sxpires variable + var expires = CreateExpiresParameter(); + // set base url + client.BaseUrl = baseUrl; + // Generate encoded signature + var sig = CreateSig(apiKey, apiSecret, expires); + // Generate the request + var request = GetApiRequest(method, endPoint, apiKey, sig, expires, apiParameters); + // execure the request + var response = client.Execute(request); + // check for a succesful response from server + if (response.ResponseStatus == ResponseStatus.Completed) + { + dynamic result = JsonConvert.DeserializeObject(response.Content); + if (result.success == "false") + { + string message = "Error: "; + var batchException = new ApplicationException(message + result.errors, result.ErrorException); + throw batchException; + } + return response; + } + else + { + throw new ApplicationException(response.ErrorMessage); + } + + } + + // Methods for post, put, get, delete + public IRestResponse Post(string endPoint, Dictionary apiParameters, string apiKey, string apiSecret) + { + Method method = Method.POST; + return Call(method, endPoint, apiParameters, apiKey, apiSecret); + } + + public IRestResponse Put(string endPoint, Dictionary apiParameters, string apiKey, string apiSecret) + { + Method method = Method.PUT; + return Call(method, endPoint, apiParameters, apiKey, apiSecret); + } + + public IRestResponse Get(string endPoint, Dictionary apiParameters, string apiKey, string apiSecret) + { + Method method = Method.GET; + return Call(method, endPoint, apiParameters, apiKey, apiSecret); + } + + public IRestResponse Delete(string endPoint, Dictionary apiParameters, string apiKey, string apiSecret) + { + Method method = Method.DELETE; + return Call(method, endPoint, apiParameters, apiKey, apiSecret); + } + + private static RestRequest GetApiRequest(Method method, string url, string api_key, string sig, double expires, Dictionary apiParameters) + { + // Create a new restsharp request + RestRequest request = new RestRequest(url, method); + // Add appropriate headers to request + request.AddHeader("Content-Type", "application/json"); + request.AddHeader("Accept", "application/json"); + + // Add key, sig and expires to request + request.AddParameter("api-key", api_key); + request.AddParameter("sig", sig); + request.AddParameter("expires", expires); + + // Loop through the parameters passed in as a dictionary and add each one to a dynamic object + var eo = new ExpandoObject(); + var eoColl = (ICollection>)eo; + foreach (var kvp in apiParameters) + { + eoColl.Add(kvp); + } + dynamic eoDynamic = eo; + + // Add each parameter to restsharp request + foreach (var prop in eoDynamic) + { + request.AddParameter(prop.Key, prop.Value); + } + + return request; + + } + + } +} diff --git a/BrightLocal/src/BrightLocal/Infrastructure/ObjectToDictionaryHelper.cs b/BrightLocal/src/BrightLocal/Infrastructure/ObjectToDictionaryHelper.cs new file mode 100644 index 0000000..7b30426 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Infrastructure/ObjectToDictionaryHelper.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal +{ + public static class ObjectToDictionaryHelper + { + public static Dictionary ToDictionary(this object source) + { + return source.ToDictionary(); + } + + public static Dictionary ToDictionary(this object source) + { + if (source == null) + ThrowExceptionWhenSourceArgumentIsNull(); + + var dictionary = new Dictionary(); + foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(source)) + AddPropertyToDictionary(property, source, dictionary); + return dictionary; + } + + private static void AddPropertyToDictionary(PropertyDescriptor property, object source, Dictionary dictionary) + { + object value = property.GetValue(source); + if (IsOfType(value)) + dictionary.Add(property.Name, (T)value); + } + + private static bool IsOfType(object value) + { + return value is T; + } + + private static void ThrowExceptionWhenSourceArgumentIsNull() + { + throw new ArgumentNullException("source", "Unable to convert object to a dictionary. The source object is null."); + } + } +} diff --git a/BrightLocal/src/BrightLocal/Infrastructure/Urls.cs b/BrightLocal/src/BrightLocal/Infrastructure/Urls.cs new file mode 100644 index 0000000..0851559 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Infrastructure/Urls.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal +{ + internal static class Urls + { + internal static string BaseUrl => "https://tools.brightlocal.com/seo-tools/api"; + internal static string Clients => "/v1/clients-and-locations/clients/"; + internal static string Locations => "/v1/clients-and-locations/locations/"; + internal static string Lsrc => "/v2/lsrc/"; + internal static string Lscu => "/v4/lscu/"; + internal static string CitationTracker => "/v2/ct/"; + internal static string CitationBurst => "/v2/cb/"; + internal static string ReviewFlow => "/v4/rf/"; + internal static string Gpw => "/v4/gpw/"; + + internal static string Rankings => "/v4/rankings/"; + } +} diff --git a/BrightLocal/src/BrightLocal/Services/BatchRankings/BatchRankingsService.cs b/BrightLocal/src/BrightLocal/Services/BatchRankings/BatchRankingsService.cs new file mode 100644 index 0000000..f7bffe7 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/BatchRankings/BatchRankingsService.cs @@ -0,0 +1,50 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal +{ + public class BatchRankingsService : BlService + { + public BatchRankingsService(string apiKey = null, string apiSecret = null) : base(apiKey, apiSecret) { } + + BlBatchRequestor batchRequest = new BlBatchRequestor(); + + BlRequestor request = new BlRequestor(); + public virtual BlBatchSuccess Search(RankingsSearchOptions searchOptions) + { + BlBatchSuccess ids = new BlBatchSuccess(); + var batchId = batchRequest.Create(this.api_key); + var url = string.Format(Urls.Rankings + "{0}", "search"); + foreach(var search in searchOptions.searches) + { + var parameters = Parameters.convertListToParameters(search); + parameters.Add("batch-id", batchId); + var success = request.Post(url, parameters, this.api_key, this.api_secret); + dynamic job = JsonConvert.DeserializeObject(success.Content); + ids.jobids.Add("Job-Id", job["job-id"]); + } + + var commit = batchRequest.Commit(batchId, this.api_key); + dynamic obj = JsonConvert.DeserializeObject(commit.Content); + if(obj.success == true) + { + ids.jobids.Add("success", true); + ids.batchId = batchId; + } + else + { + throw new ApplicationException(obj); + } + return ids; + } + + public virtual BlSuccess GetSearchResults(int batchId) + { + var results = batchRequest.GetResults(batchId, this.api_key); + return JsonConvert.DeserializeObject(results.Content); + } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/BatchRankings/RankingsSearchOptions.cs b/BrightLocal/src/BrightLocal/Services/BatchRankings/RankingsSearchOptions.cs new file mode 100644 index 0000000..bca16c6 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/BatchRankings/RankingsSearchOptions.cs @@ -0,0 +1,46 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal +{ + public class RankingsSearchOptions + { + public RankingsSearchOptions() + { + searches = new List(); + } + + public List searches { get; set; } + } + public class SearchOptions + { + + [JsonProperty("search-engine")] + public string searchEngine {get;set;} + [JsonProperty("country")] + public string country { get; set; } + [JsonProperty("google-location")] + public string googleLocation { get; set; } + [JsonProperty("bing-location")] + public string bingLocation { get; set; } + [JsonProperty("search-term")] + public string searchTerm { get; set; } + public string urls { get; set; } + [JsonProperty("business-names")] + public string businessNames { get; set; } + [JsonProperty("postcode")] + public string postcode { get; set; } + [JsonProperty("telephone")] + public string telephone { get; set; } + [JsonProperty("include-secondary-matches")] + public string includeSecondaryMatches { get; set; } + [JsonProperty("listings")] + public string listings { get; set; } + [JsonProperty("screenshots")] + public string screenshots { get; set; } + + } +} diff --git a/BrightLocal/src/BrightLocal/Services/CitationBurst/BrightLocalCbPayOptions.cs b/BrightLocal/src/BrightLocal/Services/CitationBurst/BrightLocalCbPayOptions.cs new file mode 100644 index 0000000..0f34a01 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/CitationBurst/BrightLocalCbPayOptions.cs @@ -0,0 +1,18 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace BrightLocal +{ + public class BrightLocalCbPay + { + public int campaign_id { get; set; } + public string package_id { get; set; } + public string aurtoselect { get; set; } + public List citations { get; set; } + [JsonProperty("remove-duplicates")] + public string removeDuplicates { get; set; } + public List aggregators { get; set; } + public string notes { get; set; } + + } +} diff --git a/BrightLocal/src/BrightLocal/Services/CitationBurst/CbUploadImage.cs b/BrightLocal/src/BrightLocal/Services/CitationBurst/CbUploadImage.cs new file mode 100644 index 0000000..da30740 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/CitationBurst/CbUploadImage.cs @@ -0,0 +1,9 @@ +namespace BrightLocal +{ + public class CbUploadImage + { + public int campaignId { get; set; } + public string file { get; set; } + public string imageType { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/CitationBurst/CitationBurst.cs b/BrightLocal/src/BrightLocal/Services/CitationBurst/CitationBurst.cs new file mode 100644 index 0000000..638955e --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/CitationBurst/CitationBurst.cs @@ -0,0 +1,112 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal +{ + public class CitationBurst + { + [JsonProperty("location_id")] + public int locationId { get; set; } + [JsonProperty("business_name")] + public string businessName { get; set; } + [JsonProperty("campaign_name")] + public string campaignName { get; set; } + [JsonProperty("website_address")] + public string websiteAddress { get; set; } + [JsonProperty("campaign_country")] + public string campaignCountry { get; set; } + [JsonProperty("campaign_state")] + public string campaignState { get; set; } + [JsonProperty("campaign_city")] + public string campaignCity { get; set; } + [JsonProperty("business_category_id")] + public int businessCategoryId { get; set; } + [JsonProperty("business_categories")] + public List businessCategories { get; set; } + [JsonProperty("address1")] + public string address1 { get; set; } + [JsonProperty("address2")] + public string address2 { get; set; } + [JsonProperty("postcode")] + public string postcode { get; set; } + [JsonProperty("contact_name")] + public string contactName { get; set; } + [JsonProperty("contact_firstname")] + public string contactFirstName { get; set; } + [JsonProperty("contact_telephone")] + public string contactTelephone { get; set; } + [JsonProperty("mobile_number")] + public string mobileNumber { get; set; } + [JsonProperty("fax_number")] + public string faxNumber { get; set; } + [JsonProperty("brief_description")] + public string briefDescription { get; set; } + [JsonProperty("full_description")] + public string fullDescription { get; set; } + [JsonProperty("employees_number")] + public int employeesNumber { get; set; } + [JsonProperty("start_year")] + public int startYear { get; set; } + [JsonProperty("service_name_1")] + public string serviceName1 { get; set; } + [JsonProperty("service_name_2")] + public string serviceName2 { get; set; } + [JsonProperty("service_name_3")] + public string serviceName3 { get; set; } + [JsonProperty("service_name_4")] + public string serviceName4 { get; set; } + [JsonProperty("service_name_5")] + public string serviceName5 { get; set; } + [JsonProperty("working_hours_apply_to_all")] + public int workingHoursApplyToAll { get; set; } + [JsonProperty("working_hours_mon_start")] + public int workingHoursMonStart { get; set; } + [JsonProperty("working_hours_mon_end")] + public int workingHoursMonEnd { get; set; } + [JsonProperty("working_hours_tue_start")] + public int workingHoursTueStart { get; set; } + [JsonProperty("working_hours_tue_end")] + public int workingHoursTueEnd { get; set; } + [JsonProperty("working_hours_wed_start")] + public int workingHoursWedStart { get; set; } + [JsonProperty("working_hours_Wed_end")] + public int workingHoursWedEnd { get; set; } + [JsonProperty("working_hours_thu_start")] + public int workingHoursThuStart { get; set; } + [JsonProperty("working_hours_thu_end")] + public int workingHoursThuEnd { get; set; } + [JsonProperty("working_hours_fri_start")] + public int workingHoursFriStart { get; set; } + [JsonProperty("working_hours_fri_end")] + public int workingHoursFriEnd { get; set; } + [JsonProperty("working_hours_sat_start")] + public int workingHoursSatStart { get; set; } + [JsonProperty("working_hours_sat_end")] + public int workingHoursSatEnd { get; set; } + [JsonProperty("working_hours_mon_start")] + public int workingHoursSunStart { get; set; } + [JsonProperty("working_hours_mon_end")] + public int workingHoursSunEnd { get; set; } + [JsonProperty("special_offer")] + public string specialOffer { get; set; } + [JsonProperty("special_offer_description")] + public string specialOfferDescription { get; set; } + [JsonProperty("special_offer_expiration_date")] + public string specialOfferExpirationDate { get; set; } + [JsonProperty("payment_methods")] + public string paymentMethods { get; set; } + [JsonProperty("receive-email-alerts")] + public string receiveEmailAlerts { get; set; } + [JsonProperty("alert-email-addresses")] + public string alertEmailAddresses { get; set; } + [JsonProperty("old_business_name")] + public string oldBusinessName { get; set; } + [JsonProperty("old_lookup_data")] + public string oldLookUpData { get; set; } + [JsonProperty("is_public")] + public string isPublic { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/CitationBurst/CitationBurstService.cs b/BrightLocal/src/BrightLocal/Services/CitationBurst/CitationBurstService.cs new file mode 100644 index 0000000..dd1eeb6 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/CitationBurst/CitationBurstService.cs @@ -0,0 +1,87 @@ +using Newtonsoft.Json; + +namespace BrightLocal +{ + public class CitationBurstService : BlService + { + public CitationBurstService(string apiKey = null, string apiSecret = null) : base(apiKey, apiSecret) { } + + BlRequestor request = new BlRequestor(); + + public virtual BlSuccess Create(CitationBurst create) + { + var url = string.Format(Urls.CitationBurst + "{0}", "create"); + var parameters = Parameters.convertListToParameters(create); + var success = request.Post(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlSuccess Update(UpdateCitationBurst update) + { + var url = string.Format(Urls.CitationBurst + "{0}", update.campaignId); + var parameters = Parameters.convertListToParameters(update); + var success = request.Put(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlSuccess UploadImage(CbUploadImage image) + { + var url = string.Format(Urls.CitationBurst + "{0}" + "/{1}", image.campaignId, image.imageType); + var parameters = Parameters.convertListToParameters(image.file); + var success = request.Post(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlCitations GetCitations(int campaignId) + { + var url = string.Format(Urls.CitationBurst + "{0}", "citations"); + var parameters = new Parameters.requestParameters(); + parameters.Add("campaign-id", campaignId); + var success = request.Get(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlSuccess ConfirmAndPay(BrightLocalCbPay pay) + { + var url = string.Format(Urls.CitationBurst + "{0}", "confirm-and-pay"); + var parameters = Parameters.convertListToParameters(pay); + var success = request.Post(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlCbAllCampaigns GetCampaigns() + { + var url = string.Format(Urls.CitationBurst + "{0}", "get-all"); + var parameters = new Parameters.requestParameters(); + var success = request.Get(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlCbAllCampaigns GetCampaigns(int locationId) + { + var url = string.Format(Urls.CitationBurst + "{0}", "get-all"); + var parameters = new Parameters.requestParameters(); + parameters.Add("location-id", locationId); + var success = request.Get(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlCbCampaign GetCampaign(int campaignId) + { + var url = string.Format(Urls.CitationBurst + "{0}", "get"); + var parameters = new Parameters.requestParameters(); + parameters.Add("campaign-id", campaignId); + var success = request.Get(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlSuccess GetCredits() + { + var url = string.Format(Urls.CitationBurst + "{0}", "credits"); + var parameters = new Parameters.requestParameters(); + + var credits = request.Get(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(credits.Content); + } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/CitationBurst/UpdateCitationBurst.cs b/BrightLocal/src/BrightLocal/Services/CitationBurst/UpdateCitationBurst.cs new file mode 100644 index 0000000..42e4159 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/CitationBurst/UpdateCitationBurst.cs @@ -0,0 +1,111 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace BrightLocal +{ + public class UpdateCitationBurst + { + + public int campaignId { get; set; } + [JsonProperty("location_id")] + public int locationId { get; set; } + [JsonProperty("business_name")] + public string businessName { get; set; } + [JsonProperty("campaign_name")] + public string campaignName { get; set; } + [JsonProperty("website_address")] + public string websiteAddress { get; set; } + [JsonProperty("campaign_country")] + public string campaignCountry { get; set; } + [JsonProperty("campaign_state")] + public string campaignState { get; set; } + [JsonProperty("campaign_city")] + public string campaignCity { get; set; } + [JsonProperty("business_category_id")] + public int businessCategoryId { get; set; } + [JsonProperty("business_categories")] + public List businessCategories { get; set; } + [JsonProperty("address1")] + public string address1 { get; set; } + [JsonProperty("address2")] + public string address2 { get; set; } + [JsonProperty("postcode")] + public string postcode { get; set; } + [JsonProperty("contact_name")] + public string contactName { get; set; } + [JsonProperty("contact_firstname")] + public string contactFirstName { get; set; } + [JsonProperty("contact_telephone")] + public string contactTelephone { get; set; } + [JsonProperty("mobile_number")] + public string mobileNumber { get; set; } + [JsonProperty("fax_number")] + public string faxNumber { get; set; } + [JsonProperty("brief_description")] + public string briefDescription { get; set; } + [JsonProperty("full_description")] + public string fullDescription { get; set; } + [JsonProperty("employees_number")] + public int employeesNumber { get; set; } + [JsonProperty("start_year")] + public int startYear { get; set; } + [JsonProperty("service_name_1")] + public string serviceName1 { get; set; } + [JsonProperty("service_name_2")] + public string serviceName2 { get; set; } + [JsonProperty("service_name_3")] + public string serviceName3 { get; set; } + [JsonProperty("service_name_4")] + public string serviceName4 { get; set; } + [JsonProperty("service_name_5")] + public string serviceName5 { get; set; } + [JsonProperty("working_hours_apply_to_all")] + public int workingHoursApplyToAll { get; set; } + [JsonProperty("working_hours_mon_start")] + public int workingHoursMonStart { get; set; } + [JsonProperty("working_hours_mon_end")] + public int workingHoursMonEnd { get; set; } + [JsonProperty("working_hours_tue_start")] + public int workingHoursTueStart { get; set; } + [JsonProperty("working_hours_tue_end")] + public int workingHoursTueEnd { get; set; } + [JsonProperty("working_hours_wed_start")] + public int workingHoursWedStart { get; set; } + [JsonProperty("working_hours_Wed_end")] + public int workingHoursWedEnd { get; set; } + [JsonProperty("working_hours_thu_start")] + public int workingHoursThuStart { get; set; } + [JsonProperty("working_hours_thu_end")] + public int workingHoursThuEnd { get; set; } + [JsonProperty("working_hours_fri_start")] + public int workingHoursFriStart { get; set; } + [JsonProperty("working_hours_fri_end")] + public int workingHoursFriEnd { get; set; } + [JsonProperty("working_hours_sat_start")] + public int workingHoursSatStart { get; set; } + [JsonProperty("working_hours_sat_end")] + public int workingHoursSatEnd { get; set; } + [JsonProperty("working_hours_mon_start")] + public int workingHoursSunStart { get; set; } + [JsonProperty("working_hours_mon_end")] + public int workingHoursSunEnd { get; set; } + [JsonProperty("special_offer")] + public string specialOffer { get; set; } + [JsonProperty("special_offer_description")] + public string specialOfferDescription { get; set; } + [JsonProperty("special_offer_expiration_date")] + public string specialOfferExpirationDate { get; set; } + [JsonProperty("payment_methods")] + public string paymentMethods { get; set; } + [JsonProperty("receive-email-alerts")] + public string receiveEmailAlerts { get; set; } + [JsonProperty("alert-email-addresses")] + public string alertEmailAddresses { get; set; } + [JsonProperty("old_business_name")] + public string oldBusinessName { get; set; } + [JsonProperty("old_lookup_data")] + public string oldLookUpData { get; set; } + [JsonProperty("is_public")] + public string isPublic { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/CitationTracker/CitationTracker.cs b/BrightLocal/src/BrightLocal/Services/CitationTracker/CitationTracker.cs new file mode 100644 index 0000000..60c7100 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/CitationTracker/CitationTracker.cs @@ -0,0 +1,53 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal +{ + public class CitationTracker + { + [JsonProperty("location-id")] + public int locationId { get; set; } + [JsonProperty("report-name")] + public string reportName { get; set; } + [JsonProperty("business-name")] + public string businessName { get; set; } + [JsonProperty("business-location")] + public string businessLocation { get; set; } + [JsonProperty("old-business-name-1")] + public string oldBusinessName1 { get; set; } + [JsonProperty("old-business-name-2")] + public string oldBusinessName2 { get; set; } + [JsonProperty("postcode")] + public string postcode { get; set; } + [JsonProperty("old-postcode-1")] + public string oldPostcode1 { get; set; } + [JsonProperty("old-postcode-2")] + public string oldPostcode2 { get; set; } + [JsonProperty("country")] + public string country { get; set; } + [JsonProperty("phone")] + public string phone { get; set; } + [JsonProperty("website")] + public string website { get; set; } + [JsonProperty("business-type")] + public string businessType { get; set; } + [JsonProperty("state-code")] + public string stateCode { get; set; } + [JsonProperty("monthly-run")] + public int monthlyRun { get; set; } + [JsonProperty("weekly-run")] + public int weeklyRun { get; set; } + [JsonProperty("white-label-profile-id")] + public int whiteLabelProfileId { get; set; } + [JsonProperty("active-only")] + public string activeOnly {get;set;} + public string notify { get; set; } + [JsonProperty("email-addresses")] + public string emailAddresses { get; set; } + [JsonProperty("is-public")] + public string isPublic { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/CitationTracker/CitationTrackerService.cs b/BrightLocal/src/BrightLocal/Services/CitationTracker/CitationTrackerService.cs new file mode 100644 index 0000000..a0a1973 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/CitationTracker/CitationTrackerService.cs @@ -0,0 +1,80 @@ +using Newtonsoft.Json; + +namespace BrightLocal +{ + public class CitationTrackerService: BlService + { + public CitationTrackerService(string apiKey = null, string apiSecret = null) : base(apiKey, apiSecret) { } + + BlRequestor request = new BlRequestor(); + + public virtual BlSuccess Create(CitationTracker create) + { + var url = string.Format(Urls.CitationTracker + "{0}", "add"); + var parameters = Parameters.convertListToParameters(create); + var success = request.Post(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlSuccess Update(UpdateCitationTracker update) + { + var url = string.Format(Urls.CitationTracker + "{0}", "update"); + var parameters = Parameters.convertListToParameters(update); + var success = request.Post(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlCitationTrackerReport Get(int reportId) + { + var url = string.Format(Urls.CitationTracker + "{0}", "get"); + var parameters = new Parameters.requestParameters(); + parameters.Add("report-id", reportId); + var success = request.Post(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlSuccess Run(int reportId) + { + var url = string.Format(Urls.CitationTracker + "{0}", "run"); + var parameters = new Parameters.requestParameters(); + parameters.Add("report-id", reportId); + var success = request.Post(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlSuccess Delete(int reportId) + { + var url = string.Format(Urls.CitationTracker + "{0}", "delete"); + var parameters = new Parameters.requestParameters(); + parameters.Add("report-id", reportId); + var success = request.Post(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + //method overlaod for supplying the location-id parameter + public virtual BlCtGetAllResults GetAll(int locationId) + { + var url = string.Format(Urls.CitationTracker + "{0}", "get-all"); + var parameters = new Parameters.requestParameters(); + parameters.Add("location-id", locationId); + var success = request.Post(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlCtGetAllResults GetAll() + { + var url = string.Format(Urls.CitationTracker + "{0}", "get-all"); + var parameters = new Parameters.requestParameters(); + var success = request.Post(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + public virtual BlCitationTrackerResults GetReportResults(int reportId) + { + var url = string.Format(Urls.CitationTracker + "{0}", "get-results"); + var parameters = new Parameters.requestParameters(); + parameters.Add("report-id", reportId); + var success = request.Post(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/CitationTracker/UpdateCitationTracker.cs b/BrightLocal/src/BrightLocal/Services/CitationTracker/UpdateCitationTracker.cs new file mode 100644 index 0000000..aff9c84 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/CitationTracker/UpdateCitationTracker.cs @@ -0,0 +1,55 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal +{ + public class UpdateCitationTracker + { + [JsonProperty("report-id")] + public int reportId { get; set; } + [JsonProperty("location-id")] + public int locationId { get; set; } + [JsonProperty("report-name")] + public string reportName { get; set; } + [JsonProperty("business-name")] + public string businessName { get; set; } + [JsonProperty("business-location")] + public string businessLocation { get; set; } + [JsonProperty("old-business-name-1")] + public string oldBusinessName1 { get; set; } + [JsonProperty("old-business-name-2")] + public string oldBusinessName2 { get; set; } + [JsonProperty("postcode")] + public string postcode { get; set; } + [JsonProperty("old-postcode-1")] + public string oldPostcode1 { get; set; } + [JsonProperty("old-postcode-2")] + public string oldPostcode2 { get; set; } + [JsonProperty("country")] + public string country { get; set; } + [JsonProperty("phone")] + public string phone { get; set; } + [JsonProperty("website")] + public string website { get; set; } + [JsonProperty("business-type")] + public string businessType { get; set; } + [JsonProperty("state-code")] + public string stateCode { get; set; } + [JsonProperty("monthly-run")] + public int monthlyRun { get; set; } + [JsonProperty("weekly-run")] + public int weeklyRun { get; set; } + [JsonProperty("white-label-profile-id")] + public int whiteLabelProfileId { get; set; } + [JsonProperty("active-only")] + public string activeOnly { get; set; } + public string notify { get; set; } + [JsonProperty("email-addresses")] + public string emailAddresses { get; set; } + [JsonProperty("is-public")] + public string isPublic { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/Clients/Client.cs b/BrightLocal/src/BrightLocal/Services/Clients/Client.cs new file mode 100644 index 0000000..03070c9 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/Clients/Client.cs @@ -0,0 +1,16 @@ +using Newtonsoft.Json; + +namespace BrightLocal +{ + public class Client + { + [JsonProperty("name")] + public string name { get; set; } + [JsonProperty("company-url")] + public string companyUrl { get; set; } + [JsonProperty("business-category-id")] + public int businessCategoryId { get; set; } + [JsonProperty("reference-number")] + public string referenceNumber { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/Clients/ClientService.cs b/BrightLocal/src/BrightLocal/Services/Clients/ClientService.cs new file mode 100644 index 0000000..2f99dde --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/Clients/ClientService.cs @@ -0,0 +1,56 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; + +namespace BrightLocal +{ + public class ClientService : BlService + { + public ClientService(string apiKey = null, string apiSecret = null) : base(apiKey, apiSecret) { } + + + BlRequestor request = new BlRequestor(); + + public virtual BlSuccess Create(Client create) + { + var parameters = Parameters.convertListToParameters(create); + var success = request.Post(Urls.Clients, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlSuccess Update(UpdateClient update) + { + var parameters = Parameters.convertListToParameters(update); + var success = request.Put(Urls.Clients, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlSuccess Delete(int clientId) + { + var parameters = new Parameters.requestParameters(); + parameters.Add("client-id", clientId); + var success = request.Delete(Urls.Clients, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlClient Get(int clientId) + { + var url = string.Format(Urls.Clients + "{0}", clientId); + var parameters = new Parameters.requestParameters(); + var success = request.Get(url, parameters, this.api_key, this.api_secret); + JObject o = JObject.Parse(success.Content); + return JsonConvert.DeserializeObject(o.SelectToken("client").ToString()); + } + + public virtual BlClientSearch Search(string query) + { + var url = string.Format(Urls.Clients + "search"); + var parameters = new Parameters.requestParameters(); + parameters.Add("q", query); + var results = request.Get(url, parameters, this.api_key, this.api_secret); + + return JsonConvert.DeserializeObject(results.Content); + } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/Clients/UpdateClient.cs b/BrightLocal/src/BrightLocal/Services/Clients/UpdateClient.cs new file mode 100644 index 0000000..5a8932a --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/Clients/UpdateClient.cs @@ -0,0 +1,20 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal +{ + public class UpdateClient + { + [JsonProperty("client-id")] + public int clientId { get; set; } + [JsonProperty("name")] + public string name { get; set; } + [JsonProperty("company-url")] + public string companyUrl { get; set; } + [JsonProperty("business-category-id")] + public int businessCategoryId { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/GpwReports/Gpw.cs b/BrightLocal/src/BrightLocal/Services/GpwReports/Gpw.cs new file mode 100644 index 0000000..40d6b69 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/GpwReports/Gpw.cs @@ -0,0 +1,51 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace BrightLocal +{ + public class Gpw + { + [JsonProperty("report_name")] + public string reportName { get; set; } + [JsonProperty("location_id")] + public int locationId { get; set; } + [JsonProperty("white_label_profile_id")] + public int whiteLabelProfileId { get; set; } + [JsonProperty("business_names")] + public string businessNames { get; set; } + [JsonProperty("schedule")] + public string schedule { get; set; } + [JsonProperty("day_of_month")] + public string dayOfMonth { get; set; } + [JsonProperty("report_type")] + public string reportType { get; set; } + [JsonProperty("address1")] + public string address1 { get; set; } + [JsonProperty("address2")] + public string address2 { get; set; } + [JsonProperty("profile_url")] + public string profileUrl { get; set; } + [JsonProperty("city")] + public string city { get; set; } + [JsonProperty("state_code")] + public string stateCode { get; set; } + [JsonProperty("postcode")] + public string postcode { get; set; } + [JsonProperty("phone_number")] + public string phoneNumber { get; set; } + [JsonProperty("country")] + public string country { get; set; } + [JsonProperty("search_terms")] + public string searchTerms { get; set; } + [JsonProperty("notify")] + public string notify { get; set; } + [JsonProperty("email-addresses")] + public string emailAddresses { get; set; } + [JsonProperty("google_location")] + public string googleLocation { get; set; } + [JsonProperty("is_public")] + public string isPublic { get; set; } + [JsonProperty("run")] + public string run { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/GpwReports/GpwService.cs b/BrightLocal/src/BrightLocal/Services/GpwReports/GpwService.cs new file mode 100644 index 0000000..2d24c0e --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/GpwReports/GpwService.cs @@ -0,0 +1,76 @@ + +using Newtonsoft.Json; + +namespace BrightLocal +{ + public class GpwService : BlService + { + public GpwService(string apiKey = null, string apiSecret = null) : base(apiKey, apiSecret) { } + + BlRequestor request = new BlRequestor(); + + public virtual BlSuccess Create(Gpw create) + { + var url = string.Format(Urls.Gpw + "{0}", "add"); + var parameters = Parameters.convertListToParameters(create); + var success = request.Post(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlSuccess Update(UpdateGpw update) + { + var url = string.Format(Urls.Gpw + "{0}", update.reportId); + var parameters = Parameters.convertListToParameters(update); + var success = request.Put(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlGpwReport Get(int reportId) + { + var url = string.Format(Urls.Gpw + "{0}", reportId); + var parameters = new Parameters.requestParameters(); + var success = request.Get(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlSuccess Delete(int reportId) + { + var url = string.Format(Urls.Gpw + "{0}", reportId); + var parameters = new Parameters.requestParameters(); + var success = request.Delete(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlGpwGetAllResults GetAll() + { + var parameters = new Parameters.requestParameters(); + var success = request.Get(Urls.Gpw, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlGpwGetAllResults GetAll(int locationId) + { + var parameters = new Parameters.requestParameters(); + parameters.Add("location-id", locationId); + var success = request.Get(Urls.Gpw, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlSuccess Run(int reportId) + { + var url = string.Format(Urls.Gpw + "{0}", "run"); + var parameters = new Parameters.requestParameters(); + parameters.Add("report-id", reportId); + var success = request.Put(Urls.Gpw, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlGpwReportResults GetReportResults(int reportId) + { + var url = string.Format(Urls.Gpw + "{0}", reportId + "/results"); + var parameters = new Parameters.requestParameters(); + var success = request.Get(Urls.Gpw, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/GpwReports/UpdateGpw.cs b/BrightLocal/src/BrightLocal/Services/GpwReports/UpdateGpw.cs new file mode 100644 index 0000000..53e5f41 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/GpwReports/UpdateGpw.cs @@ -0,0 +1,53 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace BrightLocal +{ + public class UpdateGpw + { + [JsonProperty("report-ID")] + public int reportId { get; set; } + [JsonProperty("report_name")] + public string reportName { get; set; } + [JsonProperty("location_id")] + public int locationId { get; set; } + [JsonProperty("white_label_profile_id")] + public int whiteLabelProfileId { get; set; } + [JsonProperty("business_names")] + public string businessNames { get; set; } + [JsonProperty("schedule")] + public string schedule { get; set; } + [JsonProperty("day_of_month")] + public string dayOfMonth { get; set; } + [JsonProperty("report_type")] + public string reportType { get; set; } + [JsonProperty("address1")] + public string address1 { get; set; } + [JsonProperty("address2")] + public string address2 { get; set; } + [JsonProperty("profile_url")] + public string profileUrl { get; set; } + [JsonProperty("city")] + public string city { get; set; } + [JsonProperty("state_code")] + public string stateCode { get; set; } + [JsonProperty("postcode")] + public string postcode { get; set; } + [JsonProperty("phone_number")] + public string phoneNumber { get; set; } + [JsonProperty("country")] + public string country { get; set; } + [JsonProperty("search_terms")] + public string searchTerms { get; set; } + [JsonProperty("notify")] + public string notify { get; set; } + [JsonProperty("email-addresses")] + public string emailAddresses { get; set; } + [JsonProperty("google_location")] + public string googleLocation { get; set; } + [JsonProperty("is_public")] + public string isPublic { get; set; } + [JsonProperty("run")] + public string run { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/Locations/Location.cs b/BrightLocal/src/BrightLocal/Services/Locations/Location.cs new file mode 100644 index 0000000..1d632c1 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/Locations/Location.cs @@ -0,0 +1,61 @@ +using Newtonsoft.Json; +using RestSharp; + +namespace BrightLocal +{ + public class Location + { + [JsonProperty("name")] + public string name { get; set; } + [JsonProperty("client-id")] + public int clientId { get; set; } + [JsonProperty("url")] + public string url { get; set; } + [JsonProperty("business-category-id")] + public int businessCategoryId { get; set; } + [JsonProperty("country")] + public string country { get; set; } + [JsonProperty("address1")] + public string address1 { get; set; } + [JsonProperty("address2")] + public string address2 { get; set; } + [JsonProperty("region")] + public string region { get; set; } + [JsonProperty("city")] + public string city { get; set; } + [JsonProperty("postcode")] + public string postcode { get; set; } + [JsonProperty("telephone")] + public string telephone { get; set; } + [JsonProperty("unique-reference")] + public string uniqueReference { get; set; } + [JsonProperty("contact-first-name")] + public string contactFirstName { get; set; } + [JsonProperty("contact-last-name")] + public string contactLastName { get; set; } + [JsonProperty("contact-mobile")] + public string contactMobile { get; set; } + [JsonProperty("contact-telephone")] + public string contactTelephone { get; set; } + [JsonProperty("contact-email")] + public string contactEmail { get; set; } + [JsonProperty("contact-fax")] + public string contactFax { get; set; } + [JsonProperty("number-of-employees")] + public string numberOfEmployees { get; set; } + [JsonProperty("year-of-formation")] + public string yearOfFormation { get; set; } + [JsonProperty("extra-business-categories")] + public JsonArray extraBusinessCategories { get; set; } + [JsonProperty("working-hours")] + public JsonArray workingHours { get; set; } + [JsonProperty("payment-methods")] + public JsonArray paymentMethods { get; set; } + [JsonProperty("short-description")] + public string shortDescription { get; set; } + [JsonProperty("long-description")] + public string longDescription { get; set; } + [JsonProperty("services-of-products")] + public JsonArray servicesOfProducts { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/Locations/LocationService.cs b/BrightLocal/src/BrightLocal/Services/Locations/LocationService.cs new file mode 100644 index 0000000..e02aed8 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/Locations/LocationService.cs @@ -0,0 +1,56 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; + +namespace BrightLocal +{ + public class LocationService: BlService + { + public LocationService(string apiKey = null, string apiSecret = null) : base(apiKey, apiSecret) { } + + BlRequestor request = new BlRequestor(); + + public virtual BlSuccess Create(Location create) + { + var parameters = Parameters.convertListToParameters(create); + var success = request.Post(Urls.Locations, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + + } + + public virtual BlSuccess Update(UpdateLocation update) + { + var url = string.Format(Urls.Locations + "{0}", update.locationId); + var parameters = Parameters.convertListToParameters(update); + var success = request.Put(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlSuccess Delete(int locationId) + { + var url = string.Format(Urls.Locations + "{0}", locationId); + var parameters = new Parameters.requestParameters(); + var success = request.Delete(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlLocation Get(int locationId) + { + var url = string.Format(Urls.Locations + "{0}", locationId); + var parameters = new Parameters.requestParameters(); + var success = request.Get(url, parameters, this.api_key, this.api_secret); + JObject o = JObject.Parse(success.Content); + return JsonConvert.DeserializeObject(o.SelectToken("location").ToString()); + } + + public virtual BlLocationSearch Search(string query) + { + var url = string.Format(Urls.Locations + "search"); + var parameters = new Parameters.requestParameters(); + parameters.Add("q", query); + var results = request.Get(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(results.Content); + } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/Locations/UpdateLocation.cs b/BrightLocal/src/BrightLocal/Services/Locations/UpdateLocation.cs new file mode 100644 index 0000000..700d826 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/Locations/UpdateLocation.cs @@ -0,0 +1,65 @@ +using Newtonsoft.Json; +using RestSharp; + + +namespace BrightLocal +{ + public class UpdateLocation + { + [JsonRequired] + [JsonProperty("location-id")] + public int locationId { get; set; } + [JsonProperty("name")] + public string name { get; set; } + [JsonProperty("client-id")] + public int clientId { get; set; } + [JsonProperty("url")] + public string url { get; set; } + [JsonProperty("business-category-id")] + public int businessCategoryId { get; set; } + [JsonProperty("country")] + public string country { get; set; } + [JsonProperty("address1")] + public string address1 { get; set; } + [JsonProperty("address2")] + public string address2 { get; set; } + [JsonProperty("region")] + public string region { get; set; } + [JsonProperty("city")] + public string city { get; set; } + [JsonProperty("postcode")] + public string postcode { get; set; } + [JsonProperty("telephone")] + public string telephone { get; set; } + [JsonProperty("unique-reference")] + public string uniqueReference { get; set; } + [JsonProperty("contact-first-name")] + public string contactFirstName { get; set; } + [JsonProperty("contact-last-name")] + public string contactLastName { get; set; } + [JsonProperty("contact-mobile")] + public string contactMobile { get; set; } + [JsonProperty("contact-telephone")] + public string contactTelephone { get; set; } + [JsonProperty("contact-email")] + public string contactEmail { get; set; } + [JsonProperty("contact-fax")] + public string contactFax { get; set; } + [JsonProperty("number-of-employees")] + public string numberOfEmployees { get; set; } + [JsonProperty("year-of-formation")] + public string yearOfFormation { get; set; } + [JsonProperty("extra-business-categories")] + public JsonArray extraBusinessCategories { get; set; } + [JsonProperty("working-hours")] + public JsonArray workingHours { get; set; } + [JsonProperty("payment-methods")] + public JsonArray paymentMethods { get; set; } + [JsonProperty("short-description")] + public string shortDescription { get; set; } + [JsonProperty("long-description")] + public string longDescription { get; set; } + [JsonProperty("services-of-products")] + public JsonArray servicesOfProducts { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/Lscu/Lscu.cs b/BrightLocal/src/BrightLocal/Services/Lscu/Lscu.cs new file mode 100644 index 0000000..e0ba827 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/Lscu/Lscu.cs @@ -0,0 +1,72 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; + + +namespace BrightLocal +{ + public class Lscu + { + [JsonProperty("report-name")] + public string reportName { get; set; } + [JsonProperty("location-id")] + public int locationId { get; set; } + [JsonProperty("white-label-profile-id")] + public int whiteLabelProfileId { get; set; } + [JsonProperty("business-names")] + public string businessNames { get; set; } + [JsonProperty("website-address")] + public string websiteAddress { get; set; } + [JsonProperty("address1")] + public string address1 { get; set; } + [JsonProperty("address2")] + public string address2 { get; set; } + [JsonProperty("area")] + public string area { get; set; } + [JsonProperty("city")] + public string city { get; set; } + [JsonProperty("state-code")] + public string stateCode { get; set; } + [JsonProperty("postcode")] + public string postcode { get; set; } + [JsonProperty("telephone")] + public string telephone { get; set; } + [JsonProperty("country")] + public string country { get; set; } + [JsonProperty("business-category")] + public string businessCategory { get; set; } + [JsonProperty("primary-business-location")] + public string primaryBusinessLocation { get; set; } + [JsonProperty("search-terms")] + public string searchTerms { get; set; } + [JsonProperty("google-location")] + public string googleLocation { get; set; } + [JsonProperty("bing-location")] + public string bingLocation { get; set; } + [JsonProperty("notify")] + public string notify { get; set; } + [JsonProperty("email-addresses")] + public string emailAddresses { get; set; } + [JsonProperty("facebook-url")] + public string facebookUrl { get; set; } + [JsonProperty("twitter-url")] + public string twitterUrl { get; set; } + [JsonProperty("is-public")] + public string isPublic { get; set; } + [JsonProperty("local-directory-urls")] + public LocalDirectoryUrls localDirectoryUrls { get; set; } + [JsonProperty("run-report")] + public string runReport { get; set; } + } + + public class LocalDirectoryUrls: Dictionary + { + + } + + public class DirectoryUrls + { + public string url { get; set; } + public string include { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/Lscu/LscuService.cs b/BrightLocal/src/BrightLocal/Services/Lscu/LscuService.cs new file mode 100644 index 0000000..4b027e1 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/Lscu/LscuService.cs @@ -0,0 +1,65 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; + + +namespace BrightLocal +{ + public class LscuService: BlService + { + public LscuService(string apiKey = null, string apiSecret = null) : base(apiKey, apiSecret) { } + + BlRequestor request = new BlRequestor(); + + public virtual BlSuccess Create(Lscu create) + { + var parameters = Parameters.convertListToParameters(create); + var success = request.Post(Urls.Lscu, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlSuccess Update(UpdateLscu update) + { + var parameters = Parameters.convertListToParameters(update); + var success = request.Put(Urls.Lscu, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlLscuReport Get(int reportId) + { + var parameters = new Parameters.requestParameters(); + parameters.Add("report-id", reportId); + var success = request.Get(Urls.Lscu, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + // returns success or failed as a string message + public virtual BlSuccess Run(int reportId) + { + var url = string.Format(Urls.Lscu + "{0}", "run"); + var parameters = new Parameters.requestParameters(); + parameters.Add("report-id", reportId); + var success = request.Put(url, parameters, this.api_key, this.api_secret); + + return JsonConvert.DeserializeObject(success.Content); + } + + // returns success or failed as a string message + public virtual BlSuccess Delete(int reportId) + { + var parameters = new Parameters.requestParameters(); + parameters.Add("report-id", reportId); + var success = request.Delete(Urls.Lscu, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlLscuSearch Search(string query) + { + var url = string.Format(Urls.Lscu + "{0}", "search"); + var parameters = new Parameters.requestParameters(); + parameters.Add("q", query); + var success = request.Get(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/Lscu/UpdateLscu.cs b/BrightLocal/src/BrightLocal/Services/Lscu/UpdateLscu.cs new file mode 100644 index 0000000..1a105ff --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/Lscu/UpdateLscu.cs @@ -0,0 +1,62 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + + +namespace BrightLocal +{ + public class UpdateLscu + { + [JsonProperty("report-id")] + public int reportId { get; set; } + [JsonProperty("report-name")] + public string reportName { get; set; } + [JsonProperty("location-id")] + public int locationId { get; set; } + [JsonProperty("white-label-profile-id")] + public int whiteLabelProfileId { get; set; } + [JsonProperty("business-names")] + public string businessNames { get; set; } + [JsonProperty("website-address")] + public string websiteAddress { get; set; } + [JsonProperty("address1")] + public string address1 { get; set; } + [JsonProperty("address2")] + public string address2 { get; set; } + [JsonProperty("area")] + public string area { get; set; } + [JsonProperty("city")] + public string city { get; set; } + [JsonProperty("state-code")] + public string stateCode { get; set; } + [JsonProperty("postcode")] + public string postcode { get; set; } + [JsonProperty("telephone")] + public string telephone { get; set; } + [JsonProperty("country")] + public string country { get; set; } + [JsonProperty("business-category")] + public string businessCategory { get; set; } + [JsonProperty("primary-business-location")] + public string primaryBusinessLocation { get; set; } + [JsonProperty("search-terms")] + public string searchTerms { get; set; } + [JsonProperty("google-location")] + public string googleLocation { get; set; } + [JsonProperty("bing-location")] + public string bingLocation { get; set; } + [JsonProperty("notify")] + public string notify { get; set; } + [JsonProperty("email-addresses")] + public string emailAddresses { get; set; } + [JsonProperty("facebook-url")] + public string facebookUrl { get; set; } + [JsonProperty("twitter-url")] + public string twitterUrl { get; set; } + [JsonProperty("is-public")] + public string isPublic { get; set; } + [JsonProperty("local-directory-urls")] + public LocalDirectoryUrls localDirectoryUrls { get; set; } + [JsonProperty("run-report")] + public string runReport { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/Lsrc/GetResultsLsrc.cs b/BrightLocal/src/BrightLocal/Services/Lsrc/GetResultsLsrc.cs new file mode 100644 index 0000000..9984eb1 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/Lsrc/GetResultsLsrc.cs @@ -0,0 +1,15 @@ +using Newtonsoft.Json; + + +namespace BrightLocal +{ + public class GetResultsLsrc + { + [JsonProperty("campaign-id")] + public int campaignId { get; set; } + [JsonProperty("campaign-history-id")] + public int campaignHistoryId { get; set; } + [JsonProperty("previous-campaign-history-id")] + public int previousCampaignHistoryId { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/Lsrc/Lsrc.cs b/BrightLocal/src/BrightLocal/Services/Lsrc/Lsrc.cs new file mode 100644 index 0000000..0565b0a --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/Lsrc/Lsrc.cs @@ -0,0 +1,56 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace BrightLocal +{ + public class Lsrc + { + [JsonProperty("name")] + public string name { get; set; } + [JsonProperty("schedule")] + public string schedule { get; set; } + [JsonProperty("day-of-week")] + public string dayOfWeek { get; set; } + [JsonProperty("day-of-month")] + public int dayOfMonth { get; set; } + [JsonProperty("location-id")] + public int locationId { get; set; } + [JsonProperty("white-label-profile-id")] + public int whiteLabelProfileId { get; set; } + [JsonProperty("tags")] + public string tags { get; set; } + [JsonProperty("search-terms")] + public string searchTerms { get; set; } + [JsonProperty("website-addresses")] + public string websiteAddresses { get; set; } + [JsonProperty("website-address")] + public string websiteAddress { get; set; } + [JsonProperty("website-address-2")] + public string websiteAddress2 { get; set; } + [JsonProperty("website-address-3")] + public string websiteAddress3 { get; set; } + [JsonProperty("country")] + public string country { get; set; } + [JsonProperty("google-location")] + public string googleLocation { get; set; } + [JsonProperty("bing-location")] + public string bingLocation { get; set; } + [JsonProperty("business-names")] + public string businessNames { get; set; } + [JsonProperty("postcode")] + public string postcode { get; set; } + [JsonProperty("telephone")] + public string telephone { get; set; } + [JsonProperty("search-engines")] + public string searchEngines { get; set; } + [JsonProperty("include-local-directory-results")] + public string includeLocalDirectoryResults { get; set; } + [JsonProperty("notify")] + public string notify { get; set; } + [JsonProperty("email-addresses")] + public string emailAddresses { get; set; } + [JsonProperty("is-public")] + public string isPublic { get; set; } + } +} + diff --git a/BrightLocal/src/BrightLocal/Services/Lsrc/LsrcService.cs b/BrightLocal/src/BrightLocal/Services/Lsrc/LsrcService.cs new file mode 100644 index 0000000..7435083 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/Lsrc/LsrcService.cs @@ -0,0 +1,121 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; + + +namespace BrightLocal +{ + public class LsrcService: BlService + { + public LsrcService(string apiKey = null, string apiSecret = null) : base(apiKey, apiSecret) { } + + BlRequestor request = new BlRequestor(); + + public virtual BlSuccess Create(Lsrc create) + { + var url = string.Format(Urls.Lsrc + "{0}", "add"); + create.searchTerms = Parameters.convertToNewline(create.searchTerms); + if(create.businessNames != null) + { + create.businessNames = Parameters.convertToNewline(create.businessNames); + } + if (create.emailAddresses != null) + { + create.emailAddresses = Parameters.convertToNewline(create.emailAddresses); + } + var parameters = Parameters.convertListToParameters(create); + var success = request.Post(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlSuccess Update(UpdateLsrc update) + { + var url = string.Format(Urls.Lsrc + "{0}", "update"); + if (update.searchTerms != null) + { + update.searchTerms = Parameters.convertToNewline(update.searchTerms); + } + if (update.businessNames != null) + { + update.businessNames = Parameters.convertToNewline(update.businessNames); + } + if (update.emailAddresses != null) + { + update.emailAddresses = Parameters.convertToNewline(update.emailAddresses); + } + var parameters = Parameters.convertListToParameters(update); + var success = request.Post(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlSuccess Delete(int campaignId) + { + var url = string.Format(Urls.Lsrc + "{0}", "delete"); + var parameters = new Parameters.requestParameters(); + parameters.Add("campaign-id", campaignId); + var success = request.Post(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + //method overlaod for supplying the location-id parameter + public virtual BlGetAllResults GetAll(int locationId) + { + var url = string.Format(Urls.Lsrc + "{0}", "get-all"); + var parameters = new Parameters.requestParameters(); + parameters.Add("location-id", locationId); + + var results = request.Get(url, parameters, this.api_key, this.api_secret); + + return JsonConvert.DeserializeObject(results.Content); + + } + + public virtual BlGetAllResults GetAll() + { + var url = string.Format(Urls.Lsrc + "{0}", "get-all"); + var parameters = new Parameters.requestParameters(); + + var results = request.Get(url, parameters, this.api_key, this.api_secret); + + return JsonConvert.DeserializeObject(results.Content); + } + + public virtual BlLsrcReport Get(int campaignId) + { + var url = string.Format(Urls.Lsrc + "{0}", "get"); + var parameters = new Parameters.requestParameters(); + parameters.Add("campaign-id", campaignId); + var success = request.Get(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlSuccess Run(int campaignId) + { + var url = string.Format(Urls.Lsrc + "{0}", "run"); + var parameters = new Parameters.requestParameters(); + parameters.Add("campaign-id", campaignId); + var success = request.Post(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlLsrcHistory GetHistory(int campaignId) + { + var url = string.Format(Urls.Lsrc + "{0}", "history/get"); + var parameters = new Parameters.requestParameters(); + parameters.Add("campaign-id", campaignId); + var results = request.Post(url, parameters, this.api_key, this.api_secret); + + return JsonConvert.DeserializeObject(results.Content); + } + + public virtual BlLsrcReportResults GetResults(GetResultsLsrc lsrc) + { + var url = string.Format(Urls.Lsrc + "{0}", "results/get"); + var parameters = Parameters.convertListToParameters(lsrc); + + var results = request.Get(url, parameters, this.api_key, this.api_secret); + var report = JsonConvert.DeserializeObject(results.Content); + return report; + } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/Lsrc/UpdateLsrc.cs b/BrightLocal/src/BrightLocal/Services/Lsrc/UpdateLsrc.cs new file mode 100644 index 0000000..80b292e --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/Lsrc/UpdateLsrc.cs @@ -0,0 +1,57 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace BrightLocal +{ + public class UpdateLsrc + { + [JsonProperty("campaign-id")] + public int campaignId { get; set; } + [JsonProperty("name")] + public string name { get; set; } + [JsonProperty("schedule")] + public string schedule { get; set; } + [JsonProperty("day-of-week")] + public string dayOfWeek { get; set; } + [JsonProperty("day-of-month")] + public int dayOfMonth { get; set; } + [JsonProperty("location-id")] + public int locationId { get; set; } + [JsonProperty("white-label-profile-id")] + public int whiteLabelProfileId { get; set; } + [JsonProperty("tags")] + public string tags { get; set; } + [JsonProperty("search-terms")] + public string searchTerms { get; set; } + [JsonProperty("website-addresses")] + public string websiteAddresses { get; set; } + [JsonProperty("website-address")] + public string websiteAddress { get; set; } + [JsonProperty("website-address-2")] + public string websiteAddress2 { get; set; } + [JsonProperty("website-address-3")] + public string websiteAddress3 { get; set; } + [JsonProperty("country")] + public string country { get; set; } + [JsonProperty("google-location")] + public string googleLocation { get; set; } + [JsonProperty("bing-location")] + public string bingLocation { get; set; } + [JsonProperty("business-names")] + public string businessNames { get; set; } + [JsonProperty("postcode")] + public string postcode { get; set; } + [JsonProperty("telephone")] + public string telephone { get; set; } + [JsonProperty("search-engines")] + public string searchEngines { get; set; } + [JsonProperty("include-local-directory-results")] + public string includeLocalDirectoryResults { get; set; } + [JsonProperty("notify")] + public string notify { get; set; } + [JsonProperty("emailAddresses")] + public string emailAddresses { get; set; } + [JsonProperty("is-public")] + public string isPublic { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/Parameters.cs b/BrightLocal/src/BrightLocal/Services/Parameters.cs new file mode 100644 index 0000000..56a780d --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/Parameters.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Threading.Tasks; + +namespace BrightLocal +{ + public class Parameters + { + public static requestParameters convertListToParameters(Object item) + { + var parameters = new requestParameters(); + foreach (var directoryinfo in item.GetType().GetProperties()) + { + if(directoryinfo.GetValue(item) != null) + { + foreach (CustomAttributeData att in directoryinfo.CustomAttributes) + { + foreach (CustomAttributeTypedArgument arg in att.ConstructorArguments) + { + parameters.Add(arg.Value.ToString(), directoryinfo.GetValue(item, null)); + } + } + } + + } + return parameters; + } + //public static Dictionary ObjectToDictionary(object value) + //{ + // Dictionary dictionary = new Dictionary(); + // if (value != null) + // { + // foreach (System.ComponentModel.PropertyDescriptor descriptor in System.ComponentModel.TypeDescriptor.GetProperties(value)) + // { + // if (descriptor != null && descriptor.Name != null) + // { + // object propValue = descriptor.GetValue(value); + // if (propValue != null) + // dictionary.Add(descriptor.Name, String.Format("{0}", propValue)); + // } + // } + // } + // return dictionary; + //} + public static string convertToNewline(string item) + { + return item.Replace(',', '\n'); + } + + public class requestParameters : Dictionary + { + + } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/ReviewFlow/ReviewFlow.cs b/BrightLocal/src/BrightLocal/Services/ReviewFlow/ReviewFlow.cs new file mode 100644 index 0000000..ca65869 --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/ReviewFlow/ReviewFlow.cs @@ -0,0 +1,59 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace BrightLocal +{ + public class ReviewFlow + { + public ReviewFlow() + { + directories = new RFDirectoryUrls(); + } + + [JsonProperty("report-name")] + public string reportName { get; set; } + [JsonProperty("location-id")] + public int locationId { get; set; } + [JsonProperty("white-label-profile-id")] + public int whiteLabelProfileId { get; set; } + [JsonProperty("business-name")] + public string businessName { get; set; } + [JsonProperty("contact-telephone")] + public string contactTelephone { get; set; } + [JsonProperty("address1")] + public string address1 { get; set; } + [JsonProperty("address2")] + public string address2 { get; set; } + [JsonProperty("city")] + public string city { get; set; } + [JsonProperty("postcode")] + public string postcode { get; set; } + [JsonProperty("country")] + public string country { get; set; } + [JsonProperty("schedule")] + public string schedule { get; set; } + [JsonProperty("run-on")] + public int runOn { get; set; } + [JsonProperty("receive-email-alerts")] + public string receiveEmailAlerts { get; set; } + [JsonProperty("email-addresses")] + public List emailAddresses { get; set; } + [JsonProperty("is-public")] + public string isPublic { get; set; } + [JsonProperty("directories")] + public RFDirectoryUrls directories { get; set; } + [JsonProperty("run-report")] + public string runReport { get; set; } + } + + public class RFDirectoryUrls : Dictionary + { + + } + + public class Directories + { + public string url { get; set; } + public bool include { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/ReviewFlow/ReviewFlowService.cs b/BrightLocal/src/BrightLocal/Services/ReviewFlow/ReviewFlowService.cs new file mode 100644 index 0000000..4f814ff --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/ReviewFlow/ReviewFlowService.cs @@ -0,0 +1,117 @@ +using Newtonsoft.Json; + +namespace BrightLocal +{ + public class ReviewFlowService : BlService + { + public ReviewFlowService(string apiKey = null, string apiSecret = null) : base(apiKey, apiSecret) { } + + BlRequestor request = new BlRequestor(); + + public virtual BlSuccess Create(ReviewFlow create) + { + var url = string.Format(Urls.ReviewFlow + "{0}", "add"); + var parameters = Parameters.convertListToParameters(create); + var success = request.Post(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlSuccess Update(UpdateReviewFlow update) + { + var url = string.Format(Urls.ReviewFlow + "{0}", update.reportId); + var parameters = Parameters.convertListToParameters(update); + var success = request.Put(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlRfReport Get(int reportId) + { + var url = string.Format(Urls.ReviewFlow + "{0}", reportId); + var parameters = new Parameters.requestParameters(); + var success = request.Get(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlSuccess Delete(int reportId) + { + var url = string.Format(Urls.ReviewFlow + "{0}", reportId); + var parameters = new Parameters.requestParameters(); + var success = request.Delete(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlRfGetAll GetAll() + { + var url = string.Format(Urls.ReviewFlow); + var parameters = new Parameters.requestParameters(); + var success = request.Get(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlRfGetAll GetAll(int locationId) + { + var url = string.Format(Urls.ReviewFlow); + var parameters = new Parameters.requestParameters(); + parameters.Add("location-id", locationId); + var success = request.Get(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlRfGetAll Search(string query) + { + var url = string.Format(Urls.ReviewFlow + "{0}", "search"); + var parameters = new Parameters.requestParameters(); + parameters.Add("q", query); + var success = request.Get(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlRfReviews GetReviews(RfGetReviews getReviews) + { + var url = string.Format(Urls.ReviewFlow + "{0}" + "/reviews", getReviews.reportId); + var parameters = Parameters.convertListToParameters(getReviews); + var success = request.Get(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlSuccess GetReviewCount(int reportId) + { + var url = string.Format(Urls.ReviewFlow + "{0}" + "/reviews/count", reportId); + var parameters = new Parameters.requestParameters(); + var success = request.Get(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlSuccess GetGrowth(int reportId) + { + var url = string.Format(Urls.ReviewFlow + "{0}" + "/reviews/growth", reportId); + var parameters = new Parameters.requestParameters(); + var success = request.Get(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BlRfDirectories GetDirectories(int reportId) + { + var url = string.Format(Urls.ReviewFlow + "{0}" + "/directories", reportId); + var parameters = new Parameters.requestParameters(); + var success = request.Get(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BrightLocalRfDirectoryStats GetDirectoryStats(int reportId) + { + var url = string.Format(Urls.ReviewFlow + "{0}" + "/directories/stats", reportId); + var parameters = new Parameters.requestParameters(); + var success = request.Get(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + + public virtual BrightLocalRfStarCounts GetStarCount(int reportId) + { + var url = string.Format(Urls.ReviewFlow + "{0}" + "/stars/count", reportId); + var parameters = new Parameters.requestParameters(); + var success = request.Get(url, parameters, this.api_key, this.api_secret); + return JsonConvert.DeserializeObject(success.Content); + } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/ReviewFlow/RfGetReviews.cs b/BrightLocal/src/BrightLocal/Services/ReviewFlow/RfGetReviews.cs new file mode 100644 index 0000000..72f491c --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/ReviewFlow/RfGetReviews.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Threading.Tasks; + +namespace BrightLocal +{ + public class RfGetReviews + { + public int reportId { get; set; } + public string directory { get; set; } + public int stars { get; set; } + public string sort { get; set; } + public string from { get; set; } + public string to { get; set; } + public int offset { get; set; } + public int limit { get; set; } + } +} diff --git a/BrightLocal/src/BrightLocal/Services/ReviewFlow/UpdateReviewFlow.cs b/BrightLocal/src/BrightLocal/Services/ReviewFlow/UpdateReviewFlow.cs new file mode 100644 index 0000000..248bdea --- /dev/null +++ b/BrightLocal/src/BrightLocal/Services/ReviewFlow/UpdateReviewFlow.cs @@ -0,0 +1,47 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace BrightLocal +{ + public class UpdateReviewFlow + { + [JsonProperty("report-id")] + public int reportId { get; set; } + [JsonProperty("report-name")] + public string reportName { get; set; } + [JsonProperty("location-id")] + public int locationId { get; set; } + [JsonProperty("white-label-profile-id")] + public int whiteLabelProfileId { get; set; } + [JsonProperty("business-name")] + public string businessName { get; set; } + [JsonProperty("contact-telephone")] + public string contactTelephone { get; set; } + [JsonProperty("address1")] + public string address1 { get; set; } + [JsonProperty("address2")] + public string address2 { get; set; } + [JsonProperty("city")] + public string city { get; set; } + [JsonProperty("postcode")] + public string postcode { get; set; } + [JsonProperty("country")] + public string country { get; set; } + [JsonProperty("schedule")] + public string schedule { get; set; } + [JsonProperty("run-on")] + public int runOn { get; set; } + [JsonProperty("receive-email-alerts")] + public string receiveEmailAlerts { get; set; } + [JsonProperty("email-addresses")] + public List emailAddresses { get; set; } + [JsonProperty("is-public")] + public string isPublic { get; set; } + [JsonProperty("directories")] + public RFDirectoryUrls directories { get; set; } + [JsonProperty("run-report")] + public string runReport { get; set; } + } + +} + diff --git a/BrightLocal/src/BrightLocal/examples/gpwExamples.cs b/BrightLocal/src/BrightLocal/examples/gpwExamples.cs index e163bcf..317f66a 100644 --- a/BrightLocal/src/BrightLocal/examples/gpwExamples.cs +++ b/BrightLocal/src/BrightLocal/examples/gpwExamples.cs @@ -25,7 +25,7 @@ public static IRestResponse addReport() parameters.Add("postcode", "10019"); parameters.Add("phone_number", "+1 212-554-1515"); parameters.Add("country", "USA"); - parameters.Add("business-category", "Restaurant"); + parameters.Add("search-terms", "['restaurant manhattan', 'cafe new york']"); var success = request.Post("v4/gpw/add", parameters); diff --git a/BrightLocal/src/BrightLocal/examples/lscuExamples.cs b/BrightLocal/src/BrightLocal/examples/lscuExamples.cs index 1d17a84..3bdb736 100644 --- a/BrightLocal/src/BrightLocal/examples/lscuExamples.cs +++ b/BrightLocal/src/BrightLocal/examples/lscuExamples.cs @@ -15,7 +15,7 @@ public static IRestResponse addReport() var parameters = new api.Parameters(); parameters.Add("report-name", "Sample SEO Check-Up Report"); - parameters.Add("business-names", "['Le Bernardin']"); + parameters.Add("business-names", JsonConvert.SerializeObject("['Le Bernardin']")); parameters.Add("website-address", "le-bernardin.com"); parameters.Add("address1", "155 Weest 51st Street"); parameters.Add("address2", ""); @@ -26,7 +26,7 @@ public static IRestResponse addReport() parameters.Add("country", "USA"); parameters.Add("business-category", "Restaurant"); parameters.Add("primary-business-location", "NY, New York"); - parameters.Add("search-terms", "['restaurant manhattan', 'cafe new york']"); + parameters.Add("search_terms", JsonConvert.SerializeObject("['restaurant manhattan', 'cafe new york']")); var success = request.Post("v4/lscu", parameters); @@ -44,7 +44,7 @@ public static IRestResponse updateReport() parameters.Add("country", "USA"); parameters.Add("business-category", "Restaurant"); parameters.Add("primary-business-location", "NY, New York"); - parameters.Add("search-terms", "['restaurant manhattan', 'cafe new york']"); + parameters.Add("search_terms", JsonConvert.SerializeObject("['restaurant manhattan', 'cafe new york']")); var success = request.Put("v4/lscu", parameters); diff --git a/BrightLocal/src/BrightLocal/examples/lsrcExamples.cs b/BrightLocal/src/BrightLocal/examples/lsrcExamples.cs index ffa158d..f8ea93f 100644 --- a/BrightLocal/src/BrightLocal/examples/lsrcExamples.cs +++ b/BrightLocal/src/BrightLocal/examples/lsrcExamples.cs @@ -1,4 +1,5 @@ -using RestSharp; +using Newtonsoft.Json; +using RestSharp; using System; using System.Collections.Generic; using System.Linq; @@ -16,7 +17,7 @@ public static IRestResponse addReport() parameters.Add("name", "Le Bernardin"); parameters.Add("schedule", "Adhoc"); parameters.Add("search-terms", "Restaurant\nfood+nyc\ndelivery+midtown+manhattan"); - parameters.Add("website-addresses", "['le-bernardin.com', 'le-bernardin2.com']"); + parameters.Add("website-addresses", JsonConvert.SerializeObject("['le-bernardin.com', 'le-bernardin2.com']")); parameters.Add("search-engines", "google, google-mobile, google-local, yahoo, yahoo-local, bing, bing-local"); var success = request.Post("v2/lsrc/add", parameters); @@ -32,7 +33,7 @@ public static IRestResponse updateReport() parameters.Add("name", "Le Bernardin"); parameters.Add("schedule", "Adhoc"); parameters.Add("search-terms", "Restaurant\nfood+nyc\ndelivery+midtown+manhattan"); - parameters.Add("website-addresses", "['le-bernardin.com', 'le-bernardin2.com']"); + parameters.Add("website-addresses", JsonConvert.SerializeObject("['le-bernardin.com', 'le-bernardin2.com']")); parameters.Add("search-engines", "google, google-mobile, google-local, yahoo, yahoo-local, bing, bing-local"); var success = request.Post("v2/lsrc/add", parameters); diff --git a/BrightLocal/src/BrightLocal/examples/rfRxamples.cs b/BrightLocal/src/BrightLocal/examples/rFExamples.cs similarity index 99% rename from BrightLocal/src/BrightLocal/examples/rfRxamples.cs rename to BrightLocal/src/BrightLocal/examples/rFExamples.cs index c42c2f9..e4d5a30 100644 --- a/BrightLocal/src/BrightLocal/examples/rfRxamples.cs +++ b/BrightLocal/src/BrightLocal/examples/rFExamples.cs @@ -6,7 +6,7 @@ namespace BrightLocal.examples { - public class rfRxamples + public class rFExamples { public static IRestResponse addReport() { diff --git a/BrightLocal/src/BrightLocal/project.json b/BrightLocal/src/BrightLocal/project.json index 67c603e..e72c8b8 100644 --- a/BrightLocal/src/BrightLocal/project.json +++ b/BrightLocal/src/BrightLocal/project.json @@ -1,19 +1,18 @@ -{ - "version": "1.0.5-*", +{ + "version": "2.0.0-*", "id": "BrightLocal", "description": "A c# wrapper class for consuming The Bright Local api. Automatically generates the proper authentication, with the siganture and expires parameter. Avoid the need to generate your own authentication signature. See documentation for examples.", "dependencies": { - "Newtonsoft.Json": "9.0.1" - + "Newtonsoft.Json": "9.0.1" }, "frameworks": { - - "net451": { + "net452": { "dependencies": { "RestSharp": "105.2.3" }, "frameworkAssemblies": { + "System.Configuration": "4.0.0.0", "System.Web": "4.0.0.0" } }, @@ -22,6 +21,7 @@ "RestSharp": "105.2.3" }, "frameworkAssemblies": { + "System.Configuration": "4.0.0.0", "System.Web": "4.0.0.0" } } @@ -31,7 +31,7 @@ "dotnet pack --no-build --output bin\\Debug --configuration %compile:Configuration%" ] }, - "packOptions": { + "pack": { "summary": "A c# wrapper class for consuming The Bright Local api. Automatically generates the proper authentication, with the siganture and expires parameter. Avoid the need to generate your own authentication signature. See documentation for examples.", "tags": [ "BrightLocal.com", "Bright Local Api", "C# wrapper", "SEO Tools" ], "owners": [ "BrightLocal" ], diff --git a/Documentation/README.md b/Documentation/README.md new file mode 100644 index 0000000..b33dde6 --- /dev/null +++ b/Documentation/README.md @@ -0,0 +1,27 @@ +# BrightLocal-Api-C-Sharp-Wrapper +Bright Local Api C# Wrapper + +A c# wrapper class for consuming The Bright Local api. Automatically generates the proper authentication, with the siganture and expires. Avoid the need to generate your own authentication signature. + + +## Documentation + +1. [Installation](Documentation/INSTALLATION.md) + +### Account Methods + +2. [Client Examples](Documentation/CLIENTS.md) +3. [Location Examples](Documentation/LOCATIONS.md) +4. [Local Search Rank Checker Examples](Documentation/LSRC.md) +5. [Local SEO Check-up Examples](Documentation/LSCU.md) +6. [Citation Tracker Examples](Documentation/CT.md) +7. [Citation Burst Examples](Documentation/CB.md) +8. [ReviewFlow Reports Examples](Documentation/RF.md) +9. [Google+ Local Wizard Reports Examples](Documentation/GPW.md) + +### Batch Methods + +10. [Rankings Examples](Documentation/RANKINGS.md) +11. [Local Directories Examples](Documentation/LOCAL-DIRECTORIES.md) +12. [Reviews Examples](Documentation/REVIEWS.md) +13. [Offsite SEO & Social PRofiles Examples](Documentation/OFFSITE&SP.md) \ No newline at end of file diff --git a/README.md b/README.md index b33dde6..1c979c0 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,889 @@ -# BrightLocal-Api-C-Sharp-Wrapper -Bright Local Api C# Wrapper +**BrightLocal API Wrapper Version 2.0** -A c# wrapper class for consuming The Bright Local api. Automatically generates the proper authentication, with the siganture and expires. Avoid the need to generate your own authentication signature. +For documentation for version 1.0 [click here](Documentation/README.md). +**BrightLocal API Services** -## Documentation +* [Clients](#clients) +* [Locations](#locations) +* [Local Search Rank Checker](#local-search-rank-checker) +* [Local SEO Check-up](#local-seo-check-up) +* [Citation Tracker](#citation-tracker) +* [Citation Burst](#citation-burst) +* [ReviewFlow Reports](#reviewflow-reports) +* [Google+ Local Wizard Reports](#google-plus-local-wizard-reports) -1. [Installation](Documentation/INSTALLATION.md) +Quick Start +----------- -### Account Methods +We recommend that you install BrightLocal via NuGet ` nuget Install-Package BrightLocal` (https://www.nuget.org/packages/BrightLocal/1.0.0/). -2. [Client Examples](Documentation/CLIENTS.md) -3. [Location Examples](Documentation/LOCATIONS.md) -4. [Local Search Rank Checker Examples](Documentation/LSRC.md) -5. [Local SEO Check-up Examples](Documentation/LSCU.md) -6. [Citation Tracker Examples](Documentation/CT.md) -7. [Citation Burst Examples](Documentation/CB.md) -8. [ReviewFlow Reports Examples](Documentation/RF.md) -9. [Google+ Local Wizard Reports Examples](Documentation/GPW.md) +```csharp + nuget Install-Package BrightLocal +``` -### Batch Methods +Next you will need to provide BrightLocal with your API key & API secret. There are currently three ways to do this: -10. [Rankings Examples](Documentation/RANKINGS.md) -11. [Local Directories Examples](Documentation/LOCAL-DIRECTORIES.md) -12. [Reviews Examples](Documentation/REVIEWS.md) -13. [Offsite SEO & Social PRofiles Examples](Documentation/OFFSITE&SP.md) \ No newline at end of file +1) Add an AppSetting with your API key to your config (this is the easiest way and will work throughout the app on every request) + +```xml + + ... + + + ... + +``` + +2) In your application initialization, call this method (this is a programmatic way, but you only have to do it once during startup) + +```csharp + BlConfiguration.SetApiCredentials("[your API key here]", "[your api secret here]"); +``` + +3) In any of the service constructors, you can optionally pass the API key & API secret (will be assigned that apikey for the life of the service instance). + +```csharp + var clientService = new ClientService("[your api key here]", "[your api secret here]"); +``` + +Clients +----- + +### Add Client + +```csharp + var client = new Client(); + client.name = "Le Bernardin"; + client.companyUrl = "le-bernardin.com"; + client.businessCategoryId = 791; + + var clientService = new ClientService(); + + BlSuccess newClient = clientService.Create(client); +``` + +The returned BlSuccess entity above will have a client-id. You will want to persist this for later. When you create a location you will be able to optionally assign it to a client ID. + +### Update Client + +```csharp + var client = new UpdateClient(); + client.clientId = 36447; + client.name = "Le Bernardin"; + client.companyUrl = "le-bernardin.com"; + client.businessCategoryId = 791; + + var clientService = new ClientService(); + + BlSuccess updateClient = clientService.Update(client); +``` + +### Delete Client + +```csharp + var clientId = 1; + var clientService = new ClientService(); + + BlSuccess deleteClient = clientService.Delete(clientId); +``` + +### Get Client + +```csharp + var clientId = 1; + var clientService = new ClientService(); + + BlClient client = clientService.Get(clientId); +``` + +### Search Clients + +```csharp + var searchQuery = "le-bernardin"; + var clientService = new ClientService(); + + BlClientSearch results = clientService.Search(searchQuery); +``` + + +Locations +----- + +### Add Location + +```csharp + var location = new Location(); + location.name = "Le Bernardin"; + location.url = "le-bernardin.com"; + location.businessCategoryId = 791; + location.country = "USA"; + location.address1 = "155 Weest 51st Street"; + location.address2 = ""; + location.region = "NY"; // state or region + location.city = "New York"; + location.postcode = "10019"; + location.telephone = "+1 212-554-1515"; + + var locationService = new LocationService(); + + var BlSuccess = locationService.Create(location); +``` + +The returned BlSuccess entity above will have a location-id. You will want to persist this for later. When you create a report you will be able to optionally assign it to a location id. + +### Update Location + +```csharp + var location = new UpdateLocation(); + location.locationId = 1; + location.name = "Le Bernardin"; + location.url = "le-bernardin.com"; + location.businessCategoryId = 791; + location.country = "USA"; + location.address1 = "155 Weest 51st Street"; + location.address2 = ""; + location.region = "NY"; // state or region + location.city = "New York"; + location.postcode = "10019"; + location.telephone = "+1 212-554-1515"; + + var locationService = new LocationService(); + + BlSuccess updateLocation = locationService.Update(location); +``` + +### Delete Location + +```csharp + var locationId = 1; + var locationService = new LocationService(); + + BlSuccess deleteLocation = locationService.Delete(locationId); +``` + +### Get Location + +```csharp + var locationId = 1; + var locationService = new LocationService(); + + BlLocation getLocation = locationService.Get(locationId); +``` + +### Search Locations + +```csharp + var searchQuery = "le-bernardin"; + var locationService = new LocationService(); + + BlLocationSearch results = locationService.Search(searchQuery); +``` + +Local Search Rank Checker +----- + +### Add Report + +```csharp + var lsrc = new Lsrc(); + lsrc.name = "Le Bernardin"; + lsrc.websiteAddresses = JsonConvert.SerializeObject(new List() {"le-bernardin.com", "www.le-bernadin.com"}); + lsrc.searchTerms = "Restaurant, food+nyc, delivery+midtown+manhattan"; + lsrc.schedule = "Adhoc"; + lsrc.searchEngines = "google, google-mobile, google-local, yahoo, yahoo-local, bing, bing-local"; + + var lsrcService = new LsrcService(); + + BlSuccess newLsrc = lsrcService.Create(lsrc); +``` + +The returned BlSuccess entity above will have a campaign-id. You will want to persist this for later in order to run and fetch the report. + +### Update Report + +```csharp + var lsrc = new UpdateLsrc(); + lsrc.campaignId = 1; + lsrc.name = "Le Bernardin"; + lsrc.websiteAddresses = JsonConvert.SerializeObject(new List() { "le-bernardin.com", "www.le-bernadin.com" }); + lsrc.searchTerms = "Restaurant, food+nyc, delivery+midtown+manhattan"; + lsrc.schedule = "Adhoc"; + lsrc.searchEngines = "google, google-mobile, google-local, yahoo, yahoo-local, bing, bing-local"; + + var lsrcService = new LsrcService(); + + BlSuccess updatedLsrc = lsrcService.Update(lsrc); +``` + +### Delete Report + +```csharp + var campaignId = 1; + var lsrcService = new LsrcService(); + + BrightLoBlSuccesscalLsrc deletedLsrc = lsrcService.Delete(campaignId); +``` + +### Get Reports + +```csharp + var lsrcService = new LsrcService(); + + BlGetAllResults lsrcList = lsrcService.GetAll();; +``` + +### Get Report + +```csharp + var campaignId = 1; + var lsrcService = new LsrcService(); + + BlLsrcReport lsrc = lsrcService.Get(campaignId); +``` + +### Run Report + +```csharp + var campaignId = 1; + var lsrcService = new LsrcService(); + + BlLsrc lsrc = lsrcService.Run(campaignId); +``` + +### Get Report History + +```csharp + var campaignId = 1; + var lsrcService = new LsrcService(); + + BlLsrcHistory lsrcHistory = lsrcService.GetHistory(campaignId); +``` + +### Get Report Results + +```csharp + var lsrc = new GetResultsLsrc(); + lsrc.campaignId = 1; + + var lsrcService = new LsrcService(); + + BlLsrcReportResults lsrcResults = lsrcService.GetResults(lsrc); +``` + + +Local SEO Check-up +----- + +### Add Report + +```csharp + Lscu lscu = new Lscu(); + lscu.reportName = "Sample SEO Chek-Up Report"; + lscu.businessNames = JsonConvert.SerializeObject(new List() {"Le Bernardin", "Le Bernardin Cafe"}); + lscu.websiteAddress = "le-bernardin.com"; + lscu.address1 = "155 Weest 51st Street"; + lscu.address2 = ""; + lscu.city = "New York"; + lscu.stateCode = "NY"; + lscu.postcode = "10019"; + lscu.telephone = "+1 212-554-1515"; + lscu.country = "USA"; + lscu.businessCategory = "Restaurant"; + lscu.primaryBusinessLocation = "NY, New York"; + lscu.searchTerms = JsonConvert.SerializeObject(new List() { "restaurant manhattan", "cafe new york" }); + + var lscuService = new LscuService(); + + BlSuccess newLscu = lscuService.Create(lscu); +``` + +The returned BlSuccess entity above will have a report-id. You will want to persist this for later when you get and run a report. + +### Supplying Local Directory URLs (see local-directory-urls parameter) + +```csharp + lscu.localDirectoryUrls = new LocalDirectoryUrls(); + lscu.localDirectoryUrls.Add( + "citysearch", + new DirectoryUrls + { + url = "http://www.yelp.co.uk/biz/greens-restaurant-san-francisco-3", + include = "yes" + }); + lscu.localDirectoryUrls.Add( + "dexknows", + new DirectoryUrls + { + url = "", + include = "yes" + }); +``` + +### Update Report + +```csharp + UpdateLscu lscu = new UpdateLscu(); + lscu.reportId = 1; + lscu.reportName = "Sample SEO Chek-Up Report"; + lscu.businessNames = JsonConvert.SerializeObject(new List() { "Le Bernardin", "Le Bernardin Cafe" }); + lscu.websiteAddress = "le-bernardin.com"; + lscu.address1 = "155 Weest 51st Street"; + lscu.address2 = ""; + lscu.city = "New York"; + lscu.stateCode = "NY"; + lscu.postcode = "10019"; + lscu.telephone = "+1 212-554-1515"; + lscu.country = "USA"; + lscu.businessCategory = "Restaurant"; + lscu.primaryBusinessLocation = "NY, New York"; + lscu.searchTerms = JsonConvert.SerializeObject(new List() { "restaurant manhattan", "cafe new york" }); + + var lscuService = new LscuService(); + + BlSuccess updateLscu = lscuService.Update(lscu); +``` + +### Get Report + +```csharp + var reportId = 1; + var lscuService = new LscuService(); + + BlLscuReport lscuReport = lscuService.Get(reportId); +``` + +### Run Report + +```csharp + var reportId = 1; + var lscuService = new LscuService(); + + BlSuccess success = lscuService.Run(reportId); +``` +The returned success entity above is of type string. Success or Failure with errors. + +### Delete Report + +```csharp + var reportId = 1; + var lscuService = new LscuService(); + + BlSuccess success = lscuService.Delete(reportId); +``` +The returned success entity above is of type string. Success or Failure with errors. + +### Search Reports + +```csharp + var searchQuery = "Bodega Wine Bar"; + var lscuService = new LscuService(); + + BlLscuSearch lscuSearch = lscuService.Search(searchQuery); +``` + +Citation Tracker +----- + +### Add Report + +```csharp + CitationTracker ct = new CitationTracker(); + ct.reportName = "Sample Citation Tracker Report"; + ct.businessName = "Le Bernardin"; + ct.website = "le-bernardin.com"; + ct.businessType = "Restaurant"; + ct.stateCode = "NY"; + ct.postcode = "10019"; + ct.phone = "+1 212-554-1515"; + ct.country = "USA"; + + var citationTrackerService = new CitationTrackerService(); + + BlSuccess newCt = citationTrackerService.Create(ct); +``` +The returned BlSuccess entity above will have a report-id. You will want to persist this for later in order to run and get the report. + +### Update Report + +```csharp + UpdateCitationTracker ct = new UpdateCitationTracker(); + ct.reportId = 682; + ct.reportName = "Sample Citation Tracker Report"; + ct.businessName = "Le Bernardin"; + ct.website = "le-bernardin.com"; + ct.businessType = "Restaurant"; + ct.stateCode = "NY"; + ct.postcode = "10019"; + ct.phone = "+1 212-554-1515"; + ct.country = "USA"; + + var citationTrackerService = new CitationTrackerService(); + + BlSuccess updateCt = citationTrackerService.Update(ct); +``` + +### Get Report + +```csharp + int reportId = 682; + + var citationTrackerService = new CitationTrackerService(); + + BlCitationTrackerReport ct = citationTrackerService.Get(reportId); +``` + +### Run Report + +```csharp + int reportId = 682; + + var citationTrackerService = new CitationTrackerService(); + + BlSuccess ct = citationTrackerService.Run(reportId); +``` + +### Delete Report + +```csharp + int reportId = 682; + + var citationTrackerService = new CitationTrackerService(); + + BlSuccess ct = citationTrackerService.Delete(reportId); +``` + +### Get Reports + +```csharp + var citationTrackerService = new CitationTrackerService(); + + BlCtGetAllResults ctResults = citationTrackerService.GetAll(); +``` + +### Get Report Results + +```csharp + var reportId = 1; + var citationTrackerService = new CitationTrackerService(); + + BlCitationTrackerResults ctResults = citationTrackerService.GetReportResults(reportId); +``` + +Citation Burst +----- + +### Create Campaign + +```csharp + string brief_description = "Born in Paris in 1972 by sibling duo Maguy and Gilbert Le Coze, Le Bernardin only served fish: Fresh, simple and prepared with respect. After receiving its first Michelin star in 1976, and two more in 1980, the Le Coze’s set to open Le Bernardin in New York in 1986."; + string full_description = "The restaurant has held three stars from the Michelin Guide since its 2005 New York launch and currently ranks 24 on the World’s 50 Best Restaurants list. The New York Zagat Guide has recognized Le Bernardin as top rated in the category of “Best Food” for the last nine consecutive years, and in 2015 was rated by the guide as New York City’s top restaurant for food and service. Le Bernardin has earned seven James Beard Awards since 1998 including “Outstanding Restaurant of the Year,” “Top Chef in New York City,” “Outstanding Service,” “Outstanding Chef in the United States,” “Outstanding Pastry Chef,” “Outstanding Wine Service,” and “Best Restaurant Design” in 2012. Most recently, the Foundation named Maguy Le Coze as Outstanding."; + + CitationBurst cb = new CitationBurst(); + cb.businessName = "Le Bernardin"; + cb.campaignName = "Sample Citation Burst Campaign"; + cb.websiteAddress = "le-bernardin.com"; + cb.campaignCountry = "USA"; + cb.campaignState = "NY"; + cb.campaignCity = "New York"; + cb.businessCategoryId = 605; + cb.businessCategories = new List() { "restaurant", "cafe" }; + cb.address1 = "155 Weest 51st Street"; + cb.address2 = ""; + cb.postcode = "10019"; + cb.contactName = "Hanane Moshe"; + cb.contactFirstName = "Hanane"; + cb.contactTelephone = "+1 212-554-1515"; + cb.briefDescription = brief_description; + cb.fullDescription = full_description; + cb.employeesNumber = 35; + cb.startYear = 1976; + cb.workingHoursApplyToAll = 0; + cb.workingHoursMonStart = 0800; + cb.workingHoursMonEnd = 2200; + cb.workingHoursTueStart = 0800; + cb.workingHoursTueEnd = 2200; + cb.workingHoursWedStart = 0800; + cb.workingHoursWedEnd = 2200; + cb.workingHoursThuStart = 0800; + cb.workingHoursThuEnd = 2200; + cb.workingHoursFriStart = 0800; + cb.workingHoursFriEnd = 2200; + cb.workingHoursSatStart = 1000; + cb.workingHoursSatEnd = 2400; + cb.workingHoursSunStart = 1000; + cb.workingHoursSunEnd = 2400; + cb.paymentMethods = "Cash|Visa"; + + var CitationBurstService = new CitationBurstService(); + + BlSuccess newCb = CitationBurstService.Create(cb); +``` +The returned BlSuccess entity above will have a campaign-id. You will want to persist this for later in order to get citations, confirm & pay, etc. + +### Update Campaign + +```csharp + string brief_description = "Born in Paris in 1972 by sibling duo Maguy and Gilbert Le Coze, Le Bernardin only served fish: Fresh, simple and prepared with respect. After receiving its first Michelin star in 1976, and two more in 1980, the Le Coze’s set to open Le Bernardin in New York in 1986."; + string full_description = "The restaurant has held three stars from the Michelin Guide since its 2005 New York launch and currently ranks 24 on the World’s 50 Best Restaurants list. The New York Zagat Guide has recognized Le Bernardin as top rated in the category of “Best Food” for the last nine consecutive years, and in 2015 was rated by the guide as New York City’s top restaurant for food and service. Le Bernardin has earned seven James Beard Awards since 1998 including “Outstanding Restaurant of the Year,” “Top Chef in New York City,” “Outstanding Service,” “Outstanding Chef in the United States,” “Outstanding Pastry Chef,” “Outstanding Wine Service,” and “Best Restaurant Design” in 2012. Most recently, the Foundation named Maguy Le Coze as Outstanding."; + + UpdateCitationBurst cb = new UpdateCitationBurst(); + cb.campaignId = 1; + cb.businessName = "Le Bernardin"; + cb.campaignName = "Sample Citation Burst Campaign"; + cb.websiteAddress = "le-bernardin.com"; + cb.campaignCountry = "USA"; + cb.campaignState = "NY"; + cb.campaignCity = "New York"; + cb.businessCategoryId = 605; + cb.businessCategories = new List() { "restaurant", "cafe" }; + cb.address1 = "155 Weest 51st Street"; + cb.address2 = ""; + cb.postcode = "10019"; + cb.contactName = "Hanane Moshe"; + cb.contactFirstName = "Hanane"; + cb.contactTelephone = "+1 212-554-1515"; + cb.briefDescription = brief_description; + cb.fullDescription = full_description; + cb.employeesNumber = 35; + cb.startYear = 1976; + cb.workingHoursApplyToAll = 0; + cb.workingHoursMonStart = 0800; + cb.workingHoursMonEnd = 2200; + cb.workingHoursTueStart = 0800; + cb.workingHoursTueEnd = 2200; + cb.workingHoursWedStart = 0800; + cb.workingHoursWedEnd = 2200; + cb.workingHoursThuStart = 0800; + cb.workingHoursThuEnd = 2200; + cb.workingHoursFriStart = 0800; + cb.workingHoursFriEnd = 2200; + cb.workingHoursSatStart = 1000; + cb.workingHoursSatEnd = 2400; + cb.workingHoursSunStart = 1000; + cb.workingHoursSunEnd = 2400; + cb.paymentMethods = "Cash|Visa"; + + var CitationBurstService = new CitationBurstService(); + + BlSuccess newCb = CitationBurstService.Update(cb); +``` + +### Upload Image + +```csharp + CbUploadImage image = new CbUploadImage(); + image.campaignId = 1; + image.file = "/path/to/image.jpg"; + image.imageType = "logo"; + + var CitationBurstService = new CitationBurstService(); + + BlSuccess cbImage = CitationBurstService.UploadImage(image); +``` + +### Get Citations + +```csharp + int campaingId = 1; + var CitationBurstService = new CitationBurstService(); + + BlCitations citations = CitationBurstService.GetCitations(campaingId); +``` + +### Confirm & Pay for Citation Campaign + +```csharp + BlCbPay confirmPay = new BlCbPay(); + confirmPay.campaign_id = 1; + confirmPay.package_id = "cb15"; + + var CitationBurstService = new CitationBurstService(); + + BlSuccess confirm = CitationBurstService.ConfirmAndPay(confirmPay); +``` + +### Getting All Campaigns + +```csharp + var CitationBurstService = new CitationBurstService(); + + BlCbAllCampaigns results = CitationBurstService.GetCampaigns(); +``` + +### Get Campaign Details + +```csharp + int campaignId = 1; + var CitationBurstService = new CitationBurstService(); + + BlCbCampaign results = CitationBurstService.GetCampaign(campaignId); +``` + +### Get Credits Balance + +```csharp + var CitationBurstService = new CitationBurstService(); + + BlSuccess credits = CitationBurstService.GetCredits(); +``` + +ReviewFLow Reports +----- + +### Add Report + +```csharp + var reviewReport = new ReviewFlow(); + reviewReport.reportName = "Sample Citation Tracker Report"; + reviewReport.businessName = "Le Bernardin"; + reviewReport.contactTelephone = "+1 212-554-1515"; + reviewReport.address1 = "155 Weest 51st Street"; + reviewReport.address2 = ""; + reviewReport.city = "NYC"; + reviewReport.postcode = "10019"; + reviewReport.country = "USA"; + + // Example for supplying Local Directory URLs (see local-directory-urls parameter) + reviewReport.directories.Add( + "citysearch", + new Directories + { + url = "http://www.yelp.co.uk/biz/greens-restaurant-san-francisco-3", + include = true + }); + reviewReport.directories.Add( + "dexknows", + new Directories + { + url = "", + include = true + }); + + var rfService = new ReviewFlowService(); + + BlSuccess newReviewReport = rfService.Create(reviewReport); + return newReviewReport; +``` + +The returned BlSuccess entity above will have a report-id. You will want to persist this for later when you get a report. + +### Update Report + +```csharp + var reviewReport = new UpdateReviewFlow(); + reviewReport.reportId = 1; + reviewReport.reportName = "Sample Citation Tracker Report"; + reviewReport.businessName = "Le Bernardin"; + reviewReport.contactTelephone = "+1 212-554-1515"; + reviewReport.address1 = "155 Weest 51st Street"; + reviewReport.address2 = ""; + reviewReport.city = "NYC"; + reviewReport.postcode = "10019"; + reviewReport.country = "USA"; + + // Example for supplying Local Directory URLs (see local-directory-urls parameter) + reviewReport.directories.Add( + "citysearch", + new Directories + { + url = "http://www.yelp.co.uk/biz/greens-restaurant-san-francisco-3", + include = true + }); + reviewReport.directories.Add( + "dexknows", + new Directories + { + url = "", + include = true + }); + + var rfService = new ReviewFlowService(); + + BlSuccess updateReviewReport = rfService.Update(reviewReport); +``` + +### Get Report + +```csharp + int reportId = 1; + var rfService = new ReviewFlowService(); + + BlRfReport reviewReport = rfService.Get(reportId); +``` + +### Delete Report + +```csharp + int reportId = 1; + var rfService = new ReviewFlowService(); + + BlSuccess deleteReport = rfService.Delete(reportId); +``` + +### Get All Reports + +```csharp + var rfService = new ReviewFlowService(); + + BlRfGetAll results = rfService.GetAll(); +``` + +### Search Reports + +```csharp + string query = "New York"; + var rfService = new ReviewFlowService(); + + BlRfGetAll results = rfService.Search(query); +``` + +### Get Reviews + +```csharp + var reviewReport = new RfGetReviews(); + reviewReport.reportId = 1; + var rfService = new ReviewFlowService(); + + BlRfReviews reviews = rfService.GetReviews(reviewReport); +``` + +### Get Review Counts + +```csharp + int reportId = 1; + var rfService = new ReviewFlowService(); + + BlSuccess reviewCount = rfService.GetReviewCount(reportId); +``` + +### Get Growth + +```csharp + int reportId = 1; + var rfService = new ReviewFlowService(); + + BlSuccess reviewGrowth = rfService.GetGrowth(reportId); +``` + +### Get Directories + +```csharp + int reportId = 1; + var rfService = new ReviewFlowService(); + + BlRfDirectories reviewDirectories = rfService.GetDirectories(reportId); +``` + +### Get Directory Stats + +```csharp + int reportId = 1; + var rfService = new ReviewFlowService(); + + BlRfDirectoryStats reviewDirectoryStats = rfService.GetDirectoryStats(reportId); +``` + +### Get Star Counts + +```csharp + int reportId = 1; + var rfService = new ReviewFlowService(); + + BlRfStarCounts reviewStarCount = rfService.GetStarCount(reportId); +``` + +Google Plus Local Wizard Reports +----- + +### Add Report + +```csharp + var gpwReport = new Gpw(); + gpwReport.reportName = "Sample Citation Tracker Report"; + gpwReport.businessNames = "Le Bernardin"; + gpwReport.schedule = "Adhoc"; + gpwReport.dayOfMonth = "2"; + gpwReport.reportType = "with"; + gpwReport.address1 = "155 Weest 51st Street"; + gpwReport.address2 = ""; + gpwReport.city = "NYC"; + gpwReport.stateCode = "NY"; + gpwReport.postcode = "10019"; + gpwReport.phoneNumber = "+1 212-554-1515"; + gpwReport.country = "USA"; + gpwReport.searchTerms = new List() { "restaurant manhattan", "cafe new york" }; + + var gpwService = new GpwService(); + + BlSuccess gpwReport = gpwService.Create(gpwReport); +``` +The returned BlSuccess entity above will have a report-id. You will want to persist this for later in order to run and get the report. + +### Update Report + +```csharp + var gpwReport = new UpdateGpw(); + gpwReport.reportId = 1; + gpwReport.reportName = "Sample Citation Tracker Report"; + gpwReport.businessNames = "Le Bernardin"; + gpwReport.schedule = "Adhoc"; + gpwReport.dayOfMonth = "2"; + gpwReport.reportType = "with"; + gpwReport.address1 = "155 Weest 51st Street"; + gpwReport.address2 = ""; + gpwReport.city = "NYC"; + gpwReport.stateCode = "NY"; + gpwReport.postcode = "10019"; + gpwReport.phoneNumber = "+1 212-554-1515"; + gpwReport.country = "USA"; + gpwReport.searchTerms = new List() { "restaurant manhattan", "cafe new york" }; + + var gpwService = new GpwService(); + + BlSuccess gpwReport = gpwService.Update(gpwReport); +``` + +### Get Report + +```csharp + var reportId = 1; + var gpwService = new GpwService(); + + BlGpwReport gpwReport = gpwService.Get(reportId); +``` + +### Delete Report + +```csharp + var reportId = 1; + var gpwService = new GpwService(); + + BlSuccess gpwReport = gpwService.Delete(reportId); +``` + +### Get All Reports + +```csharp + var gpwService = new GpwService(); + + BlGpwGetAllResults gpwGetAllResults = gpwService.GetAll(); +``` + +### Run Report + +```csharp + var reportId = 1; + var gpwService = new GpwService(); + + BlSuccess gpwReport = gpwService.Run(reportId); +``` + +### Get Report Results + +```csharp + var reportId = 1; + var gpwService = new GpwService(); + + BlGpwReportResults gpwReport = gpwService.GetReportResults(reportId); +```