:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { apiMutator } from '../../../../frontend/src/lib/api-orval-mutator'
/**
* Auto-generated from the Django backend OpenAPI schema.
* To modify these types, update the Django serializers or views, then run:
* hogli build:openapi
* Questions or issues? #team-devex on Slack
*
* PostHog API - generated
* OpenAPI spec version: 1.0.0
*/
import type {
BulkNotificationIdsRequestApi,
NotificationsListParams,
PaginatedNotificationEventListApi,
} from './api.schemas'
export const getNotificationsListUrl = (projectId: string, params?: NotificationsListParams) => {
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}/notifications/?${stringifiedParams}`
: `/api/projects/${projectId}/notifications/`
}
export const notificationsList = async (
projectId: string,
params?: NotificationsListParams,
options?: RequestInit
): Promise<PaginatedNotificationEventListApi> => {
return apiMutator<PaginatedNotificationEventListApi>(getNotificationsListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getNotificationsArchiveCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/notifications/${id}/archive/`
}
export const notificationsArchiveCreate = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getNotificationsArchiveCreateUrl(projectId, id), {
...options,
method: 'POST',
})
}
export const getNotificationsMarkReadCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/notifications/${id}/mark_read/`
}
export const notificationsMarkReadCreate = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getNotificationsMarkReadCreateUrl(projectId, id), {
...options,
method: 'POST',
})
}
export const getNotificationsMarkUnreadCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/notifications/${id}/mark_unread/`
}
export const notificationsMarkUnreadCreate = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getNotificationsMarkUnreadCreateUrl(projectId, id), {
...options,
method: 'POST',
})
}
export const getNotificationsArchiveAllCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/notifications/archive_all/`
}
export const notificationsArchiveAllCreate = async (projectId: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getNotificationsArchiveAllCreateUrl(projectId), {
...options,
method: 'POST',
})
}
export const getNotificationsArchiveBulkCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/notifications/archive_bulk/`
}
export const notificationsArchiveBulkCreate = async (
projectId: string,
bulkNotificationIdsRequestApi: BulkNotificationIdsRequestApi,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getNotificationsArchiveBulkCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(bulkNotificationIdsRequestApi),
})
}
export const getNotificationsMarkAllReadCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/notifications/mark_all_read/`
}
export const notificationsMarkAllReadCreate = async (projectId: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getNotificationsMarkAllReadCreateUrl(projectId), {
...options,
method: 'POST',
})
}
export const getNotificationsMarkReadBulkCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/notifications/mark_read_bulk/`
}
export const notificationsMarkReadBulkCreate = async (
projectId: string,
bulkNotificationIdsRequestApi: BulkNotificationIdsRequestApi,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getNotificationsMarkReadBulkCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(bulkNotificationIdsRequestApi),
})
}
export const getNotificationsMarkUnreadBulkCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/notifications/mark_unread_bulk/`
}
export const notificationsMarkUnreadBulkCreate = async (
projectId: string,
bulkNotificationIdsRequestApi: BulkNotificationIdsRequestApi,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getNotificationsMarkUnreadBulkCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(bulkNotificationIdsRequestApi),
})
}
export const getNotificationsUnreadCountRetrieveUrl = (projectId: string) => {
return `/api/projects/${projectId}/notifications/unread_count/`
}
export const notificationsUnreadCountRetrieve = async (projectId: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getNotificationsUnreadCountRetrieveUrl(projectId), {
...options,
method: 'GET',
})
}