Skip to content

Commit

Permalink
Merge pull request #29 from Mark-RSK/SingleHubAPIKey
Browse files Browse the repository at this point in the history
Pass a common HubSpotApi class to each example method
  • Loading branch information
clarkd authored Aug 3, 2018
2 parents 9698bdf + 215345d commit c24e4a8
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 55 deletions.
8 changes: 1 addition & 7 deletions HubSpot.NET.Examples/Companies.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,8 @@ namespace HubSpot.NET.Examples
{
public class Companies
{
public static void Example()
public static void Example(HubSpotApi api)
{
/**
* Initialize the API with your API Key
* You can find or generate this under Integrations -> HubSpot API key
*/
var api = new HubSpotApi("YOUR-API-KEY-HERE");

/**
* Create a company
*/
Expand Down
14 changes: 3 additions & 11 deletions HubSpot.NET.Examples/CompanyProperties.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
using HubSpot.NET.Api.Company;
using HubSpot.NET.Api.Company.Dto;
using HubSpot.NET.Api.Properties.Dto;
using HubSpot.NET.Api.Properties.Dto;
using HubSpot.NET.Core;

namespace HubSpot.NET.Examples
{
public class CompanyProperties
{
public static void Example()
public static void Example(HubSpotApi api)
{
/**
* Initialize the API with your API Key
* You can find or generate this under Integrations -> HubSpot API key
*/
var api = new HubSpotApi("YOUR-API-KEY-HERE");

/**
/**
* Get all company properties
*/
var properties = api.CompanyProperties.GetAll();
Expand Down
8 changes: 1 addition & 7 deletions HubSpot.NET.Examples/Contacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,8 @@ namespace HubSpot.NET.Examples
{
public class Contacts
{
public static void Example()
public static void Example(HubSpotApi api)
{
/**
* Initialize the API with your API Key
* You can find or generate this under Integrations -> HubSpot API key
*/
var api = new HubSpotApi("YOUR-API-KEY-HERE");

/**
* Search for a contact
*/
Expand Down
8 changes: 1 addition & 7 deletions HubSpot.NET.Examples/Deals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,8 @@ namespace HubSpot.NET.Examples
{
public class Deals
{
public static void Example()
public static void Example(HubSpotApi api)
{
/**
* Initialize the API with your API Key
* You can find or generate this under Integrations -> HubSpot API key
*/
var api = new HubSpotApi("YOUR API KEY HERE");

/**
* Create a deal
*/
Expand Down
10 changes: 2 additions & 8 deletions HubSpot.NET.Examples/EmailSubscriptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,9 @@ namespace HubSpot.NET.Examples
{
public class EmailSubscriptions
{
public static void Example()
public static void Example(HubSpotApi api)
{
/**
* Initialize the API with your API Key
* You can find or generate this under Integrations -> HubSpot API key
*/
var api = new HubSpotApi("YOUR-API-KEY-HERE");

/**
/**
* Get the available subscription types
*/
var all = api.EmailSubscriptions.GetEmailSubscriptionTypes();
Expand Down
27 changes: 12 additions & 15 deletions HubSpot.NET.Examples/Program.cs
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HubSpot.NET.Api.Contact.Dto;
using HubSpot.NET.Api.Engagement.Dto;
using HubSpot.NET.Api.Files.Dto;
using HubSpot.NET.Core;
using HubSpot.NET.Core;

namespace HubSpot.NET.Examples
{
public class Examples
{
static void Main(string[] args)
{
Deals.Example();
/**
* Initialize the API with your API Key
* You can find or generate this under Integrations -> HubSpot API key
*/
var api = new HubSpotApi("YOUR API KEY HERE");

Companies.Example();
Deals.Example(api);

Contacts.Example();
Companies.Example(api);

CompanyProperties.Example();
Contacts.Example(api);

EmailSubscriptions.Example();
CompanyProperties.Example(api);

EmailSubscriptions.Example(api);
}
}
}

0 comments on commit c24e4a8

Please sign in to comment.