From e6e7daae81becabe5d71f295719a29fccd213bd9 Mon Sep 17 00:00:00 2001 From: Arpit Gupta Date: Sat, 18 Apr 2026 00:02:32 +0530 Subject: [PATCH] feat: cut getArtistSocials tasks helper over to /api/artists/{id}/socials with x-api-key - Build URL from NEW_API_BASE_URL + nested path id (drop artist_account_id query param) - Send x-api-key: RECOUP_API_KEY header per mono/api auth retrofit - Guard on missing RECOUP_API_KEY same as createAccountSandbox template - Zod schema, error handling, exported types unchanged --- src/recoup/getArtistSocials.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/recoup/getArtistSocials.ts b/src/recoup/getArtistSocials.ts index f055c17..ab3e734 100644 --- a/src/recoup/getArtistSocials.ts +++ b/src/recoup/getArtistSocials.ts @@ -1,5 +1,6 @@ import { logger } from "@trigger.dev/sdk/v3"; import { z } from "zod"; +import { NEW_API_BASE_URL, RECOUP_API_KEY } from "../consts"; const artistSocialsResponseSchema = z.object({ status: z.literal("success"), @@ -31,8 +32,6 @@ export type ArtistSocialProfile = z.infer< typeof artistSocialsResponseSchema >["socials"][number]; -const ARTIST_SOCIALS_API_URL = "https://api.recoupable.com/api/artist/socials"; - export async function getArtistSocials( artistAccountId: string ): Promise { @@ -41,14 +40,19 @@ export async function getArtistSocials( return undefined; } + if (!RECOUP_API_KEY) { + logger.error("RECOUP_API_KEY not configured"); + return undefined; + } + try { - const url = new URL(ARTIST_SOCIALS_API_URL); - url.searchParams.set("artist_account_id", artistAccountId); + const url = `${NEW_API_BASE_URL}/api/artists/${artistAccountId}/socials`; - const response = await fetch(url.toString(), { + const response = await fetch(url, { method: "GET", headers: { "Content-Type": "application/json", + "x-api-key": RECOUP_API_KEY, }, });