Skip to main content
Glama

Storyden

by Southclaws
Mozilla Public License 2.0
229
likes.ts6.83 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 { Arguments, Key, SWRConfiguration } from "swr"; import useSWRMutation from "swr/mutation"; import type { SWRMutationConfiguration } from "swr/mutation"; import { fetcher } from "../client"; import type { InternalServerErrorResponse, LikePostGetOKResponse, LikeProfileGetOKResponse, LikeProfileGetParams, NotFoundResponse, UnauthorisedResponse, } from "../openapi-schema"; /** * Retreives all likes for the given post. Not paginated (yet.) */ export const likePostGet = (postId: string) => { return fetcher<LikePostGetOKResponse>({ url: `/likes/posts/${postId}`, method: "GET", }); }; export const getLikePostGetKey = (postId: string) => [`/likes/posts/${postId}`] as const; export type LikePostGetQueryResult = NonNullable< Awaited<ReturnType<typeof likePostGet>> >; export type LikePostGetQueryError = | UnauthorisedResponse | NotFoundResponse | InternalServerErrorResponse; export const useLikePostGet = < TError = | UnauthorisedResponse | NotFoundResponse | InternalServerErrorResponse, >( postId: string, options?: { swr?: SWRConfiguration<Awaited<ReturnType<typeof likePostGet>>, TError> & { swrKey?: Key; enabled?: boolean; }; }, ) => { const { swr: swrOptions } = options ?? {}; const isEnabled = swrOptions?.enabled !== false && !!postId; const swrKey = swrOptions?.swrKey ?? (() => (isEnabled ? getLikePostGetKey(postId) : null)); const swrFn = () => likePostGet(postId); const query = useSwr<Awaited<ReturnType<typeof swrFn>>, TError>( swrKey, swrFn, swrOptions, ); return { swrKey, ...query, }; }; /** * Add a like/vote to a post. A "like" is pretty much what you'd expect for any modern social platform, it will inform the feed algorithm and the account's recommendations as well as listing the post on their profile. Idempotent operation where repeated use will do nothing. */ export const likePostAdd = (postId: string) => { return fetcher<void>({ url: `/likes/posts/${postId}`, method: "PUT" }); }; export const getLikePostAddMutationFetcher = (postId: string) => { return (_: Key, __: { arg: Arguments }): Promise<void> => { return likePostAdd(postId); }; }; export const getLikePostAddMutationKey = (postId: string) => [`/likes/posts/${postId}`] as const; export type LikePostAddMutationResult = NonNullable< Awaited<ReturnType<typeof likePostAdd>> >; export type LikePostAddMutationError = | UnauthorisedResponse | NotFoundResponse | InternalServerErrorResponse; export const useLikePostAdd = < TError = | UnauthorisedResponse | NotFoundResponse | InternalServerErrorResponse, >( postId: string, options?: { swr?: SWRMutationConfiguration< Awaited<ReturnType<typeof likePostAdd>>, TError, Key, Arguments, Awaited<ReturnType<typeof likePostAdd>> > & { swrKey?: string }; }, ) => { const { swr: swrOptions } = options ?? {}; const swrKey = swrOptions?.swrKey ?? getLikePostAddMutationKey(postId); const swrFn = getLikePostAddMutationFetcher(postId); const query = useSWRMutation(swrKey, swrFn, swrOptions); return { swrKey, ...query, }; }; /** * Removes a like/vote from the authenticated account for the post. It will perform the inverse of any changes to the account's algorithm. Also is idempotent, so repeated use will do nothing after being actioned once. */ export const likePostRemove = (postId: string) => { return fetcher<void>({ url: `/likes/posts/${postId}`, method: "DELETE" }); }; export const getLikePostRemoveMutationFetcher = (postId: string) => { return (_: Key, __: { arg: Arguments }): Promise<void> => { return likePostRemove(postId); }; }; export const getLikePostRemoveMutationKey = (postId: string) => [`/likes/posts/${postId}`] as const; export type LikePostRemoveMutationResult = NonNullable< Awaited<ReturnType<typeof likePostRemove>> >; export type LikePostRemoveMutationError = | UnauthorisedResponse | NotFoundResponse | InternalServerErrorResponse; export const useLikePostRemove = < TError = | UnauthorisedResponse | NotFoundResponse | InternalServerErrorResponse, >( postId: string, options?: { swr?: SWRMutationConfiguration< Awaited<ReturnType<typeof likePostRemove>>, TError, Key, Arguments, Awaited<ReturnType<typeof likePostRemove>> > & { swrKey?: string }; }, ) => { const { swr: swrOptions } = options ?? {}; const swrKey = swrOptions?.swrKey ?? getLikePostRemoveMutationKey(postId); const swrFn = getLikePostRemoveMutationFetcher(postId); const query = useSWRMutation(swrKey, swrFn, swrOptions); return { swrKey, ...query, }; }; /** * Retreives all the likes that the given profile has given. */ export const likeProfileGet = ( accountHandle: string, params?: LikeProfileGetParams, ) => { return fetcher<LikeProfileGetOKResponse>({ url: `/likes/profiles/${accountHandle}`, method: "GET", params, }); }; export const getLikeProfileGetKey = ( accountHandle: string, params?: LikeProfileGetParams, ) => [`/likes/profiles/${accountHandle}`, ...(params ? [params] : [])] as const; export type LikeProfileGetQueryResult = NonNullable< Awaited<ReturnType<typeof likeProfileGet>> >; export type LikeProfileGetQueryError = | UnauthorisedResponse | NotFoundResponse | InternalServerErrorResponse; export const useLikeProfileGet = < TError = | UnauthorisedResponse | NotFoundResponse | InternalServerErrorResponse, >( accountHandle: string, params?: LikeProfileGetParams, options?: { swr?: SWRConfiguration< Awaited<ReturnType<typeof likeProfileGet>>, TError > & { swrKey?: Key; enabled?: boolean }; }, ) => { const { swr: swrOptions } = options ?? {}; const isEnabled = swrOptions?.enabled !== false && !!accountHandle; const swrKey = swrOptions?.swrKey ?? (() => (isEnabled ? getLikeProfileGetKey(accountHandle, params) : null)); const swrFn = () => likeProfileGet(accountHandle, params); 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