2
0
Fork
You've already forked discourse-api
0
HTTP Client for Discourse forum, autogenerated in Rust by OpenAPI-generator-cli
  • Rust 99.8%
  • Shell 0.2%
Jacob Dybvald Ludvigsen e26da44546
Initial Commit
HTTP client for Discourse (GPL-v2 forum software)
autogenerated in the Rust language by openapi-generator-cli
2025年08月01日 13:19:59 +02:00
.openapi-generator Initial Commit 2025年08月01日 13:19:59 +02:00
discourse-api Initial Commit 2025年08月01日 13:19:59 +02:00
docs Initial Commit 2025年08月01日 13:19:59 +02:00
src Initial Commit 2025年08月01日 13:19:59 +02:00
.gitignore Initial Commit 2025年08月01日 13:19:59 +02:00
.openapi-generator-ignore Initial Commit 2025年08月01日 13:19:59 +02:00
.travis.yml Initial Commit 2025年08月01日 13:19:59 +02:00
Cargo.toml Initial Commit 2025年08月01日 13:19:59 +02:00
discourse-api-generate.yaml Initial Commit 2025年08月01日 13:19:59 +02:00
git_push.sh Initial Commit 2025年08月01日 13:19:59 +02:00
LICENSE.md Initial Commit 2025年08月01日 13:19:59 +02:00
README.md Initial Commit 2025年08月01日 13:19:59 +02:00

Rust API client for discourse-api

This page contains the documentation on how to use Discourse through API calls.

Note: For any endpoints not listed you can follow the reverse engineer the Discourse API guide to figure out how to use an API endpoint.

Request Content-Type

The Content-Type for POST and PUT requests can be set to application/x-www-form-urlencoded, multipart/form-data, or application/json.

Endpoint Names and Response Content-Type

Most API endpoints provide the same content as their HTML counterparts. For example the URL /categories serves a list of categories, the /categories.json API provides the same information in JSON format.

Instead of sending API requests to /categories.json you may also send them to /categories and add an Accept: application/json header to the request to get the JSON response. Sending requests with the Accept header is necessary if you want to use URLs for related endpoints returned by the API, such as pagination URLs. These URLs are returned without the .json prefix so you need to add the header in order to get the correct response format.

Authentication

Some endpoints do not require any authentication, pretty much anything else will require you to be authenticated.

To become authenticated you will need to create an API Key from the admin panel.

Once you have your API Key you can pass it in along with your API Username as an HTTP header like this:

curl -X GET \"http://127.0.0.1:3000/admin/users/list/active.json\" \\
-H \"Api-Key: 714552c6148e1617aeab526d0606184b94a80ec048fc09894ff1a72b740c5f19\" \\
-H \"Api-Username: system\"

and this is how POST requests will look:

curl -X POST \"http://127.0.0.1:3000/categories\" \\
-H \"Content-Type: multipart/form-data;\" \\
-H \"Api-Key: 714552c6148e1617aeab526d0606184b94a80ec048fc09894ff1a72b740c5f19\" \\
-H \"Api-Username: system\" \\
-F \"name=89853c20-4409-e91a-a8ea-f6cdff96aaaa\" \\
-F \"color=49d9e9\" \\
-F \"text_color=f0fcfd\"

Boolean values

If an endpoint accepts a boolean be sure to specify it as a lowercase true or false value unless noted otherwise.

Overview

This API client was generated by the OpenAPI Generator project. By using the openapi-spec from a remote server, you can easily generate an API client.

  • API version: latest
  • Package version: 0.1.0
  • Generator version: 7.14.0
  • Build package: org.openapitools.codegen.languages.RustClientCodegen

Installation

Put the package under your project folder in a directory named discourse-api and add the following to Cargo.toml under [dependencies]:

discourse-api = { path = "./discourse-api" }

Documentation for API Endpoints

All URIs are relative to https://discourse.example.com

