Edits history of script submission #100 for ' Post status (mastodon)'

  • deno
    One script reply has been approved by the moderators
    Ap­pro­ved
    export async function main(
      baseUrl: string,
      accessToken: string,
      status: string,
      inReplyToId?: string,
      sensitive = false,
      spoilerText?: string,
      visibility: "public" | "unlisted" | "private" | "direct" = "public",
      language?: string,
    ) {
      const resp = await fetch(`${baseUrl}/api/v1/statuses`, {
        method: "POST",
        headers: {
          Authorization: `Bearer ${accessToken}`,
          "Content-Type": "application/json",
        },
        body: JSON.stringify({
          sensitive,
          status,
          visibility,
          ...(inReplyToId && {
            in_reply_to_id: inReplyToId,
          }),
          ...(spoilerText && {
            spoiler_text: spoilerText,
          }),
          ...(language && {
            language,
          }),
        }),
      });
    
      if (!resp.ok) {
        throw Error(`Failed to post status: Error HTTP${resp.status}`);
      }
    
      return await resp.json();
    }
    

    Submitted by hugo697 386 days ago

  • deno
    export async function main(
      baseUrl: string,
      accessToken: string,
      status: string,
      inReplyToId?: string,
      sensitive = false,
      spoilerText?: string,
      visibility: "public" | "unlisted" | "private" | "direct" = "public",
      language?: string,
    ) {
      const resp = await fetch(`${baseUrl}/api/v1/statuses`, {
        method: "POST",
        headers: {
          Authorization: `Bearer ${accessToken}`,
          "Content-Type": "application/json",
        },
        body: JSON.stringify({
          sensitive,
          status,
          visibility,
          ...(inReplyToId && {
            in_reply_to_id: inReplyToId,
          }),
          ...(spoilerText && {
            spoiler_text: spoilerText,
          }),
          ...(language && {
            language,
          }),
        }),
      });
    
      if (!resp.ok) {
        throw Error(`Failed to post status: Error HTTP${resp.status}`);
      }
    
      return await resp.json();
    }
    

    Submitted by admin 1018 days ago

  • deno
    export async function main(
      baseUrl: string,
      accessToken: string,
      status: string,
      inReplyToId?: string,
      sensitive = false,
      spoilerText?: string,
      visibility: "public" | "unlisted" | "private" | "direct" = "public",
      language?: string,
    ) {
      const resp = await fetch(`${baseUrl}/api/v1/statuses`, {
        method: "POST",
        headers: {
          "Authorization": `Bearer ${accessToken}`,
          "Content-Type": "application/json",
        },
        body: JSON.stringify({
          sensitive,
          status,
          visibility,
          ...(inReplyToId && {
            in_reply_to_id: inReplyToId,
          }),
          ...(spoilerText && {
            spoiler_text: spoilerText,
          }),
          ...(language && {
            language,
          }),
        }),
      });
    
      if (!resp.ok) {
        throw Error(`Failed to post status: Error HTTP${resp.status}`);
      }
    
      return await resp.json();
    }
    

    Submitted by jaller94 1387 days ago