:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { apiMutator } from '../../../../frontend/src/lib/api-orval-mutator'
/**
* Auto-generated from the Django backend OpenAPI schema.
* To modify these types, update the Django serializers or views, then run:
* hogli build:openapi
* Questions or issues? #team-devex on Slack
*
* PostHog API - generated
* OpenAPI spec version: 1.0.0
*/
import type {
CheckDatabaseNameResponseApi,
CheckIncrementalApi,
CheckSchemaNameResponseApi,
CreateTableFromUploadApi,
DataHealthIssuesResponseApi,
DataModelingJobApi,
DataModelingJobsListParams,
DataQualityGateConfigApi,
DataWarehouseCheckDatabaseNameRetrieveParams,
DataWarehouseCheckSchemaNameRetrieveParams,
DataWarehouseCompletedActivityRetrieveParams,
DataWarehouseExpressionApi,
DataWarehouseJobStatsRetrieveParams,
DataWarehouseManagedViewSetApi,
DataWarehouseManagedViewSetResponseApi,
DataWarehouseManagedViewSetUpdateResponseApi,
DataWarehouseManagedWarehouseMonitoringTimeseriesRetrieveParams,
DataWarehouseManagedWarehouseSourceSchemasRetrieveParams,
DataWarehouseManagedWarehouseTrinoMonitoringTimeseriesRetrieveParams,
DataWarehouseRunningActivityRetrieveParams,
DataWarehouseSavedQueryApi,
DataWarehouseSavedQueryColumnAnnotationApi,
DataWarehouseSavedQueryDraftApi,
DataWarehouseSavedQueryFolderApi,
DeleteWarehouseOrgResponseApi,
DeprovisionWarehouseResponseApi,
FileUploadResponseApi,
FixHogqlListParams,
IncrementalEligibilityApi,
InsightVariableApi,
InsightVariablesListParams,
ManagedWarehouseDataStatusResponseApi,
ManagedWarehouseMonitoringSeriesResponseApi,
ManagedWarehouseMonitoringSnapshotResponseApi,
ManagedWarehouseSourceSchemasResponseApi,
ManagedWarehouseTrinoMonitoringSnapshotResponseApi,
OnboardWarehouseTeamRequestApi,
OnboardWarehouseTeamResponseApi,
PaginatedDataModelingJobListApi,
PaginatedDataWarehouseExpressionListApi,
PaginatedDataWarehouseSavedQueryColumnAnnotationListApi,
PaginatedDataWarehouseSavedQueryDraftListApi,
PaginatedDataWarehouseSavedQueryMinimalListApi,
PaginatedInsightVariableListApi,
PaginatedQueryTabStateListApi,
PaginatedTableListApi,
PaginatedViewLinkListApi,
PaginatedWarehouseColumnAnnotationListApi,
PatchedDataQualityGateConfigApi,
PatchedDataWarehouseExpressionApi,
PatchedDataWarehouseSavedQueryApi,
PatchedDataWarehouseSavedQueryColumnAnnotationApi,
PatchedDataWarehouseSavedQueryDraftApi,
PatchedDataWarehouseSavedQueryFolderApi,
PatchedInsightVariableApi,
PatchedQueryTabStateApi,
PatchedTableApi,
PatchedViewLinkApi,
PatchedWarehouseColumnAnnotationApi,
PipelineActivityResponseApi,
PipelineJobStatsResponseApi,
PipelineRowsStatsResponseApi,
ProvisionWarehouseRequestApi,
ProvisionWarehouseResponseApi,
QueryTabStateApi,
QueryTabStateListParams,
QueryTabStateUserRetrieveParams,
ResetPasswordResponseApi,
SavedQueryAncestorsApi,
SavedQueryColumnAnnotationsListParams,
SavedQueryDependenciesApi,
SavedQueryDescendantsApi,
SavedQueryLineageRequestApi,
SavedQueryMaterializeApi,
SavedQueryResumeApi,
SavedQueryResumeRequestApi,
SavedQueryResumeSchedulesRequestApi,
SavedQueryRunApi,
SavedQueryRunResponseApi,
TableApi,
UploadedFileApi,
ViewLinkApi,
ViewLinkValidationApi,
ViewLinkValidationResponseApi,
WarehouseColumnAnnotationApi,
WarehouseColumnAnnotationsListParams,
WarehouseExpressionsListParams,
WarehouseSavedQueriesListParams,
WarehouseSavedQueryDraftsListParams,
WarehouseStatusResponseApi,
WarehouseTablesListParams,
WarehouseTablesUploadFileCreateBody,
WarehouseViewLinkListParams,
WarehouseViewLinksListParams,
} from './api.schemas'
// https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497
type IfEquals<X, Y, A = X, B = never> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? A : B
type WritableKeys<T> = {
[P in keyof T]-?: IfEquals<{ [Q in P]: T[P] }, { -readonly [Q in P]: T[P] }, P>
}[keyof T]
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never
type DistributeReadOnlyOverUnions<T> = T extends any ? NonReadonly<T> : never
type Writable<T> = Pick<T, WritableKeys<T>>
type NonReadonly<T> = [T] extends [UnionToIntersection<T>]
? {
[P in keyof Writable<T>]: T[P] extends object ? NonReadonly<NonNullable<T[P]>> : T[P]
}
: DistributeReadOnlyOverUnions<T>
export const getDataModelingJobsListUrl = (projectId: string, params?: DataModelingJobsListParams) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/data_modeling_jobs/?${stringifiedParams}`
: `/api/projects/${projectId}/data_modeling_jobs/`
}
/**
* List data modeling jobs which are "runs" for our saved queries.
*/
export const dataModelingJobsList = async (
projectId: string,
params?: DataModelingJobsListParams,
options?: RequestInit
): Promise<PaginatedDataModelingJobListApi> => {
return apiMutator<PaginatedDataModelingJobListApi>(getDataModelingJobsListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getDataModelingJobsRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/data_modeling_jobs/${id}/`
}
/**
* List data modeling jobs which are "runs" for our saved queries.
*/
export const dataModelingJobsRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<DataModelingJobApi> => {
return apiMutator<DataModelingJobApi>(getDataModelingJobsRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getDataModelingJobsRecentRetrieveUrl = (projectId: string) => {
return `/api/projects/${projectId}/data_modeling_jobs/recent/`
}
/**
* Get the most recent non-running job for each saved query from the v2 backend.
*/
export const dataModelingJobsRecentRetrieve = async (
projectId: string,
options?: RequestInit
): Promise<DataModelingJobApi> => {
return apiMutator<DataModelingJobApi>(getDataModelingJobsRecentRetrieveUrl(projectId), {
...options,
method: 'GET',
})
}
export const getDataModelingJobsRunningRetrieveUrl = (projectId: string) => {
return `/api/projects/${projectId}/data_modeling_jobs/running/`
}
/**
* Get all currently running jobs from the v2 backend.
*/
export const dataModelingJobsRunningRetrieve = async (
projectId: string,
options?: RequestInit
): Promise<DataModelingJobApi> => {
return apiMutator<DataModelingJobApi>(getDataModelingJobsRunningRetrieveUrl(projectId), {
...options,
method: 'GET',
})
}
export const getDataWarehouseCheckDatabaseNameRetrieveUrl = (
projectId: string,
params: DataWarehouseCheckDatabaseNameRetrieveParams
) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/data_warehouse/check-database-name/?${stringifiedParams}`
: `/api/projects/${projectId}/data_warehouse/check-database-name/`
}
/**
* Check if a database name is available.
*/
export const dataWarehouseCheckDatabaseNameRetrieve = async (
projectId: string,
params: DataWarehouseCheckDatabaseNameRetrieveParams,
options?: RequestInit
): Promise<CheckDatabaseNameResponseApi> => {
return apiMutator<CheckDatabaseNameResponseApi>(getDataWarehouseCheckDatabaseNameRetrieveUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getDataWarehouseCheckSchemaNameRetrieveUrl = (
projectId: string,
params: DataWarehouseCheckSchemaNameRetrieveParams
) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/data_warehouse/check-schema-name/?${stringifiedParams}`
: `/api/projects/${projectId}/data_warehouse/check-schema-name/`
}
/**
* Check if a schema name is free within the organization's managed warehouse.
*/
export const dataWarehouseCheckSchemaNameRetrieve = async (
projectId: string,
params: DataWarehouseCheckSchemaNameRetrieveParams,
options?: RequestInit
): Promise<CheckSchemaNameResponseApi> => {
return apiMutator<CheckSchemaNameResponseApi>(getDataWarehouseCheckSchemaNameRetrieveUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getDataWarehouseCompletedActivityRetrieveUrl = (
projectId: string,
params?: DataWarehouseCompletedActivityRetrieveParams
) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/data_warehouse/completed_activity/?${stringifiedParams}`
: `/api/projects/${projectId}/data_warehouse/completed_activity/`
}
/**
* Returns completed/non-running activities (jobs with status 'Completed').
* Supports pagination and cutoff time filtering.
*/
export const dataWarehouseCompletedActivityRetrieve = async (
projectId: string,
params?: DataWarehouseCompletedActivityRetrieveParams,
options?: RequestInit
): Promise<PipelineActivityResponseApi> => {
return apiMutator<PipelineActivityResponseApi>(getDataWarehouseCompletedActivityRetrieveUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getDataWarehouseDataHealthIssuesRetrieveUrl = (projectId: string) => {
return `/api/projects/${projectId}/data_warehouse/data_health_issues/`
}
/**
* Returns failed/disabled data pipeline items for the Pipeline status side panel.
* Includes: materializations, syncs, sources, destinations, and transformations.
*/
export const dataWarehouseDataHealthIssuesRetrieve = async (
projectId: string,
options?: RequestInit
): Promise<DataHealthIssuesResponseApi> => {
return apiMutator<DataHealthIssuesResponseApi>(getDataWarehouseDataHealthIssuesRetrieveUrl(projectId), {
...options,
method: 'GET',
})
}
export const getDataWarehouseDataOpsDashboardRetrieveUrl = (projectId: string) => {
return `/api/projects/${projectId}/data_warehouse/data_ops_dashboard/`
}
/**
* Returns the data ops overview dashboard ID for this team, creating it if it doesn't exist yet.
*/
export const dataWarehouseDataOpsDashboardRetrieve = async (
projectId: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getDataWarehouseDataOpsDashboardRetrieveUrl(projectId), {
...options,
method: 'GET',
})
}
export const getDataWarehouseDataQualityGateRetrieveUrl = (projectId: string) => {
return `/api/projects/${projectId}/data_warehouse/data_quality_gate/`
}
/**
* Read or update the team's data quality gate: whether a materialization whose error-severity checks fail is published.
*/
export const dataWarehouseDataQualityGateRetrieve = async (
projectId: string,
options?: RequestInit
): Promise<DataQualityGateConfigApi> => {
return apiMutator<DataQualityGateConfigApi>(getDataWarehouseDataQualityGateRetrieveUrl(projectId), {
...options,
method: 'GET',
})
}
export const getDataWarehouseDataQualityGatePartialUpdateUrl = (projectId: string) => {
return `/api/projects/${projectId}/data_warehouse/data_quality_gate/`
}
/**
* Read or update the team's data quality gate: whether a materialization whose error-severity checks fail is published.
*/
export const dataWarehouseDataQualityGatePartialUpdate = async (
projectId: string,
patchedDataQualityGateConfigApi?: PatchedDataQualityGateConfigApi,
options?: RequestInit
): Promise<DataQualityGateConfigApi> => {
return apiMutator<DataQualityGateConfigApi>(getDataWarehouseDataQualityGatePartialUpdateUrl(projectId), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedDataQualityGateConfigApi),
})
}
export const getDataWarehouseDeleteOrgDestroyUrl = (projectId: string) => {
return `/api/projects/${projectId}/data_warehouse/delete-org/`
}
/**
* Remove the organization's provisioning record after teardown, freeing its warehouse name.
*
* Called once the warehouse status reports `deleted`: deprovision tears the warehouse
* down, this removes the now-empty org row so the database_name can be reused. Restricted
* to organization admins.
*/
export const dataWarehouseDeleteOrgDestroy = async (
projectId: string,
options?: RequestInit
): Promise<DeleteWarehouseOrgResponseApi> => {
return apiMutator<DeleteWarehouseOrgResponseApi>(getDataWarehouseDeleteOrgDestroyUrl(projectId), {
...options,
method: 'DELETE',
})
}
export const getDataWarehouseDeprovisionCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/data_warehouse/deprovision/`
}
/**
* Start deprovisioning the organization's managed warehouse. Restricted to organization admins.
*/
export const dataWarehouseDeprovisionCreate = async (
projectId: string,
options?: RequestInit
): Promise<DeprovisionWarehouseResponseApi> => {
return apiMutator<DeprovisionWarehouseResponseApi>(getDataWarehouseDeprovisionCreateUrl(projectId), {
...options,
method: 'POST',
})
}
export const getDataWarehouseJobStatsRetrieveUrl = (
projectId: string,
params?: DataWarehouseJobStatsRetrieveParams
) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/data_warehouse/job_stats/?${stringifiedParams}`
: `/api/projects/${projectId}/data_warehouse/job_stats/`
}
/**
* Returns success and failed job statistics for the last 1, 7, or 30 days.
* Query parameter 'days' can be 1, 7, or 30 (default: 7).
*/
export const dataWarehouseJobStatsRetrieve = async (
projectId: string,
params?: DataWarehouseJobStatsRetrieveParams,
options?: RequestInit
): Promise<PipelineJobStatsResponseApi> => {
return apiMutator<PipelineJobStatsResponseApi>(getDataWarehouseJobStatsRetrieveUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getDataWarehouseManagedWarehouseDataStatusRetrieveUrl = (projectId: string) => {
return `/api/projects/${projectId}/data_warehouse/managed-warehouse-data-status/`
}
/**
* Get events, persons, and imported source readiness for the managed warehouse.
*/
export const dataWarehouseManagedWarehouseDataStatusRetrieve = async (
projectId: string,
options?: RequestInit
): Promise<ManagedWarehouseDataStatusResponseApi> => {
return apiMutator<ManagedWarehouseDataStatusResponseApi>(
getDataWarehouseManagedWarehouseDataStatusRetrieveUrl(projectId),
{
...options,
method: 'GET',
}
)
}
export const getDataWarehouseManagedWarehouseMonitoringRetrieveUrl = (projectId: string) => {
return `/api/projects/${projectId}/data_warehouse/managed-warehouse-monitoring/`
}
/**
* Get tenant-safe live worker, session, queue, and capacity data for the current organization.
* @summary Get managed warehouse monitoring snapshot
*/
export const dataWarehouseManagedWarehouseMonitoringRetrieve = async (
projectId: string,
options?: RequestInit
): Promise<ManagedWarehouseMonitoringSnapshotResponseApi> => {
return apiMutator<ManagedWarehouseMonitoringSnapshotResponseApi>(
getDataWarehouseManagedWarehouseMonitoringRetrieveUrl(projectId),
{
...options,
method: 'GET',
}
)
}
export const getDataWarehouseManagedWarehouseMonitoringTimeseriesRetrieveUrl = (
projectId: string,
params: DataWarehouseManagedWarehouseMonitoringTimeseriesRetrieveParams
) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/data_warehouse/managed-warehouse-monitoring-timeseries/?${stringifiedParams}`
: `/api/projects/${projectId}/data_warehouse/managed-warehouse-monitoring-timeseries/`
}
/**
* Get one allow-listed monitoring metric for the current organization and trailing time window.
* @summary Get managed warehouse monitoring time series
*/
export const dataWarehouseManagedWarehouseMonitoringTimeseriesRetrieve = async (
projectId: string,
params: DataWarehouseManagedWarehouseMonitoringTimeseriesRetrieveParams,
options?: RequestInit
): Promise<ManagedWarehouseMonitoringSeriesResponseApi> => {
return apiMutator<ManagedWarehouseMonitoringSeriesResponseApi>(
getDataWarehouseManagedWarehouseMonitoringTimeseriesRetrieveUrl(projectId, params),
{
...options,
method: 'GET',
}
)
}
export const getDataWarehouseManagedWarehouseSourceSchemasRetrieveUrl = (
projectId: string,
params: DataWarehouseManagedWarehouseSourceSchemasRetrieveParams
) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/data_warehouse/managed-warehouse-source-schemas/?${stringifiedParams}`
: `/api/projects/${projectId}/data_warehouse/managed-warehouse-source-schemas/`
}
/**
* Per-schema backfill and live import status for one source, for the Overview tab's drill-down modal — the main status endpoint only returns a per-source rollup.
* @summary Get per-schema detail for one imported source
*/
export const dataWarehouseManagedWarehouseSourceSchemasRetrieve = async (
projectId: string,
params: DataWarehouseManagedWarehouseSourceSchemasRetrieveParams,
options?: RequestInit
): Promise<ManagedWarehouseSourceSchemasResponseApi> => {
return apiMutator<ManagedWarehouseSourceSchemasResponseApi>(
getDataWarehouseManagedWarehouseSourceSchemasRetrieveUrl(projectId, params),
{
...options,
method: 'GET',
}
)
}
export const getDataWarehouseManagedWarehouseTrinoMonitoringRetrieveUrl = (projectId: string) => {
return `/api/projects/${projectId}/data_warehouse/managed-warehouse-trino-monitoring/`
}
/**
* Get tenant-safe live Trino query totals, limits, and in-flight queries for the current organization.
* @summary Get managed warehouse Trino monitoring snapshot
*/
export const dataWarehouseManagedWarehouseTrinoMonitoringRetrieve = async (
projectId: string,
options?: RequestInit
): Promise<ManagedWarehouseTrinoMonitoringSnapshotResponseApi> => {
return apiMutator<ManagedWarehouseTrinoMonitoringSnapshotResponseApi>(
getDataWarehouseManagedWarehouseTrinoMonitoringRetrieveUrl(projectId),
{
...options,
method: 'GET',
}
)
}
export const getDataWarehouseManagedWarehouseTrinoMonitoringTimeseriesRetrieveUrl = (
projectId: string,
params: DataWarehouseManagedWarehouseTrinoMonitoringTimeseriesRetrieveParams
) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/data_warehouse/managed-warehouse-trino-monitoring-timeseries/?${stringifiedParams}`
: `/api/projects/${projectId}/data_warehouse/managed-warehouse-trino-monitoring-timeseries/`
}
/**
* Get one allow-listed Trino monitoring metric for the current organization and trailing time window.
* @summary Get managed warehouse Trino monitoring time series
*/
export const dataWarehouseManagedWarehouseTrinoMonitoringTimeseriesRetrieve = async (
projectId: string,
params: DataWarehouseManagedWarehouseTrinoMonitoringTimeseriesRetrieveParams,
options?: RequestInit
): Promise<ManagedWarehouseMonitoringSeriesResponseApi> => {
return apiMutator<ManagedWarehouseMonitoringSeriesResponseApi>(
getDataWarehouseManagedWarehouseTrinoMonitoringTimeseriesRetrieveUrl(projectId, params),
{
...options,
method: 'GET',
}
)
}
export const getDataWarehouseOnboardTeamCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/data_warehouse/onboard-team/`
}
/**
* Onboard this project onto the organization's existing managed warehouse.
*
* Requires a schema name and records the project's membership in the Duckgres control plane.
* Restricted to organization admins.
*/
export const dataWarehouseOnboardTeamCreate = async (
projectId: string,
onboardWarehouseTeamRequestApi: OnboardWarehouseTeamRequestApi,
options?: RequestInit
): Promise<OnboardWarehouseTeamResponseApi> => {
return apiMutator<OnboardWarehouseTeamResponseApi>(getDataWarehouseOnboardTeamCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(onboardWarehouseTeamRequestApi),
})
}
export const getDataWarehousePropertyValuesRetrieveUrl = (projectId: string) => {
return `/api/projects/${projectId}/data_warehouse/property_values/`
}
/**
* API endpoints for data warehouse aggregate statistics and operations.
*/
export const dataWarehousePropertyValuesRetrieve = async (projectId: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getDataWarehousePropertyValuesRetrieveUrl(projectId), {
...options,
method: 'GET',
})
}
export const getDataWarehouseProvisionCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/data_warehouse/provision/`
}
/**
* Start provisioning a managed warehouse for this organization (shared by all its teams).
*/
export const dataWarehouseProvisionCreate = async (
projectId: string,
provisionWarehouseRequestApi: ProvisionWarehouseRequestApi,
options?: RequestInit
): Promise<ProvisionWarehouseResponseApi> => {
return apiMutator<ProvisionWarehouseResponseApi>(getDataWarehouseProvisionCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(provisionWarehouseRequestApi),
})
}
export const getDataWarehouseResetPasswordCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/data_warehouse/reset-password/`
}
/**
* Reset the root password for the managed warehouse.
*/
export const dataWarehouseResetPasswordCreate = async (
projectId: string,
options?: RequestInit
): Promise<ResetPasswordResponseApi> => {
return apiMutator<ResetPasswordResponseApi>(getDataWarehouseResetPasswordCreateUrl(projectId), {
...options,
method: 'POST',
})
}
export const getDataWarehouseRunningActivityRetrieveUrl = (
projectId: string,
params?: DataWarehouseRunningActivityRetrieveParams
) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/data_warehouse/running_activity/?${stringifiedParams}`
: `/api/projects/${projectId}/data_warehouse/running_activity/`
}
/**
* Returns currently running activities (jobs with status 'Running').
* Supports pagination and cutoff time filtering.
*/
export const dataWarehouseRunningActivityRetrieve = async (
projectId: string,
params?: DataWarehouseRunningActivityRetrieveParams,
options?: RequestInit
): Promise<PipelineActivityResponseApi> => {
return apiMutator<PipelineActivityResponseApi>(getDataWarehouseRunningActivityRetrieveUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getDataWarehouseTotalRowsStatsRetrieveUrl = (projectId: string) => {
return `/api/projects/${projectId}/data_warehouse/total_rows_stats/`
}
/**
* Returns aggregated statistics for the data warehouse total rows processed within the current billing period.
* Used by the frontend data warehouse scene to display usage information.
*/
export const dataWarehouseTotalRowsStatsRetrieve = async (
projectId: string,
options?: RequestInit
): Promise<PipelineRowsStatsResponseApi> => {
return apiMutator<PipelineRowsStatsResponseApi>(getDataWarehouseTotalRowsStatsRetrieveUrl(projectId), {
...options,
method: 'GET',
})
}
export const getDataWarehouseWarehouseStatusRetrieveUrl = (projectId: string) => {
return `/api/projects/${projectId}/data_warehouse/warehouse_status/`
}
/**
* Get the current provisioning status of the managed warehouse, with this project's onboarding state.
*/
export const dataWarehouseWarehouseStatusRetrieve = async (
projectId: string,
options?: RequestInit
): Promise<WarehouseStatusResponseApi> => {
return apiMutator<WarehouseStatusResponseApi>(getDataWarehouseWarehouseStatusRetrieveUrl(projectId), {
...options,
method: 'GET',
})
}
export const getFixHogqlListUrl = (projectId: string, params?: FixHogqlListParams) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/fix_hogql/?${stringifiedParams}`
: `/api/projects/${projectId}/fix_hogql/`
}
export const fixHogqlList = async (
projectId: string,
params?: FixHogqlListParams,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getFixHogqlListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getFixHogqlCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/fix_hogql/`
}
export const fixHogqlCreate = async (projectId: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getFixHogqlCreateUrl(projectId), {
...options,
method: 'POST',
})
}
export const getFixHogqlRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/fix_hogql/${id}/`
}
export const fixHogqlRetrieve = async (projectId: string, id: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getFixHogqlRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getFixHogqlUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/fix_hogql/${id}/`
}
export const fixHogqlUpdate = async (projectId: string, id: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getFixHogqlUpdateUrl(projectId, id), {
...options,
method: 'PUT',
})
}
export const getFixHogqlPartialUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/fix_hogql/${id}/`
}
export const fixHogqlPartialUpdate = async (projectId: string, id: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getFixHogqlPartialUpdateUrl(projectId, id), {
...options,
method: 'PATCH',
})
}
export const getFixHogqlDestroyUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/fix_hogql/${id}/`
}
export const fixHogqlDestroy = async (projectId: string, id: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getFixHogqlDestroyUrl(projectId, id), {
...options,
method: 'DELETE',
})
}
export const getInsightVariablesListUrl = (projectId: string, params?: InsightVariablesListParams) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/insight_variables/?${stringifiedParams}`
: `/api/projects/${projectId}/insight_variables/`
}
export const insightVariablesList = async (
projectId: string,
params?: InsightVariablesListParams,
options?: RequestInit
): Promise<PaginatedInsightVariableListApi> => {
return apiMutator<PaginatedInsightVariableListApi>(getInsightVariablesListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getInsightVariablesCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/insight_variables/`
}
export const insightVariablesCreate = async (
projectId: string,
insightVariableApi: NonReadonly<InsightVariableApi>,
options?: RequestInit
): Promise<InsightVariableApi> => {
return apiMutator<InsightVariableApi>(getInsightVariablesCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(insightVariableApi),
})
}
export const getInsightVariablesRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/insight_variables/${id}/`
}
export const insightVariablesRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<InsightVariableApi> => {
return apiMutator<InsightVariableApi>(getInsightVariablesRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getInsightVariablesUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/insight_variables/${id}/`
}
export const insightVariablesUpdate = async (
projectId: string,
id: string,
insightVariableApi: NonReadonly<InsightVariableApi>,
options?: RequestInit
): Promise<InsightVariableApi> => {
return apiMutator<InsightVariableApi>(getInsightVariablesUpdateUrl(projectId, id), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(insightVariableApi),
})
}
export const getInsightVariablesPartialUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/insight_variables/${id}/`
}
export const insightVariablesPartialUpdate = async (
projectId: string,
id: string,
patchedInsightVariableApi?: NonReadonly<PatchedInsightVariableApi>,
options?: RequestInit
): Promise<InsightVariableApi> => {
return apiMutator<InsightVariableApi>(getInsightVariablesPartialUpdateUrl(projectId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedInsightVariableApi),
})
}
export const getInsightVariablesDestroyUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/insight_variables/${id}/`
}
export const insightVariablesDestroy = async (projectId: string, id: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getInsightVariablesDestroyUrl(projectId, id), {
...options,
method: 'DELETE',
})
}
export const getManagedViewsetsRetrieveUrl = (
projectId: string,
kind: 'revenue_analytics' | 'engineering_analytics'
) => {
return `/api/projects/${projectId}/managed_viewsets/${kind}/`
}
/**
* Get all views associated with a specific managed viewset.
* GET /api/environments/{team_id}/managed_viewsets/{kind}/
*/
export const managedViewsetsRetrieve = async (
projectId: string,
kind: 'revenue_analytics' | 'engineering_analytics',
options?: RequestInit
): Promise<DataWarehouseManagedViewSetResponseApi> => {
return apiMutator<DataWarehouseManagedViewSetResponseApi>(getManagedViewsetsRetrieveUrl(projectId, kind), {
...options,
method: 'GET',
})
}
export const getManagedViewsetsUpdateUrl = (projectId: string, kind: 'revenue_analytics' | 'engineering_analytics') => {
return `/api/projects/${projectId}/managed_viewsets/${kind}/`
}
/**
* Enable or disable a managed viewset by kind.
* PUT /api/environments/{team_id}/managed_viewsets/{kind}/ with body {"enabled": true/false}
*/
export const managedViewsetsUpdate = async (
projectId: string,
kind: 'revenue_analytics' | 'engineering_analytics',
dataWarehouseManagedViewSetApi: DataWarehouseManagedViewSetApi,
options?: RequestInit
): Promise<DataWarehouseManagedViewSetUpdateResponseApi> => {
return apiMutator<DataWarehouseManagedViewSetUpdateResponseApi>(getManagedViewsetsUpdateUrl(projectId, kind), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(dataWarehouseManagedViewSetApi),
})
}
export const getQueryTabStateListUrl = (projectId: string, params?: QueryTabStateListParams) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/query_tab_state/?${stringifiedParams}`
: `/api/projects/${projectId}/query_tab_state/`
}
/**
* Create, Read, Update and Delete Query Tab State.
*/
export const queryTabStateList = async (
projectId: string,
params?: QueryTabStateListParams,
options?: RequestInit
): Promise<PaginatedQueryTabStateListApi> => {
return apiMutator<PaginatedQueryTabStateListApi>(getQueryTabStateListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getQueryTabStateCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/query_tab_state/`
}
/**
* Create, Read, Update and Delete Query Tab State.
*/
export const queryTabStateCreate = async (
projectId: string,
queryTabStateApi?: NonReadonly<QueryTabStateApi>,
options?: RequestInit
): Promise<QueryTabStateApi> => {
return apiMutator<QueryTabStateApi>(getQueryTabStateCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(queryTabStateApi),
})
}
export const getQueryTabStateRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/query_tab_state/${id}/`
}
/**
* Create, Read, Update and Delete Query Tab State.
*/
export const queryTabStateRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<QueryTabStateApi> => {
return apiMutator<QueryTabStateApi>(getQueryTabStateRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getQueryTabStateUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/query_tab_state/${id}/`
}
/**
* Create, Read, Update and Delete Query Tab State.
*/
export const queryTabStateUpdate = async (
projectId: string,
id: string,
queryTabStateApi?: NonReadonly<QueryTabStateApi>,
options?: RequestInit
): Promise<QueryTabStateApi> => {
return apiMutator<QueryTabStateApi>(getQueryTabStateUpdateUrl(projectId, id), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(queryTabStateApi),
})
}
export const getQueryTabStatePartialUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/query_tab_state/${id}/`
}
/**
* Create, Read, Update and Delete Query Tab State.
*/
export const queryTabStatePartialUpdate = async (
projectId: string,
id: string,
patchedQueryTabStateApi?: NonReadonly<PatchedQueryTabStateApi>,
options?: RequestInit
): Promise<QueryTabStateApi> => {
return apiMutator<QueryTabStateApi>(getQueryTabStatePartialUpdateUrl(projectId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedQueryTabStateApi),
})
}
export const getQueryTabStateDestroyUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/query_tab_state/${id}/`
}
/**
* Create, Read, Update and Delete Query Tab State.
*/
export const queryTabStateDestroy = async (projectId: string, id: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getQueryTabStateDestroyUrl(projectId, id), {
...options,
method: 'DELETE',
})
}
export const getQueryTabStateUserRetrieveUrl = (projectId: string, params: QueryTabStateUserRetrieveParams) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/query_tab_state/user/?${stringifiedParams}`
: `/api/projects/${projectId}/query_tab_state/user/`
}
/**
* Create, Read, Update and Delete Query Tab State.
*/
export const queryTabStateUserRetrieve = async (
projectId: string,
params: QueryTabStateUserRetrieveParams,
options?: RequestInit
): Promise<QueryTabStateApi> => {
return apiMutator<QueryTabStateApi>(getQueryTabStateUserRetrieveUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getSavedQueryColumnAnnotationsListUrl = (
projectId: string,
params?: SavedQueryColumnAnnotationsListParams
) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/saved_query_column_annotations/?${stringifiedParams}`
: `/api/projects/${projectId}/saved_query_column_annotations/`
}
/**
* Read and edit semantic descriptions of data-modelling views and columns surfaced to the AI agent.
*
* List can be filtered to one view with `?saved_query_id=<uuid>`. Any create or update is treated as a
* user edit (`is_user_edited=True`), which protects the row from being overwritten by automatic
* enrichment. Create upserts on `(saved_query, column_name)`; the view cannot be changed after creation.
*/
export const savedQueryColumnAnnotationsList = async (
projectId: string,
params?: SavedQueryColumnAnnotationsListParams,
options?: RequestInit
): Promise<PaginatedDataWarehouseSavedQueryColumnAnnotationListApi> => {
return apiMutator<PaginatedDataWarehouseSavedQueryColumnAnnotationListApi>(
getSavedQueryColumnAnnotationsListUrl(projectId, params),
{
...options,
method: 'GET',
}
)
}
export const getSavedQueryColumnAnnotationsCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/saved_query_column_annotations/`
}
/**
* Read and edit semantic descriptions of data-modelling views and columns surfaced to the AI agent.
*
* List can be filtered to one view with `?saved_query_id=<uuid>`. Any create or update is treated as a
* user edit (`is_user_edited=True`), which protects the row from being overwritten by automatic
* enrichment. Create upserts on `(saved_query, column_name)`; the view cannot be changed after creation.
*/
export const savedQueryColumnAnnotationsCreate = async (
projectId: string,
dataWarehouseSavedQueryColumnAnnotationApi: NonReadonly<DataWarehouseSavedQueryColumnAnnotationApi>,
options?: RequestInit
): Promise<DataWarehouseSavedQueryColumnAnnotationApi> => {
return apiMutator<DataWarehouseSavedQueryColumnAnnotationApi>(getSavedQueryColumnAnnotationsCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(dataWarehouseSavedQueryColumnAnnotationApi),
})
}
export const getSavedQueryColumnAnnotationsRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/saved_query_column_annotations/${id}/`
}
/**
* Read and edit semantic descriptions of data-modelling views and columns surfaced to the AI agent.
*
* List can be filtered to one view with `?saved_query_id=<uuid>`. Any create or update is treated as a
* user edit (`is_user_edited=True`), which protects the row from being overwritten by automatic
* enrichment. Create upserts on `(saved_query, column_name)`; the view cannot be changed after creation.
*/
export const savedQueryColumnAnnotationsRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<DataWarehouseSavedQueryColumnAnnotationApi> => {
return apiMutator<DataWarehouseSavedQueryColumnAnnotationApi>(
getSavedQueryColumnAnnotationsRetrieveUrl(projectId, id),
{
...options,
method: 'GET',
}
)
}
export const getSavedQueryColumnAnnotationsUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/saved_query_column_annotations/${id}/`
}
/**
* Read and edit semantic descriptions of data-modelling views and columns surfaced to the AI agent.
*
* List can be filtered to one view with `?saved_query_id=<uuid>`. Any create or update is treated as a
* user edit (`is_user_edited=True`), which protects the row from being overwritten by automatic
* enrichment. Create upserts on `(saved_query, column_name)`; the view cannot be changed after creation.
*/
export const savedQueryColumnAnnotationsUpdate = async (
projectId: string,
id: string,
dataWarehouseSavedQueryColumnAnnotationApi: NonReadonly<DataWarehouseSavedQueryColumnAnnotationApi>,
options?: RequestInit
): Promise<DataWarehouseSavedQueryColumnAnnotationApi> => {
return apiMutator<DataWarehouseSavedQueryColumnAnnotationApi>(
getSavedQueryColumnAnnotationsUpdateUrl(projectId, id),
{
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(dataWarehouseSavedQueryColumnAnnotationApi),
}
)
}
export const getSavedQueryColumnAnnotationsPartialUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/saved_query_column_annotations/${id}/`
}
/**
* Read and edit semantic descriptions of data-modelling views and columns surfaced to the AI agent.
*
* List can be filtered to one view with `?saved_query_id=<uuid>`. Any create or update is treated as a
* user edit (`is_user_edited=True`), which protects the row from being overwritten by automatic
* enrichment. Create upserts on `(saved_query, column_name)`; the view cannot be changed after creation.
*/
export const savedQueryColumnAnnotationsPartialUpdate = async (
projectId: string,
id: string,
patchedDataWarehouseSavedQueryColumnAnnotationApi?: NonReadonly<PatchedDataWarehouseSavedQueryColumnAnnotationApi>,
options?: RequestInit
): Promise<DataWarehouseSavedQueryColumnAnnotationApi> => {
return apiMutator<DataWarehouseSavedQueryColumnAnnotationApi>(
getSavedQueryColumnAnnotationsPartialUpdateUrl(projectId, id),
{
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedDataWarehouseSavedQueryColumnAnnotationApi),
}
)
}
export const getSavedQueryColumnAnnotationsDestroyUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/saved_query_column_annotations/${id}/`
}
/**
* Read and edit semantic descriptions of data-modelling views and columns surfaced to the AI agent.
*
* List can be filtered to one view with `?saved_query_id=<uuid>`. Any create or update is treated as a
* user edit (`is_user_edited=True`), which protects the row from being overwritten by automatic
* enrichment. Create upserts on `(saved_query, column_name)`; the view cannot be changed after creation.
*/
export const savedQueryColumnAnnotationsDestroy = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getSavedQueryColumnAnnotationsDestroyUrl(projectId, id), {
...options,
method: 'DELETE',
})
}
export const getWarehouseColumnAnnotationsListUrl = (
projectId: string,
params?: WarehouseColumnAnnotationsListParams
) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/warehouse_column_annotations/?${stringifiedParams}`
: `/api/projects/${projectId}/warehouse_column_annotations/`
}
/**
* Read and edit semantic descriptions of warehouse tables and columns surfaced to the AI agent.
*
* List can be filtered to one table with `?table_id=<uuid>`. Any create or update is treated as a
* user edit (`is_user_edited=True`), which protects the row from being overwritten by automatic
* enrichment. Create upserts on `(table, column_name)`; the table cannot be changed after creation.
*/
export const warehouseColumnAnnotationsList = async (
projectId: string,
params?: WarehouseColumnAnnotationsListParams,
options?: RequestInit
): Promise<PaginatedWarehouseColumnAnnotationListApi> => {
return apiMutator<PaginatedWarehouseColumnAnnotationListApi>(
getWarehouseColumnAnnotationsListUrl(projectId, params),
{
...options,
method: 'GET',
}
)
}
export const getWarehouseColumnAnnotationsCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/warehouse_column_annotations/`
}
/**
* Read and edit semantic descriptions of warehouse tables and columns surfaced to the AI agent.
*
* List can be filtered to one table with `?table_id=<uuid>`. Any create or update is treated as a
* user edit (`is_user_edited=True`), which protects the row from being overwritten by automatic
* enrichment. Create upserts on `(table, column_name)`; the table cannot be changed after creation.
*/
export const warehouseColumnAnnotationsCreate = async (
projectId: string,
warehouseColumnAnnotationApi: NonReadonly<WarehouseColumnAnnotationApi>,
options?: RequestInit
): Promise<WarehouseColumnAnnotationApi> => {
return apiMutator<WarehouseColumnAnnotationApi>(getWarehouseColumnAnnotationsCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(warehouseColumnAnnotationApi),
})
}
export const getWarehouseColumnAnnotationsRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_column_annotations/${id}/`
}
/**
* Read and edit semantic descriptions of warehouse tables and columns surfaced to the AI agent.
*
* List can be filtered to one table with `?table_id=<uuid>`. Any create or update is treated as a
* user edit (`is_user_edited=True`), which protects the row from being overwritten by automatic
* enrichment. Create upserts on `(table, column_name)`; the table cannot be changed after creation.
*/
export const warehouseColumnAnnotationsRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<WarehouseColumnAnnotationApi> => {
return apiMutator<WarehouseColumnAnnotationApi>(getWarehouseColumnAnnotationsRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getWarehouseColumnAnnotationsUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_column_annotations/${id}/`
}
/**
* Read and edit semantic descriptions of warehouse tables and columns surfaced to the AI agent.
*
* List can be filtered to one table with `?table_id=<uuid>`. Any create or update is treated as a
* user edit (`is_user_edited=True`), which protects the row from being overwritten by automatic
* enrichment. Create upserts on `(table, column_name)`; the table cannot be changed after creation.
*/
export const warehouseColumnAnnotationsUpdate = async (
projectId: string,
id: string,
warehouseColumnAnnotationApi: NonReadonly<WarehouseColumnAnnotationApi>,
options?: RequestInit
): Promise<WarehouseColumnAnnotationApi> => {
return apiMutator<WarehouseColumnAnnotationApi>(getWarehouseColumnAnnotationsUpdateUrl(projectId, id), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(warehouseColumnAnnotationApi),
})
}
export const getWarehouseColumnAnnotationsPartialUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_column_annotations/${id}/`
}
/**
* Read and edit semantic descriptions of warehouse tables and columns surfaced to the AI agent.
*
* List can be filtered to one table with `?table_id=<uuid>`. Any create or update is treated as a
* user edit (`is_user_edited=True`), which protects the row from being overwritten by automatic
* enrichment. Create upserts on `(table, column_name)`; the table cannot be changed after creation.
*/
export const warehouseColumnAnnotationsPartialUpdate = async (
projectId: string,
id: string,
patchedWarehouseColumnAnnotationApi?: NonReadonly<PatchedWarehouseColumnAnnotationApi>,
options?: RequestInit
): Promise<WarehouseColumnAnnotationApi> => {
return apiMutator<WarehouseColumnAnnotationApi>(getWarehouseColumnAnnotationsPartialUpdateUrl(projectId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedWarehouseColumnAnnotationApi),
})
}
export const getWarehouseColumnAnnotationsDestroyUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_column_annotations/${id}/`
}
/**
* Read and edit semantic descriptions of warehouse tables and columns surfaced to the AI agent.
*
* List can be filtered to one table with `?table_id=<uuid>`. Any create or update is treated as a
* user edit (`is_user_edited=True`), which protects the row from being overwritten by automatic
* enrichment. Create upserts on `(table, column_name)`; the table cannot be changed after creation.
*/
export const warehouseColumnAnnotationsDestroy = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getWarehouseColumnAnnotationsDestroyUrl(projectId, id), {
...options,
method: 'DELETE',
})
}
export const getWarehouseExpressionsListUrl = (projectId: string, params?: WarehouseExpressionsListParams) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/warehouse_expressions/?${stringifiedParams}`
: `/api/projects/${projectId}/warehouse_expressions/`
}
/**
* Create, read, update and delete saved HogQL expressions that appear as virtual fields on tables.
*/
export const warehouseExpressionsList = async (
projectId: string,
params?: WarehouseExpressionsListParams,
options?: RequestInit
): Promise<PaginatedDataWarehouseExpressionListApi> => {
return apiMutator<PaginatedDataWarehouseExpressionListApi>(getWarehouseExpressionsListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getWarehouseExpressionsCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/warehouse_expressions/`
}
/**
* Create, read, update and delete saved HogQL expressions that appear as virtual fields on tables.
*/
export const warehouseExpressionsCreate = async (
projectId: string,
dataWarehouseExpressionApi: NonReadonly<DataWarehouseExpressionApi>,
options?: RequestInit
): Promise<DataWarehouseExpressionApi> => {
return apiMutator<DataWarehouseExpressionApi>(getWarehouseExpressionsCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(dataWarehouseExpressionApi),
})
}
export const getWarehouseExpressionsRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_expressions/${id}/`
}
/**
* Create, read, update and delete saved HogQL expressions that appear as virtual fields on tables.
*/
export const warehouseExpressionsRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<DataWarehouseExpressionApi> => {
return apiMutator<DataWarehouseExpressionApi>(getWarehouseExpressionsRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getWarehouseExpressionsUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_expressions/${id}/`
}
/**
* Create, read, update and delete saved HogQL expressions that appear as virtual fields on tables.
*/
export const warehouseExpressionsUpdate = async (
projectId: string,
id: string,
dataWarehouseExpressionApi: NonReadonly<DataWarehouseExpressionApi>,
options?: RequestInit
): Promise<DataWarehouseExpressionApi> => {
return apiMutator<DataWarehouseExpressionApi>(getWarehouseExpressionsUpdateUrl(projectId, id), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(dataWarehouseExpressionApi),
})
}
export const getWarehouseExpressionsPartialUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_expressions/${id}/`
}
/**
* Create, read, update and delete saved HogQL expressions that appear as virtual fields on tables.
*/
export const warehouseExpressionsPartialUpdate = async (
projectId: string,
id: string,
patchedDataWarehouseExpressionApi?: NonReadonly<PatchedDataWarehouseExpressionApi>,
options?: RequestInit
): Promise<DataWarehouseExpressionApi> => {
return apiMutator<DataWarehouseExpressionApi>(getWarehouseExpressionsPartialUpdateUrl(projectId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedDataWarehouseExpressionApi),
})
}
export const getWarehouseExpressionsDestroyUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_expressions/${id}/`
}
/**
* Create, read, update and delete saved HogQL expressions that appear as virtual fields on tables.
*/
export const warehouseExpressionsDestroy = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getWarehouseExpressionsDestroyUrl(projectId, id), {
...options,
method: 'DELETE',
})
}
export const getWarehouseSavedQueriesListUrl = (projectId: string, params?: WarehouseSavedQueriesListParams) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/warehouse_saved_queries/?${stringifiedParams}`
: `/api/projects/${projectId}/warehouse_saved_queries/`
}
/**
* Create, Read, Update and Delete Warehouse Tables.
*/
export const warehouseSavedQueriesList = async (
projectId: string,
params?: WarehouseSavedQueriesListParams,
options?: RequestInit
): Promise<PaginatedDataWarehouseSavedQueryMinimalListApi> => {
return apiMutator<PaginatedDataWarehouseSavedQueryMinimalListApi>(
getWarehouseSavedQueriesListUrl(projectId, params),
{
...options,
method: 'GET',
}
)
}
export const getWarehouseSavedQueriesCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/warehouse_saved_queries/`
}
/**
* Create, Read, Update and Delete Warehouse Tables.
*/
export const warehouseSavedQueriesCreate = async (
projectId: string,
dataWarehouseSavedQueryApi: NonReadonly<DataWarehouseSavedQueryApi>,
options?: RequestInit
): Promise<DataWarehouseSavedQueryApi> => {
return apiMutator<DataWarehouseSavedQueryApi>(getWarehouseSavedQueriesCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(dataWarehouseSavedQueryApi),
})
}
export const getWarehouseSavedQueriesRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_saved_queries/${id}/`
}
/**
* Create, Read, Update and Delete Warehouse Tables.
*/
export const warehouseSavedQueriesRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<DataWarehouseSavedQueryApi> => {
return apiMutator<DataWarehouseSavedQueryApi>(getWarehouseSavedQueriesRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getWarehouseSavedQueriesUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_saved_queries/${id}/`
}
/**
* Create, Read, Update and Delete Warehouse Tables.
*/
export const warehouseSavedQueriesUpdate = async (
projectId: string,
id: string,
dataWarehouseSavedQueryApi: NonReadonly<DataWarehouseSavedQueryApi>,
options?: RequestInit
): Promise<DataWarehouseSavedQueryApi> => {
return apiMutator<DataWarehouseSavedQueryApi>(getWarehouseSavedQueriesUpdateUrl(projectId, id), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(dataWarehouseSavedQueryApi),
})
}
export const getWarehouseSavedQueriesPartialUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_saved_queries/${id}/`
}
/**
* Create, Read, Update and Delete Warehouse Tables.
*/
export const warehouseSavedQueriesPartialUpdate = async (
projectId: string,
id: string,
patchedDataWarehouseSavedQueryApi?: NonReadonly<PatchedDataWarehouseSavedQueryApi>,
options?: RequestInit
): Promise<DataWarehouseSavedQueryApi> => {
return apiMutator<DataWarehouseSavedQueryApi>(getWarehouseSavedQueriesPartialUpdateUrl(projectId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedDataWarehouseSavedQueryApi),
})
}
export const getWarehouseSavedQueriesDestroyUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_saved_queries/${id}/`
}
/**
* Create, Read, Update and Delete Warehouse Tables.
*/
export const warehouseSavedQueriesDestroy = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getWarehouseSavedQueriesDestroyUrl(projectId, id), {
...options,
method: 'DELETE',
})
}
export const getWarehouseSavedQueriesActivityRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_saved_queries/${id}/activity/`
}
/**
* Create, Read, Update and Delete Warehouse Tables.
*/
export const warehouseSavedQueriesActivityRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<DataWarehouseSavedQueryApi> => {
return apiMutator<DataWarehouseSavedQueryApi>(getWarehouseSavedQueriesActivityRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getWarehouseSavedQueriesAncestorsCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_saved_queries/${id}/ancestors/`
}
/**
* Return the ancestors of this saved query.
*
* By default, we return every ancestor. The `level` parameter bounds how many hops back
* to walk, so 1 gives the immediate parents.
*/
export const warehouseSavedQueriesAncestorsCreate = async (
projectId: string,
id: string,
savedQueryLineageRequestApi?: SavedQueryLineageRequestApi,
options?: RequestInit
): Promise<SavedQueryAncestorsApi> => {
return apiMutator<SavedQueryAncestorsApi>(getWarehouseSavedQueriesAncestorsCreateUrl(projectId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(savedQueryLineageRequestApi),
})
}
export const getWarehouseSavedQueriesCancelCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_saved_queries/${id}/cancel/`
}
/**
* Cancel a running saved query workflow.
*/
export const warehouseSavedQueriesCancelCreate = async (
projectId: string,
id: string,
dataWarehouseSavedQueryApi: NonReadonly<DataWarehouseSavedQueryApi>,
options?: RequestInit
): Promise<DataWarehouseSavedQueryApi> => {
return apiMutator<DataWarehouseSavedQueryApi>(getWarehouseSavedQueriesCancelCreateUrl(projectId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(dataWarehouseSavedQueryApi),
})
}
export const getWarehouseSavedQueriesDependenciesRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_saved_queries/${id}/dependencies/`
}
/**
* Return the count of immediate upstream and downstream dependencies for this saved query.
*/
export const warehouseSavedQueriesDependenciesRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<SavedQueryDependenciesApi> => {
return apiMutator<SavedQueryDependenciesApi>(getWarehouseSavedQueriesDependenciesRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getWarehouseSavedQueriesDescendantsCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_saved_queries/${id}/descendants/`
}
/**
* Return the descendants of this saved query.
*
* By default, we return every descendant. The `level` parameter bounds how many hops
* forward to walk, so 1 gives the immediate children.
*/
export const warehouseSavedQueriesDescendantsCreate = async (
projectId: string,
id: string,
savedQueryLineageRequestApi?: SavedQueryLineageRequestApi,
options?: RequestInit
): Promise<SavedQueryDescendantsApi> => {
return apiMutator<SavedQueryDescendantsApi>(getWarehouseSavedQueriesDescendantsCreateUrl(projectId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(savedQueryLineageRequestApi),
})
}
export const getWarehouseSavedQueriesMaterializeCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_saved_queries/${id}/materialize/`
}
/**
* Enable materialization for this saved query, at the requested sync frequency or daily.
*/
export const warehouseSavedQueriesMaterializeCreate = async (
projectId: string,
id: string,
savedQueryMaterializeApi?: SavedQueryMaterializeApi,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getWarehouseSavedQueriesMaterializeCreateUrl(projectId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(savedQueryMaterializeApi),
})
}
export const getWarehouseSavedQueriesResumeCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_saved_queries/${id}/resume/`
}
/**
* Resume materialization suspended after repeated failures.
*
* Scheduled runs skip a suspended model and everything downstream of it, so it cannot succeed
* its way back on its own.
*/
export const warehouseSavedQueriesResumeCreate = async (
projectId: string,
id: string,
savedQueryResumeRequestApi?: SavedQueryResumeRequestApi,
options?: RequestInit
): Promise<SavedQueryResumeApi> => {
return apiMutator<SavedQueryResumeApi>(getWarehouseSavedQueriesResumeCreateUrl(projectId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(savedQueryResumeRequestApi),
})
}
export const getWarehouseSavedQueriesRevertMaterializationCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_saved_queries/${id}/revert_materialization/`
}
/**
* Undo materialization, revert back to the original view.
* (i.e. delete the materialized table and the schedule)
*/
export const warehouseSavedQueriesRevertMaterializationCreate = async (
projectId: string,
id: string,
dataWarehouseSavedQueryApi: NonReadonly<DataWarehouseSavedQueryApi>,
options?: RequestInit
): Promise<DataWarehouseSavedQueryApi> => {
return apiMutator<DataWarehouseSavedQueryApi>(
getWarehouseSavedQueriesRevertMaterializationCreateUrl(projectId, id),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(dataWarehouseSavedQueryApi),
}
)
}
export const getWarehouseSavedQueriesRunCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_saved_queries/${id}/run/`
}
/**
* Run this saved query.
*/
export const warehouseSavedQueriesRunCreate = async (
projectId: string,
id: string,
savedQueryRunApi?: SavedQueryRunApi,
options?: RequestInit
): Promise<SavedQueryRunResponseApi> => {
return apiMutator<SavedQueryRunResponseApi>(getWarehouseSavedQueriesRunCreateUrl(projectId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(savedQueryRunApi),
})
}
export const getWarehouseSavedQueriesRunHistoryRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_saved_queries/${id}/run_history/`
}
/**
* Return the recent run history (up to 5 most recent) for this materialized view.
*/
export const warehouseSavedQueriesRunHistoryRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<DataWarehouseSavedQueryApi> => {
return apiMutator<DataWarehouseSavedQueryApi>(getWarehouseSavedQueriesRunHistoryRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getWarehouseSavedQueriesCheckIncrementalCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/warehouse_saved_queries/check_incremental/`
}
/**
* Report whether a query can be materialized incrementally, without running it.
*
* Parses the SQL only, so it is cheap enough to call from the editor as the user types. Lets
* the editor explain why the incremental option is unavailable before anything is saved.
*/
export const warehouseSavedQueriesCheckIncrementalCreate = async (
projectId: string,
checkIncrementalApi: CheckIncrementalApi,
options?: RequestInit
): Promise<IncrementalEligibilityApi> => {
return apiMutator<IncrementalEligibilityApi>(getWarehouseSavedQueriesCheckIncrementalCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(checkIncrementalApi),
})
}
export const getWarehouseSavedQueriesResumeSchedulesCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/warehouse_saved_queries/resume_schedules/`
}
/**
* Resume materialization for several models that were suspended after repeated failures.
*
* Accepts a list of view IDs in the request body: {"view_ids": ["id1", "id2", ...]}
* This endpoint is idempotent - calling it on models that are already running is safe.
*/
export const warehouseSavedQueriesResumeSchedulesCreate = async (
projectId: string,
savedQueryResumeSchedulesRequestApi: SavedQueryResumeSchedulesRequestApi,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getWarehouseSavedQueriesResumeSchedulesCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(savedQueryResumeSchedulesRequestApi),
})
}
export const getWarehouseSavedQueryDraftsListUrl = (
projectId: string,
params?: WarehouseSavedQueryDraftsListParams
) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/warehouse_saved_query_drafts/?${stringifiedParams}`
: `/api/projects/${projectId}/warehouse_saved_query_drafts/`
}
export const warehouseSavedQueryDraftsList = async (
projectId: string,
params?: WarehouseSavedQueryDraftsListParams,
options?: RequestInit
): Promise<PaginatedDataWarehouseSavedQueryDraftListApi> => {
return apiMutator<PaginatedDataWarehouseSavedQueryDraftListApi>(
getWarehouseSavedQueryDraftsListUrl(projectId, params),
{
...options,
method: 'GET',
}
)
}
export const getWarehouseSavedQueryDraftsCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/warehouse_saved_query_drafts/`
}
export const warehouseSavedQueryDraftsCreate = async (
projectId: string,
dataWarehouseSavedQueryDraftApi?: NonReadonly<DataWarehouseSavedQueryDraftApi>,
options?: RequestInit
): Promise<DataWarehouseSavedQueryDraftApi> => {
return apiMutator<DataWarehouseSavedQueryDraftApi>(getWarehouseSavedQueryDraftsCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(dataWarehouseSavedQueryDraftApi),
})
}
export const getWarehouseSavedQueryDraftsRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_saved_query_drafts/${id}/`
}
export const warehouseSavedQueryDraftsRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<DataWarehouseSavedQueryDraftApi> => {
return apiMutator<DataWarehouseSavedQueryDraftApi>(getWarehouseSavedQueryDraftsRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getWarehouseSavedQueryDraftsUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_saved_query_drafts/${id}/`
}
export const warehouseSavedQueryDraftsUpdate = async (
projectId: string,
id: string,
dataWarehouseSavedQueryDraftApi?: NonReadonly<DataWarehouseSavedQueryDraftApi>,
options?: RequestInit
): Promise<DataWarehouseSavedQueryDraftApi> => {
return apiMutator<DataWarehouseSavedQueryDraftApi>(getWarehouseSavedQueryDraftsUpdateUrl(projectId, id), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(dataWarehouseSavedQueryDraftApi),
})
}
export const getWarehouseSavedQueryDraftsPartialUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_saved_query_drafts/${id}/`
}
export const warehouseSavedQueryDraftsPartialUpdate = async (
projectId: string,
id: string,
patchedDataWarehouseSavedQueryDraftApi?: NonReadonly<PatchedDataWarehouseSavedQueryDraftApi>,
options?: RequestInit
): Promise<DataWarehouseSavedQueryDraftApi> => {
return apiMutator<DataWarehouseSavedQueryDraftApi>(getWarehouseSavedQueryDraftsPartialUpdateUrl(projectId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedDataWarehouseSavedQueryDraftApi),
})
}
export const getWarehouseSavedQueryDraftsDestroyUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_saved_query_drafts/${id}/`
}
export const warehouseSavedQueryDraftsDestroy = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getWarehouseSavedQueryDraftsDestroyUrl(projectId, id), {
...options,
method: 'DELETE',
})
}
export const getWarehouseSavedQueryFoldersListUrl = (projectId: string) => {
return `/api/projects/${projectId}/warehouse_saved_query_folders/`
}
export const warehouseSavedQueryFoldersList = async (
projectId: string,
options?: RequestInit
): Promise<DataWarehouseSavedQueryFolderApi[]> => {
return apiMutator<DataWarehouseSavedQueryFolderApi[]>(getWarehouseSavedQueryFoldersListUrl(projectId), {
...options,
method: 'GET',
})
}
export const getWarehouseSavedQueryFoldersCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/warehouse_saved_query_folders/`
}
export const warehouseSavedQueryFoldersCreate = async (
projectId: string,
dataWarehouseSavedQueryFolderApi: NonReadonly<DataWarehouseSavedQueryFolderApi>,
options?: RequestInit
): Promise<DataWarehouseSavedQueryFolderApi> => {
return apiMutator<DataWarehouseSavedQueryFolderApi>(getWarehouseSavedQueryFoldersCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(dataWarehouseSavedQueryFolderApi),
})
}
export const getWarehouseSavedQueryFoldersRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_saved_query_folders/${id}/`
}
export const warehouseSavedQueryFoldersRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<DataWarehouseSavedQueryFolderApi> => {
return apiMutator<DataWarehouseSavedQueryFolderApi>(getWarehouseSavedQueryFoldersRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getWarehouseSavedQueryFoldersPartialUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_saved_query_folders/${id}/`
}
export const warehouseSavedQueryFoldersPartialUpdate = async (
projectId: string,
id: string,
patchedDataWarehouseSavedQueryFolderApi?: NonReadonly<PatchedDataWarehouseSavedQueryFolderApi>,
options?: RequestInit
): Promise<DataWarehouseSavedQueryFolderApi> => {
return apiMutator<DataWarehouseSavedQueryFolderApi>(getWarehouseSavedQueryFoldersPartialUpdateUrl(projectId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedDataWarehouseSavedQueryFolderApi),
})
}
export const getWarehouseSavedQueryFoldersDestroyUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_saved_query_folders/${id}/`
}
export const warehouseSavedQueryFoldersDestroy = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getWarehouseSavedQueryFoldersDestroyUrl(projectId, id), {
...options,
method: 'DELETE',
})
}
export const getWarehouseTablesListUrl = (projectId: string, params?: WarehouseTablesListParams) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/warehouse_tables/?${stringifiedParams}`
: `/api/projects/${projectId}/warehouse_tables/`
}
/**
* Create, Read, Update and Delete Warehouse Tables.
*/
export const warehouseTablesList = async (
projectId: string,
params?: WarehouseTablesListParams,
options?: RequestInit
): Promise<PaginatedTableListApi> => {
return apiMutator<PaginatedTableListApi>(getWarehouseTablesListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getWarehouseTablesCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/warehouse_tables/`
}
/**
* Create, Read, Update and Delete Warehouse Tables.
*/
export const warehouseTablesCreate = async (
projectId: string,
tableApi: NonReadonly<TableApi>,
options?: RequestInit
): Promise<TableApi> => {
return apiMutator<TableApi>(getWarehouseTablesCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(tableApi),
})
}
export const getWarehouseTablesRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_tables/${id}/`
}
/**
* Create, Read, Update and Delete Warehouse Tables.
*/
export const warehouseTablesRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<TableApi> => {
return apiMutator<TableApi>(getWarehouseTablesRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getWarehouseTablesUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_tables/${id}/`
}
/**
* Create, Read, Update and Delete Warehouse Tables.
*/
export const warehouseTablesUpdate = async (
projectId: string,
id: string,
tableApi: NonReadonly<TableApi>,
options?: RequestInit
): Promise<TableApi> => {
return apiMutator<TableApi>(getWarehouseTablesUpdateUrl(projectId, id), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(tableApi),
})
}
export const getWarehouseTablesPartialUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_tables/${id}/`
}
/**
* Create, Read, Update and Delete Warehouse Tables.
*/
export const warehouseTablesPartialUpdate = async (
projectId: string,
id: string,
patchedTableApi?: NonReadonly<PatchedTableApi>,
options?: RequestInit
): Promise<TableApi> => {
return apiMutator<TableApi>(getWarehouseTablesPartialUpdateUrl(projectId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedTableApi),
})
}
export const getWarehouseTablesDestroyUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_tables/${id}/`
}
/**
* Create, Read, Update and Delete Warehouse Tables.
*/
export const warehouseTablesDestroy = async (projectId: string, id: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getWarehouseTablesDestroyUrl(projectId, id), {
...options,
method: 'DELETE',
})
}
export const getWarehouseTablesRefreshSchemaCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_tables/${id}/refresh_schema/`
}
/**
* Re-introspect an existing direct-read warehouse table's schema from its underlying source files and overwrite its stored column list. Use when the source schema has evolved (e.g. new columns in the underlying Delta/Parquet/CSV files) but queries still can't see the new columns, because PostHog serves a cached column snapshot until the table is refreshed. This applies only to existing direct-read tables. New direct-read tables cannot be created. Tables managed by an external data source sync refresh on their own schedule.
* @summary Refresh table schema from source
*/
export const warehouseTablesRefreshSchemaCreate = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getWarehouseTablesRefreshSchemaCreateUrl(projectId, id), {
...options,
method: 'POST',
})
}
export const getWarehouseTablesReplaceFileCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_tables/${id}/replace_file/`
}
/**
* Point a table made from an uploaded file at a new upload, then import it with one full refresh. Upload the new file with upload_file first. The table keeps its id and its name, and its rows are replaced when the sync finishes. The old file is deleted only after that sync succeeds. The sync bills its rows like any other import.
* @summary Replace the file of a table made from an uploaded file
*/
export const warehouseTablesReplaceFileCreate = async (
projectId: string,
id: string,
uploadedFileApi: UploadedFileApi,
options?: RequestInit
): Promise<TableApi> => {
return apiMutator<TableApi>(getWarehouseTablesReplaceFileCreateUrl(projectId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(uploadedFileApi),
})
}
export const getWarehouseTablesUpdateSchemaCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_tables/${id}/update_schema/`
}
/**
* Create, Read, Update and Delete Warehouse Tables.
*/
export const warehouseTablesUpdateSchemaCreate = async (
projectId: string,
id: string,
tableApi: NonReadonly<TableApi>,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getWarehouseTablesUpdateSchemaCreateUrl(projectId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(tableApi),
})
}
export const getWarehouseTablesCreateFromUploadCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/warehouse_tables/create_from_upload/`
}
/**
* Turn a previously uploaded file into a warehouse table with a FileUpload source.
*
* The file already sits in PostHog's own bucket (see `upload_file`), so the table points straight
* at it for the initial direct read. The source imports it on its first sync. The read location
* is always derived from the caller's own team, so a client-supplied
* `upload_id` can only resolve inside that team's folder, and the table carries no credential (reads
* fall back to the node role, never a user-supplied key).
*
* For a team with object storage sources, the table also gets a file upload source. Its first
* sync imports the file and turns the same table row into a managed table.
* @summary Create a warehouse table and FileUpload source from an uploaded file
*/
export const warehouseTablesCreateFromUploadCreate = async (
projectId: string,
createTableFromUploadApi: CreateTableFromUploadApi,
options?: RequestInit
): Promise<TableApi> => {
return apiMutator<TableApi>(getWarehouseTablesCreateFromUploadCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(createTableFromUploadApi),
})
}
export const getWarehouseTablesFileCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/warehouse_tables/file/`
}
/**
* Create, Read, Update and Delete Warehouse Tables.
*/
export const warehouseTablesFileCreate = async (
projectId: string,
tableApi: NonReadonly<TableApi>,
options?: RequestInit
): Promise<void> => {
const formData = new FormData()
if (tableApi.deleted !== undefined && tableApi.deleted !== null) {
formData.append(`deleted`, tableApi.deleted.toString())
}
formData.append(`name`, tableApi.name)
formData.append(`format`, tableApi.format)
formData.append(`url_pattern`, tableApi.url_pattern)
formData.append(`credential`, JSON.stringify(tableApi.credential))
if (tableApi.options !== undefined) {
formData.append(`options`, JSON.stringify(tableApi.options))
}
return apiMutator<void>(getWarehouseTablesFileCreateUrl(projectId), {
...options,
method: 'POST',
body: formData,
})
}
export const getWarehouseTablesUploadFileCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/warehouse_tables/upload_file/`
}
/**
* Store an uploaded file for a new warehouse table and FileUpload source.
*
* Uploading is a separate first step from `create_from_upload` so the create call stays JSON-only:
* this returns an `upload_id` the caller passes back to build the table. The file is written under
* a team-scoped prefix, so a table can only ever read back its own team's uploads.
* @summary Upload a file for a new warehouse table and FileUpload source
*/
export const warehouseTablesUploadFileCreate = async (
projectId: string,
warehouseTablesUploadFileCreateBody?: WarehouseTablesUploadFileCreateBody,
options?: RequestInit
): Promise<FileUploadResponseApi> => {
const formData = new FormData()
if (warehouseTablesUploadFileCreateBody?.file !== undefined) {
formData.append(`file`, warehouseTablesUploadFileCreateBody.file)
}
if (warehouseTablesUploadFileCreateBody?.file_format !== undefined) {
formData.append(`file_format`, warehouseTablesUploadFileCreateBody.file_format)
}
return apiMutator<FileUploadResponseApi>(getWarehouseTablesUploadFileCreateUrl(projectId), {
...options,
method: 'POST',
body: formData,
})
}
export const getWarehouseViewLinkListUrl = (projectId: string, params?: WarehouseViewLinkListParams) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/warehouse_view_link/?${stringifiedParams}`
: `/api/projects/${projectId}/warehouse_view_link/`
}
/**
* Create, Read, Update and Delete View Columns.
*/
export const warehouseViewLinkList = async (
projectId: string,
params?: WarehouseViewLinkListParams,
options?: RequestInit
): Promise<PaginatedViewLinkListApi> => {
return apiMutator<PaginatedViewLinkListApi>(getWarehouseViewLinkListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getWarehouseViewLinkCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/warehouse_view_link/`
}
/**
* Create, Read, Update and Delete View Columns.
*/
export const warehouseViewLinkCreate = async (
projectId: string,
viewLinkApi: NonReadonly<ViewLinkApi>,
options?: RequestInit
): Promise<ViewLinkApi> => {
return apiMutator<ViewLinkApi>(getWarehouseViewLinkCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(viewLinkApi),
})
}
export const getWarehouseViewLinkRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_view_link/${id}/`
}
/**
* Create, Read, Update and Delete View Columns.
*/
export const warehouseViewLinkRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<ViewLinkApi> => {
return apiMutator<ViewLinkApi>(getWarehouseViewLinkRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getWarehouseViewLinkUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_view_link/${id}/`
}
/**
* Create, Read, Update and Delete View Columns.
*/
export const warehouseViewLinkUpdate = async (
projectId: string,
id: string,
viewLinkApi: NonReadonly<ViewLinkApi>,
options?: RequestInit
): Promise<ViewLinkApi> => {
return apiMutator<ViewLinkApi>(getWarehouseViewLinkUpdateUrl(projectId, id), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(viewLinkApi),
})
}
export const getWarehouseViewLinkPartialUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_view_link/${id}/`
}
/**
* Create, Read, Update and Delete View Columns.
*/
export const warehouseViewLinkPartialUpdate = async (
projectId: string,
id: string,
patchedViewLinkApi?: NonReadonly<PatchedViewLinkApi>,
options?: RequestInit
): Promise<ViewLinkApi> => {
return apiMutator<ViewLinkApi>(getWarehouseViewLinkPartialUpdateUrl(projectId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedViewLinkApi),
})
}
export const getWarehouseViewLinkDestroyUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_view_link/${id}/`
}
/**
* Create, Read, Update and Delete View Columns.
*/
export const warehouseViewLinkDestroy = async (projectId: string, id: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getWarehouseViewLinkDestroyUrl(projectId, id), {
...options,
method: 'DELETE',
})
}
export const getWarehouseViewLinkValidateCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/warehouse_view_link/validate/`
}
/**
* Create, Read, Update and Delete View Columns.
*/
export const warehouseViewLinkValidateCreate = async (
projectId: string,
viewLinkValidationApi: ViewLinkValidationApi,
options?: RequestInit
): Promise<ViewLinkValidationResponseApi> => {
return apiMutator<ViewLinkValidationResponseApi>(getWarehouseViewLinkValidateCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(viewLinkValidationApi),
})
}
export const getWarehouseViewLinksListUrl = (projectId: string, params?: WarehouseViewLinksListParams) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/warehouse_view_links/?${stringifiedParams}`
: `/api/projects/${projectId}/warehouse_view_links/`
}
/**
* Create, Read, Update and Delete View Columns.
*/
export const warehouseViewLinksList = async (
projectId: string,
params?: WarehouseViewLinksListParams,
options?: RequestInit
): Promise<PaginatedViewLinkListApi> => {
return apiMutator<PaginatedViewLinkListApi>(getWarehouseViewLinksListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getWarehouseViewLinksCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/warehouse_view_links/`
}
/**
* Create, Read, Update and Delete View Columns.
*/
export const warehouseViewLinksCreate = async (
projectId: string,
viewLinkApi: NonReadonly<ViewLinkApi>,
options?: RequestInit
): Promise<ViewLinkApi> => {
return apiMutator<ViewLinkApi>(getWarehouseViewLinksCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(viewLinkApi),
})
}
export const getWarehouseViewLinksRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_view_links/${id}/`
}
/**
* Create, Read, Update and Delete View Columns.
*/
export const warehouseViewLinksRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<ViewLinkApi> => {
return apiMutator<ViewLinkApi>(getWarehouseViewLinksRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getWarehouseViewLinksUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_view_links/${id}/`
}
/**
* Create, Read, Update and Delete View Columns.
*/
export const warehouseViewLinksUpdate = async (
projectId: string,
id: string,
viewLinkApi: NonReadonly<ViewLinkApi>,
options?: RequestInit
): Promise<ViewLinkApi> => {
return apiMutator<ViewLinkApi>(getWarehouseViewLinksUpdateUrl(projectId, id), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(viewLinkApi),
})
}
export const getWarehouseViewLinksPartialUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_view_links/${id}/`
}
/**
* Create, Read, Update and Delete View Columns.
*/
export const warehouseViewLinksPartialUpdate = async (
projectId: string,
id: string,
patchedViewLinkApi?: NonReadonly<PatchedViewLinkApi>,
options?: RequestInit
): Promise<ViewLinkApi> => {
return apiMutator<ViewLinkApi>(getWarehouseViewLinksPartialUpdateUrl(projectId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedViewLinkApi),
})
}
export const getWarehouseViewLinksDestroyUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/warehouse_view_links/${id}/`
}
/**
* Create, Read, Update and Delete View Columns.
*/
export const warehouseViewLinksDestroy = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getWarehouseViewLinksDestroyUrl(projectId, id), {
...options,
method: 'DELETE',
})
}
export const getWarehouseViewLinksValidateCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/warehouse_view_links/validate/`
}
/**
* Create, Read, Update and Delete View Columns.
*/
export const warehouseViewLinksValidateCreate = async (
projectId: string,
viewLinkValidationApi: ViewLinkValidationApi,
options?: RequestInit
): Promise<ViewLinkValidationResponseApi> => {
return apiMutator<ViewLinkValidationResponseApi>(getWarehouseViewLinksValidateCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(viewLinkValidationApi),
})
}