Skip to content

Commit c24e4a8

Browse files
authored
Merge pull request #29 from Mark-RSK/SingleHubAPIKey
Pass a common HubSpotApi class to each example method
2 parents 9698bdf + 215345d commit c24e4a8

File tree

6 files changed

+20
-55
lines changed

6 files changed

+20
-55
lines changed

HubSpot.NET.Examples/Companies.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,8 @@ namespace HubSpot.NET.Examples
66
{
77
public class Companies
88
{
9-
public static void Example()
9+
public static void Example(HubSpotApi api)
1010
{
11-
/**
12-
* Initialize the API with your API Key
13-
* You can find or generate this under Integrations -> HubSpot API key
14-
*/
15-
var api = new HubSpotApi("YOUR-API-KEY-HERE");
16-
1711
/**
1812
* Create a company
1913
*/

HubSpot.NET.Examples/CompanyProperties.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
1-
using HubSpot.NET.Api.Company;
2-
using HubSpot.NET.Api.Company.Dto;
3-
using HubSpot.NET.Api.Properties.Dto;
1+
using HubSpot.NET.Api.Properties.Dto;
42
using HubSpot.NET.Core;
53

64
namespace HubSpot.NET.Examples
75
{
86
public class CompanyProperties
97
{
10-
public static void Example()
8+
public static void Example(HubSpotApi api)
119
{
12-
/**
13-
* Initialize the API with your API Key
14-
* You can find or generate this under Integrations -> HubSpot API key
15-
*/
16-
var api = new HubSpotApi("YOUR-API-KEY-HERE");
17-
18-
/**
10+
/**
1911
* Get all company properties
2012
*/
2113
var properties = api.CompanyProperties.GetAll();

HubSpot.NET.Examples/Contacts.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,8 @@ namespace HubSpot.NET.Examples
1010
{
1111
public class Contacts
1212
{
13-
public static void Example()
13+
public static void Example(HubSpotApi api)
1414
{
15-
/**
16-
* Initialize the API with your API Key
17-
* You can find or generate this under Integrations -> HubSpot API key
18-
*/
19-
var api = new HubSpotApi("YOUR-API-KEY-HERE");
20-
2115
/**
2216
* Search for a contact
2317
*/

HubSpot.NET.Examples/Deals.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,8 @@ namespace HubSpot.NET.Examples
77
{
88
public class Deals
99
{
10-
public static void Example()
10+
public static void Example(HubSpotApi api)
1111
{
12-
/**
13-
* Initialize the API with your API Key
14-
* You can find or generate this under Integrations -> HubSpot API key
15-
*/
16-
var api = new HubSpotApi("YOUR API KEY HERE");
17-
1812
/**
1913
* Create a deal
2014
*/

HubSpot.NET.Examples/EmailSubscriptions.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,9 @@ namespace HubSpot.NET.Examples
55
{
66
public class EmailSubscriptions
77
{
8-
public static void Example()
8+
public static void Example(HubSpotApi api)
99
{
10-
/**
11-
* Initialize the API with your API Key
12-
* You can find or generate this under Integrations -> HubSpot API key
13-
*/
14-
var api = new HubSpotApi("YOUR-API-KEY-HERE");
15-
16-
/**
10+
/**
1711
* Get the available subscription types
1812
*/
1913
var all = api.EmailSubscriptions.GetEmailSubscriptionTypes();

HubSpot.NET.Examples/Program.cs

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.IO;
4-
using System.Linq;
5-
using System.Text;
6-
using System.Threading.Tasks;
7-
using HubSpot.NET.Api.Contact.Dto;
8-
using HubSpot.NET.Api.Engagement.Dto;
9-
using HubSpot.NET.Api.Files.Dto;
10-
using HubSpot.NET.Core;
1+
using HubSpot.NET.Core;
112

123
namespace HubSpot.NET.Examples
134
{
145
public class Examples
156
{
167
static void Main(string[] args)
178
{
18-
Deals.Example();
9+
/**
10+
* Initialize the API with your API Key
11+
* You can find or generate this under Integrations -> HubSpot API key
12+
*/
13+
var api = new HubSpotApi("YOUR API KEY HERE");
1914

20-
Companies.Example();
15+
Deals.Example(api);
2116

22-
Contacts.Example();
17+
Companies.Example(api);
2318

24-
CompanyProperties.Example();
19+
Contacts.Example(api);
2520

26-
EmailSubscriptions.Example();
21+
CompanyProperties.Example(api);
22+
23+
EmailSubscriptions.Example(api);
2724
}
2825
}
2926
}

0 commit comments

Comments
 (0)