diff --git a/.github/workflows/build_and_publish.yml b/.github/workflows/build_and_publish.yml index c382d9c..69946da 100644 --- a/.github/workflows/build_and_publish.yml +++ b/.github/workflows/build_and_publish.yml @@ -2,12 +2,16 @@ name: Build and Publish API on: push: - branches: [main] + branches: + - main jobs: build: runs-on: ubuntu-latest + permissions: + contents: write + steps: - name: Checkout repository uses: actions/checkout@v3 @@ -24,51 +28,57 @@ jobs: - name: Commit changes uses: EndBug/add-and-commit@v9 with: - author_name: Revolt CI - author_email: revolt-ci@users.noreply.github.com + author_name: Stoat CI + author_email: stoat-ci@users.noreply.github.com message: "chore: build library from latest spec [skip ci]" - name: Find current API version run: echo "api_version=$(jq -r .info.version OpenAPI.json)" >> $GITHUB_ENV + - name: Check if tag exists for current version uses: mukunku/tag-exists-action@v1.2.0 id: checkTag with: tag: ${{ env.api_version }} + - name: Update version in package.json if: ${{ steps.checkTag.outputs.exists }} != true run: | jq '.version="${{ env.api_version }}"' package.json > temp.json mv temp.json package.json + - name: Commit changes if: ${{ steps.checkTag.outputs.exists }} != true uses: EndBug/add-and-commit@v9 with: - author_name: Revolt CI - author_email: revolt-ci@users.noreply.github.com + author_name: Stoat CI + author_email: stoat-ci@users.noreply.github.com tag: "${{ env.api_version }} --force" message: "chore: bump version to ${{ env.api_version }} [skip ci]" + - name: Publish to NPM if: ${{ steps.checkTag.outputs.exists }} != true uses: JS-DevTools/npm-publish@v1 with: token: ${{ secrets.NPM_TOKEN }} - - name: Checkout revolt.js repository + - name: Checkout stoat.js repository if: ${{ steps.checkTag.outputs.exists }} != true uses: actions/checkout@v3 with: - repository: revoltchat/revolt.js - path: revolt.js - token: ${{ secrets.PAT }} - - name: Update revolt-api dependency + repository: stoatchat/javascript-client-sdk + path: stoat.js + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Update stoat-api dependency if: ${{ steps.checkTag.outputs.exists }} != true - run: cd revolt.js && pnpm add revolt-api@${{ env.api_version }} + run: cd stoat.js && pnpm add stoat-api@${{ env.api_version }} + - name: Commit changes if: ${{ steps.checkTag.outputs.exists }} != true uses: EndBug/add-and-commit@v4 with: - cwd: "revolt.js" - author_name: Revolt CI - author_email: revolt-ci@users.noreply.github.com - message: "chore: update revolt-api to ${{ env.api_version }}" + cwd: "stoat.js" + author_name: Stoat CI + author_email: stoat-ci@users.noreply.github.com + message: "chore: update stoat-api to ${{ env.api_version }}" diff --git a/LICENSE b/LICENSE index 15115d5..10038ad 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 Revolt +Copyright (c) 2022-2025 Pawel Makles Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/OpenAPI.json b/OpenAPI.json index 5051ec6..64dad57 100644 --- a/OpenAPI.json +++ b/OpenAPI.json @@ -2063,6 +2063,16 @@ } } ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DataJoinCall" + } + } + }, + "required": true + }, "responses": { "default": { "description": "An error occurred.", @@ -2079,7 +2089,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LegacyCreateVoiceUserResponse" + "$ref": "#/components/schemas/CreateVoiceUserResponse" } } } @@ -2092,13 +2102,61 @@ ] } }, + "/channels/{target}/end_ring/{target_user}": { + "put": { + "tags": [ + "Voice" + ], + "summary": "Stop Ring", + "description": "Stops ringing a specific user in a dm call. You must be in the call to use this endpoint, returns NotConnected otherwise. Only valid in DM/Group channels, will return NoEffect in servers. Returns NotFound if the user is not in the dm/group channel", + "operationId": "voice_stop_ring_stop_ring", + "parameters": [ + { + "name": "target", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/Id" + } + }, + { + "name": "target_user", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/Id" + } + } + ], + "responses": { + "default": { + "description": "An error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "204": { + "description": "Success" + } + }, + "security": [ + { + "Session Token": [] + } + ] + } + }, "/channels/{target}/permissions/{role_id}": { "put": { "tags": [ "Channel Permissions" ], "summary": "Set Role Permission", - "description": "Sets permissions for the specified role in this channel.\n\nChannel must be a `TextChannel` or `VoiceChannel`.", + "description": "Sets permissions for the specified role in this channel.\n\nChannel must be a `TextChannel`.", "operationId": "permissions_set_set_role_permissions", "parameters": [ { @@ -2163,7 +2221,7 @@ "Channel Permissions" ], "summary": "Set Default Permission", - "description": "Sets permissions for the default role in this channel.\n\nChannel must be a `Group`, `TextChannel` or `VoiceChannel`.", + "description": "Sets permissions for the default role in this channel.\n\nChannel must be a `Group` or `TextChannel`.", "operationId": "permissions_set_default_set_default_channel_permissions", "parameters": [ { @@ -5829,7 +5887,7 @@ "email", "invite_only", "january", - "voso" + "livekit" ], "properties": { "captcha": { @@ -5864,7 +5922,7 @@ } ] }, - "voso": { + "livekit": { "description": "Voice server configuration", "allOf": [ { @@ -5915,20 +5973,44 @@ "type": "object", "required": [ "enabled", - "url", - "ws" + "nodes" ], "properties": { "enabled": { "description": "Whether voice is enabled", "type": "boolean" }, - "url": { - "description": "URL pointing to the voice API", + "nodes": { + "description": "All livekit nodes", + "type": "array", + "items": { + "$ref": "#/components/schemas/VoiceNode" + } + } + } + }, + "VoiceNode": { + "title": "Information about a livekit node", + "type": "object", + "required": [ + "lat", + "lon", + "name", + "public_url" + ], + "properties": { + "name": { "type": "string" }, - "ws": { - "description": "URL pointing to the voice WebSocket server", + "lat": { + "type": "number", + "format": "double" + }, + "lon": { + "type": "number", + "format": "double" + }, + "public_url": { "type": "string" } } @@ -6886,6 +6968,76 @@ } } }, + { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "LiveKitUnavailable" + ] + } + } + }, + { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NotAVoiceChannel" + ] + } + } + }, + { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "AlreadyConnected" + ] + } + } + }, + { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NotConnected" + ] + } + } + }, + { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "UnknownNode" + ] + } + } + }, { "type": "object", "required": [ @@ -7799,70 +7951,15 @@ "nsfw": { "description": "Whether this channel is marked as not safe for work", "type": "boolean" - } - } - }, - { - "description": "Voice channel belonging to a server", - "type": "object", - "required": [ - "_id", - "channel_type", - "name", - "server" - ], - "properties": { - "channel_type": { - "type": "string", - "enum": [ - "VoiceChannel" - ] }, - "_id": { - "description": "Unique Id", - "type": "string" - }, - "server": { - "description": "Id of the server this channel belongs to", - "type": "string" - }, - "name": { - "description": "Display name of the channel", - "type": "string" - }, - "description": { - "description": "Channel description", - "type": "string", - "nullable": true - }, - "icon": { - "description": "Custom icon attachment", + "voice": { + "description": "Voice Information for when this channel is also a voice channel", "allOf": [ { - "$ref": "#/components/schemas/File" + "$ref": "#/components/schemas/VoiceInformation" } ], "nullable": true - }, - "default_permissions": { - "description": "Default permissions assigned to users in this channel", - "allOf": [ - { - "$ref": "#/components/schemas/OverrideField" - } - ], - "nullable": true - }, - "role_permissions": { - "description": "Permissions assigned based on role to this channel", - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/OverrideField" - } - }, - "nsfw": { - "description": "Whether this channel is marked as not safe for work", - "type": "boolean" } } } @@ -7888,6 +7985,19 @@ } } }, + "VoiceInformation": { + "description": "Voice information for a channel", + "type": "object", + "properties": { + "max_users": { + "description": "Maximium amount of users allowed in the voice channel at once", + "type": "integer", + "format": "uint", + "minimum": 1.0, + "nullable": true + } + } + }, "MutualResponse": { "description": "Mutual friends, servers, groups and DMs response", "type": "object", @@ -8255,6 +8365,15 @@ "type": "boolean", "nullable": true }, + "voice": { + "description": "Voice Information for voice channels", + "allOf": [ + { + "$ref": "#/components/schemas/VoiceInformation" + } + ], + "nullable": true + }, "remove": { "description": "Fields to remove from channel", "default": [], @@ -8271,7 +8390,8 @@ "enum": [ "Description", "Icon", - "DefaultPermissions" + "DefaultPermissions", + "Voice" ] }, "Invite": { @@ -8554,6 +8674,14 @@ } ], "nullable": true + }, + "can_publish": { + "description": "Whether the member is server-wide voice muted", + "type": "boolean" + }, + "can_receive": { + "description": "Whether the member is server-wide voice deafened", + "type": "boolean" } } }, @@ -8857,6 +8985,32 @@ "type": "string" } } + }, + { + "type": "object", + "required": [ + "by", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "call_started" + ] + }, + "by": { + "type": "string" + }, + "finished_at": { + "allOf": [ + { + "$ref": "#/components/schemas/ISO8601 Timestamp" + } + ], + "nullable": true + } + } } ] }, @@ -9782,16 +9936,45 @@ } } }, - "LegacyCreateVoiceUserResponse": { + "CreateVoiceUserResponse": { "description": "Voice server token response", "type": "object", "required": [ - "token" + "token", + "url" ], "properties": { "token": { "description": "Token for authenticating with the voice server", "type": "string" + }, + "url": { + "description": "Url of the livekit server to connect to", + "type": "string" + } + } + }, + "DataJoinCall": { + "description": "Join a voice channel", + "type": "object", + "properties": { + "node": { + "description": "Name of the node to join", + "type": "string", + "nullable": true + }, + "force_disconnect": { + "description": "Whether to force disconnect any other existing voice connections\n\nUseful for disconnecting on another device and joining on a new.", + "type": "boolean", + "nullable": true + }, + "recipients": { + "description": "Users which should be notified of the call starting\n\nOnly used when the user is the first one connected.", + "type": "array", + "items": { + "type": "string" + }, + "nullable": true } } }, @@ -9858,7 +10041,7 @@ ], "properties": { "permissions": { - "description": "Allow / deny values to set for members in this `TextChannel` or `VoiceChannel`", + "description": "Allow / deny values to set for members in this server channel", "allOf": [ { "$ref": "#/components/schemas/Override" @@ -10410,6 +10593,15 @@ "description": "Whether this channel is age restricted", "type": "boolean", "nullable": true + }, + "voice": { + "description": "Voice Information for when this channel is also a voice channel", + "allOf": [ + { + "$ref": "#/components/schemas/VoiceInformation" + } + ], + "nullable": true } } }, @@ -10515,6 +10707,21 @@ ], "nullable": true }, + "can_publish": { + "description": "server-wide voice muted", + "type": "boolean", + "nullable": true + }, + "can_receive": { + "description": "server-wide voice deafened", + "type": "boolean", + "nullable": true + }, + "voice_channel": { + "description": "voice channel to move to if already in a voice channel", + "type": "string", + "nullable": true + }, "remove": { "description": "Fields to remove from channel object", "default": [], @@ -10533,6 +10740,8 @@ "Avatar", "Roles", "Timeout", + "CanReceive", + "CanPublish", "JoinedAt" ] }, diff --git a/package.json b/package.json index 8ea7515..1f1d28e 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,14 @@ { - "name": "revolt-api", + "name": "stoat-api", "version": "0.8.9", - "description": "Revolt API Library", + "description": "Stoat API Library", "type": "module", "exports": { ".": "./lib/index.js" }, "types": "lib/index.d.ts", - "homepage": "https://developers.revolt.chat", - "repository": "https://github.com/revoltchat/api.git", + "homepage": "https://developers.stoat.chat", + "repository": "https://github.com/stoatchat/javascript-client-api", "author": "Paul Makles ", "license": "MIT", "scripts": { @@ -29,4 +29,4 @@ "README.md" ], "packageManager": "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39" -} +} \ No newline at end of file diff --git a/src/baseURL.ts b/src/baseURL.ts index b8e0feb..2331908 100644 --- a/src/baseURL.ts +++ b/src/baseURL.ts @@ -1,2 +1,2 @@ // This file was auto-generated by @insertish/oapi! -export const defaultBaseURL = "https://api.revolt.chat"; \ No newline at end of file +export const defaultBaseURL = "https://stoat.chat/api"; \ No newline at end of file