Class Method HTTP request Description
AdminApi activate_user PUT /admin/users/{id}/activate.json Activate a user
AdminApi admin_get_user GET /admin/users/{id}.json Get a user by id
AdminApi admin_list_users GET /admin/users/list/{flag}.json Get a list of users
AdminApi anonymize_user PUT /admin/users/{id}/anonymize.json Anonymize a user
AdminApi deactivate_user PUT /admin/users/{id}/deactivate.json Deactivate a user
AdminApi delete_user DELETE /admin/users/{id}.json Delete a user
AdminApi log_out_user POST /admin/users/{id}/log_out.json Log a user out
AdminApi refresh_gravatar POST /user_avatar/{username}/refresh_gravatar.json Refresh gravatar
AdminApi silence_user PUT /admin/users/{id}/silence.json Silence a user
AdminApi suspend_user PUT /admin/users/{id}/suspend.json Suspend a user
BackupsApi create_backup POST /admin/backups.json Create backup
BackupsApi download_backup GET /admin/backups/{filename} Download backup
BackupsApi get_backups GET /admin/backups.json List backups
BackupsApi send_download_backup_email PUT /admin/backups/{filename} Send download backup email
BadgesApi admin_list_badges GET /admin/badges.json List badges
BadgesApi create_badge POST /admin/badges.json Create badge
BadgesApi delete_badge DELETE /admin/badges/{id}.json Delete badge
BadgesApi list_user_badges GET /user-badges/{username}.json List badges for a user
BadgesApi update_badge PUT /admin/badges/{id}.json Update badge
CategoriesApi create_category POST /categories.json Creates a category
CategoriesApi get_category GET /c/{id}/show.json Show category
CategoriesApi get_site GET /site.json Get site info
CategoriesApi list_categories GET /categories.json Retrieves a list of categories
CategoriesApi list_category_topics GET /c/{slug}/{id}.json List topics
CategoriesApi update_category PUT /categories/{id}.json Updates a category
GroupsApi add_group_members PUT /groups/{id}/members.json Add group members
GroupsApi create_group POST /admin/groups.json Create a group
GroupsApi delete_group DELETE /admin/groups/{id}.json Delete a group
GroupsApi get_group GET /groups/{id}.json Get a group
GroupsApi list_group_members GET /groups/{id}/members.json List group members
GroupsApi list_groups GET /groups.json List groups
GroupsApi remove_group_members DELETE /groups/{id}/members.json Remove group members
GroupsApi update_group PUT /groups/{id}.json Update a group
InvitesApi create_invite POST /invites.json Create an invite
InvitesApi create_multiple_invites POST /invites/create-multiple.json Create multiple invites
InvitesApi invite_group_to_topic POST /t/{id}/invite-group.json Invite group to topic
InvitesApi invite_to_topic POST /t/{id}/invite.json Invite to topic
NotificationsApi get_notifications GET /notifications.json Get the notifications that belong to the current user
NotificationsApi mark_notifications_as_read PUT /notifications/mark-read.json Mark notifications as read
PostsApi create_topic_post_pm POST /posts.json Creates a new topic, a new post, or a private message
PostsApi delete_post DELETE /posts/{id}.json delete a single post
PostsApi get_post GET /posts/{id}.json Retrieve a single post
PostsApi list_posts GET /posts.json List latest posts across topics
PostsApi lock_post PUT /posts/{id}/locked.json Lock a post from being edited
PostsApi perform_post_action POST /post_actions.json Like a post and other actions
PostsApi post_replies GET /posts/{id}/replies.json List replies to a post
PostsApi update_post PUT /posts/{id}.json Update a single post
PrivateMessagesApi create_topic_post_pm POST /posts.json Creates a new topic, a new post, or a private message
PrivateMessagesApi get_user_sent_private_messages GET /topics/private-messages-sent/{username}.json Get a list of private messages sent for a user
PrivateMessagesApi list_user_private_messages GET /topics/private-messages/{username}.json Get a list of private messages for a user
SearchApi search GET /search.json Search for a term
SiteApi get_site GET /site.json Get site info
SiteApi get_site_basic_info GET /site/basic-info.json Get site basic info
TagsApi create_tag_group POST /tag_groups.json Creates a tag group
TagsApi get_tag GET /tag/{name}.json Get a specific tag
TagsApi get_tag_group GET /tag_groups/{id}.json Get a single tag group
TagsApi list_tag_groups GET /tag_groups.json Get a list of tag groups
TagsApi list_tags GET /tags.json Get a list of tags
TagsApi update_tag_group PUT /tag_groups/{id}.json Update tag group
TopicsApi bookmark_topic PUT /t/{id}/bookmark.json Bookmark topic
TopicsApi create_topic_post_pm POST /posts.json Creates a new topic, a new post, or a private message
TopicsApi create_topic_timer POST /t/{id}/timer.json Create topic timer
TopicsApi get_specific_posts_from_topic GET /t/{id}/posts.json Get specific posts from a topic
TopicsApi get_topic GET /t/{id}.json Get a single topic
TopicsApi get_topic_by_external_id GET /t/external_id/{external_id}.json Get topic by external_id
TopicsApi invite_group_to_topic POST /t/{id}/invite-group.json Invite group to topic
TopicsApi invite_to_topic POST /t/{id}/invite.json Invite to topic
TopicsApi list_latest_topics GET /latest.json Get the latest topics
TopicsApi list_top_topics GET /top.json Get the top topics filtered by period
TopicsApi remove_topic DELETE /t/{id}.json Remove a topic
TopicsApi set_notification_level POST /t/{id}/notifications.json Set notification level
TopicsApi update_topic PUT /t/-/{id}.json Update a topic
TopicsApi update_topic_status PUT /t/{id}/status.json Update the status of a topic
TopicsApi update_topic_timestamp PUT /t/{id}/change-timestamp.json Update topic timestamp
UploadsApi abort_multipart POST /uploads/abort-multipart.json Abort multipart upload
UploadsApi batch_presign_multipart_parts POST /uploads/batch-presign-multipart-parts.json Generates batches of presigned URLs for multipart parts
UploadsApi complete_external_upload POST /uploads/complete-external-upload.json Completes a direct external upload
UploadsApi complete_multipart POST /uploads/complete-multipart.json Complete multipart upload
UploadsApi create_multipart_upload POST /uploads/create-multipart.json Creates a multipart external upload
UploadsApi create_upload POST /uploads.json Creates an upload
UploadsApi generate_presigned_put POST /uploads/generate-presigned-put.json Initiates a direct external upload
UsersApi activate_user PUT /admin/users/{id}/activate.json Activate a user
UsersApi admin_get_user GET /admin/users/{id}.json Get a user by id
UsersApi admin_list_users GET /admin/users/list/{flag}.json Get a list of users
UsersApi anonymize_user PUT /admin/users/{id}/anonymize.json Anonymize a user
UsersApi change_password PUT /users/password-reset/{token}.json Change password
UsersApi create_user POST /users.json Creates a user
UsersApi deactivate_user PUT /admin/users/{id}/deactivate.json Deactivate a user
UsersApi delete_user DELETE /admin/users/{id}.json Delete a user
UsersApi get_user GET /u/{username}.json Get a single user by username
UsersApi get_user_emails GET /u/{username}/emails.json Get email addresses belonging to a user
UsersApi get_user_external_id GET /u/by-external/{external_id}.json Get a user by external_id
UsersApi get_user_identiy_provider_external_id GET /u/by-external/{provider}/{external_id}.json Get a user by identity provider external ID
UsersApi list_user_actions GET /user_actions.json Get a list of user actions
UsersApi list_user_badges GET /user-badges/{username}.json List badges for a user
UsersApi list_users_public GET /directory_items.json Get a public list of users
UsersApi log_out_user POST /admin/users/{id}/log_out.json Log a user out
UsersApi refresh_gravatar POST /user_avatar/{username}/refresh_gravatar.json Refresh gravatar
UsersApi send_password_reset_email POST /session/forgot_password.json Send password reset email
UsersApi silence_user PUT /admin/users/{id}/silence.json Silence a user
UsersApi suspend_user PUT /admin/users/{id}/suspend.json Suspend a user
UsersApi update_avatar PUT /u/{username}/preferences/avatar/pick.json Update avatar
UsersApi update_email PUT /u/{username}/preferences/email.json Update email
UsersApi update_user PUT /u/{username}.json Update a user
UsersApi update_username PUT /u/{username}/preferences/username.json Update username

Documentation For Models

To get access to the crate's generated documentation, use:

cargo doc --open

Author