Skip to content

Commit

Permalink
Merge pull request #429 from HubSpot/feature/discoveriesForNewClients
Browse files Browse the repository at this point in the history
Discoveries for new clients
  • Loading branch information
ksvirkou-hubspot authored Dec 13, 2023
2 parents f4a27a6 + 8734066 commit 72135de
Show file tree
Hide file tree
Showing 22 changed files with 391 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/discovery/cms/CmsDiscovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type AuditLogsDiscovery from './audit_logs/AuditLogsDiscovery'
import type BlogsDiscovery from './blogs/BlogsDiscovery'
import type DomainsDiscovery from './domains/DomainsDiscovery'
import type HubdbDiscovery from './hubdb/HubdbDiscovery'
import type PagesDiscovery from './pages/PagesDiscovery'
import type PerformanceDiscovery from './performance/PerformanceDiscovery'
import type SiteSearchDiscovery from './site_search/SiteSearchDiscovery'
import type SourceCodeDiscovery from './source_code/SourceCodeDiscovery'
Expand All @@ -13,6 +14,7 @@ export default class CmsDiscovery extends BaseDiscovery {
protected _blogs: BlogsDiscovery | undefined
protected _domains: DomainsDiscovery | undefined
protected _hubdb: HubdbDiscovery | undefined
protected _pages: PagesDiscovery | undefined
protected _performance: PerformanceDiscovery | undefined
protected _siteSearch: SiteSearchDiscovery | undefined
protected _sourceCode: SourceCodeDiscovery | undefined
Expand Down Expand Up @@ -70,6 +72,19 @@ export default class CmsDiscovery extends BaseDiscovery {
return this._hubdb
}

/**
* Getter
* @returns PagesDiscovery
*/
get pages() {
if (!this._pages) {
const requiredClass = require('./pages/PagesDiscovery')
this._pages = new requiredClass.default(this.config) as PagesDiscovery
}

return this._pages
}

/**
* Getter
* @returns PerformanceDiscovery
Expand Down
32 changes: 32 additions & 0 deletions src/discovery/cms/pages/PagesDiscovery.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import {
createConfiguration,
LandingPagesApi,
RequestContext,
ResponseContext,
ServerConfiguration,
SitePagesApi,
} from '../../../../codegen/cms/pages/index'
import { Observable } from '../../../../codegen/cms/pages/rxjsStub'
import { ApiClientConfigurator } from '../../../configuration/ApiClientConfigurator'
import IConfiguration from '../../../configuration/IConfiguration'
import ApiDecoratorService from '../../../services/ApiDecoratorService'

export default class PagesDiscovery {
public landingPagesApi: LandingPagesApi
public sitePagesApi: SitePagesApi

constructor(config: IConfiguration) {
const configuration = createConfiguration(
ApiClientConfigurator.getParams<
RequestContext,
ResponseContext,
Observable<RequestContext>,
Observable<ResponseContext>,
ServerConfiguration<{}>
>(config, ServerConfiguration, Observable, Observable),
)

this.landingPagesApi = ApiDecoratorService.getInstance().apply<LandingPagesApi>(new LandingPagesApi(configuration))
this.sitePagesApi = ApiDecoratorService.getInstance().apply<SitePagesApi>(new SitePagesApi(configuration))
}
}
15 changes: 15 additions & 0 deletions src/discovery/crm/CrmDiscovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type DealsDiscovery from './deals/DealsDiscovery'
import type ExtensionsDiscovery from './extensions/ExtensionsDiscovery'
import type ImportsDiscovery from './imports/ImportsDiscovery'
import type LineItemsDiscovery from './line_items/LineItemsDiscovery'
import type ListsDiscovery from './lists/ListsDiscovery'
import type ObjectsDiscovery from './objects/ObjectsDiscovery'
import type OwnersDiscovery from './owners/OwnersDiscovery'
import type PipelinesDiscovery from './pipelines/PipelinesDiscovery'
Expand All @@ -24,6 +25,7 @@ export default class CrmDiscovery extends BaseDiscovery {
protected _extensions: ExtensionsDiscovery | undefined
protected _imports: ImportsDiscovery | undefined
protected _lineItems: LineItemsDiscovery | undefined
protected _lists: ListsDiscovery | undefined
protected _objects: ObjectsDiscovery | undefined
protected _owners: OwnersDiscovery | undefined
protected _pipelines: PipelinesDiscovery | undefined
Expand Down Expand Up @@ -125,6 +127,19 @@ export default class CrmDiscovery extends BaseDiscovery {
return this._lineItems
}

/**
* Getter
* @returns ListsDiscovery
*/
get lists() {
if (!this._lists) {
const requiredClass = require('./lists/ListsDiscovery')
this._lists = new requiredClass.default(this.config) as ListsDiscovery
}

return this._lists
}

/**
* Getter
* @returns ObjectsDiscovery
Expand Down
32 changes: 32 additions & 0 deletions src/discovery/crm/lists/ListsDiscovery.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import {
createConfiguration,
ListsApi,
MembershipsApi,
RequestContext,
ResponseContext,
ServerConfiguration,
} from '../../../../codegen/crm/lists/index'
import { Observable } from '../../../../codegen/crm/lists/rxjsStub'
import { ApiClientConfigurator } from '../../../configuration/ApiClientConfigurator'
import IConfiguration from '../../../configuration/IConfiguration'
import ApiDecoratorService from '../../../services/ApiDecoratorService'

export default class ListsDiscovery {
public listsApi: ListsApi
public membershipsApi: MembershipsApi

constructor(config: IConfiguration) {
const configuration = createConfiguration(
ApiClientConfigurator.getParams<
RequestContext,
ResponseContext,
Observable<RequestContext>,
Observable<ResponseContext>,
ServerConfiguration<{}>
>(config, ServerConfiguration, Observable, Observable),
)

this.listsApi = ApiDecoratorService.getInstance().apply<ListsApi>(new ListsApi(configuration))
this.membershipsApi = ApiDecoratorService.getInstance().apply<MembershipsApi>(new MembershipsApi(configuration))
}
}
30 changes: 30 additions & 0 deletions src/discovery/crm/objects/ObjectsDiscovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ import type CallsDiscovery from './calls/CallsDiscovery'
import type CommunicationsDiscovery from './communications/CommunicationsDiscovery'
import type EmailsDiscovery from './emails/EmailsDiscovery'
import type FeedbackSubmissionsDiscovery from './feedback_submissions/FeedbackSubmissionsDiscovery'
import type GoalsDiscovery from './goals/GoalsDiscovery'
import type MeetingsDiscovery from './meetings/MeetingsDiscovery'
import type NotesDiscovery from './notes/NotesDiscovery'
import type PostalMailDiscovery from './postal_mail/PostalMailDiscovery'
import type TasksDiscovery from './tasks/TasksDiscovery'
import type TaxesDiscovery from './taxes/TaxesDiscovery'

export default class ObjectsDiscovery extends BaseDiscovery {
public associationsApi: AssociationsApi
Expand All @@ -35,10 +37,12 @@ export default class ObjectsDiscovery extends BaseDiscovery {
protected _calls: CallsDiscovery | undefined
protected _emails: EmailsDiscovery | undefined
protected _feedbackSubmissions: FeedbackSubmissionsDiscovery | undefined
protected _goals: GoalsDiscovery | undefined
protected _meetings: MeetingsDiscovery | undefined
protected _notes: NotesDiscovery | undefined
protected _postalMail: PostalMailDiscovery | undefined
protected _tasks: TasksDiscovery | undefined
protected _taxes: TaxesDiscovery | undefined

constructor(config: IConfiguration) {
super(config)
Expand Down Expand Up @@ -112,6 +116,19 @@ export default class ObjectsDiscovery extends BaseDiscovery {
return this._feedbackSubmissions
}

/**
* Getter
* @returns GoalsDiscovery
*/
get goals() {
if (!this._goals) {
const requiredClass = require('./goals/GoalsDiscovery')
this._goals = new requiredClass.default(this.config) as GoalsDiscovery
}

return this._goals
}

/**
* Getter
* @returns MeetingsDiscovery
Expand Down Expand Up @@ -163,4 +180,17 @@ export default class ObjectsDiscovery extends BaseDiscovery {

return this._tasks
}

/**
* Getter
* @returns TasksDiscovery
*/
get taxes() {
if (!this._taxes) {
const requiredClass = require('./taxes/TaxesDiscovery')
this._taxes = new requiredClass.default(this.config) as TaxesDiscovery
}

return this._taxes
}
}
41 changes: 41 additions & 0 deletions src/discovery/crm/objects/goals/GoalsDiscovery.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { createConfiguration } from '../../../../../codegen/crm/objects/goals/configuration'
import {
BasicApi,
BatchApi,
GDPRApi,
PublicObjectApi,
RequestContext,
ResponseContext,
SearchApi,
ServerConfiguration,
} from '../../../../../codegen/crm/objects/goals/index'
import { Observable } from '../../../../../codegen/crm/objects/goals/rxjsStub'
import { ApiClientConfigurator } from '../../../../configuration/ApiClientConfigurator'
import IConfiguration from '../../../../configuration/IConfiguration'
import ApiDecoratorService from '../../../../services/ApiDecoratorService'

