Skip to main content
Glama

Storyden

by Southclaws
Mozilla Public License 2.0
229
links.ts5.22 kB
/** * Generated by orval v7.2.0 🍺 * Do not edit manually. * storyden * Storyden social API for building community driven platforms. The Storyden API does not adhere to semantic versioning but instead applies a rolling strategy with deprecations and minimal breaking changes. This has been done mainly for a simpler development process and it may be changed to a more fixed versioning strategy in the future. Ultimately, the primary way Storyden tracks versions is dates, there are no set release tags currently. * OpenAPI spec version: v1.25.8-canary */ import useSwr from "swr"; import type { Key, SWRConfiguration } from "swr"; import useSWRMutation from "swr/mutation"; import type { SWRMutationConfiguration } from "swr/mutation"; import { fetcher } from "../client"; import type { InternalServerErrorResponse, LinkCreateBody, LinkCreateOKResponse, LinkGetOKResponse, LinkListOKResponse, LinkListParams, NotFoundResponse, UnauthorisedResponse, } from "../openapi-schema"; /** * Add a link to the community bookmarks. This will also scrape the content at the site the link points to, if possible. If the submitted link is an invalid link for whatever reason (invalid URL structure or page is dead) then the API will fail. The metadata for the link is indexed on success. If the submitted link already exists it will be an idempotent operation, unless the body contains additional metadata. In these cases, the link's metadata will be updated with the new metadata and the URL is unchanged. When a link is submitted, it is first "cleaned" to remove any fragments. */ export const linkCreate = (linkCreateBody: LinkCreateBody) => { return fetcher<LinkCreateOKResponse>({ url: `/links`, method: "POST", headers: { "Content-Type": "application/json" }, data: linkCreateBody, }); }; export const getLinkCreateMutationFetcher = () => { return ( _: Key, { arg }: { arg: LinkCreateBody }, ): Promise<LinkCreateOKResponse> => { return linkCreate(arg); }; }; export const getLinkCreateMutationKey = () => [`/links`] as const; export type LinkCreateMutationResult = NonNullable< Awaited<ReturnType<typeof linkCreate>> >; export type LinkCreateMutationError = | UnauthorisedResponse | InternalServerErrorResponse; export const useLinkCreate = < TError = UnauthorisedResponse | InternalServerErrorResponse, >(options?: { swr?: SWRMutationConfiguration< Awaited<ReturnType<typeof linkCreate>>, TError, Key, LinkCreateBody, Awaited<ReturnType<typeof linkCreate>> > & { swrKey?: string }; }) => { const { swr: swrOptions } = options ?? {}; const swrKey = swrOptions?.swrKey ?? getLinkCreateMutationKey(); const swrFn = getLinkCreateMutationFetcher(); const query = useSWRMutation(swrKey, swrFn, swrOptions); return { swrKey, ...query, }; }; /** * List all links using the filtering options. */ export const linkList = (params?: LinkListParams) => { return fetcher<LinkListOKResponse>({ url: `/links`, method: "GET", params }); }; export const getLinkListKey = (params?: LinkListParams) => [`/links`, ...(params ? [params] : [])] as const; export type LinkListQueryResult = NonNullable< Awaited<ReturnType<typeof linkList>> >; export type LinkListQueryError = NotFoundResponse | InternalServerErrorResponse; export const useLinkList = < TError = NotFoundResponse | InternalServerErrorResponse, >( params?: LinkListParams, options?: { swr?: SWRConfiguration<Awaited<ReturnType<typeof linkList>>, TError> & { swrKey?: Key; enabled?: boolean; }; }, ) => { const { swr: swrOptions } = options ?? {}; const isEnabled = swrOptions?.enabled !== false; const swrKey = swrOptions?.swrKey ?? (() => (isEnabled ? getLinkListKey(params) : null)); const swrFn = () => linkList(params); const query = useSwr<Awaited<ReturnType<typeof swrFn>>, TError>( swrKey, swrFn, swrOptions, ); return { swrKey, ...query, }; }; /** * Get the details for a specific link. Such as where it's been posted, which resources it's linked to and how many times it's been opened. */ export const linkGet = (linkSlug: string) => { return fetcher<LinkGetOKResponse>({ url: `/links/${linkSlug}`, method: "GET", }); }; export const getLinkGetKey = (linkSlug: string) => [`/links/${linkSlug}`] as const; export type LinkGetQueryResult = NonNullable< Awaited<ReturnType<typeof linkGet>> >; export type LinkGetQueryError = NotFoundResponse | InternalServerErrorResponse; export const useLinkGet = < TError = NotFoundResponse | InternalServerErrorResponse, >( linkSlug: string, options?: { swr?: SWRConfiguration<Awaited<ReturnType<typeof linkGet>>, TError> & { swrKey?: Key; enabled?: boolean; }; }, ) => { const { swr: swrOptions } = options ?? {}; const isEnabled = swrOptions?.enabled !== false && !!linkSlug; const swrKey = swrOptions?.swrKey ?? (() => (isEnabled ? getLinkGetKey(linkSlug) : null)); const swrFn = () => linkGet(linkSlug); const query = useSwr<Awaited<ReturnType<typeof swrFn>>, TError>( swrKey, swrFn, swrOptions, ); return { swrKey, ...query, }; };

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Southclaws/storyden'

If you have feedback or need assistance with the MCP directory API, please join our Discord server