Edits history of script submission #12068 for ' Update instance settings (clerk)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Clerk = {
      apiKey: string;
    };
    /**
     * Update instance settings
     * Updates the settings of an instance
     */
    export async function main(
      auth: Clerk,
      body: {
        test_mode?: false | true;
        hibp?: false | true;
        enhanced_email_deliverability?: false | true;
        support_email?: string;
        clerk_js_version?: string;
        development_origin?: string;
        allowed_origins?: string[];
        cookieless_dev?: false | true;
        url_based_session_syncing?: false | true;
      },
    ) {
      const url = new URL(`https://api.clerk.com/v1/instance`);
    
      const response = await fetch(url, {
        method: "PATCH",
        headers: {
          "Content-Type": "application/json",
          Authorization: "Bearer " + auth.apiKey,
        },
        body: JSON.stringify(body),
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.text();
    }
    

    Submitted by hugo697 428 days ago