import { useState } from "react";
import { CodeExample } from "~/routes/resources.codeexample";
import { Api } from "~/services/externalApis/apis.server";
import { cn } from "~/utils/cn";
import { Feedback } from "../Feedback";
import { Header1, Header2, Header3 } from "../primitives/Headers";
import { Paragraph } from "../primitives/Paragraph";
import { TextLink } from "../primitives/TextLink";
export function CustomHelp({ api }: { api: Api }) {
const [selectedExample, setSelectedExample] = useState(0);
const changeCodeExample = (index: number) => {
setSelectedExample(index);
};
return (
Using {api.name} with an SDK or requests
You can use Trigger.dev with any existing Node SDK or even just using fetch. You can
subscribe to any API with{" "}
HTTP endpoints
{" "}
and perform actions by wrapping tasks using{" "}
io.runTask
. This makes your background job resumable and appear in our dashboard.
{api.examples && api.examples.length > 0 ? (
<>
Example {api.name} code
This is how you can use {api.name} with Trigger.dev. This code can be copied and
modified to suit your use-case.
{api.examples.length > 1 && (
{api.examples?.map((example, index) => (
))}
)}
>
) : (
<>
Getting started with {api.name}
We recommend searching for the official {api.name} Node SDK. If they have one, you can
install it and then use their API documentation to get started and create tasks. If they
don't, there are often third party SDKs you can use instead.
Please{" "}
reach out to us
}
defaultValue="help"
/>{" "}
if you're having any issues connecting to {api.name}, we'll help you get set up as
quickly as possible.
>
)}