The URL of your site. Don't add / at the end
Optional options: ApiOptionsoptions
Private _chatPrivate _optionsPrivate _webhookThe URL of discourse site
Static prefixedProvide one axios to use
Get default header
The discourse api's options
Webhook receptor
send request easily
the endpoint. if the endpoint not starts with '/', we consider it as a url
method. defaltly 'GET'
Optional data: unknownfor "POST" and "PUT": request payload. For "GET" and "DELETE": URLSearchParams
Optional options: { Optional doWhen true, we will not automatically add the end of .json when fetching
Optional headers?: Record<string, string>custom header
Optional overrideWhen true, the options.header will override the default headers. Otherwise, the request will use a header that is a combination of the two
Optional params?: unknownURL Params
Promise
Rest ...args: any[]Optional context: anyCreates a new topic, a new post, or a private message
payloads
Optional archetype?: stringRequired for new private message.
Optional category?: numberOptional if creating a new topic, and ignored if creating a new post.
Optional created_Datestring for created at
Optional embed_Provide a URL from a remote system to associate a forum topic with that URL, typically for using Discourse as a comments system for an external blog.
Optional external_Provide an external_id from a remote system to associate a forum topic with that id.
Raw post
Optional reply_Optional, the post number to reply to inside a topic.
Optional target_Required for private message, comma separated.
Optional title?: stringRequired if creating a new topic or new private message.
Optional topic_Required if creating a new post.
Create a upload
File path or file buffer
Optional options: FormData | { Decrypt the encrypted user_api_key from discourse
your private_key
The encrypted user_api_key
Api version
The user api key
The nonce provided when generating user_api_key
Delete a single post https://docs.discourse.org/#tag/Posts/operation/deletePost
Post id
The SiteSetting.can_permanently_delete needs to be enabled first before this param can be used. Also this endpoint needs to be called first without permanently and then followed up with a second call 5 minutes later with permanently to permanently delete.
Delete a post action, unlike a post and other actions
https://docs.discourse.org/#tag/Posts/operation/performPostAction
The post action type. See https://github.com/discourse/discourse/blob/main/app/models/post_action_type.rb
Asynchronously generate a user api key.
It is the async version of generateUserApiKeySync.
Optional params: generateUserApiKeyParamsparams
Generate a user api key. It might be slow if you don't provide a private key because this function will generate it!
Usage:
api.generateUserApiKeySync
Optional params: generateUserApiKeyParamsparams
Get the latest topics. It is an alias of listLatest
Rest ...args: never[]Get notifications of a user
Optional load_more_notifications: stringmore notifications url
Retrieve a single post
This endpoint can be used to get the number of likes on a post using the actions_summary property in the response. actions_summary responses with the id of 2 signify a like. If there are no actions_summary items with the id of 2, that means there are 0 likes. Other ids likely refer to various different flag types.
Invite to topic
https://docs.discourse.org/#tag/Topics/operation/inviteToTopic
Optional email?: stringOptional user?: stringTopic updated
Get the latest topics
Optional options: { Optional ascending?: booleanOptional custom_You can usually provide more_topics_url
If you provide this value, you cannot provide other options
Optional order?: "views" | "posters" | "default" | "created" | "activity" | "posts" | "category" | "likes" | "op_likes"Optional status?: "closed" | "archived" | "open" | "deleted" | "listed" | "public" | "unlisted"Lock a post from being edited. You should provide an api that has moderator premission.
See https://docs.discourse.org/#tag/Posts/operation/lockPost
The updated post
Optional fn: ((...args) => void)Rest ...args: any[]Optional context: anyOptional once: booleanAdd a listener for a given event.
Rest ...args: any[]Optional context: anyAdd a one-time listener for a given event.
Rest ...args: any[]Optional context: anyPerform a post action, like a post and other actions
https://docs.discourse.org/#tag/Posts/operation/performPostAction
The post action type. See https://github.com/discourse/discourse/blob/main/app/models/post_action_type.rb
2 - like3 - off_topic4 - inappropriate6 - notify_user7 - notify_moderators8 - spamOptional flag_topic: booleanThe updated post
Remove all listeners, or those of the specified event.
Optional event: string | symbolRemove the listeners of a given event.
Optional fn: ((...args) => void)Rest ...args: any[]Optional context: anyOptional once: booleanRemove a topic
https://docs.discourse.org/#tag/Topics/operation/removeTopic
Unlokc a post that was locked from being edited. You should provide an api that has moderator premission.
See https://docs.discourse.org/#tag/Posts/operation/lockPost
The updated post
Update a topic
https://docs.discourse.org/#tag/Topics/operation/updateTopic
Optional category_Optional title?: stringTopic updated
Update the status of a topic.
https://docs.discourse.org/#tag/Topics/operation/updateTopicStatus
Topic id
Status
Enabled
Optional until: string | DateUntil. Only required for pinned and pinned_globally
Generated using TypeDoc
Create a api client