export default class GoalsDiscovery {
public basicApi: BasicApi
public batchApi: BatchApi
public gdprApi: GDPRApi
public publicObjectApi: PublicObjectApi
public searchApi: SearchApi

constructor(config: IConfiguration) {
const configuration = createConfiguration(
ApiClientConfigurator.getParams<
RequestContext,
ResponseContext,
Observable<RequestContext>,
Observable<ResponseContext>,
ServerConfiguration<{}>
>(config, ServerConfiguration, Observable, Observable),
)

this.basicApi = ApiDecoratorService.getInstance().apply<BasicApi>(new BasicApi(configuration))
this.batchApi = ApiDecoratorService.getInstance().apply<BatchApi>(new BatchApi(configuration))
this.gdprApi = ApiDecoratorService.getInstance().apply<GDPRApi>(new GDPRApi(configuration))
this.publicObjectApi = ApiDecoratorService.getInstance().apply<PublicObjectApi>(new PublicObjectApi(configuration))
this.searchApi = ApiDecoratorService.getInstance().apply<SearchApi>(new SearchApi(configuration))
}
}
41 changes: 41 additions & 0 deletions src/discovery/crm/objects/taxes/TaxesDiscovery.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { createConfiguration } from '../../../../../codegen/crm/objects/taxes/configuration'
import {
BasicApi,
BatchApi,
GDPRApi,
PublicObjectApi,
RequestContext,
ResponseContext,
SearchApi,
ServerConfiguration,
} from '../../../../../codegen/crm/objects/taxes/index'
import { Observable } from '../../../../../codegen/crm/objects/taxes/rxjsStub'
import { ApiClientConfigurator } from '../../../../configuration/ApiClientConfigurator'
import IConfiguration from '../../../../configuration/IConfiguration'
import ApiDecoratorService from '../../../../services/ApiDecoratorService'

