Skip to content

Conversation

@boatbomber
Copy link
Member

@boatbomber boatbomber commented Jan 5, 2023

This is waiting until rojo-rbx/rojo#639 is released, but reviews for grammar and clarity are welcome!

You can read the rendered version here:
https://github.com/boatbomber/rojo.space/blob/headless-api-docs/docs/headless-api.md

Copy link

@Ho1yShif Ho1yShif left a comment

Choose a reason for hiding this comment

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

Great job on this! Can't wait to see what developers do with it

@boatbomber boatbomber marked this pull request as ready for review February 14, 2024 02:33

## Accessing the API

Plugins and command bar all share the same module cache, which allows us to expose the API through a ModuleScript located at `game.Rojo`. Using the name `"Rojo"` is easy to remember and follows branding. Once you've required Rojo, the API will be located at `Rojo.API`. For example:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Plugins and command bar all share the same module cache, which allows us to expose the API through a ModuleScript located at `game.Rojo`. Using the name `"Rojo"` is easy to remember and follows branding. Once you've required Rojo, the API will be located at `Rojo.API`. For example:
Plugins and command bar all share the same module cache, which allows us to expose the API through a ModuleScript located at `game.Rojo`. Using the name `"Rojo"` is easy to remember and is recommended. Once you've required Rojo, the API will be located at `Rojo.API`. For example:

Feels weird to mention branding in docs.

Copy link
Member

Choose a reason for hiding this comment

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

This phrasing still reads a little oddly imo - maybe we should simply say "We chose the name Rojo because it is easy to remember," or alternatively, strike this sentence entirely? I don't think it's particularly necessary for the sentiment we're trying to get across here

})
```

![requestPrompt](https://github.com/boatbomber/rojo.space/assets/40185666/ef9d0bcd-e39a-46ee-aec6-656c85699d5e)
Copy link
Member

Choose a reason for hiding this comment

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

This asset is not located in the PR! We should try to keep things local to avoid link rot.

```Lua
Rojo.API:ConnectAsync(host: string?, port: string?): void
```
Attempts to connect Rojo to the given host and port. Same behavior as the user clicking the Connect button (sync locking, etc., all behave the same).
Copy link
Member

Choose a reason for hiding this comment

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

Given how messy the meaning of Async is in Roblox, it might be worth mentioning that this (and any other async API) yield and what they yield on. It's a small QoL thing for implementors to know.

```Lua
Rojo.API:GetSetting(setting: string): any
```
Returns the value of the given setting.
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to list the settings here?

```
Sends a Rojo notification that indicates it comes from a third-party plugin. Returns a function that dismisses the notification.

![image](https://github.com/boatbomber/rojo.space/assets/40185666/c3f31715-dcdd-4c9d-b947-8dceee606b61)
Copy link
Member

Choose a reason for hiding this comment

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

Same concern with the asset link here.

Returns the user's chosen host and port, even if not actively connected to it.

```Lua
Rojo.API:CreateApiContext(baseUrl: string): ApiContext
Copy link
Member

Choose a reason for hiding this comment

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

How do we want to approach documenting ApiContext? It's an implementation detail right now, but if we expose this it needs to be versioned and documented.

```Lua
Rojo.API:CreateApiContext(baseUrl: string): ApiContext
```
Returns a new ApiContext using the given baseUrl. Useful for complex use cases that directly interface with Rojo endpoints.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Returns a new ApiContext using the given baseUrl. Useful for complex use cases that directly interface with Rojo endpoints.
Returns a new `ApiContext` using the given baseUrl. Useful for complex use cases that directly interface with Rojo endpoints.

```Lua
Rojo.API.Version: {number}
```
The Rojo plugin version. (Example: `{7, 2, 1}`)
Copy link
Member

Choose a reason for hiding this comment

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

Wow, we've been sitting on this PR for too long! Sorry, haha.

```Lua
Rojo.API.ProtocolVersion: number
```
The Rojo plugin's protocol version.
Copy link
Member

Choose a reason for hiding this comment

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

This is, as far as I know, the only mention of protocol version in the docs. Do we want to elaborate on it a bit?

```Lua
Rojo.API.Connected: boolean
```
Whether Rojo is currently connected to a serve session.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Whether Rojo is currently connected to a serve session.
Whether Rojo is currently connected to a server.

Let's try to avoid things that invite questions like "serve session".

It's obvious to you and me what that means, but it seems like the sort of thing we'll get questions about.

Copy link
Member

Choose a reason for hiding this comment

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

I think it'd be good to err on the side of specificity:

"Whether the Roblox Studio plugin is currently connected to a Rojo server"

Perhaps a little extreme, but the point stands, lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants