Documentation
¶
Index ¶
- type BulkResolveHubspotCompanyReviewsEndpoint
- type BulkResolveHubspotCompanyReviewsRequest
- type CancelHubspotSyncEndpoint
- type CancelHubspotSyncRequest
- type CreateNewHubspotCompanyReviewEndpoint
- type CreateNewHubspotCompanyReviewRequest
- type ExecuteHubspotSyncEndpoint
- type ExecuteHubspotSyncRequest
- type ExportHubspotCompanyReviewsEndpoint
- type ExportHubspotCompanyReviewsRequest
- type GetCurrentHubspotSyncEndpoint
- type GetCurrentHubspotSyncRequest
- type GetHubspotSyncJobEndpoint
- type GetHubspotSyncJobRequest
- type HubspotCompanyReviewResolutionInput
- type HubspotSyncSvc
- type HubspotSyncSvcConfig
- type LinkHubspotCompanyReviewEndpoint
- type LinkHubspotCompanyReviewRequest
- type ListHubspotCompanyReviewsEndpoint
- type ListHubspotCompanyReviewsRequest
- type ListHubspotSyncRecordsEndpoint
- type ListHubspotSyncRecordsRequest
- type SkipHubspotCompanyReviewEndpoint
- type SkipHubspotCompanyReviewRequest
- type StartHubspotSyncEndpoint
- type StartHubspotSyncRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BulkResolveHubspotCompanyReviewsEndpoint ¶
type BulkResolveHubspotCompanyReviewsEndpoint struct{}
Applies many company-match decisions to a sync at once, the way a reviewed spreadsheet comes back in.
The decisions are validated against the sync synchronously — an unknown review, or one belonging to another sync, fails the whole request — and then applied by a background job. Poll the returned job to follow it: each decision that could not be applied lands in the job's `errors`, keyed by its index in `reviews`, while the rest still take effect.
func (*BulkResolveHubspotCompanyReviewsEndpoint) Materialize ¶
func (e *BulkResolveHubspotCompanyReviewsEndpoint) Materialize() *apiendpoint.APIEndpoint[*BulkResolveHubspotCompanyReviewsRequest, *apiresource.Job]
type BulkResolveHubspotCompanyReviewsRequest ¶
type BulkResolveHubspotCompanyReviewsRequest struct {
// HubSpot sync job ID.
JobID string `path:"id" validate:"required"`
// The decisions to apply. Every review must belong to this sync.
Reviews []HubspotCompanyReviewResolutionInput `json:"reviews" validate:"required,min=1,max=1000,dive"`
}
Request to resolve many company reviews at once.
func (*BulkResolveHubspotCompanyReviewsRequest) SchemaExample ¶
func (*BulkResolveHubspotCompanyReviewsRequest) SchemaExample() any
type CancelHubspotSyncEndpoint ¶
type CancelHubspotSyncEndpoint struct{}
Cancels a HubSpot sync job that is still in progress, releasing the account to start a new one.
Use this when a sync is stuck — for example when the worker running it stopped without recording an outcome. The job is marked failed, with the cancelling user recorded in `last_error`. Anything already written to HubSpot stays there; cancelling only stops the run. A sync that has already completed or failed cannot be cancelled.
func (*CancelHubspotSyncEndpoint) Materialize ¶
func (e *CancelHubspotSyncEndpoint) Materialize() *apiendpoint.APIEndpoint[*CancelHubspotSyncRequest, *apiresource.HubspotSyncJob]
type CancelHubspotSyncRequest ¶
type CancelHubspotSyncRequest struct {
// HubSpot sync job ID.
JobID string `path:"id" validate:"required"`
}
Request to cancel an in-progress HubSpot sync job.
type CreateNewHubspotCompanyReviewEndpoint ¶
type CreateNewHubspotCompanyReviewEndpoint struct{}
Resolves a reviewed customer by creating a new HubSpot company for it during the sync (rather than linking to an existing one).
func (*CreateNewHubspotCompanyReviewEndpoint) Materialize ¶
func (e *CreateNewHubspotCompanyReviewEndpoint) Materialize() *apiendpoint.APIEndpoint[*CreateNewHubspotCompanyReviewRequest, *apiresource.HubspotCompanyReview]
type CreateNewHubspotCompanyReviewRequest ¶
type CreateNewHubspotCompanyReviewRequest struct {
// HubSpot sync job ID.
JobID string `path:"id" validate:"required"`
// Company review ID.
ReviewID string `path:"review_id" validate:"required"`
}
Request to resolve a company review by creating a new HubSpot company.
type ExecuteHubspotSyncEndpoint ¶
type ExecuteHubspotSyncEndpoint struct{}
Executes a reviewed HubSpot sync job, writing companies, contacts, and Closed-Won deals to HubSpot.
Every company review must be resolved or skipped first, and the job's preview pass must have finished — a sync that failed mid-preview has incomplete matches and cannot be executed, so start a new one instead. Writing happens in the background: this returns as soon as the job is claimed, and the job moves to `executing`. Calling it again while the sync is running is rejected, but a run that failed part-way can be executed again to resume where it stopped.
func (*ExecuteHubspotSyncEndpoint) Materialize ¶
func (e *ExecuteHubspotSyncEndpoint) Materialize() *apiendpoint.APIEndpoint[*ExecuteHubspotSyncRequest, *apiresource.HubspotSyncJob]
type ExecuteHubspotSyncRequest ¶
type ExecuteHubspotSyncRequest struct {
// HubSpot sync job ID.
JobID string `path:"id" validate:"required"`
}
Request to execute a reviewed HubSpot sync job.
type ExportHubspotCompanyReviewsEndpoint ¶
type ExportHubspotCompanyReviewsEndpoint struct{}
Starts an export of a sync's company-match review queue and returns the job that tracks it.
The file carries each customer's name, email, and website alongside its candidate HubSpot companies, plus blank `Decision` and `HubSpot Company ID` columns. Filling those in and posting the rows back to the bulk-resolve endpoint applies them, so the queue can be worked outside the dashboard.
func (*ExportHubspotCompanyReviewsEndpoint) Materialize ¶
func (e *ExportHubspotCompanyReviewsEndpoint) Materialize() *apiendpoint.APIEndpoint[*ExportHubspotCompanyReviewsRequest, *apiresource.Job]
type ExportHubspotCompanyReviewsRequest ¶
type ExportHubspotCompanyReviewsRequest struct {
// HubSpot sync job ID.
JobID string `path:"id" validate:"required"`
// Restrict the file to reviews in this resolution status.
Status *constants.HubspotCompanyReviewStatus `json:"status"`
}
Filters which of a sync's company reviews land in the exported file.
func (*ExportHubspotCompanyReviewsRequest) SchemaExample ¶
func (*ExportHubspotCompanyReviewsRequest) SchemaExample() any
type GetCurrentHubspotSyncEndpoint ¶
type GetCurrentHubspotSyncEndpoint struct{}
Retrieves the account's most recent HubSpot sync job so a dashboard can resume an in-progress sync after a refresh.
Returns a not-found error when no sync has ever been started for the account.
func (*GetCurrentHubspotSyncEndpoint) Materialize ¶
func (e *GetCurrentHubspotSyncEndpoint) Materialize() *apiendpoint.APIEndpoint[*GetCurrentHubspotSyncRequest, *apiresource.HubspotSyncJob]
type GetCurrentHubspotSyncRequest ¶
type GetCurrentHubspotSyncRequest struct{}
Request to retrieve the account's current HubSpot sync job.
type GetHubspotSyncJobEndpoint ¶
type GetHubspotSyncJobEndpoint struct{}
Retrieves a HubSpot sync job, including its current status and the dry-run report produced by the preview pass.
Poll this endpoint to track the progress of a running sync.
func (*GetHubspotSyncJobEndpoint) Materialize ¶
func (e *GetHubspotSyncJobEndpoint) Materialize() *apiendpoint.APIEndpoint[*GetHubspotSyncJobRequest, *apiresource.HubspotSyncJob]
type GetHubspotSyncJobRequest ¶
type GetHubspotSyncJobRequest struct {
// HubSpot sync job ID.
JobID string `path:"id" validate:"required"`
}
Request to retrieve a HubSpot sync job.
type HubspotCompanyReviewResolutionInput ¶
type HubspotCompanyReviewResolutionInput struct {
// The review being decided.
ReviewID string `json:"review_id" validate:"required"`
// What to do with the customer.
//
// - `link`: match it to the existing HubSpot company named by `resolved_hubspot_id`.
// - `create_new`: create a new HubSpot company for it.
// - `skip`: leave the customer and its orders out of the sync.
Action constants.HubspotCompanyReviewAction `json:"action" validate:"required"`
// The HubSpot company id to link to. Required when `action` is `link`.
ResolvedHubspotID *string `json:"resolved_hubspot_id"`
}
One company-match decision.
type HubspotSyncSvc ¶
type HubspotSyncSvc interface {
StartSync(ctx context.Context, req *StartHubspotSyncRequest) (*apiresource.HubspotSyncJob, *apierror.APIError)
GetCurrentSyncJob(ctx context.Context, req *GetCurrentHubspotSyncRequest) (*apiresource.HubspotSyncJob, *apierror.APIError)
GetSyncJob(ctx context.Context, req *GetHubspotSyncJobRequest) (*apiresource.HubspotSyncJob, *apierror.APIError)
CancelSync(ctx context.Context, req *CancelHubspotSyncRequest) (*apiresource.HubspotSyncJob, *apierror.APIError)
ListSyncRecords(ctx context.Context, req *ListHubspotSyncRecordsRequest) (*apiresource.List[apiresource.HubspotSyncRecord], *apierror.APIError)
ListCompanyReviews(ctx context.Context, req *ListHubspotCompanyReviewsRequest) (*apiresource.List[apiresource.HubspotCompanyReview], *apierror.APIError)
LinkCompanyReview(ctx context.Context, req *LinkHubspotCompanyReviewRequest) (*apiresource.HubspotCompanyReview, *apierror.APIError)
CreateNewCompanyReview(ctx context.Context, req *CreateNewHubspotCompanyReviewRequest) (*apiresource.HubspotCompanyReview, *apierror.APIError)
SkipCompanyReview(ctx context.Context, req *SkipHubspotCompanyReviewRequest) (*apiresource.HubspotCompanyReview, *apierror.APIError)
BulkResolveCompanyReviews(ctx context.Context, req *BulkResolveHubspotCompanyReviewsRequest) (*apiresource.Job, *apierror.APIError)
ExportCompanyReviews(ctx context.Context, req *ExportHubspotCompanyReviewsRequest) (*apiresource.Job, *apierror.APIError)
ExecuteSync(ctx context.Context, req *ExecuteHubspotSyncRequest) (*apiresource.HubspotSyncJob, *apierror.APIError)
}
HubspotSyncSvc backs the HubSpot backfill endpoints by calling the core-service gRPC API.
func NewHubspotSyncSvc ¶
func NewHubspotSyncSvc(config *HubspotSyncSvcConfig) HubspotSyncSvc
type HubspotSyncSvcConfig ¶
type HubspotSyncSvcConfig struct {
// CoreClient (required) is the core-service HubSpot sync gRPC client.
CoreClient pb.CoreHubspotSyncServiceClient
}
HubspotSyncSvcConfig configures the HubSpot sync endpoint service.
type LinkHubspotCompanyReviewEndpoint ¶
type LinkHubspotCompanyReviewEndpoint struct{}
Links a reviewed customer to an existing HubSpot company, resolving the review so the sync can proceed.
func (*LinkHubspotCompanyReviewEndpoint) Materialize ¶
func (e *LinkHubspotCompanyReviewEndpoint) Materialize() *apiendpoint.APIEndpoint[*LinkHubspotCompanyReviewRequest, *apiresource.HubspotCompanyReview]
type LinkHubspotCompanyReviewRequest ¶
type LinkHubspotCompanyReviewRequest struct {
// HubSpot sync job ID.
JobID string `path:"id" validate:"required"`
// Company review ID.
ReviewID string `path:"review_id" validate:"required"`
// The HubSpot company id to link this customer to.
ResolvedHubspotID string `json:"resolved_hubspot_id" validate:"required"`
}
Request to link a company review to an existing HubSpot company.
func (*LinkHubspotCompanyReviewRequest) SchemaExample ¶
func (*LinkHubspotCompanyReviewRequest) SchemaExample() any
type ListHubspotCompanyReviewsEndpoint ¶
type ListHubspotCompanyReviewsEndpoint struct{}
Lists the company-match review queue for a sync job — the customers that could not be confidently matched to a HubSpot company and need a human decision before the sync executes.
The whole queue is returned in a single response, without pagination.
func (*ListHubspotCompanyReviewsEndpoint) Materialize ¶
func (e *ListHubspotCompanyReviewsEndpoint) Materialize() *apiendpoint.APIEndpoint[*ListHubspotCompanyReviewsRequest, *apiresource.List[apiresource.HubspotCompanyReview]]
type ListHubspotCompanyReviewsRequest ¶
type ListHubspotCompanyReviewsRequest struct {
// HubSpot sync job ID.
JobID string `path:"id" validate:"required"`
// Restrict the results to reviews in this resolution status.
Status *constants.HubspotCompanyReviewStatus `query:"status"`
}
Request to list a sync job's company-match reviews.
type ListHubspotSyncRecordsEndpoint ¶
type ListHubspotSyncRecordsEndpoint struct{}
Lists the mappings the HubSpot sync has recorded for the account — each OpenMRP record and the HubSpot object it maps to.
A mapping is recorded as soon as the sync resolves a record's HubSpot object, which for a confidently matched customer happens during the read-only preview, before anything has been written to HubSpot. Results are ordered by OpenMRP record id.
func (*ListHubspotSyncRecordsEndpoint) Materialize ¶
func (e *ListHubspotSyncRecordsEndpoint) Materialize() *apiendpoint.APIEndpoint[*ListHubspotSyncRecordsRequest, *apiresource.List[apiresource.HubspotSyncRecord]]
type ListHubspotSyncRecordsRequest ¶
type ListHubspotSyncRecordsRequest struct {
// The kind of mapping to list.
//
// One request returns one kind of mapping; omit this to list the customer-to-company mappings.
AugnoType constants.HubspotSyncRecordAugnoType `query:"augno_type" default:"customer"`
// Opaque cursor token identifying where the page of results starts.
//
// Use the `cursor` value embedded in a previous response's `next_page_url` to fetch the next page. Omit to start from the first page.
Cursor *string `query:"cursor"`
// Maximum number of results to return in a single page.
Limit int32 `query:"limit" default:"100" validate:"min=1,max=1000"`
}
Request to list the account's HubSpot sync records.
func (*ListHubspotSyncRecordsRequest) SchemaExample ¶
func (*ListHubspotSyncRecordsRequest) SchemaExample() any
SchemaExample documents this endpoint's list query parameters for OpenAPI. The cursor keysets on the record's augno_id, so it is a string cursor rather than the id-based one PaginationRequest documents.
type SkipHubspotCompanyReviewEndpoint ¶
type SkipHubspotCompanyReviewEndpoint struct{}
Skips a reviewed customer, excluding it (and its orders) from the sync entirely.
func (*SkipHubspotCompanyReviewEndpoint) Materialize ¶
func (e *SkipHubspotCompanyReviewEndpoint) Materialize() *apiendpoint.APIEndpoint[*SkipHubspotCompanyReviewRequest, *apiresource.HubspotCompanyReview]
type SkipHubspotCompanyReviewRequest ¶
type SkipHubspotCompanyReviewRequest struct {
// HubSpot sync job ID.
JobID string `path:"id" validate:"required"`
// Company review ID.
ReviewID string `path:"review_id" validate:"required"`
}
Request to skip a company review.
type StartHubspotSyncEndpoint ¶
type StartHubspotSyncEndpoint struct{}
Starts a one-time HubSpot backfill for the account and kicks off the read-only preview pass.
The job matches existing customers to HubSpot companies and produces a dry-run report; it writes nothing to HubSpot until the review queue is resolved and the sync is executed. Poll the returned job to know when the preview has finished.
Only one sync can be underway at a time: starting another while a sync is previewing, awaiting review, or executing is rejected. If the account has no active HubSpot integration, the job is still created but its preview pass fails immediately.
func (*StartHubspotSyncEndpoint) Materialize ¶
func (e *StartHubspotSyncEndpoint) Materialize() *apiendpoint.APIEndpoint[*StartHubspotSyncRequest, *apiresource.HubspotSyncJob]
type StartHubspotSyncRequest ¶
type StartHubspotSyncRequest struct {
// Orders placed on or after this date are backfilled as Closed-Won deals during the sync.
//
// Only the UTC date is used, so the whole of that day is included regardless of the time of day given. Omit to sync companies and contacts only, with no historical deals.
GoLiveCutoffAt field.Optional[time.Time] `json:"go_live_cutoff_at,omitzero"`
}
Request to start a HubSpot backfill.
func (*StartHubspotSyncRequest) SchemaExample ¶
func (*StartHubspotSyncRequest) SchemaExample() any
Source Files
¶
- endpoint_bulk_resolve_hubspot_company_reviews.go
- endpoint_cancel_hubspot_sync.go
- endpoint_create_new_hubspot_company_review.go
- endpoint_execute_hubspot_sync.go
- endpoint_export_hubspot_company_reviews.go
- endpoint_get_current_hubspot_sync.go
- endpoint_get_hubspot_sync_job.go
- endpoint_link_hubspot_company_review.go
- endpoint_list_hubspot_company_reviews.go
- endpoint_list_hubspot_sync_records.go
- endpoint_skip_hubspot_company_review.go
- endpoint_start_hubspot_sync.go
- service.go