export default class TaxesDiscovery {
public basicApi: BasicApi
public batchApi: BatchApi
public gdprApi: GDPRApi
public publicObjectApi: PublicObjectApi
public searchApi: SearchApi

constructor(config: IConfiguration) {
const configuration = createConfiguration(
ApiClientConfigurator.getParams<
RequestContext,
ResponseContext,
Observable<RequestContext>,
Observable<ResponseContext>,
ServerConfiguration<{}>
>(config, ServerConfiguration, Observable, Observable),
)

this.basicApi = ApiDecoratorService.getInstance().apply<BasicApi>(new BasicApi(configuration))
this.batchApi = ApiDecoratorService.getInstance().apply<BatchApi>(new BatchApi(configuration))
this.gdprApi = ApiDecoratorService.getInstance().apply<GDPRApi>(new GDPRApi(configuration))
this.publicObjectApi = ApiDecoratorService.getInstance().apply<PublicObjectApi>(new PublicObjectApi(configuration))
this.searchApi = ApiDecoratorService.getInstance().apply<SearchApi>(new SearchApi(configuration))
}
}
19 changes: 18 additions & 1 deletion src/discovery/events/EventsDiscovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ import { Observable } from '../../../codegen/events/rxjsStub'
import { ApiClientConfigurator } from '../../configuration/ApiClientConfigurator'
import IConfiguration from '../../configuration/IConfiguration'
import ApiDecoratorService from '../../services/ApiDecoratorService'
import BaseDiscovery from '../BaseDiscovery'
import type SendDiscovery from './send/SendDiscovery'

export default class EventsDiscovery {
export default class EventsDiscovery extends BaseDiscovery {
public eventsApi: EventsApi
protected _send: SendDiscovery | undefined

constructor(config: IConfiguration = {}) {
super(config)
const configuration = createConfiguration(
ApiClientConfigurator.getParams<
RequestContext,
Expand All @@ -26,4 +30,17 @@ export default class EventsDiscovery {

this.eventsApi = ApiDecoratorService.getInstance().apply<EventsApi>(new EventsApi(configuration))
}

/**
* Getter
* @returns SendDiscovery
*/
get send() {
if (!this._send) {
const requiredClass = require('./send/SendDiscovery')
this._send = new requiredClass.default(this.config) as SendDiscovery
}

return this._send
}
}
31 changes: 31 additions & 0 deletions src/discovery/events/send/SendDiscovery.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import {
BehavioralEventsTrackingApi,
createConfiguration,
RequestContext,
ResponseContext,
ServerConfiguration,
} from '../../../../codegen/events/send/index'
import { Observable } from '../../../../codegen/events/send/rxjsStub'
import { ApiClientConfigurator } from '../../../configuration/ApiClientConfigurator'
import IConfiguration from '../../../configuration/IConfiguration'
import ApiDecoratorService from '../../../services/ApiDecoratorService'

export default class EventsDiscovery {
public behavioralEventsTrackingApi: BehavioralEventsTrackingApi

constructor(config: IConfiguration) {
const configuration = createConfiguration(
ApiClientConfigurator.getParams<
RequestContext,
ResponseContext,
Observable<RequestContext>,
Observable<ResponseContext>,
ServerConfiguration<{}>
>(config, ServerConfiguration, Observable, Observable),
)

this.behavioralEventsTrackingApi = ApiDecoratorService.getInstance().apply<BehavioralEventsTrackingApi>(
new BehavioralEventsTrackingApi(configuration),
)
}
}
15 changes: 15 additions & 0 deletions src/discovery/settings/SettingsDiscovery.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
import BaseDiscovery from '../BaseDiscovery'
import type BusinessUnitsDiscovery from './business_units/BusinessUnitsDiscovery'
import type UsersDiscovery from './users/UsersDiscovery'

export default class SettingsDiscovery extends BaseDiscovery {
protected _businessUnits: BusinessUnitsDiscovery | undefined
protected _users: UsersDiscovery | undefined

/**
* Getter
* @returns BusinessUnitsDiscovery
*/
get businessUnits() {
if (!this._businessUnits) {
const requiredClass = require('./business_units/BusinessUnitsDiscovery')
this._businessUnits = new requiredClass.default(this.config) as BusinessUnitsDiscovery
}

return this._businessUnits
}

/**
* Getter
* @returns UsersDiscovery
Expand Down
Loading

0 comments on commit 72135de

Please sign in to comment.