{"id":15204045,"url":"https://github.com/typescriptlibs/tsl-mastodon-api","last_synced_at":"2025-10-29T04:31:41.898Z","repository":{"id":63097788,"uuid":"562491611","full_name":"typescriptlibs/tsl-mastodon-api","owner":"typescriptlibs","description":"TypeScript Library for the Mastodon API","archived":false,"fork":false,"pushed_at":"2025-07-06T06:21:23.000Z","size":551,"stargazers_count":22,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-19T20:44:32.985Z","etag":null,"topics":["mastodon","typescript"],"latest_commit_sha":null,"homepage":"https://typescriptlibs.org/tsl-mastodon-api","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/typescriptlibs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-11-06T14:28:31.000Z","updated_at":"2025-07-06T06:21:26.000Z","dependencies_parsed_at":"2024-03-02T11:32:44.173Z","dependency_job_id":"0fd57442-e756-4fa2-ab19-24684d09a150","html_url":"https://github.com/typescriptlibs/tsl-mastodon-api","commit_stats":{"total_commits":207,"total_committers":2,"mean_commits":103.5,"dds":0.009661835748792313,"last_synced_commit":"11e98cdd47d4fbc6d2027de12ec0bc55bd13062f"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/typescriptlibs/tsl-mastodon-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typescriptlibs%2Ftsl-mastodon-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typescriptlibs%2Ftsl-mastodon-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typescriptlibs%2Ftsl-mastodon-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typescriptlibs%2Ftsl-mastodon-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/typescriptlibs","download_url":"https://codeload.github.com/typescriptlibs/tsl-mastodon-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typescriptlibs%2Ftsl-mastodon-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280971721,"owners_count":26422675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-25T02:00:06.499Z","response_time":81,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mastodon","typescript"],"created_at":"2024-09-28T05:06:10.096Z","updated_at":"2025-10-29T04:31:41.060Z","avatar_url":"https://github.com/typescriptlibs.png","language":"TypeScript","readme":"TypeScript Library for the Mastodon API\n=======================================\n\nTypeScript library to access a Mastodon server from front-end or back-end environments.\n\n\n\n[![CodeQL](https://github.com/typescriptlibs/tsl-mastodon-api/workflows/CodeQL/badge.svg)](https://github.com/typescriptlibs/tsl-mastodon-api/actions/workflows/codeql.yml)\n[![Node.js](https://github.com/typescriptlibs/tsl-mastodon-api/workflows/Node.js/badge.svg)](https://github.com/typescriptlibs/tsl-mastodon-api/actions/workflows/node.js.yml)\n[![npm](https://img.shields.io/npm/v/tsl-mastodon-api.svg)](https://www.npmjs.com/package/tsl-mastodon-api)\n[![license](https://img.shields.io/npm/l/tsl-mastodon-api.svg)](https://github.com/typescriptlibs/tsl-mastodon-api/blob/main/LICENSE.md)\n\n\n\nInstallation\n------------\n\nRun the following command for client/server or server-only projects:\n\n```Shell\nnpm install tsl-mastodon-api\n```\n\nRun the following command for client-only projects:\n\n```Shell\nnpm install tsl-mastodon-api --omit=optional\n```\n\n\nAccess Token\n------------\n\nYou need an access token for communication with a Mastodon server.\n\n1. Open your Mastodon website and go to the profile settings of the account.\n\n2. In the profile settings open the section 'Development'.\n\n3. Create a new application and use the related access token.\n\nOr you can use the `OAuth.createApp` function (import `tsl-mastodon-api/lib/OAuth.js`).\n\n\n\nExamples\n--------\n\n```TypeScript\nimport * as Mastodon from 'tsl-mastodon-api';\nasync function postHelloWorld(): Promise\u003cvoid\u003e {\n    // create the API instance\n    const mastodon = new Mastodon.API({\n        access_token: 'ABC',\n        api_url: 'https://mastodon.example/api/v1/'\n    });\n    // expect client / server errors\n    try {\n        const media = await mastodon.postMediaAttachment(\n            { file: await Mastodon.Utilities.fileFrom('animation.gif') },\n            true\n        );\n        const result = await mastodon.postStatus({\n            media_ids: [media.json.id],\n            sensitive: true,\n            spoiler_text: 'Hello',\n            status: 'World'\n        });\n        console.log(JSON.stringify(result));\n    }\n    catch (error) {\n        console.error(error);\n    }\n}\npostHelloWorld();\n```\n\n\n\nAPI Overview\n------------\n\nThe following snippets show an excerpt of the API.\n\n```TypeScript\nAPI(config)\nAPI.delay()\nAPI.search(search)\n\nAPI.getAccount()\nAPI.getAnnouncements(queryParameters?)\nAPI.getListAccounts(listID, queryParameters?)\nAPI.getMediaAttachment(mediaAttachmentID, awaitProcessing)\nAPI.getNotifications()\nAPI.getStatusesOfPublic(queryParameters?)\n\nAPI.postDismissAnnouncement(announcementID)\nAPI.postDismissNotification(notificationID)\nAPI.postListAccounts(listID, listAccounts)\nAPI.postMediaAttachment(mediaAttachment, awaitProcessing)\nAPI.postPollVote(pollID, pollVote)\nAPI.postStatus(status)\n\nAPI.putAnnouncementReaction(announcementID, emojiName)\nAPI.putMediaAttachmentUpdate(mediaAttachmentID, mediaAttachmentUpdate)\n\nAPI.deleteAnnouncementReaction(announcementID, emojiName)\nAPI.deleteListAccounts(listID, listAccounts)\nAPI.deleteNotification(notificationID)\nAPI.deleteStatus(statusID)\n```\n\n```TypeScript\nJSON.isAccount(json)\nJSON.isAnnouncement(json)\nJSON.isList(json)\nJSON.isMediaAttachment(json)\nJSON.isNotification(json)\nJSON.isStatus(json)\nJSON.isStreamData(json)\n```\n\n```TypeScript\nREST(config)\nREST.delete(path, params?)\nREST.fetch(method, path, params?)\nREST.get(path, params?)\nREST.patch(path, params?)\nREST.post(path, params?)\nREST.put(path, params?)\n```\n\nOptional with import of `tsl-mastodon-api/lib/OAuth.js`:\n\n```TypeScript\nOAuth.createApp(apiURL, appName, redirectURI?, scopes?, website?)\nOAuth.getAccessToken(baseURL, clientId, clientSecret, authorizationCode, redirectUri?)\nOAuth.getAuthorizationUrl(baseURL, clientId, clientSecret, redirectUri?, scope?)\n```\n\nOptional with import of `tsl-mastodon-api/lib/StreamAPI.js`:\n\n```TypeScript\nStreamAPI(config)\nStreamAPI.off(eventType, eventListener)\nStreamAPI.on(eventType, eventListener)\nStreamAPI.subscribe(streamType, streamParams?, eventListener?)\nStreamAPI.unsubscribe(streamType, streamParams?, eventListener?)\n```\n\n\n\nLinks\n-----\n\n* [github.com/typescriptlibs/tsl-mastodon-api](https://github.com/typescriptlibs/tsl-mastodon-api/releases)\n\n* [npmjs.com/package/tsl-mastodon-api](https://www.npmjs.com/package/tsl-mastodon-api)\n\n* [typescriptlibs.org](https://typescriptlibs.org/)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypescriptlibs%2Ftsl-mastodon-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftypescriptlibs%2Ftsl-mastodon-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypescriptlibs%2Ftsl-mastodon-api/lists"}