public HubSpotContactPropertyApi(IHubSpotClient client) { MidRoute = "/properties/v1/contacts"; _client = client; AddRoute <ContactPropertyModel>("properties"); }
public async Task <IReadOnlyList <Model.Contacts.Contact> > GetContacts(IHubSpotClient client, IReadOnlyList <IProperty> propertiesToQuery) { var contactIds = await GetAllContactIds(); var contacts = new List <HubSpot.Model.Contacts.Contact>(); foreach (var partition in contactIds.Batch(BatchSize)) { var response = await client.Contacts.GetManyByIdAsync(partition.ToArray(), propertiesToQuery, PropertyMode.ValueOnly, FormSubmissionMode.None, false, false); contacts.AddRange(response.Values); } return(contacts); async Task <IReadOnlyList <long> > GetAllContactIds() { var ids = new List <long>(); ContactIdList list = null; do { list = await client.Companies.GetContactIdsInCompanyAsync(_companyId, 25, list?.Offset); ids.AddRange(list.ContactIds); } while (list.HasMore); return(ids); } }
public HubSpotTimelineApi(IHubSpotClient client) { _client = client; MidRoute = $"/integrations/v1/{client.AppId}"; AddRoute <TimelineEventHubSpotModel>("/timeline/event"); AddRoute <TimelineEventTypeHubSpotModel>("/timeline/event-types"); }
public async Task GetAsync_invokes_selector_from_parameters_to_retrieve_deal([Frozen] IHubSpotClient hubSpotClient, [Frozen] IDealSelector dealSelector, HubSpotDealConnector sut) { //Arrange //Act await sut.GetAsync <HubSpot.Deals.Deal>(dealSelector); //Assert Mock.Get(dealSelector).Verify(x => x.GetDeal(hubSpotClient), Times.Once); }
private void InitializeRepos(IHubSpotClient client, string clientId = "", string clientSecret = "") { OAuth = new HubSpotOAuthApi(client, clientId, clientSecret); Company = new HubSpotCompanyApi(client); Contact = new HubSpotContactApi(client); ContactProperty = new HubSpotContactPropertyApi(client); Deal = new HubSpotDealApi(client); Engagement = new HubSpotEngagementApi(client); File = new HubSpotCosFileApi(client); Owner = new HubSpotOwnerApi(client); CompanyProperties = new HubSpotCompaniesPropertiesApi(client); EmailSubscriptions = new HubSpotEmailSubscriptionsApi(client); Timelines = new HubSpotTimelineApi(client); }
public async Task <IReadOnlyList <Model.Contacts.Contact> > GetContacts(IHubSpotClient client, IReadOnlyList <IProperty> propertiesToQuery) { long?offset = null; var result = new List <Model.Contacts.Contact>(); (IReadOnlyList <Model.Contacts.Contact> list, bool hasMore, long?offset)tuple; do { tuple = await Get(client, propertiesToQuery, offset).ConfigureAwait(false); offset = tuple.offset; result.AddRange(tuple.list); } while (tuple.hasMore); return(result); }
public EngagementsIterator(IHubSpotClient client, HubSpotCrawlJobData jobData) : base(client, jobData) { }
public HubSpotDealApi(IHubSpotClient client) { _client = client; AddRoute <DealHubSpotModel>("/deal"); }
public HubSpotContactConnector(IHubSpotClient client, IContactTypeManager typeManager) { _client = client ?? throw new ArgumentNullException(nameof(client)); _typeManager = typeManager ?? throw new ArgumentNullException(nameof(typeManager)); }
public HubSpotDealApi(IHubSpotClient client) : base(client) { }
public StaticContactListIterator(IHubSpotClient client, HubSpotCrawlJobData jobData) : base(client, jobData) { }
public RecentDealsIterator(IHubSpotClient client, HubSpotCrawlJobData jobData) : base(client, jobData) { }
protected override async Task <(IReadOnlyList <Model.Contacts.Contact> list, bool hasMore, long?offset)> Get(IHubSpotClient client, IReadOnlyList <IProperty> propertiesToQuery, long?offset) { var response = await client.Contacts.SearchAsync(_searchQuery, propertiesToQuery, 25, offset); return(response.Contacts, response.HasMore, response.Offset); }
public HubSpotDealApi(IHubSpotClient client) { _client = client; }
protected HubSpotIteratorBase(IHubSpotClient client, HubSpotCrawlJobData jobData) { Client = client ?? throw new ArgumentNullException(nameof(client)); JobData = jobData ?? throw new ArgumentNullException(nameof(jobData)); }
protected override async Task <(IReadOnlyList <Model.Deals.Deal> list, bool hasMore, long?offset)> GetDeals(IHubSpotClient client, IReadOnlyList <IProperty> propertiesToQuery, long?offset) { var response = await client.Deals.GetRecentlyCreatedAsync(count : 20, offset : offset); return(response.Results, response.HasMore, response.Offset); }
public HubSpotEmailSubscriptionsApi(IHubSpotClient client) { _client = client; }
public TemplatesIterator(IHubSpotClient client, HubSpotCrawlJobData jobData) : base(client, jobData) { }
public HubSpotEngagementApi(IHubSpotClient client) { _client = client; AddRoute <EngagementHubSpotModel>("engagements/"); }
public async Task GetAsync_returns_converted_deal([Frozen] IDealTypeManager dealTypeManager, [Frozen] IHubSpotClient hubSpotClient, [Frozen] IDealSelector dealSelector, HubSpot.Deals.Deal convertedDeal, HubSpotDealConnector sut, IFixture fixture) { //Arrange Mock.Get(dealTypeManager).Setup(x => x.ConvertTo <HubSpot.Deals.Deal>(It.IsAny <HubSpot.Model.Deals.Deal>())).Returns(convertedDeal); //Act var result = await sut.GetAsync <HubSpot.Deals.Deal>(dealSelector); //Assert Assert.That(result, Is.EqualTo(convertedDeal)); }
public HubSpotEngagementApi(IHubSpotClient client) { _client = client; }
public HubSpotEmailSubscriptionsApi(IHubSpotClient client) { _client = client; AddRoute <SubscriptionTimelineHubSpotModel>("timeline"); }
public async Task GetAsync_invokes_deal_type_manager_to_convert_selector_result([Frozen] IDealTypeManager dealTypeManager, [Frozen] IHubSpotClient hubSpotClient, [Frozen] IDealSelector dealSelector, HubSpotDealConnector sut, HubSpot.Model.Deals.Deal deal) { //Arrange Mock.Get(dealSelector).Setup(x => x.GetDeal(hubSpotClient)).Returns(Task.FromResult(deal)); //Act await sut.GetAsync <HubSpot.Deals.Deal>(dealSelector); //Assert Mock.Get(dealTypeManager).Verify(x => x.ConvertTo <HubSpot.Deals.Deal>(deal), Times.Once); }
public HubSpotCompaniesPropertiesApi(IHubSpotClient client) { _client = client; }
public async Task GetAsync_returns_null_if_deal_retrieving_throws_NotFoundException([Frozen] IHubSpotClient hubSpotClient, [Frozen] IDealSelector dealSelector, HubSpotDealConnector sut, NotFoundException notFoundException) { //Arrange Mock.Get(dealSelector).Setup(x => x.GetDeal(hubSpotClient)).Throws(notFoundException); //Act var result = await sut.GetAsync <HubSpot.Deals.Deal>(dealSelector); //Assert Assert.That(result, Is.Null); }
public Task <Model.Contacts.Contact> GetContact(IHubSpotClient client, IReadOnlyList <IProperty> propertiesToQuery) { return(client.Contacts.GetByIdAsync(_contactId, propertiesToQuery, PropertyMode.ValueOnly, FormSubmissionMode.None, false)); }
public HubSpotContactApi(IHubSpotClient client) { _client = client; }
public TicketsIterator(IHubSpotClient client, HubSpotCrawlJobData jobData, Settings properties) : base(client, jobData) { _settings = properties ?? throw new ArgumentNullException(nameof(properties)); }
public BlogPostsIterator(IHubSpotClient client, HubSpotCrawlJobData jobData) : base(client, jobData) { }
public HubSpotCompanyApi(IHubSpotClient client) : base(client) { }