Skip to content

Conversation

@commonly-ts
Copy link
Contributor

@commonly-ts commonly-ts commented Oct 24, 2025

Description

Includes all current UserRestriction endpoints according to the cloud API reference.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • ✅ Test update
  • 📦 Dependency update

Changes Made

  • Added listUserRestrictions to users resource
  • Added listUserRestrictionLogs to users resource
  • Added updateUserRestriction to users resource
  • Added getUserRestriction to users resource
  • Added relevant typings for the above methods
  • Added tests for all the above methods
  • Installed the uuid package for generating the idempotency key

Testing

  • All existing tests pass (pnpm test)
  • Added new tests for new functionality
  • Tested manually (describe below)

Manual Testing

With the below code, it calls the Roblox API and confirms data has been returned. It also logged the results for manual review of the response.

image

Invalid universeId and missing credentials (missing/invalid scopes) return OpenCloudError: Unauthorized: invalid or missing Open Cloud credentials.

describe("Users: UserRestriction Integration", () => {
  const client = new OpenCloud({
    apiKey: "actual-api-key",
    baseUrl
  });

  it("should listUserRestrictions", async () => {
    const result = await client.users.listUserRestrictions("4434277335");
    console.log(result);
    expect(result.userRestrictions).toBeDefined();
  });

  it("should getUserRestriction", async () => {
    const result = await client.users.getUserRestriction("4434277335", "1210019099");
    console.log(result);
    expect(result).toBeDefined();
  });

  it("should updateUserRestriction", async () => {
    const result = await client.users.updateUserRestriction("4434277335", "1210019099", {
      active: true,
      displayReason: "Test ban",
      privateReason: "integration test",
      duration: "3s",
      excludeAltAccounts: false,
    });
    console.log(result);
    expect(result).toBeDefined();
  });

  it("should listUserRestrictionLogs", async () => {
    const result = await client.users.listUserRestrictionLogs("4434277335");
    console.log(result);
    expect(result.logs).toBeDefined();
  });
});

Code Quality

  • My code follows the project's coding style
  • I have run pnpm lint and fixed any issues
  • I have run pnpm format to format my code
  • I have run pnpm typecheck and there are no type errors
  • I have reviewed my own code

Documentation

  • I have updated the relevant documentation (if applicable)
  • I have added/updated JSDoc comments for new/modified code

Screenshots/Recordings

Additional Context

For some reason Roblox decided to call the user Ids "user_restriction_id," so in this "user_restriction_id" just means a Roblox user Id.

updateUserRestriction does support FieldMasks through its updateMask query parameter, but only game_join_restriction can be passed due to it only being able to be updated atomically.

Checklist

  • I have read the CONTRIBUTING.md guide
  • My PR title follows the Conventional Commits format
  • I have rebased my branch on the latest main branch
  • I have tested my changes against the Roblox Open Cloud API (if applicable)
  • This PR is ready for review

Copy link
Member

@marinofranz marinofranz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Along with the uninstallation of the dependency, we might need to look into merging this into #2 as UserRestriction falls under the universes resource (/cloud/v2/universes/)

Copy link
Member

@marinofranz marinofranz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove package-lock.json as this codebase uses pnpm

@marinofranz marinofranz added the enhancement New feature or request label Oct 25, 2025
@codecov
Copy link

codecov bot commented Oct 25, 2025

Codecov Report

❌ Patch coverage is 96.15385% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/resources/users.ts 96.15% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@commonly-ts
Copy link
Contributor Author

Along with the uninstallation of the dependency, we might need to look into merging this into #2 as UserRestriction falls under the universes resource (/cloud/v2/universes/)

Roblox's Cloud API reference does list it under Users and Groups, which is why I put it under users.ts 🤷
image

@marinofranz
Copy link
Member

Along with the uninstallation of the dependency, we might need to look into merging this into #2 as UserRestriction falls under the universes resource (/cloud/v2/universes/)

Roblox's Cloud API reference does list it under Users and Groups, which is why I put it under users.ts 🤷 image

Yeah, we thought the same but we eventually decided to group resources by URL. We've found a few inaccuracies with the Roblox Open Cloud API documentation such as this, but your changes will still come to use, we just need to move them over to the feature branch for universes.

Let's keep this PR open and I'll squash-merge your changes into the branch for #2 and move the implementation
I'll let you know of any progress 🙂

@commonly-ts
Copy link
Contributor Author

Along with the uninstallation of the dependency, we might need to look into merging this into #2 as UserRestriction falls under the universes resource (/cloud/v2/universes/)

Roblox's Cloud API reference does list it under Users and Groups, which is why I put it under users.ts 🤷 image

Yeah, we thought the same but we eventually decided to group resources by URL. We've found a few inaccuracies with the Roblox Open Cloud API documentation such as this, but your changes will still come to use, we just need to move them over to the feature branch for universes.

