: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 '../../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 - core
* OpenAPI spec version: 1.0.0
*/
import type {
BulkUpdateTagsRequestApi,
BulkUpdateTagsResponseApi,
CIMDVerificationTokenApi,
CIMDVerificationTokenCreateApi,
CIMDVerificationTokenWithValueApi,
CimdVerificationTokensListParams,
ConnectedAppApi,
DataDeletionPreviewApi,
DataDeletionRequestApi,
DataDeletionRequestCreateApi,
DataDeletionRequestInputApi,
DataDeletionRequestsListParams,
DeviceApprovalApi,
DeviceDecisionApi,
DeviceGrantDetailsApi,
DeviceUserCodeApi,
DomainsListParams,
DomainsScimLogsRetrieveParams,
EmojiSearchResponseApi,
EmojiSearchSuggestRetrieveParams,
EnterprisePropertyDefinitionApi,
EventIngestionRestrictionApi,
EventPropertyValuesResponseApi,
EventsValuesRetrieveParams,
ExportedAssetApi,
ExportedAssetCreateApi,
ExportsListParams,
FileSystemApi,
FileSystemDestroyParams,
FileSystemFrequentListParams,
FileSystemHomeFolderApi,
FileSystemListParams,
FileSystemRankedSearchResponseApi,
FileSystemSearchRetrieveParams,
FileSystemShortcutApi,
FileSystemShortcutBulkUpdateApi,
FileSystemShortcutListParams,
FileSystemShortcutReorderApi,
GitHubBranchesResponseApi,
GitHubInstallRequestListResponseApi,
GitHubReposRefreshResponseApi,
GitHubReposResponseApi,
IdentityProviderConfigApi,
IdentityProviderConfigsListParams,
IdentityProviderConfigsScimLogsRetrieveParams,
InvitesListParams,
LeakedKeyReportApi,
LeakedKeyReportResponseApi,
OauthApplicationsListParams,
OnboardingSkipRequestApi,
OrganizationDomainApi,
OrganizationInviteApi,
OrganizationInviteDelegateApi,
OrganizationNotificationLockBulkUpdateApi,
OrganizationNotificationMemberApi,
OrganizationsProjectsEventIngestionRestrictionsListParams,
OrganizationsProjectsListParams,
PaginatedCIMDVerificationTokenListApi,
PaginatedDataDeletionRequestListApi,
PaginatedEnterprisePropertyDefinitionListApi,
PaginatedExportedAssetListApi,
PaginatedFileSystemListApi,
PaginatedFileSystemShortcutListApi,
PaginatedIdentityProviderConfigListApi,
PaginatedOrganizationDomainListApi,
PaginatedOrganizationInviteListApi,
PaginatedOrganizationOAuthApplicationListApi,
PaginatedProjectBackwardCompatBasicListApi,
PaginatedProjectSecretAPIKeyListApi,
PaginatedSCIMRequestLogApi,
PaginatedUploadedMediaListApi,
PaginatedUserGitHubIntegrationListResponseListApi,
PaginatedUserListApi,
PaginatedWorkloadTrustPolicyListApi,
PaginatedWorkloadTrustPolicyRequestListApi,
PatchedCIMDVerificationTokenUpdateApi,
PatchedEnterprisePropertyDefinitionApi,
PatchedFileSystemApi,
PatchedFileSystemShortcutApi,
PatchedIdentityProviderConfigApi,
PatchedOrganizationDomainApi,
PatchedProductIntroSeenApi,
PatchedProjectBackwardCompatApi,
PatchedProjectSecretAPIKeyApi,
PatchedUserApi,
PatchedWorkloadTrustPolicyApi,
ProductEnablementApi,
ProductEnablementResultApi,
ProjectApi,
ProjectBackwardCompatApi,
ProjectCreateRequestApi,
ProjectSecretAPIKeyApi,
ProjectSecretApiKeysListParams,
PropertyDefinitionsListParams,
RevokeOtherSessionsResponseApi,
SCIMTokenResponseApi,
SearchIntentRequestApi,
SearchIntentResponseApi,
SharingConfigurationApi,
TerminalNetplayMailboxApi,
TerminalNetplayMailboxRetrieveParams,
TerminalNetplaySignalApi,
ToolbarEntitlementsApi,
TwoFactorStatusApi,
UploadedMediaApi,
UploadedMediaCreateBody,
UploadedMediaCreatedApi,
UploadedMediaListParams,
UploadedMediaStartUploadApi,
UploadedMediaUploadStartedApi,
UserApi,
UserAuthSessionApi,
UserCodexConnectRequestApi,
UserCodexIntegrationApi,
UserGitHubLinkStartRequestApi,
UserGitHubLinkStartResponseApi,
UserGitHubPrepareCallbackRequestApi,
UserGithubLoginApi,
UserPushTokenItemApi,
UserPushTokenRegisterRequestApi,
UserPushTokenUnregisterRequestApi,
UserSlackLinkStartRequestApi,
UserSlackLinkStartResponseApi,
UserSlackLinkableWorkspaceListResponseApi,
UsersIntegrationsGithubBranchesRetrieveParams,
UsersIntegrationsGithubReposRetrieveParams,
UsersIntegrationsListParams,
UsersListParams,
UsersLoginSessionsListParams,
UsersProductIntroSeenPartialUpdate200,
VerifyEmailRequestApi,
WorkloadProvidersResponseApi,
WorkloadTrustPoliciesListParams,
WorkloadTrustPolicyApi,
WorkloadTrustPolicyRequestApi,
WorkloadTrustPolicyRequestsListParams,
} 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 getOauthConnectedAppsListUrl = () => {
return `/api/oauth/connected-apps/`
}
/**
* Returns all OAuth applications that can currently act as the requesting user, whether they hold an unexpired access token or an unrevoked refresh token.
* @summary List connected OAuth applications
*/
export const oauthConnectedAppsList = async (options?: RequestInit): Promise<ConnectedAppApi[]> => {
return apiMutator<ConnectedAppApi[]>(getOauthConnectedAppsListUrl(), {
...options,
method: 'GET',
})
}
export const getOauthConnectedAppsRevokeCreateUrl = (id: string) => {
return `/api/oauth/connected-apps/${id}/revoke/`
}
/**
* Revokes all tokens and grants for the specified application for the current user.
* @summary Revoke a connected OAuth application
*/
export const oauthConnectedAppsRevokeCreate = async (id: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getOauthConnectedAppsRevokeCreateUrl(id), {
...options,
method: 'POST',
})
}
export const getOauthDeviceApproveCreateUrl = () => {
return `/api/oauth_device/approve/`
}
/**
* Approve a device grant for one project. The token gets the requested scopes the person kept.
*/
export const oauthDeviceApproveCreate = async (
deviceApprovalApi: DeviceApprovalApi,
options?: RequestInit
): Promise<DeviceDecisionApi> => {
return apiMutator<DeviceDecisionApi>(getOauthDeviceApproveCreateUrl(), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(deviceApprovalApi),
})
}
export const getOauthDeviceDenyCreateUrl = () => {
return `/api/oauth_device/deny/`
}
/**
* Refuse a device grant, so the client's next poll gets `access_denied`.
*/
export const oauthDeviceDenyCreate = async (
deviceUserCodeApi: DeviceUserCodeApi,
options?: RequestInit
): Promise<DeviceDecisionApi> => {
return apiMutator<DeviceDecisionApi>(getOauthDeviceDenyCreateUrl(), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(deviceUserCodeApi),
})
}
export const getOauthDeviceLookupCreateUrl = () => {
return `/api/oauth_device/lookup/`
}
/**
* Show what a device code asks for, so the person can check it before approving.
*/
export const oauthDeviceLookupCreate = async (
deviceUserCodeApi: DeviceUserCodeApi,
options?: RequestInit
): Promise<DeviceGrantDetailsApi> => {
return apiMutator<DeviceGrantDetailsApi>(getOauthDeviceLookupCreateUrl(), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(deviceUserCodeApi),
})
}
export const getCimdVerificationTokensListUrl = (organizationId: string, params?: CimdVerificationTokensListParams) => {
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/organizations/${organizationId}/cimd_verification_tokens/?${stringifiedParams}`
: `/api/organizations/${organizationId}/cimd_verification_tokens/`
}
/**
* Manage CIMD verification tokens for an organization.
*
* A partner embeds the plaintext token in their CIMD metadata document as
* `verification_token` inside the `com.posthog` object (the legacy top-level
* `posthog_verification_token` field still works as a fallback). When PostHog fetches
* the metadata, matching the token links the partner app to this organization and
* grants a higher default rate limit for account provisioning.
*
* Each token is scoped at creation to the one `cimd_url` it will be published at,
* and verifies nowhere else. Two organizations may name the same URL; only the one
* whose token is actually served there verifies, so claiming a URL cannot be used
* to block a partner from verifying theirs.
*
* The plaintext value is only available on creation; we store a hash.
*/
export const cimdVerificationTokensList = async (
organizationId: string,
params?: CimdVerificationTokensListParams,
options?: RequestInit
): Promise<PaginatedCIMDVerificationTokenListApi> => {
return apiMutator<PaginatedCIMDVerificationTokenListApi>(getCimdVerificationTokensListUrl(organizationId, params), {
...options,
method: 'GET',
})
}
export const getCimdVerificationTokensCreateUrl = (organizationId: string) => {
return `/api/organizations/${organizationId}/cimd_verification_tokens/`
}
/**
* Manage CIMD verification tokens for an organization.
*
* A partner embeds the plaintext token in their CIMD metadata document as
* `verification_token` inside the `com.posthog` object (the legacy top-level
* `posthog_verification_token` field still works as a fallback). When PostHog fetches
* the metadata, matching the token links the partner app to this organization and
* grants a higher default rate limit for account provisioning.
*
* Each token is scoped at creation to the one `cimd_url` it will be published at,
* and verifies nowhere else. Two organizations may name the same URL; only the one
* whose token is actually served there verifies, so claiming a URL cannot be used
* to block a partner from verifying theirs.
*
* The plaintext value is only available on creation; we store a hash.
*/
export const cimdVerificationTokensCreate = async (
organizationId: string,
cIMDVerificationTokenCreateApi: CIMDVerificationTokenCreateApi,
options?: RequestInit
): Promise<CIMDVerificationTokenWithValueApi> => {
return apiMutator<CIMDVerificationTokenWithValueApi>(getCimdVerificationTokensCreateUrl(organizationId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(cIMDVerificationTokenCreateApi),
})
}
export const getCimdVerificationTokensRetrieveUrl = (organizationId: string, id: string) => {
return `/api/organizations/${organizationId}/cimd_verification_tokens/${id}/`
}
/**
* Manage CIMD verification tokens for an organization.
*
* A partner embeds the plaintext token in their CIMD metadata document as
* `verification_token` inside the `com.posthog` object (the legacy top-level
* `posthog_verification_token` field still works as a fallback). When PostHog fetches
* the metadata, matching the token links the partner app to this organization and
* grants a higher default rate limit for account provisioning.
*
* Each token is scoped at creation to the one `cimd_url` it will be published at,
* and verifies nowhere else. Two organizations may name the same URL; only the one
* whose token is actually served there verifies, so claiming a URL cannot be used
* to block a partner from verifying theirs.
*
* The plaintext value is only available on creation; we store a hash.
*/
export const cimdVerificationTokensRetrieve = async (
organizationId: string,
id: string,
options?: RequestInit
): Promise<CIMDVerificationTokenApi> => {
return apiMutator<CIMDVerificationTokenApi>(getCimdVerificationTokensRetrieveUrl(organizationId, id), {
...options,
method: 'GET',
})
}
export const getCimdVerificationTokensPartialUpdateUrl = (organizationId: string, id: string) => {
return `/api/organizations/${organizationId}/cimd_verification_tokens/${id}/`
}
/**
* Manage CIMD verification tokens for an organization.
*
* A partner embeds the plaintext token in their CIMD metadata document as
* `verification_token` inside the `com.posthog` object (the legacy top-level
* `posthog_verification_token` field still works as a fallback). When PostHog fetches
* the metadata, matching the token links the partner app to this organization and
* grants a higher default rate limit for account provisioning.
*
* Each token is scoped at creation to the one `cimd_url` it will be published at,
* and verifies nowhere else. Two organizations may name the same URL; only the one
* whose token is actually served there verifies, so claiming a URL cannot be used
* to block a partner from verifying theirs.
*
* The plaintext value is only available on creation; we store a hash.
*/
export const cimdVerificationTokensPartialUpdate = async (
organizationId: string,
id: string,
patchedCIMDVerificationTokenUpdateApi?: PatchedCIMDVerificationTokenUpdateApi,
options?: RequestInit
): Promise<CIMDVerificationTokenApi> => {
return apiMutator<CIMDVerificationTokenApi>(getCimdVerificationTokensPartialUpdateUrl(organizationId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedCIMDVerificationTokenUpdateApi),
})
}
export const getCimdVerificationTokensDestroyUrl = (organizationId: string, id: string) => {
return `/api/organizations/${organizationId}/cimd_verification_tokens/${id}/`
}
/**
* Manage CIMD verification tokens for an organization.
*
* A partner embeds the plaintext token in their CIMD metadata document as
* `verification_token` inside the `com.posthog` object (the legacy top-level
* `posthog_verification_token` field still works as a fallback). When PostHog fetches
* the metadata, matching the token links the partner app to this organization and
* grants a higher default rate limit for account provisioning.
*
* Each token is scoped at creation to the one `cimd_url` it will be published at,
* and verifies nowhere else. Two organizations may name the same URL; only the one
* whose token is actually served there verifies, so claiming a URL cannot be used
* to block a partner from verifying theirs.
*
* The plaintext value is only available on creation; we store a hash.
*/
export const cimdVerificationTokensDestroy = async (
organizationId: string,
id: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getCimdVerificationTokensDestroyUrl(organizationId, id), {
...options,
method: 'DELETE',
})
}
export const getDomainsListUrl = (organizationId: string, params?: DomainsListParams) => {
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/organizations/${organizationId}/domains/?${stringifiedParams}`
: `/api/organizations/${organizationId}/domains/`
}
export const domainsList = async (
organizationId: string,
params?: DomainsListParams,
options?: RequestInit
): Promise<PaginatedOrganizationDomainListApi> => {
return apiMutator<PaginatedOrganizationDomainListApi>(getDomainsListUrl(organizationId, params), {
...options,
method: 'GET',
})
}
export const getDomainsCreateUrl = (organizationId: string) => {
return `/api/organizations/${organizationId}/domains/`
}
export const domainsCreate = async (
organizationId: string,
organizationDomainApi: NonReadonly<OrganizationDomainApi>,
options?: RequestInit
): Promise<OrganizationDomainApi> => {
return apiMutator<OrganizationDomainApi>(getDomainsCreateUrl(organizationId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(organizationDomainApi),
})
}
export const getDomainsRetrieveUrl = (organizationId: string, id: string) => {
return `/api/organizations/${organizationId}/domains/${id}/`
}
export const domainsRetrieve = async (
organizationId: string,
id: string,
options?: RequestInit
): Promise<OrganizationDomainApi> => {
return apiMutator<OrganizationDomainApi>(getDomainsRetrieveUrl(organizationId, id), {
...options,
method: 'GET',
})
}
export const getDomainsUpdateUrl = (organizationId: string, id: string) => {
return `/api/organizations/${organizationId}/domains/${id}/`
}
export const domainsUpdate = async (
organizationId: string,
id: string,
organizationDomainApi: NonReadonly<OrganizationDomainApi>,
options?: RequestInit
): Promise<OrganizationDomainApi> => {
return apiMutator<OrganizationDomainApi>(getDomainsUpdateUrl(organizationId, id), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(organizationDomainApi),
})
}
export const getDomainsPartialUpdateUrl = (organizationId: string, id: string) => {
return `/api/organizations/${organizationId}/domains/${id}/`
}
export const domainsPartialUpdate = async (
organizationId: string,
id: string,
patchedOrganizationDomainApi?: NonReadonly<PatchedOrganizationDomainApi>,
options?: RequestInit
): Promise<OrganizationDomainApi> => {
return apiMutator<OrganizationDomainApi>(getDomainsPartialUpdateUrl(organizationId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedOrganizationDomainApi),
})
}
export const getDomainsDestroyUrl = (organizationId: string, id: string) => {
return `/api/organizations/${organizationId}/domains/${id}/`
}
export const domainsDestroy = async (organizationId: string, id: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getDomainsDestroyUrl(organizationId, id), {
...options,
method: 'DELETE',
})
}
export const getDomainsScimLogsRetrieveUrl = (
organizationId: string,
id: string,
params?: DomainsScimLogsRetrieveParams
) => {
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/organizations/${organizationId}/domains/${id}/scim/logs/?${stringifiedParams}`
: `/api/organizations/${organizationId}/domains/${id}/scim/logs/`
}
export const domainsScimLogsRetrieve = async (
organizationId: string,
id: string,
params?: DomainsScimLogsRetrieveParams,
options?: RequestInit
): Promise<PaginatedSCIMRequestLogApi> => {
return apiMutator<PaginatedSCIMRequestLogApi>(getDomainsScimLogsRetrieveUrl(organizationId, id, params), {
...options,
method: 'GET',
})
}
export const getDomainsVerifyCreateUrl = (organizationId: string, id: string) => {
return `/api/organizations/${organizationId}/domains/${id}/verify/`
}
export const domainsVerifyCreate = async (
organizationId: string,
id: string,
organizationDomainApi: NonReadonly<OrganizationDomainApi>,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getDomainsVerifyCreateUrl(organizationId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(organizationDomainApi),
})
}
export const getIdentityProviderConfigsListUrl = (
organizationId: string,
params?: IdentityProviderConfigsListParams
) => {
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/organizations/${organizationId}/identity_provider_configs/?${stringifiedParams}`
: `/api/organizations/${organizationId}/identity_provider_configs/`
}
export const identityProviderConfigsList = async (
organizationId: string,
params?: IdentityProviderConfigsListParams,
options?: RequestInit
): Promise<PaginatedIdentityProviderConfigListApi> => {
return apiMutator<PaginatedIdentityProviderConfigListApi>(
getIdentityProviderConfigsListUrl(organizationId, params),
{
...options,
method: 'GET',
}
)
}
export const getIdentityProviderConfigsCreateUrl = (organizationId: string) => {
return `/api/organizations/${organizationId}/identity_provider_configs/`
}
export const identityProviderConfigsCreate = async (
organizationId: string,
identityProviderConfigApi?: NonReadonly<IdentityProviderConfigApi>,
options?: RequestInit
): Promise<IdentityProviderConfigApi> => {
return apiMutator<IdentityProviderConfigApi>(getIdentityProviderConfigsCreateUrl(organizationId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(identityProviderConfigApi),
})
}
export const getIdentityProviderConfigsRetrieveUrl = (organizationId: string, id: string) => {
return `/api/organizations/${organizationId}/identity_provider_configs/${id}/`
}
export const identityProviderConfigsRetrieve = async (
organizationId: string,
id: string,
options?: RequestInit
): Promise<IdentityProviderConfigApi> => {
return apiMutator<IdentityProviderConfigApi>(getIdentityProviderConfigsRetrieveUrl(organizationId, id), {
...options,
method: 'GET',
})
}
export const getIdentityProviderConfigsUpdateUrl = (organizationId: string, id: string) => {
return `/api/organizations/${organizationId}/identity_provider_configs/${id}/`
}
export const identityProviderConfigsUpdate = async (
organizationId: string,
id: string,
identityProviderConfigApi?: NonReadonly<IdentityProviderConfigApi>,
options?: RequestInit
): Promise<IdentityProviderConfigApi> => {
return apiMutator<IdentityProviderConfigApi>(getIdentityProviderConfigsUpdateUrl(organizationId, id), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(identityProviderConfigApi),
})
}
export const getIdentityProviderConfigsPartialUpdateUrl = (organizationId: string, id: string) => {
return `/api/organizations/${organizationId}/identity_provider_configs/${id}/`
}
export const identityProviderConfigsPartialUpdate = async (
organizationId: string,
id: string,
patchedIdentityProviderConfigApi?: NonReadonly<PatchedIdentityProviderConfigApi>,
options?: RequestInit
): Promise<IdentityProviderConfigApi> => {
return apiMutator<IdentityProviderConfigApi>(getIdentityProviderConfigsPartialUpdateUrl(organizationId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedIdentityProviderConfigApi),
})
}
export const getIdentityProviderConfigsDestroyUrl = (organizationId: string, id: string) => {
return `/api/organizations/${organizationId}/identity_provider_configs/${id}/`
}
export const identityProviderConfigsDestroy = async (
organizationId: string,
id: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getIdentityProviderConfigsDestroyUrl(organizationId, id), {
...options,
method: 'DELETE',
})
}
export const getIdentityProviderConfigsScimLogsRetrieveUrl = (
organizationId: string,
id: string,
params?: IdentityProviderConfigsScimLogsRetrieveParams
) => {
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/organizations/${organizationId}/identity_provider_configs/${id}/scim/logs/?${stringifiedParams}`
: `/api/organizations/${organizationId}/identity_provider_configs/${id}/scim/logs/`
}
export const identityProviderConfigsScimLogsRetrieve = async (
organizationId: string,
id: string,
params?: IdentityProviderConfigsScimLogsRetrieveParams,
options?: RequestInit
): Promise<PaginatedSCIMRequestLogApi> => {
return apiMutator<PaginatedSCIMRequestLogApi>(
getIdentityProviderConfigsScimLogsRetrieveUrl(organizationId, id, params),
{
...options,
method: 'GET',
}
)
}
export const getIdentityProviderConfigsScimTokenCreateUrl = (organizationId: string, id: string) => {
return `/api/organizations/${organizationId}/identity_provider_configs/${id}/scim/token/`
}
/**
* Regenerate the SCIM bearer token for this IdP config.
*/
export const identityProviderConfigsScimTokenCreate = async (
organizationId: string,
id: string,
options?: RequestInit
): Promise<SCIMTokenResponseApi> => {
return apiMutator<SCIMTokenResponseApi>(getIdentityProviderConfigsScimTokenCreateUrl(organizationId, id), {
...options,
method: 'POST',
})
}
export const getInvitesListUrl = (organizationId: string, params?: InvitesListParams) => {
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/organizations/${organizationId}/invites/?${stringifiedParams}`
: `/api/organizations/${organizationId}/invites/`
}
export const invitesList = async (
organizationId: string,
params?: InvitesListParams,
options?: RequestInit
): Promise<PaginatedOrganizationInviteListApi> => {
return apiMutator<PaginatedOrganizationInviteListApi>(getInvitesListUrl(organizationId, params), {
...options,
method: 'GET',
})
}
export const getInvitesCreateUrl = (organizationId: string) => {
return `/api/organizations/${organizationId}/invites/`
}
export const invitesCreate = async (
organizationId: string,
organizationInviteApi: NonReadonly<OrganizationInviteApi>,
options?: RequestInit
): Promise<OrganizationInviteApi> => {
return apiMutator<OrganizationInviteApi>(getInvitesCreateUrl(organizationId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(organizationInviteApi),
})
}
export const getInvitesDestroyUrl = (organizationId: string, id: string) => {
return `/api/organizations/${organizationId}/invites/${id}/`
}
export const invitesDestroy = async (organizationId: string, id: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getInvitesDestroyUrl(organizationId, id), {
...options,
method: 'DELETE',
})
}
export const getInvitesBulkCreateUrl = (organizationId: string) => {
return `/api/organizations/${organizationId}/invites/bulk/`
}
export const invitesBulkCreate = async (
organizationId: string,
organizationInviteApi: NonReadonly<OrganizationInviteApi>,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getInvitesBulkCreateUrl(organizationId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(organizationInviteApi),
})
}
export const getInvitesDelegateCreateUrl = (organizationId: string) => {
return `/api/organizations/${organizationId}/invites/delegate/`
}
/**
* Create an onboarding delegation invite: an admin-level invite flagged as a setup delegation.
* Sends a single dedicated delegation email and records the inviting user as having delegated.
*/
export const invitesDelegateCreate = async (
organizationId: string,
organizationInviteDelegateApi: OrganizationInviteDelegateApi,
options?: RequestInit
): Promise<OrganizationInviteApi> => {
return apiMutator<OrganizationInviteApi>(getInvitesDelegateCreateUrl(organizationId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(organizationInviteDelegateApi),
})
}
export const getNotificationLocksListUrl = (organizationId: string) => {
return `/api/organizations/${organizationId}/notification_locks/`
}
/**
* List the organization's members with their own notification settings and the locks in force for each.
*/
export const notificationLocksList = async (
organizationId: string,
options?: RequestInit
): Promise<OrganizationNotificationMemberApi[]> => {
return apiMutator<OrganizationNotificationMemberApi[]>(getNotificationLocksListUrl(organizationId), {
...options,
method: 'GET',
})
}
export const getNotificationLocksBulkUpdateCreateUrl = (organizationId: string) => {
return `/api/organizations/${organizationId}/notification_locks/bulk_update/`
}
/**
* Lock or unlock notification settings for members of this organization. Each affected member is notified in the app.
*/
export const notificationLocksBulkUpdateCreate = async (
organizationId: string,
organizationNotificationLockBulkUpdateApi: OrganizationNotificationLockBulkUpdateApi,
options?: RequestInit
): Promise<OrganizationNotificationMemberApi[]> => {
return apiMutator<OrganizationNotificationMemberApi[]>(getNotificationLocksBulkUpdateCreateUrl(organizationId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(organizationNotificationLockBulkUpdateApi),
})
}
export const getOauthApplicationsListUrl = (organizationId: string, params?: OauthApplicationsListParams) => {
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/organizations/${organizationId}/oauth_applications/?${stringifiedParams}`
: `/api/organizations/${organizationId}/oauth_applications/`
}
/**
* ViewSet for listing OAuth applications at the organization level (read-only).
*/
export const oauthApplicationsList = async (
organizationId: string,
params?: OauthApplicationsListParams,
options?: RequestInit
): Promise<PaginatedOrganizationOAuthApplicationListApi> => {
return apiMutator<PaginatedOrganizationOAuthApplicationListApi>(
getOauthApplicationsListUrl(organizationId, params),
{
...options,
method: 'GET',
}
)
}
export const getOrganizationsProjectsListUrl = (organizationId: string, params?: OrganizationsProjectsListParams) => {
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/organizations/${organizationId}/projects/?${stringifiedParams}`
: `/api/organizations/${organizationId}/projects/`
}
/**
* Projects for the current organization.
*/
export const organizationsProjectsList = async (
organizationId: string,
params?: OrganizationsProjectsListParams,
options?: RequestInit
): Promise<PaginatedProjectBackwardCompatBasicListApi> => {
return apiMutator<PaginatedProjectBackwardCompatBasicListApi>(
getOrganizationsProjectsListUrl(organizationId, params),
{
...options,
method: 'GET',
}
)
}
export const getOrganizationsProjectsCreateUrl = (organizationId: string) => {
return `/api/organizations/${organizationId}/projects/`
}
/**
* Projects for the current organization.
*/
export const organizationsProjectsCreate = async (
organizationId: string,
projectCreateRequestApi?: ProjectCreateRequestApi,
options?: RequestInit
): Promise<ProjectBackwardCompatApi> => {
return apiMutator<ProjectBackwardCompatApi>(getOrganizationsProjectsCreateUrl(organizationId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(projectCreateRequestApi),
})
}
export const getOrganizationsProjectsRetrieveUrl = (organizationId: string, id: number) => {
return `/api/organizations/${organizationId}/projects/${id}/`
}
/**
* Retrieve a project and its settings.
*/
export const organizationsProjectsRetrieve = async (
organizationId: string,
id: number,
options?: RequestInit
): Promise<ProjectBackwardCompatApi> => {
return apiMutator<ProjectBackwardCompatApi>(getOrganizationsProjectsRetrieveUrl(organizationId, id), {
...options,
method: 'GET',
})
}
export const getOrganizationsProjectsUpdateUrl = (organizationId: string, id: number) => {
return `/api/organizations/${organizationId}/projects/${id}/`
}
/**
* Replace a project and its settings. Prefer the PATCH endpoint for partial updates — PUT requires every writable field to be provided.
*/
export const organizationsProjectsUpdate = async (
organizationId: string,
id: number,
projectBackwardCompatApi?: NonReadonly<ProjectBackwardCompatApi>,
options?: RequestInit
): Promise<ProjectBackwardCompatApi> => {
return apiMutator<ProjectBackwardCompatApi>(getOrganizationsProjectsUpdateUrl(organizationId, id), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(projectBackwardCompatApi),
})
}
export const getOrganizationsProjectsPartialUpdateUrl = (organizationId: string, id: number) => {
return `/api/organizations/${organizationId}/projects/${id}/`
}
/**
* Update one or more of a project's settings. Only the fields included in the request body are changed.
*/
export const organizationsProjectsPartialUpdate = async (
organizationId: string,
id: number,
patchedProjectBackwardCompatApi?: NonReadonly<PatchedProjectBackwardCompatApi>,
options?: RequestInit
): Promise<ProjectBackwardCompatApi> => {
return apiMutator<ProjectBackwardCompatApi>(getOrganizationsProjectsPartialUpdateUrl(organizationId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedProjectBackwardCompatApi),
})
}
export const getOrganizationsProjectsDestroyUrl = (organizationId: string, id: number) => {
return `/api/organizations/${organizationId}/projects/${id}/`
}
/**
* Projects for the current organization.
*/
export const organizationsProjectsDestroy = async (
organizationId: string,
id: number,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getOrganizationsProjectsDestroyUrl(organizationId, id), {
...options,
method: 'DELETE',
})
}
export const getOrganizationsProjectsActivityRetrieveUrl = (organizationId: string, id: number) => {
return `/api/organizations/${organizationId}/projects/${id}/activity/`
}
/**
* Projects for the current organization.
*/
export const organizationsProjectsActivityRetrieve = async (
organizationId: string,
id: number,
options?: RequestInit
): Promise<ProjectBackwardCompatApi> => {
return apiMutator<ProjectBackwardCompatApi>(getOrganizationsProjectsActivityRetrieveUrl(organizationId, id), {
...options,
method: 'GET',
})
}
export const getOrganizationsProjectsAddProductIntentPartialUpdateUrl = (organizationId: string, id: number) => {
return `/api/organizations/${organizationId}/projects/${id}/add_product_intent/`
}
/**
* Projects for the current organization.
*/
export const organizationsProjectsAddProductIntentPartialUpdate = async (
organizationId: string,
id: number,
patchedProjectBackwardCompatApi?: NonReadonly<PatchedProjectBackwardCompatApi>,
options?: RequestInit
): Promise<ProjectBackwardCompatApi> => {
return apiMutator<ProjectBackwardCompatApi>(
getOrganizationsProjectsAddProductIntentPartialUpdateUrl(organizationId, id),
{
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedProjectBackwardCompatApi),
}
)
}
export const getOrganizationsProjectsCancelDeletionCreateUrl = (organizationId: string, id: number) => {
return `/api/organizations/${organizationId}/projects/${id}/cancel-deletion/`
}
/**
* Cancel a scheduled project deletion and restore access to the project.
*/
export const organizationsProjectsCancelDeletionCreate = async (
organizationId: string,
id: number,
options?: RequestInit
): Promise<ProjectApi> => {
return apiMutator<ProjectApi>(getOrganizationsProjectsCancelDeletionCreateUrl(organizationId, id), {
...options,
method: 'POST',
})
}
export const getOrganizationsProjectsChangeOrganizationCreateUrl = (organizationId: string, id: number) => {
return `/api/organizations/${organizationId}/projects/${id}/change_organization/`
}
/**
* Projects for the current organization.
*/
export const organizationsProjectsChangeOrganizationCreate = async (
organizationId: string,
id: number,
projectBackwardCompatApi?: NonReadonly<ProjectBackwardCompatApi>,
options?: RequestInit
): Promise<ProjectBackwardCompatApi> => {
return apiMutator<ProjectBackwardCompatApi>(
getOrganizationsProjectsChangeOrganizationCreateUrl(organizationId, id),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(projectBackwardCompatApi),
}
)
}
export const getOrganizationsProjectsCompleteProductOnboardingPartialUpdateUrl = (
organizationId: string,
id: number
) => {
return `/api/organizations/${organizationId}/projects/${id}/complete_product_onboarding/`
}
/**
* Projects for the current organization.
*/
export const organizationsProjectsCompleteProductOnboardingPartialUpdate = async (
organizationId: string,
id: number,
patchedProjectBackwardCompatApi?: NonReadonly<PatchedProjectBackwardCompatApi>,
options?: RequestInit
): Promise<ProjectBackwardCompatApi> => {
return apiMutator<ProjectBackwardCompatApi>(
getOrganizationsProjectsCompleteProductOnboardingPartialUpdateUrl(organizationId, id),
{
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedProjectBackwardCompatApi),
}
)
}
export const getOrganizationsProjectsDefaultEvaluationContextsRetrieveUrl = (organizationId: string, id: number) => {
return `/api/organizations/${organizationId}/projects/${id}/default_evaluation_contexts/`
}
/**
* Manage default evaluation contexts for a project. Members can read; writing requires
* project admin, matching the admin-only settings UI.
*/
export const organizationsProjectsDefaultEvaluationContextsRetrieve = async (
organizationId: string,
id: number,
options?: RequestInit
): Promise<ProjectBackwardCompatApi> => {
return apiMutator<ProjectBackwardCompatApi>(
getOrganizationsProjectsDefaultEvaluationContextsRetrieveUrl(organizationId, id),
{
...options,
method: 'GET',
}
)
}
export const getOrganizationsProjectsDefaultEvaluationContextsCreateUrl = (organizationId: string, id: number) => {
return `/api/organizations/${organizationId}/projects/${id}/default_evaluation_contexts/`
}
/**
* Manage default evaluation contexts for a project. Members can read; writing requires
* project admin, matching the admin-only settings UI.
*/
export const organizationsProjectsDefaultEvaluationContextsCreate = async (
organizationId: string,
id: number,
projectBackwardCompatApi?: NonReadonly<ProjectBackwardCompatApi>,
options?: RequestInit
): Promise<ProjectBackwardCompatApi> => {
return apiMutator<ProjectBackwardCompatApi>(
getOrganizationsProjectsDefaultEvaluationContextsCreateUrl(organizationId, id),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(projectBackwardCompatApi),
}
)
}
export const getOrganizationsProjectsDefaultEvaluationContextsDestroyUrl = (organizationId: string, id: number) => {
return `/api/organizations/${organizationId}/projects/${id}/default_evaluation_contexts/`
}
/**
* Manage default evaluation contexts for a project. Members can read; writing requires
* project admin, matching the admin-only settings UI.
*/
export const organizationsProjectsDefaultEvaluationContextsDestroy = async (
organizationId: string,
id: number,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getOrganizationsProjectsDefaultEvaluationContextsDestroyUrl(organizationId, id), {
...options,
method: 'DELETE',
})
}
export const getOrganizationsProjectsDefaultReleaseConditionsRetrieveUrl = (organizationId: string, id: number) => {
return `/api/organizations/${organizationId}/projects/${id}/default_release_conditions/`
}
/**
* Manage default release conditions for new feature flags in this project. Members can read;
* writing requires project admin, matching the admin-only settings UI.
*/
export const organizationsProjectsDefaultReleaseConditionsRetrieve = async (
organizationId: string,
id: number,
options?: RequestInit
): Promise<ProjectBackwardCompatApi> => {
return apiMutator<ProjectBackwardCompatApi>(
getOrganizationsProjectsDefaultReleaseConditionsRetrieveUrl(organizationId, id),
{
...options,
method: 'GET',
}
)
}
export const getOrganizationsProjectsDefaultReleaseConditionsUpdateUrl = (organizationId: string, id: number) => {
return `/api/organizations/${organizationId}/projects/${id}/default_release_conditions/`
}
/**
* Manage default release conditions for new feature flags in this project. Members can read;
* writing requires project admin, matching the admin-only settings UI.
*/
export const organizationsProjectsDefaultReleaseConditionsUpdate = async (
organizationId: string,
id: number,
projectBackwardCompatApi?: NonReadonly<ProjectBackwardCompatApi>,
options?: RequestInit
): Promise<ProjectBackwardCompatApi> => {
return apiMutator<ProjectBackwardCompatApi>(
getOrganizationsProjectsDefaultReleaseConditionsUpdateUrl(organizationId, id),
{
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(projectBackwardCompatApi),
}
)
}
export const getOrganizationsProjectsDeleteSecretTokenBackupPartialUpdateUrl = (organizationId: string, id: number) => {
return `/api/organizations/${organizationId}/projects/${id}/delete_secret_token_backup/`
}
/**
* Projects for the current organization.
*/
export const organizationsProjectsDeleteSecretTokenBackupPartialUpdate = async (
organizationId: string,
id: number,
patchedProjectBackwardCompatApi?: NonReadonly<PatchedProjectBackwardCompatApi>,
options?: RequestInit
): Promise<ProjectBackwardCompatApi> => {
return apiMutator<ProjectBackwardCompatApi>(
getOrganizationsProjectsDeleteSecretTokenBackupPartialUpdateUrl(organizationId, id),
{
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedProjectBackwardCompatApi),
}
)
}
export const getOrganizationsProjectsEventIngestionRestrictionsListUrl = (
organizationId: string,
id: number,
params?: OrganizationsProjectsEventIngestionRestrictionsListParams
) => {
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/organizations/${organizationId}/projects/${id}/event_ingestion_restrictions/?${stringifiedParams}`
: `/api/organizations/${organizationId}/projects/${id}/event_ingestion_restrictions/`
}
/**
* Projects for the current organization.
*/
export const organizationsProjectsEventIngestionRestrictionsList = async (
organizationId: string,
id: number,
params?: OrganizationsProjectsEventIngestionRestrictionsListParams,
options?: RequestInit
): Promise<EventIngestionRestrictionApi[]> => {
return apiMutator<EventIngestionRestrictionApi[]>(
getOrganizationsProjectsEventIngestionRestrictionsListUrl(organizationId, id, params),
{
...options,
method: 'GET',
}
)
}
export const getOrganizationsProjectsExperimentsConfigRetrieveUrl = (organizationId: string, id: number) => {
return `/api/organizations/${organizationId}/projects/${id}/experiments_config/`
}
/**
* Manage experiment configuration for this project.
*/
export const organizationsProjectsExperimentsConfigRetrieve = async (
organizationId: string,
id: number,
options?: RequestInit
): Promise<ProjectBackwardCompatApi> => {
return apiMutator<ProjectBackwardCompatApi>(
getOrganizationsProjectsExperimentsConfigRetrieveUrl(organizationId, id),
{
...options,
method: 'GET',
}
)
}
export const getOrganizationsProjectsExperimentsConfigPartialUpdateUrl = (organizationId: string, id: number) => {
return `/api/organizations/${organizationId}/projects/${id}/experiments_config/`
}
/**
* Manage experiment configuration for this project.
*/
export const organizationsProjectsExperimentsConfigPartialUpdate = async (
organizationId: string,
id: number,
patchedProjectBackwardCompatApi?: NonReadonly<PatchedProjectBackwardCompatApi>,
options?: RequestInit
): Promise<ProjectBackwardCompatApi> => {
return apiMutator<ProjectBackwardCompatApi>(
getOrganizationsProjectsExperimentsConfigPartialUpdateUrl(organizationId, id),
{
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedProjectBackwardCompatApi),
}
)
}
export const getOrganizationsProjectsGenerateConversationsPublicTokenCreateUrl = (
organizationId: string,
id: number
) => {
return `/api/organizations/${organizationId}/projects/${id}/generate_conversations_public_token/`
}
/**
* Projects for the current organization.
*/
export const organizationsProjectsGenerateConversationsPublicTokenCreate = async (
organizationId: string,
id: number,
projectBackwardCompatApi?: NonReadonly<ProjectBackwardCompatApi>,
options?: RequestInit
): Promise<ProjectBackwardCompatApi> => {
return apiMutator<ProjectBackwardCompatApi>(
getOrganizationsProjectsGenerateConversationsPublicTokenCreateUrl(organizationId, id),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(projectBackwardCompatApi),
}
)
}
export const getOrganizationsProjectsIsGeneratingDemoDataRetrieveUrl = (organizationId: string, id: number) => {
return `/api/organizations/${organizationId}/projects/${id}/is_generating_demo_data/`
}
/**
* Projects for the current organization.
*/
export const organizationsProjectsIsGeneratingDemoDataRetrieve = async (
organizationId: string,
id: number,
options?: RequestInit
): Promise<ProjectBackwardCompatApi> => {
return apiMutator<ProjectBackwardCompatApi>(
getOrganizationsProjectsIsGeneratingDemoDataRetrieveUrl(organizationId, id),
{
...options,
method: 'GET',
}
)
}
export const getOrganizationsProjectsResetTokenPartialUpdateUrl = (organizationId: string, id: number) => {
return `/api/organizations/${organizationId}/projects/${id}/reset_token/`
}
/**
* Projects for the current organization.
*/
export const organizationsProjectsResetTokenPartialUpdate = async (
organizationId: string,
id: number,
patchedProjectBackwardCompatApi?: NonReadonly<PatchedProjectBackwardCompatApi>,
options?: RequestInit
): Promise<ProjectBackwardCompatApi> => {
return apiMutator<ProjectBackwardCompatApi>(
getOrganizationsProjectsResetTokenPartialUpdateUrl(organizationId, id),
{
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedProjectBackwardCompatApi),
}
)
}
export const getOrganizationsProjectsRotateHeatmapsScreenshotSecretPartialUpdateUrl = (
organizationId: string,
id: number
) => {
return `/api/organizations/${organizationId}/projects/${id}/rotate_heatmaps_screenshot_secret/`
}
/**
* Projects for the current organization.
*/
export const organizationsProjectsRotateHeatmapsScreenshotSecretPartialUpdate = async (
organizationId: string,
id: number,
options?: RequestInit
): Promise<ProjectBackwardCompatApi> => {
return apiMutator<ProjectBackwardCompatApi>(
getOrganizationsProjectsRotateHeatmapsScreenshotSecretPartialUpdateUrl(organizationId, id),
{
...options,
method: 'PATCH',
}
)
}
export const getOrganizationsProjectsRotateSecretTokenPartialUpdateUrl = (organizationId: string, id: number) => {
return `/api/organizations/${organizationId}/projects/${id}/rotate_secret_token/`
}
/**
* Projects for the current organization.
*/
export const organizationsProjectsRotateSecretTokenPartialUpdate = async (
organizationId: string,
id: number,
patchedProjectBackwardCompatApi?: NonReadonly<PatchedProjectBackwardCompatApi>,
options?: RequestInit
): Promise<ProjectBackwardCompatApi> => {
return apiMutator<ProjectBackwardCompatApi>(
getOrganizationsProjectsRotateSecretTokenPartialUpdateUrl(organizationId, id),
{
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedProjectBackwardCompatApi),
}
)
}
export const getOrganizationsProjectsSettingsAsOfRetrieveUrl = (organizationId: string, id: number) => {
return `/api/organizations/${organizationId}/projects/${id}/settings_as_of/`
}
/**
* Return the project settings as of the provided timestamp.
* Query params:
* - at: ISO8601 datetime (required)
* - scope: optional, one or multiple keys to filter the returned settings
*/
export const organizationsProjectsSettingsAsOfRetrieve = async (
organizationId: string,
id: number,
options?: RequestInit
): Promise<ProjectBackwardCompatApi> => {
return apiMutator<ProjectBackwardCompatApi>(getOrganizationsProjectsSettingsAsOfRetrieveUrl(organizationId, id), {
...options,
method: 'GET',
})
}
export const getDashboardsSharingListUrl = (projectId: string, dashboardId: number) => {
return `/api/projects/${projectId}/dashboards/${dashboardId}/sharing/`
}
export const dashboardsSharingList = async (
projectId: string,
dashboardId: number,
options?: RequestInit
): Promise<SharingConfigurationApi[]> => {
return apiMutator<SharingConfigurationApi[]>(getDashboardsSharingListUrl(projectId, dashboardId), {
...options,
method: 'GET',
})
}
export const getDashboardsSharingPasswordsCreateUrl = (projectId: string, dashboardId: number) => {
return `/api/projects/${projectId}/dashboards/${dashboardId}/sharing/passwords/`
}
/**
* Create a new password for the sharing configuration.
*/
export const dashboardsSharingPasswordsCreate = async (
projectId: string,
dashboardId: number,
sharingConfigurationApi?: NonReadonly<SharingConfigurationApi>,
options?: RequestInit
): Promise<SharingConfigurationApi> => {
return apiMutator<SharingConfigurationApi>(getDashboardsSharingPasswordsCreateUrl(projectId, dashboardId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(sharingConfigurationApi),
})
}
export const getDashboardsSharingPasswordsDestroyUrl = (projectId: string, dashboardId: number, passwordId: string) => {
return `/api/projects/${projectId}/dashboards/${dashboardId}/sharing/passwords/${passwordId}/`
}
/**
* Delete a password from the sharing configuration.
*/
export const dashboardsSharingPasswordsDestroy = async (
projectId: string,
dashboardId: number,
passwordId: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getDashboardsSharingPasswordsDestroyUrl(projectId, dashboardId, passwordId), {
...options,
method: 'DELETE',
})
}
export const getDashboardsSharingRefreshCreateUrl = (projectId: string, dashboardId: number) => {
return `/api/projects/${projectId}/dashboards/${dashboardId}/sharing/refresh/`
}
export const dashboardsSharingRefreshCreate = async (
projectId: string,
dashboardId: number,
sharingConfigurationApi?: NonReadonly<SharingConfigurationApi>,
options?: RequestInit
): Promise<SharingConfigurationApi> => {
return apiMutator<SharingConfigurationApi>(getDashboardsSharingRefreshCreateUrl(projectId, dashboardId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(sharingConfigurationApi),
})
}
export const getDataDeletionRequestsListUrl = (projectId: string, params?: DataDeletionRequestsListParams) => {
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_deletion_requests/?${stringifiedParams}`
: `/api/projects/${projectId}/data_deletion_requests/`
}
/**
* List self-service event deletion requests for this project.
*/
export const dataDeletionRequestsList = async (
projectId: string,
params?: DataDeletionRequestsListParams,
options?: RequestInit
): Promise<PaginatedDataDeletionRequestListApi> => {
return apiMutator<PaginatedDataDeletionRequestListApi>(getDataDeletionRequestsListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getDataDeletionRequestsCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/data_deletion_requests/`
}
/**
* Submit a one-column HogQL query for event deletion.
*/
export const dataDeletionRequestsCreate = async (
projectId: string,
dataDeletionRequestCreateApi: DataDeletionRequestCreateApi,
options?: RequestInit
): Promise<DataDeletionRequestApi> => {
return apiMutator<DataDeletionRequestApi>(getDataDeletionRequestsCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(dataDeletionRequestCreateApi),
})
}
export const getDataDeletionRequestsRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/data_deletion_requests/${id}/`
}
/**
* Get one self-service event deletion request for this project.
*/
export const dataDeletionRequestsRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<DataDeletionRequestApi> => {
return apiMutator<DataDeletionRequestApi>(getDataDeletionRequestsRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getDataDeletionRequestsPreviewCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/data_deletion_requests/preview/`
}
/**
* Validate a one-column HogQL query and count the selected event UUIDs.
*/
export const dataDeletionRequestsPreviewCreate = async (
projectId: string,
dataDeletionRequestInputApi: DataDeletionRequestInputApi,
options?: RequestInit
): Promise<DataDeletionPreviewApi> => {
return apiMutator<DataDeletionPreviewApi>(getDataDeletionRequestsPreviewCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(dataDeletionRequestInputApi),
})
}
export const getEmojiSearchSuggestRetrieveUrl = (projectId: string, params: EmojiSearchSuggestRetrieveParams) => {
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}/emoji_search/suggest/?${stringifiedParams}`
: `/api/projects/${projectId}/emoji_search/suggest/`
}
/**
* @summary Suggest emojis for an unmatched search
*/
export const emojiSearchSuggestRetrieve = async (
projectId: string,
params: EmojiSearchSuggestRetrieveParams,
options?: RequestInit
): Promise<EmojiSearchResponseApi> => {
return apiMutator<EmojiSearchResponseApi>(getEmojiSearchSuggestRetrieveUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getEventsValuesRetrieveUrl = (projectId: string, params: EventsValuesRetrieveParams) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
const explodeParameters = ['event_name']
if (Array.isArray(value) && explodeParameters.includes(key)) {
value.forEach((v) => {
normalizedParams.append(key, v === null ? 'null' : String(v))
})
return
}
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/events/values/?${stringifiedParams}`
: `/api/projects/${projectId}/events/values/`
}
/**
* List values of an event property from recent events.
*/
export const eventsValuesRetrieve = async (
projectId: string,
params: EventsValuesRetrieveParams,
options?: RequestInit
): Promise<EventPropertyValuesResponseApi> => {
return apiMutator<EventPropertyValuesResponseApi>(getEventsValuesRetrieveUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getExportsListUrl = (projectId: string, params?: ExportsListParams) => {
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}/exports/?${stringifiedParams}`
: `/api/projects/${projectId}/exports/`
}
export const exportsList = async (
projectId: string,
params?: ExportsListParams,
options?: RequestInit
): Promise<PaginatedExportedAssetListApi> => {
return apiMutator<PaginatedExportedAssetListApi>(getExportsListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getExportsCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/exports/`
}
export const exportsCreate = async (
projectId: string,
exportedAssetCreateApi: NonReadonly<ExportedAssetCreateApi>,
options?: RequestInit
): Promise<ExportedAssetCreateApi> => {
return apiMutator<ExportedAssetCreateApi>(getExportsCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(exportedAssetCreateApi),
})
}
export const getExportsRetrieveUrl = (projectId: string, id: number) => {
return `/api/projects/${projectId}/exports/${id}/`
}
export const exportsRetrieve = async (
projectId: string,
id: number,
options?: RequestInit
): Promise<ExportedAssetApi> => {
return apiMutator<ExportedAssetApi>(getExportsRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getExportsContentRetrieveUrl = (projectId: string, id: number) => {
return `/api/projects/${projectId}/exports/${id}/content/`
}
export const exportsContentRetrieve = async (projectId: string, id: number, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getExportsContentRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getFileSystemListUrl = (projectId: string, params?: FileSystemListParams) => {
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}/file_system/?${stringifiedParams}`
: `/api/projects/${projectId}/file_system/`
}
export const fileSystemList = async (
projectId: string,
params?: FileSystemListParams,
options?: RequestInit
): Promise<PaginatedFileSystemListApi> => {
return apiMutator<PaginatedFileSystemListApi>(getFileSystemListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getFileSystemCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/file_system/`
}
export const fileSystemCreate = async (
projectId: string,
fileSystemApi: NonReadonly<FileSystemApi>,
options?: RequestInit
): Promise<FileSystemApi> => {
return apiMutator<FileSystemApi>(getFileSystemCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(fileSystemApi),
})
}
export const getFileSystemRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/file_system/${id}/`
}
export const fileSystemRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<FileSystemApi> => {
return apiMutator<FileSystemApi>(getFileSystemRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getFileSystemUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/file_system/${id}/`
}
export const fileSystemUpdate = async (
projectId: string,
id: string,
fileSystemApi: NonReadonly<FileSystemApi>,
options?: RequestInit
): Promise<FileSystemApi> => {
return apiMutator<FileSystemApi>(getFileSystemUpdateUrl(projectId, id), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(fileSystemApi),
})
}
export const getFileSystemPartialUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/file_system/${id}/`
}
export const fileSystemPartialUpdate = async (
projectId: string,
id: string,
patchedFileSystemApi?: NonReadonly<PatchedFileSystemApi>,
options?: RequestInit
): Promise<FileSystemApi> => {
return apiMutator<FileSystemApi>(getFileSystemPartialUpdateUrl(projectId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedFileSystemApi),
})
}
export const getFileSystemDestroyUrl = (projectId: string, id: string, params?: FileSystemDestroyParams) => {
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}/file_system/${id}/?${stringifiedParams}`
: `/api/projects/${projectId}/file_system/${id}/`
}
export const fileSystemDestroy = async (
projectId: string,
id: string,
params?: FileSystemDestroyParams,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getFileSystemDestroyUrl(projectId, id, params), {
...options,
method: 'DELETE',
})
}
export const getFileSystemCountCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/file_system/${id}/count/`
}
/**
* Get count of all files in a folder.
*/
export const fileSystemCountCreate = async (
projectId: string,
id: string,
fileSystemApi: NonReadonly<FileSystemApi>,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getFileSystemCountCreateUrl(projectId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(fileSystemApi),
})
}
export const getFileSystemLinkCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/file_system/${id}/link/`
}
export const fileSystemLinkCreate = async (
projectId: string,
id: string,
fileSystemApi: NonReadonly<FileSystemApi>,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getFileSystemLinkCreateUrl(projectId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(fileSystemApi),
})
}
export const getFileSystemMoveCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/file_system/${id}/move/`
}
export const fileSystemMoveCreate = async (
projectId: string,
id: string,
fileSystemApi: NonReadonly<FileSystemApi>,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getFileSystemMoveCreateUrl(projectId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(fileSystemApi),
})
}
export const getFileSystemCountByPathCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/file_system/count_by_path/`
}
/**
* Get count of all files in a folder.
*/
export const fileSystemCountByPathCreate = async (
projectId: string,
fileSystemApi: NonReadonly<FileSystemApi>,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getFileSystemCountByPathCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(fileSystemApi),
})
}
export const getFileSystemFrequentListUrl = (projectId: string, params?: FileSystemFrequentListParams) => {
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}/file_system/frequent/?${stringifiedParams}`
: `/api/projects/${projectId}/file_system/frequent/`
}
/**
* @summary List frequently viewed files
*/
export const fileSystemFrequentList = async (
projectId: string,
params?: FileSystemFrequentListParams,
options?: RequestInit
): Promise<FileSystemApi[]> => {
return apiMutator<FileSystemApi[]>(getFileSystemFrequentListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getFileSystemHomeFolderCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/file_system/home_folder/`
}
export const fileSystemHomeFolderCreate = async (
projectId: string,
options?: RequestInit
): Promise<FileSystemHomeFolderApi> => {
return apiMutator<FileSystemHomeFolderApi>(getFileSystemHomeFolderCreateUrl(projectId), {
...options,
method: 'POST',
})
}
export const getFileSystemLogViewRetrieveUrl = (projectId: string) => {
return `/api/projects/${projectId}/file_system/log_view/`
}
export const fileSystemLogViewRetrieve = async (projectId: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getFileSystemLogViewRetrieveUrl(projectId), {
...options,
method: 'GET',
})
}
export const getFileSystemLogViewCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/file_system/log_view/`
}
export const fileSystemLogViewCreate = async (
projectId: string,
fileSystemApi: NonReadonly<FileSystemApi>,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getFileSystemLogViewCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(fileSystemApi),
})
}
export const getFileSystemSearchRetrieveUrl = (projectId: string, params: FileSystemSearchRetrieveParams) => {
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}/file_system/search/?${stringifiedParams}`
: `/api/projects/${projectId}/file_system/search/`
}
/**
* Ranks entries by words matched, typos, word proximity, name before folder, exact words, word position, exactness, the user's recent views, and recency.
* @summary Search files by relevance
*/
export const fileSystemSearchRetrieve = async (
projectId: string,
params: FileSystemSearchRetrieveParams,
options?: RequestInit
): Promise<FileSystemRankedSearchResponseApi> => {
return apiMutator<FileSystemRankedSearchResponseApi>(getFileSystemSearchRetrieveUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getFileSystemUndoDeleteCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/file_system/undo_delete/`
}
export const fileSystemUndoDeleteCreate = async (
projectId: string,
fileSystemApi: NonReadonly<FileSystemApi>,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getFileSystemUndoDeleteCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(fileSystemApi),
})
}
export const getFileSystemUnfiledRetrieveUrl = (projectId: string) => {
return `/api/projects/${projectId}/file_system/unfiled/`
}
export const fileSystemUnfiledRetrieve = async (projectId: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getFileSystemUnfiledRetrieveUrl(projectId), {
...options,
method: 'GET',
})
}
export const getFileSystemShortcutListUrl = (projectId: string, params?: FileSystemShortcutListParams) => {
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}/file_system_shortcut/?${stringifiedParams}`
: `/api/projects/${projectId}/file_system_shortcut/`
}
export const fileSystemShortcutList = async (
projectId: string,
params?: FileSystemShortcutListParams,
options?: RequestInit
): Promise<PaginatedFileSystemShortcutListApi> => {
return apiMutator<PaginatedFileSystemShortcutListApi>(getFileSystemShortcutListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getFileSystemShortcutCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/file_system_shortcut/`
}
export const fileSystemShortcutCreate = async (
projectId: string,
fileSystemShortcutApi: NonReadonly<FileSystemShortcutApi>,
options?: RequestInit
): Promise<FileSystemShortcutApi> => {
return apiMutator<FileSystemShortcutApi>(getFileSystemShortcutCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(fileSystemShortcutApi),
})
}
export const getFileSystemShortcutRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/file_system_shortcut/${id}/`
}
export const fileSystemShortcutRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<FileSystemShortcutApi> => {
return apiMutator<FileSystemShortcutApi>(getFileSystemShortcutRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getFileSystemShortcutUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/file_system_shortcut/${id}/`
}
export const fileSystemShortcutUpdate = async (
projectId: string,
id: string,
fileSystemShortcutApi: NonReadonly<FileSystemShortcutApi>,
options?: RequestInit
): Promise<FileSystemShortcutApi> => {
return apiMutator<FileSystemShortcutApi>(getFileSystemShortcutUpdateUrl(projectId, id), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(fileSystemShortcutApi),
})
}
export const getFileSystemShortcutPartialUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/file_system_shortcut/${id}/`
}
export const fileSystemShortcutPartialUpdate = async (
projectId: string,
id: string,
patchedFileSystemShortcutApi?: NonReadonly<PatchedFileSystemShortcutApi>,
options?: RequestInit
): Promise<FileSystemShortcutApi> => {
return apiMutator<FileSystemShortcutApi>(getFileSystemShortcutPartialUpdateUrl(projectId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedFileSystemShortcutApi),
})
}
export const getFileSystemShortcutDestroyUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/file_system_shortcut/${id}/`
}
export const fileSystemShortcutDestroy = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getFileSystemShortcutDestroyUrl(projectId, id), {
...options,
method: 'DELETE',
})
}
export const getFileSystemShortcutBulkUpdateCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/file_system_shortcut/bulk_update/`
}
/**
* Create and delete several of the current user's shortcuts in one transaction, then return the full shortcut list in display order. Any unknown ID in `remove_ids` rejects the whole request.
*/
export const fileSystemShortcutBulkUpdateCreate = async (
projectId: string,
fileSystemShortcutBulkUpdateApi?: FileSystemShortcutBulkUpdateApi,
options?: RequestInit
): Promise<FileSystemShortcutApi[]> => {
return apiMutator<FileSystemShortcutApi[]>(getFileSystemShortcutBulkUpdateCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(fileSystemShortcutBulkUpdateApi),
})
}
export const getFileSystemShortcutReorderCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/file_system_shortcut/reorder/`
}
/**
* Set the display order of the current user's shortcuts. `ordered_ids` becomes the new top-to-bottom order; any unknown IDs are rejected.
*/
export const fileSystemShortcutReorderCreate = async (
projectId: string,
fileSystemShortcutReorderApi: FileSystemShortcutReorderApi,
options?: RequestInit
): Promise<PaginatedFileSystemShortcutListApi> => {
return apiMutator<PaginatedFileSystemShortcutListApi>(getFileSystemShortcutReorderCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(fileSystemShortcutReorderApi),
})
}
export const getInsightsSharingListUrl = (projectId: string, insightId: number) => {
return `/api/projects/${projectId}/insights/${insightId}/sharing/`
}
export const insightsSharingList = async (
projectId: string,
insightId: number,
options?: RequestInit
): Promise<SharingConfigurationApi[]> => {
return apiMutator<SharingConfigurationApi[]>(getInsightsSharingListUrl(projectId, insightId), {
...options,
method: 'GET',
})
}
export const getInsightsSharingPasswordsCreateUrl = (projectId: string, insightId: number) => {
return `/api/projects/${projectId}/insights/${insightId}/sharing/passwords/`
}
/**
* Create a new password for the sharing configuration.
*/
export const insightsSharingPasswordsCreate = async (
projectId: string,
insightId: number,
sharingConfigurationApi?: NonReadonly<SharingConfigurationApi>,
options?: RequestInit
): Promise<SharingConfigurationApi> => {
return apiMutator<SharingConfigurationApi>(getInsightsSharingPasswordsCreateUrl(projectId, insightId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(sharingConfigurationApi),
})
}
export const getInsightsSharingPasswordsDestroyUrl = (projectId: string, insightId: number, passwordId: string) => {
return `/api/projects/${projectId}/insights/${insightId}/sharing/passwords/${passwordId}/`
}
/**
* Delete a password from the sharing configuration.
*/
export const insightsSharingPasswordsDestroy = async (
projectId: string,
insightId: number,
passwordId: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getInsightsSharingPasswordsDestroyUrl(projectId, insightId, passwordId), {
...options,
method: 'DELETE',
})
}
export const getInsightsSharingRefreshCreateUrl = (projectId: string, insightId: number) => {
return `/api/projects/${projectId}/insights/${insightId}/sharing/refresh/`
}
export const insightsSharingRefreshCreate = async (
projectId: string,
insightId: number,
sharingConfigurationApi?: NonReadonly<SharingConfigurationApi>,
options?: RequestInit
): Promise<SharingConfigurationApi> => {
return apiMutator<SharingConfigurationApi>(getInsightsSharingRefreshCreateUrl(projectId, insightId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(sharingConfigurationApi),
})
}
export const getNotebooksSharingListUrl = (projectId: string, notebookId: string) => {
return `/api/projects/${projectId}/notebooks/${notebookId}/sharing/`
}
export const notebooksSharingList = async (
projectId: string,
notebookId: string,
options?: RequestInit
): Promise<SharingConfigurationApi[]> => {
return apiMutator<SharingConfigurationApi[]>(getNotebooksSharingListUrl(projectId, notebookId), {
...options,
method: 'GET',
})
}
export const getNotebooksSharingPasswordsCreateUrl = (projectId: string, notebookId: string) => {
return `/api/projects/${projectId}/notebooks/${notebookId}/sharing/passwords/`
}
/**
* Create a new password for the sharing configuration.
*/
export const notebooksSharingPasswordsCreate = async (
projectId: string,
notebookId: string,
sharingConfigurationApi?: NonReadonly<SharingConfigurationApi>,
options?: RequestInit
): Promise<SharingConfigurationApi> => {
return apiMutator<SharingConfigurationApi>(getNotebooksSharingPasswordsCreateUrl(projectId, notebookId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(sharingConfigurationApi),
})
}
export const getNotebooksSharingPasswordsDestroyUrl = (projectId: string, notebookId: string, passwordId: string) => {
return `/api/projects/${projectId}/notebooks/${notebookId}/sharing/passwords/${passwordId}/`
}
/**
* Delete a password from the sharing configuration.
*/
export const notebooksSharingPasswordsDestroy = async (
projectId: string,
notebookId: string,
passwordId: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getNotebooksSharingPasswordsDestroyUrl(projectId, notebookId, passwordId), {
...options,
method: 'DELETE',
})
}
export const getNotebooksSharingRefreshCreateUrl = (projectId: string, notebookId: string) => {
return `/api/projects/${projectId}/notebooks/${notebookId}/sharing/refresh/`
}
export const notebooksSharingRefreshCreate = async (
projectId: string,
notebookId: string,
sharingConfigurationApi?: NonReadonly<SharingConfigurationApi>,
options?: RequestInit
): Promise<SharingConfigurationApi> => {
return apiMutator<SharingConfigurationApi>(getNotebooksSharingRefreshCreateUrl(projectId, notebookId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(sharingConfigurationApi),
})
}
export const getProductEnablementCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/product_enablement/`
}
export const productEnablementCreate = async (
projectId: string,
productEnablementApi: ProductEnablementApi,
options?: RequestInit
): Promise<ProductEnablementResultApi> => {
return apiMutator<ProductEnablementResultApi>(getProductEnablementCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(productEnablementApi),
})
}
export const getProjectSecretApiKeysListUrl = (projectId: string, params?: ProjectSecretApiKeysListParams) => {
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}/project_secret_api_keys/?${stringifiedParams}`
: `/api/projects/${projectId}/project_secret_api_keys/`
}
export const projectSecretApiKeysList = async (
projectId: string,
params?: ProjectSecretApiKeysListParams,
options?: RequestInit
): Promise<PaginatedProjectSecretAPIKeyListApi> => {
return apiMutator<PaginatedProjectSecretAPIKeyListApi>(getProjectSecretApiKeysListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getProjectSecretApiKeysCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/project_secret_api_keys/`
}
export const projectSecretApiKeysCreate = async (
projectId: string,
projectSecretAPIKeyApi: NonReadonly<ProjectSecretAPIKeyApi>,
options?: RequestInit
): Promise<ProjectSecretAPIKeyApi> => {
return apiMutator<ProjectSecretAPIKeyApi>(getProjectSecretApiKeysCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(projectSecretAPIKeyApi),
})
}
export const getProjectSecretApiKeysRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/project_secret_api_keys/${id}/`
}
export const projectSecretApiKeysRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<ProjectSecretAPIKeyApi> => {
return apiMutator<ProjectSecretAPIKeyApi>(getProjectSecretApiKeysRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getProjectSecretApiKeysUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/project_secret_api_keys/${id}/`
}
export const projectSecretApiKeysUpdate = async (
projectId: string,
id: string,
projectSecretAPIKeyApi: NonReadonly<ProjectSecretAPIKeyApi>,
options?: RequestInit
): Promise<ProjectSecretAPIKeyApi> => {
return apiMutator<ProjectSecretAPIKeyApi>(getProjectSecretApiKeysUpdateUrl(projectId, id), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(projectSecretAPIKeyApi),
})
}
export const getProjectSecretApiKeysPartialUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/project_secret_api_keys/${id}/`
}
export const projectSecretApiKeysPartialUpdate = async (
projectId: string,
id: string,
patchedProjectSecretAPIKeyApi?: NonReadonly<PatchedProjectSecretAPIKeyApi>,
options?: RequestInit
): Promise<ProjectSecretAPIKeyApi> => {
return apiMutator<ProjectSecretAPIKeyApi>(getProjectSecretApiKeysPartialUpdateUrl(projectId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedProjectSecretAPIKeyApi),
})
}
export const getProjectSecretApiKeysDestroyUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/project_secret_api_keys/${id}/`
}
export const projectSecretApiKeysDestroy = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getProjectSecretApiKeysDestroyUrl(projectId, id), {
...options,
method: 'DELETE',
})
}
export const getProjectSecretApiKeysRollCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/project_secret_api_keys/${id}/roll/`
}
/**
* Roll a project secret API key
*/
export const projectSecretApiKeysRollCreate = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<ProjectSecretAPIKeyApi> => {
return apiMutator<ProjectSecretAPIKeyApi>(getProjectSecretApiKeysRollCreateUrl(projectId, id), {
...options,
method: 'POST',
})
}
export const getPropertyDefinitionsListUrl = (projectId: string, params?: PropertyDefinitionsListParams) => {
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}/property_definitions/?${stringifiedParams}`
: `/api/projects/${projectId}/property_definitions/`
}
export const propertyDefinitionsList = async (
projectId: string,
params?: PropertyDefinitionsListParams,
options?: RequestInit
): Promise<PaginatedEnterprisePropertyDefinitionListApi> => {
return apiMutator<PaginatedEnterprisePropertyDefinitionListApi>(getPropertyDefinitionsListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getPropertyDefinitionsRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/property_definitions/${id}/`
}
export const propertyDefinitionsRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<EnterprisePropertyDefinitionApi> => {
return apiMutator<EnterprisePropertyDefinitionApi>(getPropertyDefinitionsRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getPropertyDefinitionsUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/property_definitions/${id}/`
}
export const propertyDefinitionsUpdate = async (
projectId: string,
id: string,
enterprisePropertyDefinitionApi?: NonReadonly<EnterprisePropertyDefinitionApi>,
options?: RequestInit
): Promise<EnterprisePropertyDefinitionApi> => {
return apiMutator<EnterprisePropertyDefinitionApi>(getPropertyDefinitionsUpdateUrl(projectId, id), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(enterprisePropertyDefinitionApi),
})
}
export const getPropertyDefinitionsPartialUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/property_definitions/${id}/`
}
export const propertyDefinitionsPartialUpdate = async (
projectId: string,
id: string,
patchedEnterprisePropertyDefinitionApi?: NonReadonly<PatchedEnterprisePropertyDefinitionApi>,
options?: RequestInit
): Promise<EnterprisePropertyDefinitionApi> => {
return apiMutator<EnterprisePropertyDefinitionApi>(getPropertyDefinitionsPartialUpdateUrl(projectId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedEnterprisePropertyDefinitionApi),
})
}
export const getPropertyDefinitionsDestroyUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/property_definitions/${id}/`
}
export const propertyDefinitionsDestroy = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getPropertyDefinitionsDestroyUrl(projectId, id), {
...options,
method: 'DELETE',
})
}
export const getPropertyDefinitionsBulkUpdateTagsCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/property_definitions/bulk_update_tags/`
}
/**
* Bulk update tags on multiple objects.
*
* PAT access: this action has no ``required_scopes=`` on the decorator —
* inheriting viewsets must add ``"bulk_update_tags"`` to their
* ``scope_object_write_actions`` list to accept personal API keys.
* Without that opt-in, ``APIScopePermission`` rejects PAT requests with
* "This action does not support personal API key access". Done per-viewset
* so granting ``<scope>:write`` for one resource doesn't leak access to
* sibling resources that share this mixin.
*
* Accepts:
* - {"ids": [...], "action": "add"|"remove"|"set", "tags": ["tag1", "tag2"]}
*
* Actions:
* - "add": Add tags to existing tags on each object
* - "remove": Remove specific tags from each object
* - "set": Replace all tags on each object with the provided list
*/
export const propertyDefinitionsBulkUpdateTagsCreate = async (
projectId: string,
bulkUpdateTagsRequestApi: BulkUpdateTagsRequestApi,
options?: RequestInit
): Promise<BulkUpdateTagsResponseApi> => {
return apiMutator<BulkUpdateTagsResponseApi>(getPropertyDefinitionsBulkUpdateTagsCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(bulkUpdateTagsRequestApi),
})
}
export const getPropertyDefinitionsSeenTogetherRetrieveUrl = (projectId: string) => {
return `/api/projects/${projectId}/property_definitions/seen_together/`
}
/**
* Allows a caller to provide a list of event names and a single property name
* Returns a map of the event names to a boolean representing whether that property has ever been seen with that event_name
*/
export const propertyDefinitionsSeenTogetherRetrieve = async (
projectId: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getPropertyDefinitionsSeenTogetherRetrieveUrl(projectId), {
...options,
method: 'GET',
})
}
export const getSessionRecordingsSharingListUrl = (projectId: string, recordingId: string) => {
return `/api/projects/${projectId}/session_recordings/${recordingId}/sharing/`
}
export const sessionRecordingsSharingList = async (
projectId: string,
recordingId: string,
options?: RequestInit
): Promise<SharingConfigurationApi[]> => {
return apiMutator<SharingConfigurationApi[]>(getSessionRecordingsSharingListUrl(projectId, recordingId), {
...options,
method: 'GET',
})
}
export const getSessionRecordingsSharingPasswordsCreateUrl = (projectId: string, recordingId: string) => {
return `/api/projects/${projectId}/session_recordings/${recordingId}/sharing/passwords/`
}
/**
* Create a new password for the sharing configuration.
*/
export const sessionRecordingsSharingPasswordsCreate = async (
projectId: string,
recordingId: string,
sharingConfigurationApi?: NonReadonly<SharingConfigurationApi>,
options?: RequestInit
): Promise<SharingConfigurationApi> => {
return apiMutator<SharingConfigurationApi>(getSessionRecordingsSharingPasswordsCreateUrl(projectId, recordingId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(sharingConfigurationApi),
})
}
export const getSessionRecordingsSharingPasswordsDestroyUrl = (
projectId: string,
recordingId: string,
passwordId: string
) => {
return `/api/projects/${projectId}/session_recordings/${recordingId}/sharing/passwords/${passwordId}/`
}
/**
* Delete a password from the sharing configuration.
*/
export const sessionRecordingsSharingPasswordsDestroy = async (
projectId: string,
recordingId: string,
passwordId: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getSessionRecordingsSharingPasswordsDestroyUrl(projectId, recordingId, passwordId), {
...options,
method: 'DELETE',
})
}
export const getSessionRecordingsSharingRefreshCreateUrl = (projectId: string, recordingId: string) => {
return `/api/projects/${projectId}/session_recordings/${recordingId}/sharing/refresh/`
}
export const sessionRecordingsSharingRefreshCreate = async (
projectId: string,
recordingId: string,
sharingConfigurationApi?: NonReadonly<SharingConfigurationApi>,
options?: RequestInit
): Promise<SharingConfigurationApi> => {
return apiMutator<SharingConfigurationApi>(getSessionRecordingsSharingRefreshCreateUrl(projectId, recordingId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(sharingConfigurationApi),
})
}
export const getTaxonomicSearchIntentClassifyCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/taxonomic_search_intent/classify/`
}
/**
* Guess which filter picker tab a search belongs to, so the picker can suggest or promote it.
* @summary Classify a filter picker search
*/
export const taxonomicSearchIntentClassifyCreate = async (
projectId: string,
searchIntentRequestApi: SearchIntentRequestApi,
options?: RequestInit
): Promise<SearchIntentResponseApi> => {
return apiMutator<SearchIntentResponseApi>(getTaxonomicSearchIntentClassifyCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(searchIntentRequestApi),
})
}
export const getTerminalNetplayMailboxRetrieveUrl = (
projectId: string,
params: TerminalNetplayMailboxRetrieveParams
) => {
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}/terminal_netplay/mailbox/?${stringifiedParams}`
: `/api/projects/${projectId}/terminal_netplay/mailbox/`
}
/**
* Read and clear a terminal's WebRTC mailbox. Reading the host mailbox keeps the room open.
*/
export const terminalNetplayMailboxRetrieve = async (
projectId: string,
params: TerminalNetplayMailboxRetrieveParams,
options?: RequestInit
): Promise<TerminalNetplayMailboxApi> => {
return apiMutator<TerminalNetplayMailboxApi>(getTerminalNetplayMailboxRetrieveUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getTerminalNetplaySignalCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/terminal_netplay/signal/`
}
/**
* Send a WebRTC session description to another terminal in a Doom room.
*/
export const terminalNetplaySignalCreate = async (
projectId: string,
terminalNetplaySignalApi: TerminalNetplaySignalApi,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getTerminalNetplaySignalCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(terminalNetplaySignalApi),
})
}
export const getUploadedMediaListUrl = (projectId: string, params: UploadedMediaListParams) => {
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}/uploaded_media/?${stringifiedParams}`
: `/api/projects/${projectId}/uploaded_media/`
}
/**
* List images in the media library. Requires a `purpose` filter — the library is scoped per consumer (e.g. `email`), so browsing without one would mix in unrelated uploads (dashboard images, toolbar screenshots, ...).
*/
export const uploadedMediaList = async (
projectId: string,
params: UploadedMediaListParams,
options?: RequestInit
): Promise<PaginatedUploadedMediaListApi> => {
return apiMutator<PaginatedUploadedMediaListApi>(getUploadedMediaListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getUploadedMediaCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/uploaded_media/`
}
/**
*
* When object storage is available this API allows upload of media which can be used, for example, in text cards on dashboards.
*
* Uploaded media must be less than 4MB and decode as a PNG, JPEG, GIF, WebP, AVIF or BMP image — the formats
* the download route will serve inline. Pass `purpose` to also add the image to a library, making it visible
* to `GET ?purpose=...`.
*
*/
export const uploadedMediaCreate = async (
projectId: string,
uploadedMediaCreateBody?: UploadedMediaCreateBody,
options?: RequestInit
): Promise<UploadedMediaCreatedApi> => {
const formData = new FormData()
if (uploadedMediaCreateBody?.image !== undefined) {
formData.append(`image`, uploadedMediaCreateBody.image)
}
if (uploadedMediaCreateBody?.purpose !== undefined) {
formData.append(`purpose`, uploadedMediaCreateBody.purpose)
}
return apiMutator<UploadedMediaCreatedApi>(getUploadedMediaCreateUrl(projectId), {
...options,
method: 'POST',
body: formData,
})
}
export const getUploadedMediaDestroyUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/uploaded_media/${id}/`
}
/**
* Remove an image from its media library. It stops appearing in the library list, but its URL keeps working, so content that already uses it (a sent email, a live template) is not broken.
*/
export const uploadedMediaDestroy = async (projectId: string, id: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getUploadedMediaDestroyUrl(projectId, id), {
...options,
method: 'DELETE',
})
}
export const getUploadedMediaCompleteUploadCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/uploaded_media/${id}/complete_upload/`
}
/**
* Step 2 of the presigned upload flow: verifies the object POSTed to the upload_url, sniffs its real content type, and activates it — after this it appears in the library and is publicly servable.
*/
export const uploadedMediaCompleteUploadCreate = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<UploadedMediaApi> => {
return apiMutator<UploadedMediaApi>(getUploadedMediaCompleteUploadCreateUrl(projectId, id), {
...options,
method: 'POST',
})
}
export const getUploadedMediaStartUploadCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/uploaded_media/start_upload/`
}
/**
* Step 1 of the presigned upload flow: reserves a pending image and returns a presigned URL to POST the file to directly, bytes never pass through this API. Call complete_upload with the returned id once the upload finishes.
*/
export const uploadedMediaStartUploadCreate = async (
projectId: string,
uploadedMediaStartUploadApi: UploadedMediaStartUploadApi,
options?: RequestInit
): Promise<UploadedMediaUploadStartedApi> => {
return apiMutator<UploadedMediaUploadStartedApi>(getUploadedMediaStartUploadCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(uploadedMediaStartUploadApi),
})
}
export const getWorkloadTrustPoliciesListUrl = (projectId: string, params?: WorkloadTrustPoliciesListParams) => {
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}/workload_trust_policies/?${stringifiedParams}`
: `/api/projects/${projectId}/workload_trust_policies/`
}
export const workloadTrustPoliciesList = async (
projectId: string,
params?: WorkloadTrustPoliciesListParams,
options?: RequestInit
): Promise<PaginatedWorkloadTrustPolicyListApi> => {
return apiMutator<PaginatedWorkloadTrustPolicyListApi>(getWorkloadTrustPoliciesListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getWorkloadTrustPoliciesCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/workload_trust_policies/`
}
export const workloadTrustPoliciesCreate = async (
projectId: string,
workloadTrustPolicyApi: NonReadonly<WorkloadTrustPolicyApi>,
options?: RequestInit
): Promise<WorkloadTrustPolicyApi> => {
return apiMutator<WorkloadTrustPolicyApi>(getWorkloadTrustPoliciesCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(workloadTrustPolicyApi),
})
}
export const getWorkloadTrustPoliciesRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/workload_trust_policies/${id}/`
}
export const workloadTrustPoliciesRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<WorkloadTrustPolicyApi> => {
return apiMutator<WorkloadTrustPolicyApi>(getWorkloadTrustPoliciesRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getWorkloadTrustPoliciesUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/workload_trust_policies/${id}/`
}
export const workloadTrustPoliciesUpdate = async (
projectId: string,
id: string,
workloadTrustPolicyApi: NonReadonly<WorkloadTrustPolicyApi>,
options?: RequestInit
): Promise<WorkloadTrustPolicyApi> => {
return apiMutator<WorkloadTrustPolicyApi>(getWorkloadTrustPoliciesUpdateUrl(projectId, id), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(workloadTrustPolicyApi),
})
}
export const getWorkloadTrustPoliciesPartialUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/workload_trust_policies/${id}/`
}
export const workloadTrustPoliciesPartialUpdate = async (
projectId: string,
id: string,
patchedWorkloadTrustPolicyApi?: NonReadonly<PatchedWorkloadTrustPolicyApi>,
options?: RequestInit
): Promise<WorkloadTrustPolicyApi> => {
return apiMutator<WorkloadTrustPolicyApi>(getWorkloadTrustPoliciesPartialUpdateUrl(projectId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedWorkloadTrustPolicyApi),
})
}
export const getWorkloadTrustPoliciesDestroyUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/workload_trust_policies/${id}/`
}
export const workloadTrustPoliciesDestroy = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getWorkloadTrustPoliciesDestroyUrl(projectId, id), {
...options,
method: 'DELETE',
})
}
export const getWorkloadTrustPoliciesProvidersRetrieveUrl = (projectId: string) => {
return `/api/projects/${projectId}/workload_trust_policies/providers/`
}
export const workloadTrustPoliciesProvidersRetrieve = async (
projectId: string,
options?: RequestInit
): Promise<WorkloadProvidersResponseApi> => {
return apiMutator<WorkloadProvidersResponseApi>(getWorkloadTrustPoliciesProvidersRetrieveUrl(projectId), {
...options,
method: 'GET',
})
}
export const getWorkloadTrustPolicyRequestsListUrl = (
projectId: string,
params?: WorkloadTrustPolicyRequestsListParams
) => {
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}/workload_trust_policy_requests/?${stringifiedParams}`
: `/api/projects/${projectId}/workload_trust_policy_requests/`
}
export const workloadTrustPolicyRequestsList = async (
projectId: string,
params?: WorkloadTrustPolicyRequestsListParams,
options?: RequestInit
): Promise<PaginatedWorkloadTrustPolicyRequestListApi> => {
return apiMutator<PaginatedWorkloadTrustPolicyRequestListApi>(
getWorkloadTrustPolicyRequestsListUrl(projectId, params),
{
...options,
method: 'GET',
}
)
}
export const getWorkloadTrustPolicyRequestsCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/workload_trust_policy_requests/`
}
export const workloadTrustPolicyRequestsCreate = async (
projectId: string,
workloadTrustPolicyRequestApi: NonReadonly<WorkloadTrustPolicyRequestApi>,
options?: RequestInit
): Promise<WorkloadTrustPolicyRequestApi> => {
return apiMutator<WorkloadTrustPolicyRequestApi>(getWorkloadTrustPolicyRequestsCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(workloadTrustPolicyRequestApi),
})
}
export const getWorkloadTrustPolicyRequestsRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/workload_trust_policy_requests/${id}/`
}
export const workloadTrustPolicyRequestsRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<WorkloadTrustPolicyRequestApi> => {
return apiMutator<WorkloadTrustPolicyRequestApi>(getWorkloadTrustPolicyRequestsRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getWorkloadTrustPolicyRequestsApproveCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/workload_trust_policy_requests/${id}/approve/`
}
export const workloadTrustPolicyRequestsApproveCreate = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<WorkloadTrustPolicyRequestApi> => {
return apiMutator<WorkloadTrustPolicyRequestApi>(getWorkloadTrustPolicyRequestsApproveCreateUrl(projectId, id), {
...options,
method: 'POST',
})
}
export const getWorkloadTrustPolicyRequestsRejectCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/workload_trust_policy_requests/${id}/reject/`
}
export const workloadTrustPolicyRequestsRejectCreate = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<WorkloadTrustPolicyRequestApi> => {
return apiMutator<WorkloadTrustPolicyRequestApi>(getWorkloadTrustPolicyRequestsRejectCreateUrl(projectId, id), {
...options,
method: 'POST',
})
}
export const getRevokeLeakedKeyCreateUrl = () => {
return `/api/revoke_leaked_key/`
}
/**
* Public, unauthenticated endpoint for self-service revocation of a leaked PostHog personal API key, project secret API key, legacy feature flags secure API key, or OAuth access/refresh token. If the token matches a real credential, it is revoked immediately and the owner is notified by email. This includes an expired OAuth access token: the paired refresh token it protects may still be live. A legacy feature flags secure API key is matched through its migrated project secret API key row; it cannot be rotated automatically, so its project admins get an email to rotate it.
*
* This endpoint only checks the region it is running on. `"found": false` does not guarantee the token is safe. If you're not sure which region issued it, check both: https://app.posthog.com/api/revoke_leaked_key and https://eu.posthog.com/api/revoke_leaked_key.
* @summary Report and revoke a leaked PostHog API key or token
*/
export const revokeLeakedKeyCreate = async (
leakedKeyReportApi: LeakedKeyReportApi,
options?: RequestInit
): Promise<LeakedKeyReportResponseApi> => {
return apiMutator<LeakedKeyReportResponseApi>(getRevokeLeakedKeyCreateUrl(), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(leakedKeyReportApi),
})
}
export const getUserToolbarEntitlementsRetrieveUrl = () => {
return `/api/user/toolbar_entitlements/`
}
export const userToolbarEntitlementsRetrieve = async (options?: RequestInit): Promise<ToolbarEntitlementsApi> => {
return apiMutator<ToolbarEntitlementsApi>(getUserToolbarEntitlementsRetrieveUrl(), {
...options,
method: 'GET',
})
}
export const getUsersListUrl = (params?: UsersListParams) => {
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/users/?${stringifiedParams}` : `/api/users/`
}
export const usersList = async (params?: UsersListParams, options?: RequestInit): Promise<PaginatedUserListApi> => {
return apiMutator<PaginatedUserListApi>(getUsersListUrl(params), {
...options,
method: 'GET',
})
}
export const getUsersRetrieveUrl = (uuid: string) => {
return `/api/users/${uuid}/`
}
/**
* Retrieve a user's profile and settings. Pass `@me` as the UUID to fetch the authenticated user; non-staff callers may only access their own account.
*/
export const usersRetrieve = async (uuid: string, options?: RequestInit): Promise<UserApi> => {
return apiMutator<UserApi>(getUsersRetrieveUrl(uuid), {
...options,
method: 'GET',
})
}
export const getUsersUpdateUrl = (uuid: string) => {
return `/api/users/${uuid}/`
}
/**
* Replace the authenticated user's profile and settings. Pass `@me` as the UUID to update the authenticated user. Prefer the PATCH endpoint for partial updates — PUT requires every writable field to be provided.
*/
export const usersUpdate = async (
uuid: string,
userApi: NonReadonly<UserApi>,
options?: RequestInit
): Promise<UserApi> => {
return apiMutator<UserApi>(getUsersUpdateUrl(uuid), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(userApi),
})
}
export const getUsersPartialUpdateUrl = (uuid: string) => {
return `/api/users/${uuid}/`
}
/**
* Update one or more of the authenticated user's profile fields or settings.
*/
export const usersPartialUpdate = async (
uuid: string,
patchedUserApi?: NonReadonly<PatchedUserApi>,
options?: RequestInit
): Promise<UserApi> => {
return apiMutator<UserApi>(getUsersPartialUpdateUrl(uuid), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedUserApi),
})
}
export const getUsersDestroyUrl = (uuid: string) => {
return `/api/users/${uuid}/`
}
export const usersDestroy = async (uuid: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getUsersDestroyUrl(uuid), {
...options,
method: 'DELETE',
})
}
export const getUsersCredentialsReviewCompleteCreateUrl = (uuid: string) => {
return `/api/users/${uuid}/credentials_review_complete/`
}
/**
* Mark the user as having reviewed their existing credentials. Idempotent. Flips `requires_credential_review` to False so the post-login interstitial isn't shown again. Does not modify any credentials; the user revokes individual Personal API Keys and passkeys via their existing endpoints from the same screen.
*/
export const usersCredentialsReviewCompleteCreate = async (uuid: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getUsersCredentialsReviewCompleteCreateUrl(uuid), {
...options,
method: 'POST',
})
}
export const getUsersGithubLoginRetrieveUrl = (uuid: string) => {
return `/api/users/${uuid}/github_login/`
}
export const usersGithubLoginRetrieve = async (uuid: string, options?: RequestInit): Promise<UserGithubLoginApi> => {
return apiMutator<UserGithubLoginApi>(getUsersGithubLoginRetrieveUrl(uuid), {
...options,
method: 'GET',
})
}
export const getUsersHedgehogConfigRetrieveUrl = (uuid: string) => {
return `/api/users/${uuid}/hedgehog_config/`
}
export const usersHedgehogConfigRetrieve = async (uuid: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getUsersHedgehogConfigRetrieveUrl(uuid), {
...options,
method: 'GET',
})
}
export const getUsersHedgehogConfigPartialUpdateUrl = (uuid: string) => {
return `/api/users/${uuid}/hedgehog_config/`
}
export const usersHedgehogConfigPartialUpdate = async (
uuid: string,
patchedUserApi?: NonReadonly<PatchedUserApi>,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getUsersHedgehogConfigPartialUpdateUrl(uuid), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedUserApi),
})
}
export const getUsersIntegrationsListUrl = (uuid: string, params?: UsersIntegrationsListParams) => {
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/users/${uuid}/integrations/?${stringifiedParams}`
: `/api/users/${uuid}/integrations/`
}
/**
* Return the authenticated user's personal integrations of a given
* ``kind`` (``github`` or ``slack``).
*
* The response shape varies per kind because the underlying ``UserIntegration``
* rows carry different identity fields — GitHub rows expose
* ``installation_id`` / ``account`` / ``uses_shared_installation``; Slack
* rows expose ``slack_user_id`` / ``slack_team_id`` / ``slack_team_name``.
* Kind-specific destroy and start actions remain split so their distinct
* semantics (e.g. Slack's lack of "uninstall on last reference") stay
* explicit at the URL layer.
*
* Default of ``kind=github`` is load-bearing: mobile (``apps/mobile/...``)
* and the Code SDK (``packages/api-client/...``) both call this endpoint
* without a query param today and rely on receiving GitHub rows.
* @summary List the user's personal integrations of a given kind
*/
export const usersIntegrationsList = async (
uuid: string,
params?: UsersIntegrationsListParams,
options?: RequestInit
): Promise<PaginatedUserGitHubIntegrationListResponseListApi> => {
return apiMutator<PaginatedUserGitHubIntegrationListResponseListApi>(getUsersIntegrationsListUrl(uuid, params), {
...options,
method: 'GET',
})
}
export const getUsersIntegrationsCodexRetrieveUrl = (uuid: string) => {
return `/api/users/${uuid}/integrations/codex/`
}
/**
* `/api/users/@me/integrations/` — manage the user's personal GitHub integrations.
* @summary Show the ChatGPT account connected for Codex cloud tasks
*/
export const usersIntegrationsCodexRetrieve = async (
uuid: string,
options?: RequestInit
): Promise<UserCodexIntegrationApi> => {
return apiMutator<UserCodexIntegrationApi>(getUsersIntegrationsCodexRetrieveUrl(uuid), {
...options,
method: 'GET',
})
}
export const getUsersIntegrationsCodexCreateUrl = (uuid: string) => {
return `/api/users/${uuid}/integrations/codex/`
}
/**
* Submit the `tokens` object of the `auth.json` that `codex login` wrote on the user's machine. PostHog refreshes the chain once to prove it works, stores the rotated tokens encrypted, and from then on refreshes them for the user's Codex cloud runs. Only the owning user can connect. No response carries a token.
* @summary Connect a ChatGPT account for Codex cloud tasks
*/
export const usersIntegrationsCodexCreate = async (
uuid: string,
userCodexConnectRequestApi: UserCodexConnectRequestApi,
options?: RequestInit
): Promise<UserCodexIntegrationApi> => {
return apiMutator<UserCodexIntegrationApi>(getUsersIntegrationsCodexCreateUrl(uuid), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(userCodexConnectRequestApi),
})
}
export const getUsersIntegrationsCodexDestroyUrl = (uuid: string) => {
return `/api/users/${uuid}/integrations/codex/`
}
/**
* Revokes the refresh token at OpenAI and deletes the stored tokens. Idempotent.
* @summary Disconnect the ChatGPT account used for Codex cloud tasks
*/
export const usersIntegrationsCodexDestroy = async (uuid: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getUsersIntegrationsCodexDestroyUrl(uuid), {
...options,
method: 'DELETE',
})
}
export const getUsersIntegrationsGithubDestroyUrl = (uuid: string, installationId: string) => {
return `/api/users/${uuid}/integrations/github/${installationId}/`
}
/**
* Remove a specific GitHub installation by its installation_id.
* @summary Disconnect a personal GitHub integration
*/
export const usersIntegrationsGithubDestroy = async (
uuid: string,
installationId: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getUsersIntegrationsGithubDestroyUrl(uuid, installationId), {
...options,
method: 'DELETE',
})
}
export const getUsersIntegrationsGithubBranchesRetrieveUrl = (
uuid: string,
installationId: string,
params: UsersIntegrationsGithubBranchesRetrieveParams
) => {
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/users/${uuid}/integrations/github/${installationId}/branches/?${stringifiedParams}`
: `/api/users/${uuid}/integrations/github/${installationId}/branches/`
}
/**
* List branches for a repository accessible to a personal GitHub installation.
* @summary List branches for a personal GitHub installation repository
*/
export const usersIntegrationsGithubBranchesRetrieve = async (
uuid: string,
installationId: string,
params: UsersIntegrationsGithubBranchesRetrieveParams,
options?: RequestInit
): Promise<GitHubBranchesResponseApi> => {
return apiMutator<GitHubBranchesResponseApi>(
getUsersIntegrationsGithubBranchesRetrieveUrl(uuid, installationId, params),
{
...options,
method: 'GET',
}
)
}
export const getUsersIntegrationsGithubReposRetrieveUrl = (
uuid: string,
installationId: string,
params?: UsersIntegrationsGithubReposRetrieveParams
) => {
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/users/${uuid}/integrations/github/${installationId}/repos/?${stringifiedParams}`
: `/api/users/${uuid}/integrations/github/${installationId}/repos/`
}
/**
* List repositories accessible to a specific GitHub installation (paginated, cached).
* @summary List repositories for a personal GitHub installation
*/
export const usersIntegrationsGithubReposRetrieve = async (
uuid: string,
installationId: string,
params?: UsersIntegrationsGithubReposRetrieveParams,
options?: RequestInit
): Promise<GitHubReposResponseApi> => {
return apiMutator<GitHubReposResponseApi>(
getUsersIntegrationsGithubReposRetrieveUrl(uuid, installationId, params),
{
...options,
method: 'GET',
}
)
}
export const getUsersIntegrationsGithubReposRefreshCreateUrl = (uuid: string, installationId: string) => {
return `/api/users/${uuid}/integrations/github/${installationId}/repos/refresh/`
}
/**
* Refresh repositories accessible to a specific GitHub installation.
* @summary Refresh repositories for a personal GitHub installation
*/
export const usersIntegrationsGithubReposRefreshCreate = async (
uuid: string,
installationId: string,
options?: RequestInit
): Promise<GitHubReposRefreshResponseApi> => {
return apiMutator<GitHubReposRefreshResponseApi>(
getUsersIntegrationsGithubReposRefreshCreateUrl(uuid, installationId),
{
...options,
method: 'POST',
}
)
}
export const getUsersIntegrationsGithubInstallRequestsRetrieveUrl = (uuid: string) => {
return `/api/users/${uuid}/integrations/github/install_requests/`
}
/**
* Return the requesting user's GitHub App install-approval requests, newest first.
*
* This is the durable server-side "awaiting org owner approval" state (see
* ``posthog.models.user_integration.GitHubInstallRequest``), distinct from the in-flight
* connect spinner, which never touches this table.
* @summary List the user's GitHub install-approval requests
*/
export const usersIntegrationsGithubInstallRequestsRetrieve = async (
uuid: string,
options?: RequestInit
): Promise<GitHubInstallRequestListResponseApi> => {
return apiMutator<GitHubInstallRequestListResponseApi>(getUsersIntegrationsGithubInstallRequestsRetrieveUrl(uuid), {
...options,
method: 'GET',
})
}
export const getUsersIntegrationsGithubInstallRequestsDestroyUrl = (uuid: string, requestId: string) => {
return `/api/users/${uuid}/integrations/github/install_requests/${requestId}/`
}
/**
* Delete one of the requesting user's install-approval requests, whatever its status.
*
* User-facing bookkeeping only: a later connect attempt records a fresh row.
* @summary Dismiss a GitHub install-approval request
*/
export const usersIntegrationsGithubInstallRequestsDestroy = async (
uuid: string,
requestId: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getUsersIntegrationsGithubInstallRequestsDestroyUrl(uuid, requestId), {
...options,
method: 'DELETE',
})
}
export const getUsersIntegrationsGithubPrepareCallbackCreateUrl = (uuid: string) => {
return `/api/users/${uuid}/integrations/github/prepare_callback/`
}
/**
* Seed personal GitHub manage callback state before opening installation settings on GitHub.
*/
export const usersIntegrationsGithubPrepareCallbackCreate = async (
uuid: string,
userGitHubPrepareCallbackRequestApi: UserGitHubPrepareCallbackRequestApi,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getUsersIntegrationsGithubPrepareCallbackCreateUrl(uuid), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(userGitHubPrepareCallbackRequestApi),
})
}
export const getUsersIntegrationsGithubStartCreateUrl = (uuid: string) => {
return `/api/users/${uuid}/integrations/github/start/`
}
/**
* Start GitHub linking: either full App install or OAuth-only (user-to-server).
*
* ``**_kwargs`` absorbs ``parent_lookup_uuid`` from the nested
* ``/api/users/{uuid}/integrations/`` router (same pattern as ``local_evaluation``
* under projects).
*
* Usually returns ``install_url`` pointing at ``/installations/new`` so the
* user can pick any GitHub org (new or already connected). GitHub's install
* page handles both cases: orgs where the app is installed show "Configure"
* (no admin needed), orgs where it isn't show "Install" (needs admin).
*
* **OAuth fast path:** when the current project already has a team-level
* GitHub installation, and the user has no ``UserIntegration`` for that
* installation yet, we skip the org picker and redirect straight to
* ``/login/oauth/authorize`` so the user only authorizes themselves.
* ``connect_from`` is preserved for first-party clients so they return to
* the originating client immediately.
*
* In both cases the response key is ``install_url`` for compatibility with callers.
* @summary Start GitHub personal integration linking
*/
export const usersIntegrationsGithubStartCreate = async (
uuid: string,
userGitHubLinkStartRequestApi?: UserGitHubLinkStartRequestApi,
options?: RequestInit
): Promise<UserGitHubLinkStartResponseApi> => {
return apiMutator<UserGitHubLinkStartResponseApi>(getUsersIntegrationsGithubStartCreateUrl(uuid), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(userGitHubLinkStartRequestApi),
})
}
export const getUsersIntegrationsSlackDestroyUrl = (uuid: string, slackUserId: string) => {
return `/api/users/${uuid}/integrations/slack/${slackUserId}/`
}
/**
* Remove a Slack identity link by Slack user id. Idempotent and
* flag-agnostic — users must always be able to unlink even after the
* feature flag is turned off.
* @summary Unlink a Slack identity
*/
export const usersIntegrationsSlackDestroy = async (
uuid: string,
slackUserId: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getUsersIntegrationsSlackDestroyUrl(uuid, slackUserId), {
...options,
method: 'DELETE',
})
}
export const getUsersIntegrationsSlackLinkableWorkspacesRetrieveUrl = (uuid: string) => {
return `/api/users/${uuid}/integrations/slack/linkable_workspaces/`
}
/**
* Return Slack workspaces in the user's organizations that they have
* not yet linked. The settings UI uses this list to decide whether to
* show a "Link my Slack account" button (non-empty list) and what to
* offer in the picker when several are connectable.
* @summary List Slack workspaces this user could link to
*/
export const usersIntegrationsSlackLinkableWorkspacesRetrieve = async (
uuid: string,
options?: RequestInit
): Promise<UserSlackLinkableWorkspaceListResponseApi> => {
return apiMutator<UserSlackLinkableWorkspaceListResponseApi>(
getUsersIntegrationsSlackLinkableWorkspacesRetrieveUrl(uuid),
{
...options,
method: 'GET',
}
)
}
export const getUsersIntegrationsSlackStartCreateUrl = (uuid: string) => {
return `/api/users/${uuid}/integrations/slack/start/`
}
/**
* Mint a Sign-in-with-Slack invite URL initiated from settings, without
* Slack-DM context. The returned URL takes the user through PostHog login
* (already satisfied here), then to Slack OAuth, then back to our callback
* which writes the ``UserIntegration`` row.
*
* Without body params, falls back to the user's ``current_team`` and that
* team's first Slack ``Integration`` — works when there's exactly one
* linkable workspace. With ``team_id`` + ``slack_team_id``, links against
* the exact pair (what the frontend uses when a picker is shown).
*
* Refuses if the target team has no matching Slack workspace, if the
* feature flag is off for the workspace, or if the user is already linked
* to it.
* @summary Start Slack identity link from settings
*/
export const usersIntegrationsSlackStartCreate = async (
uuid: string,
userSlackLinkStartRequestApi?: UserSlackLinkStartRequestApi,
options?: RequestInit
): Promise<UserSlackLinkStartResponseApi> => {
return apiMutator<UserSlackLinkStartResponseApi>(getUsersIntegrationsSlackStartCreateUrl(uuid), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(userSlackLinkStartRequestApi),
})
}
export const getUsersLoginSessionsListUrl = (uuid: string, params?: UsersLoginSessionsListParams) => {
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/users/${uuid}/login_sessions/?${stringifiedParams}`
: `/api/users/${uuid}/login_sessions/`
}
/**
* List the cookie-auth login sessions for the current user. Self-only — never another user.
*/
export const usersLoginSessionsList = async (
uuid: string,
params?: UsersLoginSessionsListParams,
options?: RequestInit
): Promise<UserAuthSessionApi[]> => {
return apiMutator<UserAuthSessionApi[]>(getUsersLoginSessionsListUrl(uuid, params), {
...options,
method: 'GET',
})
}
export const getUsersLoginSessionsDestroyUrl = (uuid: string, sessionId: string) => {
return `/api/users/${uuid}/login_sessions/${sessionId}/`
}
/**
* Revoke a single login session belonging to the current user. Self-only.
*
* Requires recent auth (TimeSensitiveActionPermission) so a stolen cookie can't weaponize
* revocation, and is blocked while impersonating via ImpersonationBlockedPathsMiddleware.
*/
export const usersLoginSessionsDestroy = async (
uuid: string,
sessionId: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getUsersLoginSessionsDestroyUrl(uuid, sessionId), {
...options,
method: 'DELETE',
})
}
export const getUsersLoginSessionsRevokeOthersCreateUrl = (uuid: string) => {
return `/api/users/${uuid}/login_sessions/revoke_others/`
}
/**
* Revoke every login session for the current user except the one making this request. Self-only.
*
* Requires recent auth (TimeSensitiveActionPermission) so a stolen cookie can't weaponize the
* "log out everywhere else" lock-out, and is blocked while impersonating.
*/
export const usersLoginSessionsRevokeOthersCreate = async (
uuid: string,
options?: RequestInit
): Promise<RevokeOtherSessionsResponseApi> => {
return apiMutator<RevokeOtherSessionsResponseApi>(getUsersLoginSessionsRevokeOthersCreateUrl(uuid), {
...options,
method: 'POST',
})
}
export const getUsersOnboardingSkipCreateUrl = (uuid: string) => {
return `/api/users/${uuid}/onboarding/skip/`
}
/**
* Mark the current user as having exited onboarding with a non-delegated reason.
* Idempotent: the skip timestamp is only set on the first successful call.
*
* Callers wanting to delegate setup to a teammate must use the dedicated
* /organizations/{id}/invites/delegate/ endpoint, which atomically creates the
* invite and sets reason="delegated". This endpoint rejects that reason so state
* can't be faked without a real invite.
*/
export const usersOnboardingSkipCreate = async (
uuid: string,
onboardingSkipRequestApi: OnboardingSkipRequestApi,
options?: RequestInit
): Promise<UserApi> => {
return apiMutator<UserApi>(getUsersOnboardingSkipCreateUrl(uuid), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(onboardingSkipRequestApi),
})
}
export const getUsersProductIntroSeenPartialUpdateUrl = (uuid: string) => {
return `/api/users/${uuid}/product_intro_seen/`
}
/**
* Record that this user has seen one product intro.
*
* Separate from the `has_seen_product_intro_for` field on the main user PATCH, which requires a
* recently authenticated session. Dismissing an intro must not depend on that: a re-auth prompt
* would cover the intro it interrupts, and the dismissal would never persist. Nothing reachable
* here changes an account, an organization, or a profile.
*
* Merging server-side also keeps two intros dismissed from separate tabs from dropping each
* other's key, which a read-modify-write of the whole map cannot avoid.
*/
export const usersProductIntroSeenPartialUpdate = async (
uuid: string,
patchedProductIntroSeenApi?: PatchedProductIntroSeenApi,
options?: RequestInit
): Promise<UsersProductIntroSeenPartialUpdate200> => {
return apiMutator<UsersProductIntroSeenPartialUpdate200>(getUsersProductIntroSeenPartialUpdateUrl(uuid), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedProductIntroSeenApi),
})
}
export const getUsersPushTokensCreateUrl = (uuid: string) => {
return `/api/users/${uuid}/push_tokens/`
}
/**
* Register the device for the authenticated user, removing registrations for the same token belonging to other users on this instance. Re-registration refreshes `platform` and `last_seen_at`.
* @summary Register a push notification token
*/
export const usersPushTokensCreate = async (
uuid: string,
userPushTokenRegisterRequestApi: UserPushTokenRegisterRequestApi,
options?: RequestInit
): Promise<UserPushTokenItemApi> => {
return apiMutator<UserPushTokenItemApi>(getUsersPushTokensCreateUrl(uuid), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(userPushTokenRegisterRequestApi),
})
}
export const getUsersPushTokensUnregisterCreateUrl = (uuid: string) => {
return `/api/users/${uuid}/push_tokens/unregister/`
}
/**
* Delete the row matching `(user, token)`. Returns 204 even if no row matches so the mobile client can call this unconditionally when the user opts out.
* @summary Unregister a push notification token
*/
export const usersPushTokensUnregisterCreate = async (
uuid: string,
userPushTokenUnregisterRequestApi: UserPushTokenUnregisterRequestApi,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getUsersPushTokensUnregisterCreateUrl(uuid), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(userPushTokenUnregisterRequestApi),
})
}
export const getUsersScenePersonalisationCreateUrl = (uuid: string) => {
return `/api/users/${uuid}/scene_personalisation/`
}
export const usersScenePersonalisationCreate = async (
uuid: string,
userApi: NonReadonly<UserApi>,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getUsersScenePersonalisationCreateUrl(uuid), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(userApi),
})
}
export const getUsersStart2faSetupRetrieveUrl = (uuid: string) => {
return `/api/users/${uuid}/start_2fa_setup/`
}
export const usersStart2faSetupRetrieve = async (uuid: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getUsersStart2faSetupRetrieveUrl(uuid), {
...options,
method: 'GET',
})
}
export const getUsersTwoFactorBackupCodesCreateUrl = (uuid: string) => {
return `/api/users/${uuid}/two_factor_backup_codes/`
}
/**
* Generate new backup codes, invalidating any existing ones
*/
export const usersTwoFactorBackupCodesCreate = async (
uuid: string,
userApi: NonReadonly<UserApi>,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getUsersTwoFactorBackupCodesCreateUrl(uuid), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(userApi),
})
}
export const getUsersTwoFactorDisableCreateUrl = (uuid: string) => {
return `/api/users/${uuid}/two_factor_disable/`
}
/**
* Disable 2FA and remove all related devices
*/
export const usersTwoFactorDisableCreate = async (
uuid: string,
userApi: NonReadonly<UserApi>,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getUsersTwoFactorDisableCreateUrl(uuid), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(userApi),
})
}
export const getUsersTwoFactorStartSetupRetrieveUrl = (uuid: string) => {
return `/api/users/${uuid}/two_factor_start_setup/`
}
export const usersTwoFactorStartSetupRetrieve = async (uuid: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getUsersTwoFactorStartSetupRetrieveUrl(uuid), {
...options,
method: 'GET',
})
}
export const getUsersTwoFactorStatusRetrieveUrl = (uuid: string) => {
return `/api/users/${uuid}/two_factor_status/`
}
/**
* Get current 2FA status, including how many backup codes are left.
*/
export const usersTwoFactorStatusRetrieve = async (
uuid: string,
options?: RequestInit
): Promise<TwoFactorStatusApi> => {
return apiMutator<TwoFactorStatusApi>(getUsersTwoFactorStatusRetrieveUrl(uuid), {
...options,
method: 'GET',
})
}
export const getUsersTwoFactorValidateCreateUrl = (uuid: string) => {
return `/api/users/${uuid}/two_factor_validate/`
}
export const usersTwoFactorValidateCreate = async (
uuid: string,
userApi: NonReadonly<UserApi>,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getUsersTwoFactorValidateCreateUrl(uuid), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(userApi),
})
}
export const getUsersValidate2faCreateUrl = (uuid: string) => {
return `/api/users/${uuid}/validate_2fa/`
}
export const usersValidate2faCreate = async (
uuid: string,
userApi: NonReadonly<UserApi>,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getUsersValidate2faCreateUrl(uuid), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(userApi),
})
}
export const getUsersCancelEmailChangeRequestPartialUpdateUrl = () => {
return `/api/users/cancel_email_change_request/`
}
export const usersCancelEmailChangeRequestPartialUpdate = async (
patchedUserApi?: NonReadonly<PatchedUserApi>,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getUsersCancelEmailChangeRequestPartialUpdateUrl(), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedUserApi),
})
}
export const getUsersRequestEmailVerificationCreateUrl = () => {
return `/api/users/request_email_verification/`
}
export const usersRequestEmailVerificationCreate = async (
userApi: NonReadonly<UserApi>,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getUsersRequestEmailVerificationCreateUrl(), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(userApi),
})
}
export const getUsersVerifyEmailCreateUrl = () => {
return `/api/users/verify_email/`
}
export const usersVerifyEmailCreate = async (
verifyEmailRequestApi: VerifyEmailRequestApi,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getUsersVerifyEmailCreateUrl(), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(verifyEmailRequestApi),
})
}