From b75ef330875378078e04be4aae236b7ca3dc82fd Mon Sep 17 00:00:00 2001 From: Valerie Coffman Date: Mon, 23 Dec 2024 15:05:08 -0800 Subject: [PATCH 1/5] feat: endpoint to get metrics of casts matching a query --- src/v2/spec.yaml | 75 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/src/v2/spec.yaml b/src/v2/spec.yaml index d689b5c..e990b9d 100644 --- a/src/v2/spec.yaml +++ b/src/v2/spec.yaml @@ -2614,6 +2614,31 @@ components: $ref: "#/components/schemas/CastWithInteractions" next: $ref: "#/components/schemas/NextCursor" + CastsMetrics: + type: object + required: + - start + - resolution_in_seconds + - cast_count + properties: + start: + type: string + format: date-time + resolution_in_seconds: + type: integer + format: int32 + cast_count: + type: integer + format: int32 + CastsMetricsResponse: + type: object + required: + - metrics + properties: + metrics: + type: array + items: + $ref: "#/components/schemas/CastsMetrics" FeedResponse: type: object required: @@ -5326,6 +5351,56 @@ paths: $ref: "#/components/schemas/CastsSearchResponse" "400": $ref: "#/components/responses/400Response" + /farcaster/cast/metrics: + get: + tags: + - Cast + summary: Metrics for casts + description: Fetches metrics casts matching a query + externalDocs: + url: https://docs.neynar.com/reference/fetch-cast-metrics + operationId: fetch-cast-metrics + parameters: + - name: q + in: query + required: true + description: "Query string to search for casts" + example: "star wars" + schema: + type: string + - name: interval + in: query + required: false + description: "Interval of time for which to fetch metrics. Choices are `1d`, `7d`, `30d`" + schema: + type: string + enum: + - 1d + - 7d + - 30d + default: "30d" + - name: author_fid + in: query + required: false + description: "Fid of the user whose casts you want to search" + example: 194 + schema: + $ref: "#/components/schemas/Fid" + - name: channel_id + in: query + required: false + schema: + type: string + description: "Channel ID of the casts you want to search" + responses: + "200": + description: Successful operation. + content: + application/json: + schema: + $ref: "#/components/schemas/CastMetricsResponse" + "400": + $ref: "#/components/responses/400Response" /farcaster/cast/conversation: get: tags: From 1b7e9909bba2d6d47ce3827963d329f9eeb29587 Mon Sep 17 00:00:00 2001 From: Valerie Coffman Date: Mon, 23 Dec 2024 15:09:04 -0800 Subject: [PATCH 2/5] typo --- src/v2/spec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/v2/spec.yaml b/src/v2/spec.yaml index e990b9d..7438aa0 100644 --- a/src/v2/spec.yaml +++ b/src/v2/spec.yaml @@ -5398,7 +5398,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/CastMetricsResponse" + $ref: "#/components/schemas/CastsMetricsResponse" "400": $ref: "#/components/responses/400Response" /farcaster/cast/conversation: From 8831b5bdd0cfe5ef5650597b3e02f4b8bb72f19f Mon Sep 17 00:00:00 2001 From: Valerie Coffman Date: Mon, 23 Dec 2024 16:22:08 -0800 Subject: [PATCH 3/5] remove default --- src/v2/spec.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/v2/spec.yaml b/src/v2/spec.yaml index 7438aa0..7269bfe 100644 --- a/src/v2/spec.yaml +++ b/src/v2/spec.yaml @@ -5378,7 +5378,6 @@ paths: - 1d - 7d - 30d - default: "30d" - name: author_fid in: query required: false From 1ba8ed20c509e9d71e52c783e1dc09f01c97f48b Mon Sep 17 00:00:00 2001 From: Valerie Coffman Date: Tue, 24 Dec 2024 11:52:17 -0800 Subject: [PATCH 4/5] change tag to metrics --- src/v2/spec.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/v2/spec.yaml b/src/v2/spec.yaml index 7269bfe..2370ac8 100644 --- a/src/v2/spec.yaml +++ b/src/v2/spec.yaml @@ -4492,6 +4492,8 @@ tags: description: Operations related to onchain data - name: Login description: Operations related to login + - name: Metrics + description: Operations related to retrieving metrics paths: /farcaster/user/fid: @@ -5354,7 +5356,7 @@ paths: /farcaster/cast/metrics: get: tags: - - Cast + - Metrics summary: Metrics for casts description: Fetches metrics casts matching a query externalDocs: From 0525bbe8e82f9ab8a1f063c902e8152147fd0588 Mon Sep 17 00:00:00 2001 From: Valerie Coffman Date: Tue, 24 Dec 2024 11:53:14 -0800 Subject: [PATCH 5/5] bump version number --- src/v2/spec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/v2/spec.yaml b/src/v2/spec.yaml index 2370ac8..745161e 100644 --- a/src/v2/spec.yaml +++ b/src/v2/spec.yaml @@ -1,7 +1,7 @@ openapi: 3.1.0 info: title: Farcaster API V2 - version: "2.6.1" + version: "2.7.0" description: > The Farcaster API allows you to interact with the Farcaster protocol. See the [Neynar docs](https://docs.neynar.com/reference) for more details.