Skip to content

: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.

chore(revenue-analytics): declare the person join request and response (#104256)

Julian Bezed684d1d1bc0
diff --git a/products/revenue_analytics/backend/api.py b/products/revenue_analytics/backend/api.py
index 1c227f9d1db5..9d3821882b90 100644
--- a/products/revenue_analytics/backend/api.py
+++ b/products/revenue_analytics/backend/api.py
@@ -1,5 +1,6 @@
from typing import cast
+from drf_spectacular.utils import extend_schema
from posthoganalytics import capture_exception
from rest_framework import serializers, status
from rest_framework.decorators import action
@@ -103,7 +104,13 @@ class RevenueAnalyticsTaxonomyViewSet(TeamAndOrgViewSetMixin, GenericViewSet):
class RevenueAnalyticsJoinSerializer(serializers.Serializer):
- enabled = serializers.BooleanField(required=True)
+ enabled = serializers.BooleanField(
+ required=True, help_text="True creates the person join for the project, false removes it."
+ )
+
+
+class RevenueAnalyticsJoinResponseSerializer(serializers.Serializer):
+ detail = serializers.CharField(help_text="What the request did, for display.")
class RevenueAnalyticsJoinViewSet(TeamAndOrgViewSetMixin, GenericViewSet):
@@ -111,7 +118,11 @@ class RevenueAnalyticsJoinViewSet(TeamAndOrgViewSetMixin, GenericViewSet):
serializer_class = _FallbackSerializer
permission_classes = [IsAuthenticated]
- def create(self, request: Request, **kwargs):
+ @extend_schema(
+ request=RevenueAnalyticsJoinSerializer,
+ responses={200: RevenueAnalyticsJoinResponseSerializer},
+ )
+ def create(self, request: Request, **kwargs) -> Response:
_assert_revenue_analytics_access(self.team, cast(User, request.user), "editor")
serializer = RevenueAnalyticsJoinSerializer(data=request.data)
diff --git a/products/revenue_analytics/frontend/generated/api.schemas.ts b/products/revenue_analytics/frontend/generated/api.schemas.ts
index 9f8941edee6b..3e31b5137fd2 100644
--- a/products/revenue_analytics/frontend/generated/api.schemas.ts
+++ b/products/revenue_analytics/frontend/generated/api.schemas.ts
@@ -7,3 +7,12 @@
* PostHog API - generated
* OpenAPI spec version: 1.0.0
*/
+export interface RevenueAnalyticsJoinApi {
+ /** True creates the person join for the project, false removes it. */
+ enabled: boolean
+}
+
+export interface RevenueAnalyticsJoinResponseApi {
+ /** What the request did, for display. */
+ detail: string
+}
diff --git a/products/revenue_analytics/frontend/generated/api.ts b/products/revenue_analytics/frontend/generated/api.ts
index 4625b506ab27..9990a0807298 100644
--- a/products/revenue_analytics/frontend/generated/api.ts
+++ b/products/revenue_analytics/frontend/generated/api.ts
@@ -1,3 +1,4 @@
+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:
@@ -7,16 +8,22 @@
* PostHog API - generated
* OpenAPI spec version: 1.0.0
*/
-import { apiMutator } from '../../../../frontend/src/lib/api-orval-mutator'
+import type { RevenueAnalyticsJoinApi, RevenueAnalyticsJoinResponseApi } from './api.schemas'
export const getRevenueAnalyticsJoinsCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/revenue_analytics/joins/`
}
-export const revenueAnalyticsJoinsCreate = async (projectId: string, options?: RequestInit): Promise<void> => {
- return apiMutator<void>(getRevenueAnalyticsJoinsCreateUrl(projectId), {
+export const revenueAnalyticsJoinsCreate = async (
+ projectId: string,
+ revenueAnalyticsJoinApi: RevenueAnalyticsJoinApi,
+ options?: RequestInit
+): Promise<RevenueAnalyticsJoinResponseApi> => {
+ return apiMutator<RevenueAnalyticsJoinResponseApi>(getRevenueAnalyticsJoinsCreateUrl(projectId), {
...options,
method: 'POST',
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
+ body: JSON.stringify(revenueAnalyticsJoinApi),
})
}
diff --git a/products/revenue_analytics/frontend/generated/api.zod.ts b/products/revenue_analytics/frontend/generated/api.zod.ts
index e8a15d4e1b52..f673cbb2b8fa 100644
--- a/products/revenue_analytics/frontend/generated/api.zod.ts
+++ b/products/revenue_analytics/frontend/generated/api.zod.ts
@@ -7,3 +7,8 @@
* PostHog API - generated
* OpenAPI spec version: 1.0.0
*/
+import * as zod from 'zod'
+
+export const RevenueAnalyticsJoinsCreateBody = /* @__PURE__ */ zod.object({
+ enabled: zod.boolean().describe('True creates the person join for the project, false removes it.'),
+})
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 0b703bd90846..60e9752048f6 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -84004,6 +84004,16 @@ export namespace Schemas {
next_offset: number | null;
}
+ export interface RevenueAnalyticsJoin {
+ /** True creates the person join for the project, false removes it. */
+ enabled: boolean;
+ }
+
+ export interface RevenueAnalyticsJoinResponse {
+ /** What the request did, for display. */
+ detail: string;
+ }
+
export interface ReviewBlindSpotsConfig {
/** Name of the `review-hog-blind-spots-*` skill this row represents (the sweep's identity). */
skill_name: string;