Let's keep this PR open and I'll squash-merge your changes into the branch for #2 and move the implementation
I'll let you know of any progress 🙂

Just asking, is there a specific way you want me to publish PRs if they're a new resource and/or one like the universe endpoints branch?

@marinofranz
Copy link
Member

Along with the uninstallation of the dependency, we might need to look into merging this into #2 as UserRestriction falls under the universes resource (/cloud/v2/universes/)

Roblox's Cloud API reference does list it under Users and Groups, which is why I put it under users.ts 🤷 image

Yeah, we thought the same but we eventually decided to group resources by URL. We've found a few inaccuracies with the Roblox Open Cloud API documentation such as this, but your changes will still come to use, we just need to move them over to the feature branch for universes.
Let's keep this PR open and I'll squash-merge your changes into the branch for #2 and move the implementation
I'll let you know of any progress 🙂

Just asking, is there a specific way you want me to publish PRs if they're a new resource and/or one like the universe endpoints branch?

Usually you should just send in a PR and it'll get merged into main but in this case, a PR for the creation of this resource had already been created, so it complicated things a little, but we'll sort it out 😄

marinofranz added a commit that referenced this pull request Oct 28, 2025
- getUserRestriction
- updateUserRestriction
- updateUserRestriction
- listUserRestrictionLogs
- types moved to src/types/universes.ts

Co-authored-by: Commonly <camblees50@gmail.com>
@marinofranz
Copy link
Member

Hey @commonly-ts - got an update for you

I've integrated your changes in this PR to our ongoing Universes API implementation in #2
The core logic and typings you added are now part of PR #2 (with you credited as a co-author in the commit). We just moved the functions to the appropriate files to keep things consistent with the resource layout of the SDK

Thanks again for your contribution 🎉
Once #2 is merged, this PR will effectively be covered, so we'll close it at that point 🙂

@marinofranz marinofranz mentioned this pull request Oct 28, 2025
15 tasks
@commonly-ts
Copy link
Contributor Author

Hey @commonly-ts - got an update for you

I've integrated your changes in this PR to our ongoing Universes API implementation in #2 The core logic and typings you added are now part of PR #2 (with you credited as a co-author in the commit). We just moved the functions to the appropriate files to keep things consistent with the resource layout of the SDK

Thanks again for your contribution 🎉 Once #2 is merged, this PR will effectively be covered, so we'll close it at that point 🙂

Cheers. Just one thing, could you remove my email from the commit message, or replace it with my GitHub no-reply email instead? Thanks!

marinofranz added a commit that referenced this pull request Oct 31, 2025
- getUserRestriction
- updateUserRestriction
- updateUserRestriction
- listUserRestrictionLogs
- types moved to src/types/universes.ts

Co-authored-by: Commonly <51011212+commonly-ts@users.noreply.github.com>
@marinofranz
Copy link
Member

Cheers. Just one thing, could you remove my email from the commit message, or replace it with my GitHub no-reply email instead? Thanks!

Not a problem, I've amended the commit and changed the email from the co-author line 😄

marinofranz added a commit that referenced this pull request Oct 31, 2025
- getUserRestriction
- updateUserRestriction
- updateUserRestriction
- listUserRestrictionLogs
- types moved to src/types/universes.ts

Co-authored-by: Commonly <51011212+commonly-ts@users.noreply.github.com>
marinofranz added a commit that referenced this pull request Nov 13, 2025
- getUserRestriction
- updateUserRestriction
- updateUserRestriction
- listUserRestrictionLogs
- types moved to src/types/universes.ts

Co-authored-by: Commonly <51011212+commonly-ts@users.noreply.github.com>
marinofranz added a commit that referenced this pull request Nov 13, 2025
- getUserRestriction
- updateUserRestriction
- updateUserRestriction
- listUserRestrictionLogs
- types moved to src/types/universes.ts

Co-authored-by: Commonly <51011212+commonly-ts@users.noreply.github.com>
github-actions bot pushed a commit that referenced this pull request Nov 13, 2025
# [1.10.0](v1.9.0...v1.10.0) (2025-11-13)

### Bug Fixes

* **universes:** replace append with set for URLSearchParams ([0235d34](0235d34))
* **universes:** update translation to use LanguageCode and adjust test cases ([b04246d](b04246d))
* **universes:** update translations to use Partial<Record> and correct language codes ([009a25b](009a25b))

### Features

* add Universes API client ([4ba5fd2](4ba5fd2))
* implement idempotency key generation ([46456c4](46456c4))
* **universes:** add restart universe servers endpoint ([ceeb0e1](ceeb0e1))
* **universes:** add speech asset generation, publishing, and translation methods ([bf5d646](bf5d646))
* **universes:** export Universes resource from index ([d944f85](d944f85))
* **universes:** port UserRestriction endpoints from [#3](#3) ([6a583b5](6a583b5))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants