Skip to content

Commit 04e682b

Browse files
authored
WebSocket API Support & Update CI to nightly system (#36)
* websocket support (v1, in testing) * improvements to websocket API * updates to websocket PR * make some core changes and introduce xmldoc to realtime wrapper, update examples * update docs * final touch ups * update CI with new package * remove claude code stuff * fix readme * CI changes for new spec release * testt * ci fixes * another fix to ci * try one more time * test * fix wget * Upgrade .NET SDK to spec 2.20.7-nightly * fix ci versioning * Upgrade .NET SDK to spec 21.20.7-nightly.3 * remove quotes to fix versioning * thanks AI * Upgrade .NET SDK to spec 220.7-nightly.3 * fix one last time my friend * Upgrade .NET SDK to spec 2.20.7-nightly.3 * CI auto version bump, yay * fix ci --------- Co-authored-by: binn <binn@users.noreply.github.com>
1 parent 3a7d866 commit 04e682b

File tree

358 files changed

+15512
-7163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

358 files changed

+15512
-7163
lines changed

.github/workflows/ci.yaml

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,43 @@
11
on:
22
repository_dispatch:
3-
types: [spec_release]
3+
types: [release]
44
workflow_dispatch:
5-
6-
#on: push
5+
inputs:
6+
json:
7+
description: 'Passed json from repository_dispatch'
8+
required: true
9+
type: string
10+
version_postfix:
11+
description: 'Additional string to concatenate onto the existing version before release'
12+
required: false
13+
type: string
14+
default: ''
715

816
name: Generate VRChat API SDK
917

1018
jobs:
1119
generate:
1220
runs-on: ubuntu-latest
1321
name: Generate VRChat API SDK
22+
env:
23+
ARTIFACT_NAME: "openapi.yaml"
24+
INPUT: ${{ github.event_name == 'repository_dispatch' && toJSON(github.event.client_payload) || inputs.json }}
25+
SPEC_URL: ${{ (github.event_name == 'repository_dispatch' && github.event.client_payload || fromJSON(inputs.json))['artifacts']['openapi-legacy.yaml'] }}
26+
PASSED_VERSION: ${{ (github.event_name == 'repository_dispatch' && github.event.client_payload || fromJSON(inputs.json))['version'] }}
27+
VERSION_POSTPEND: ${{ github.event_name == 'workflow_dispatch' && inputs.version_postfix || '' }}
1428
steps:
15-
- name: Install yq via apt
16-
run: sudo apt install -y yq
17-
18-
- uses: actions/setup-node@v3
29+
- uses: actions/setup-node@v4
1930
with:
20-
node-version: 18
31+
node-version: 22
2132

22-
- uses: actions/checkout@v3
33+
- uses: actions/checkout@v4
2334
- name: 'Cache node_modules'
24-
uses: actions/cache@v3
35+
uses: actions/cache@v4
2536
with:
2637
path: node_modules
27-
key: ${{ runner.os }}-node-v18-${{ hashFiles('**/generate.sh') }}
38+
key: ${{ runner.os }}-node-v22-${{ hashFiles('**/generate.sh') }}
2839
restore-keys: |
29-
${{ runner.os }}-node-v18
40+
${{ runner.os }}-node-v22
3041
3142
- name: Install OpenAPI Generator CLI
3243
run: npm install @openapitools/openapi-generator-cli
@@ -37,32 +48,27 @@ jobs:
3748
- name: Setup NuGet
3849
uses: NuGet/setup-nuget@v1.1.1
3950

40-
- uses: actions/setup-dotnet@v3
51+
- uses: actions/setup-dotnet@v5
4152
with:
4253
dotnet-version: '8.0.x'
4354

44-
- name: Generate SDK Client
45-
run: bash ./generate.sh
46-
47-
- name: Copy README.md into src/
48-
run: cp README.md src/
55+
- name: Download Specification
56+
run: wget "${SPEC_URL}" '--output-document' "${ARTIFACT_NAME}"
4957

5058
- name: Check version number
5159
run: |
52-
vrchat_sdk_version=$(yq '.info.version' openapi.yaml | tr -d '"')
53-
54-
major=$(echo $vrchat_sdk_version | cut -d. -f1)
55-
minor=$(echo $vrchat_sdk_version | cut -d. -f2)
56-
patch=$(echo $vrchat_sdk_version | cut -d. -f3)
57-
58-
vrchat_sdk_version="$((major+1)).$minor.$patch"
60+
vrchat_sdk_version=$(( ${PASSED_VERSION%%.*} + 1)).${PASSED_VERSION#*.}${VERSION_POSTPEND}
61+
echo "Version is: ${vrchat_sdk_version}"
5962
echo "vrchat_sdk_version=$vrchat_sdk_version" >> $GITHUB_ENV
6063
61-
- name: Print version number
62-
run: echo ${{ env.vrchat_sdk_version }}
64+
- name: Generate SDK Client
65+
run: bash ./generate.sh "${ARTIFACT_NAME}" "${vrchat_sdk_version}"
66+
67+
- name: Copy README.md into src/
68+
run: cp README.md src/
6369

64-
- name: Delete openapi.yaml file
65-
run: rm openapi.yaml
70+
- name: Delete openapi.json file
71+
run: unlink ${ARTIFACT_NAME}
6672

6773
- name: Deploy SDK back into main branch
6874
uses: JamesIves/github-pages-deploy-action@v4
@@ -72,7 +78,7 @@ jobs:
7278
commit-message: "Upgrade .NET SDK to spec ${{ env.vrchat_sdk_version }}"
7379

7480
- name: Publish to VRChat.API to NuGet
75-
if: github.event_name != 'workflow_dispatch'
81+
if: github.event_name == 'repository_dispatch'
7682
uses: pairbit/publish-nuget@v2.5.8
7783
with:
7884
# Filepath of the project to be packaged, relative to root of repository
@@ -87,7 +93,7 @@ jobs:
8793
INCLUDE_SYMBOLS: true
8894

8995
- name: Publish to VRChat.API.Extensions.Hosting to NuGet
90-
if: github.event_name != 'workflow_dispatch'
96+
if: github.event_name == 'repository_dispatch'
9197
uses: pairbit/publish-nuget@v2.5.8
9298
with:
9399
# Filepath of the project to be packaged, relative to root of repository

.github/workflows/realtime-ci.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Build and Publish VRChat Realtime SDK
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'wrapper/VRChat.API.Realtime/**'
9+
- '.github/workflows/realtime-ci.yml'
10+
workflow_dispatch:
11+
12+
jobs:
13+
build-and-publish:
14+
runs-on: ubuntu-latest
15+
name: Build and Publish VRChat Realtime SDK
16+
steps:
17+
- name: Checkout current commit
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0 # Fetch all history to compare versions
21+
22+
- name: Setup .NET
23+
uses: actions/setup-dotnet@v5
24+
with:
25+
dotnet-version: '8.0.x'
26+
27+
- name: Setup NuGet
28+
uses: NuGet/setup-nuget@v1.1.1
29+
30+
- name: Get current version from csproj
31+
id: current_version
32+
run: |
33+
VERSION=$(grep -oP '(?<=<Version>)[^<]+' wrapper/VRChat.API.Realtime/VRChat.API.Realtime.csproj)
34+
echo "version=$VERSION" >> $GITHUB_OUTPUT
35+
echo "Current version: $VERSION"
36+
37+
- name: Get previous version from NuGet
38+
id: nuget_version
39+
run: |
40+
# Try to get the latest version from NuGet
41+
NUGET_VERSION=$(curl -s "https://api.nuget.org/v3-flatcontainer/vrchat.api.realtime/index.json" | jq -r '.versions[-1]' 2>/dev/null || echo "0.0.0")
42+
if [ "$NUGET_VERSION" = "null" ] || [ -z "$NUGET_VERSION" ]; then
43+
NUGET_VERSION="0.0.0"
44+
fi
45+
echo "version=$NUGET_VERSION" >> $GITHUB_OUTPUT
46+
echo "Latest NuGet version: $NUGET_VERSION"
47+
48+
- name: Check if version changed
49+
id: version_check
50+
run: |
51+
CURRENT="${{ steps.current_version.outputs.version }}"
52+
NUGET="${{ steps.nuget_version.outputs.version }}"
53+
54+
echo "Current version: $CURRENT"
55+
echo "NuGet version: $NUGET"
56+
57+
if [ "$CURRENT" != "$NUGET" ]; then
58+
echo "Version changed from $NUGET to $CURRENT"
59+
echo "changed=true" >> $GITHUB_OUTPUT
60+
else
61+
echo "Version unchanged ($CURRENT)"
62+
echo "changed=false" >> $GITHUB_OUTPUT
63+
fi
64+
65+
- name: Build project
66+
run: dotnet build wrapper/VRChat.API.Realtime/VRChat.API.Realtime.csproj --configuration Release
67+
68+
- name: Publish to NuGet
69+
if: steps.version_check.outputs.changed == 'true'
70+
uses: pairbit/publish-nuget@v2.5.8
71+
with:
72+
PROJECT_FILE_PATH: wrapper/VRChat.API.Realtime/VRChat.API.Realtime.csproj
73+
PACKAGE_NAME: VRChat.API.Realtime
74+
NUGET_KEY: ${{ secrets.NUGET_KEY }}
75+
INCLUDE_SYMBOLS: true

.openapi-generator/FILES

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,12 @@ docs/AvatarsApi.md
4545
docs/Badge.md
4646
docs/Balance.md
4747
docs/BanGroupMemberRequest.md
48+
docs/BoopRequest.md
4849
docs/CalendarApi.md
4950
docs/CalendarEvent.md
51+
docs/CalendarEventDiscovery.md
52+
docs/CalendarEventDiscoveryInclusion.md
53+
docs/CalendarEventDiscoveryScope.md
5054
docs/CalendarEventUserInterest.md
5155
docs/ChangeUserTagsRequest.md
5256
docs/CreateAvatarModerationRequest.md
@@ -61,7 +65,6 @@ docs/CreateGroupPostRequest.md
6165
docs/CreateGroupRequest.md
6266
docs/CreateGroupRoleRequest.md
6367
docs/CreateInstanceRequest.md
64-
docs/CreatePermissionRequest.md
6568
docs/CreateWorldRequest.md
6669
docs/CurrentUser.md
6770
docs/CurrentUserPlatformHistoryInner.md
@@ -72,6 +75,7 @@ docs/DiscordDetails.md
7275
docs/DynamicContentRow.md
7376
docs/EconomyAccount.md
7477
docs/EconomyApi.md
78+
docs/EquipInventoryItemRequest.md
7579
docs/Error.md
7680
docs/Favorite.md
7781
docs/FavoriteGroup.md
@@ -137,6 +141,7 @@ docs/InstanceType.md
137141
docs/InstancesApi.md
138142
docs/Inventory.md
139143
docs/InventoryApi.md
144+
docs/InventoryConsumptionResults.md
140145
docs/InventoryDefaultAttributesValue.md
141146
docs/InventoryDefaultAttributesValueValidator.md
142147
docs/InventoryDrop.md
@@ -171,6 +176,8 @@ docs/LimitedWorld.md
171176
docs/MIMEType.md
172177
docs/MiscellaneousApi.md
173178
docs/ModerateUserRequest.md
179+
docs/MutualFriend.md
180+
docs/Mutuals.md
174181
docs/Notification.md
175182
docs/NotificationDetailInvite.md
176183
docs/NotificationDetailInviteResponse.md
@@ -182,6 +189,7 @@ docs/NotificationsApi.md
182189
docs/OkStatus.md
183190
docs/OkStatus2.md
184191
docs/OrderOption.md
192+
docs/OrderOptionShort.md
185193
docs/PaginatedCalendarEventList.md
186194
docs/PaginatedGroupAuditLogEntryList.md
187195
docs/PastDisplayName.md
@@ -200,10 +208,13 @@ docs/Product.md
200208
docs/ProductListing.md
201209
docs/ProductListingType.md
202210
docs/ProductListingVariant.md
211+
docs/ProductPurchase.md
212+
docs/ProductPurchasePurchaseContext.md
203213
docs/ProductType.md
204214
docs/Prop.md
205215
docs/PropUnityPackage.md
206216
docs/PropsApi.md
217+
docs/PurchaseProductListingRequest.md
207218
docs/Region.md
208219
docs/RegisterUserAccountRequest.md
209220
docs/ReleaseStatus.md
@@ -218,6 +229,7 @@ docs/ServiceQueueStats.md
218229
docs/ServiceStatus.md
219230
docs/ShareInventoryItemDirectRequest.md
220231
docs/SortOption.md
232+
docs/SortOptionProductPurchase.md
221233
docs/Store.md
222234
docs/StoreShelf.md
223235
docs/StoreType.md
@@ -250,7 +262,6 @@ docs/UpdateGroupRequest.md
250262
docs/UpdateGroupRoleRequest.md
251263
docs/UpdateInventoryItemRequest.md
252264
docs/UpdateInviteMessageRequest.md
253-
docs/UpdatePermissionRequest.md
254265
docs/UpdateTiliaTOSRequest.md
255266
docs/UpdateUserBadgeRequest.md
256267
docs/UpdateUserNoteRequest.md
@@ -353,7 +364,11 @@ src/VRChat.API/Model/AvatarUnityPackageUrlObject.cs
353364
src/VRChat.API/Model/Badge.cs
354365
src/VRChat.API/Model/Balance.cs
355366
src/VRChat.API/Model/BanGroupMemberRequest.cs
367+
src/VRChat.API/Model/BoopRequest.cs
356368
src/VRChat.API/Model/CalendarEvent.cs
369+
src/VRChat.API/Model/CalendarEventDiscovery.cs
370+
src/VRChat.API/Model/CalendarEventDiscoveryInclusion.cs
371+
src/VRChat.API/Model/CalendarEventDiscoveryScope.cs
357372
src/VRChat.API/Model/CalendarEventUserInterest.cs
358373
src/VRChat.API/Model/ChangeUserTagsRequest.cs
359374
src/VRChat.API/Model/CreateAvatarModerationRequest.cs
@@ -368,7 +383,6 @@ src/VRChat.API/Model/CreateGroupPostRequest.cs
368383
src/VRChat.API/Model/CreateGroupRequest.cs
369384
src/VRChat.API/Model/CreateGroupRoleRequest.cs
370385
src/VRChat.API/Model/CreateInstanceRequest.cs
371-
src/VRChat.API/Model/CreatePermissionRequest.cs
372386
src/VRChat.API/Model/CreateWorldRequest.cs
373387
src/VRChat.API/Model/CurrentUser.cs
374388
src/VRChat.API/Model/CurrentUserPlatformHistoryInner.cs
@@ -378,6 +392,7 @@ src/VRChat.API/Model/Disable2FAResult.cs
378392
src/VRChat.API/Model/DiscordDetails.cs
379393
src/VRChat.API/Model/DynamicContentRow.cs
380394
src/VRChat.API/Model/EconomyAccount.cs
395+
src/VRChat.API/Model/EquipInventoryItemRequest.cs
381396
src/VRChat.API/Model/Error.cs
382397
src/VRChat.API/Model/Favorite.cs
383398
src/VRChat.API/Model/FavoriteGroup.cs
@@ -437,6 +452,7 @@ src/VRChat.API/Model/InstanceRegion.cs
437452
src/VRChat.API/Model/InstanceShortNameResponse.cs
438453
src/VRChat.API/Model/InstanceType.cs
439454
src/VRChat.API/Model/Inventory.cs
455+
src/VRChat.API/Model/InventoryConsumptionResults.cs
440456
src/VRChat.API/Model/InventoryDefaultAttributesValue.cs
441457
src/VRChat.API/Model/InventoryDefaultAttributesValueValidator.cs
442458
src/VRChat.API/Model/InventoryDrop.cs
@@ -468,6 +484,8 @@ src/VRChat.API/Model/LimitedUserSearch.cs
468484
src/VRChat.API/Model/LimitedWorld.cs
469485
src/VRChat.API/Model/MIMEType.cs
470486
src/VRChat.API/Model/ModerateUserRequest.cs
487+
src/VRChat.API/Model/MutualFriend.cs
488+
src/VRChat.API/Model/Mutuals.cs
471489
src/VRChat.API/Model/Notification.cs
472490
src/VRChat.API/Model/NotificationDetailInvite.cs
473491
src/VRChat.API/Model/NotificationDetailInviteResponse.cs
@@ -478,6 +496,7 @@ src/VRChat.API/Model/NotificationType.cs
478496
src/VRChat.API/Model/OkStatus.cs
479497
src/VRChat.API/Model/OkStatus2.cs
480498
src/VRChat.API/Model/OrderOption.cs
499+
src/VRChat.API/Model/OrderOptionShort.cs
481500
src/VRChat.API/Model/PaginatedCalendarEventList.cs
482501
src/VRChat.API/Model/PaginatedGroupAuditLogEntryList.cs
483502
src/VRChat.API/Model/PastDisplayName.cs
@@ -494,9 +513,12 @@ src/VRChat.API/Model/Product.cs
494513
src/VRChat.API/Model/ProductListing.cs
495514
src/VRChat.API/Model/ProductListingType.cs
496515
src/VRChat.API/Model/ProductListingVariant.cs
516+
src/VRChat.API/Model/ProductPurchase.cs
517+
src/VRChat.API/Model/ProductPurchasePurchaseContext.cs
497518
src/VRChat.API/Model/ProductType.cs
498519
src/VRChat.API/Model/Prop.cs
499520
src/VRChat.API/Model/PropUnityPackage.cs
521+
src/VRChat.API/Model/PurchaseProductListingRequest.cs
500522
src/VRChat.API/Model/Region.cs
501523
src/VRChat.API/Model/RegisterUserAccountRequest.cs
502524
src/VRChat.API/Model/ReleaseStatus.cs
@@ -511,6 +533,7 @@ src/VRChat.API/Model/ServiceQueueStats.cs
511533
src/VRChat.API/Model/ServiceStatus.cs
512534
src/VRChat.API/Model/ShareInventoryItemDirectRequest.cs
513535
src/VRChat.API/Model/SortOption.cs
536+
src/VRChat.API/Model/SortOptionProductPurchase.cs
514537
src/VRChat.API/Model/Store.cs
515538
src/VRChat.API/Model/StoreShelf.cs
516539
src/VRChat.API/Model/StoreType.cs
@@ -543,7 +566,6 @@ src/VRChat.API/Model/UpdateGroupRequest.cs
543566
src/VRChat.API/Model/UpdateGroupRoleRequest.cs
544567
src/VRChat.API/Model/UpdateInventoryItemRequest.cs
545568
src/VRChat.API/Model/UpdateInviteMessageRequest.cs
546-
src/VRChat.API/Model/UpdatePermissionRequest.cs
547569
src/VRChat.API/Model/UpdateTiliaTOSRequest.cs
548570
src/VRChat.API/Model/UpdateUserBadgeRequest.cs
549571
src/VRChat.API/Model/UpdateUserNoteRequest.cs

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,16 @@ public class MyController : Controller
133133

134134
Console app (login): see [VRChat.API.Examples.Console](examples/VRChat.API.Examples.Console/)
135135

136+
Console app (WebSocket): see [VRChat.API.Examples.WebSocket](examples/VRChat.API.Examples.WebSocket/)
137+
136138
ASP.NET Core (depedency injection): see [VRChat.API.Examples.AspNetCore](examples/VRChat.API.Examples.AspNetCore/)
137139

140+
# WebSockets / VRChat Pipeline
141+
142+
You can use the `VRChat.API.Realtime` library to connect to VRChat's WebSocket and listen to events.
143+
144+
The documentation for it is available at [WEBSOCKET.md](WEBSOCKET.md).
145+
138146
# Manually authenticating
139147

140148
Sometimes, we don't have two-factor authentication set up on our accounts. While it's **reccomended** for most bots or apps, your app may be a WPF/WinForms application that requires user credential input. In these cases, the `LoginAsync()` methods on `IVRChat` won't work, because they only support token-based two-factor authentication.

0 commit comments

Comments
 (0)