Skip to content

Commit

Permalink
Merge branch 'ajskateboarder/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
towerofnix committed Dec 15, 2023
2 parents c82ed7d + 7404c9e commit 8f1fef1
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
1 change: 1 addition & 0 deletions api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Unofficial documentation for the Scratch API. See [root index](..) for more info
* [`/proxy` API](proxy.md) - Miscellaneous utilities
* [`/users` API](users.md) - Fetch user information
* [`projects.` and `assets.` APIs](project_data.md) - Fetch code and assets used in projects
* [`synthesis-service.` and `translation-service.` APIs](synth_trans.md) - Fetch translations and syntheses used by block extensions

### Object definitions

Expand Down
8 changes: 6 additions & 2 deletions api/project_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

These retrieve all of the data and files needed for a scratch project/file.

### `GET cdn.projects.scratch.mit.edu/<project id>/`
## `https://cdn.projects.scratch.mit.edu/`

### `GET /<project id>/`

Retrieves the projects JSON data, which is where all of the code for a scratch project is stored.

### `GET cdn.assets.scratch.mit.edu/internalapi/asset/<md5 file>/get/`
## `https://cdn.assets.scratch.mit.edu/`

### `GET /internalapi/asset/<md5 file>/get/`

Retrieves the asset with the given file name. An asset is a costume, sound or other file used in a project. Each asset in each project has a unique md5 id, which is used for referencing and retrieving it.

Expand Down
25 changes: 25 additions & 0 deletions api/synth_trans.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# `synthesis-service.` and `translate-service.` APIs

These retrieve the speech synthesis and translation results for their respective extensions.

## `https://translate-service.scratch.mit.edu/`

### `GET /translate?language=<locale>&text=<text>`

Retrieves the translation of the input text in the given language. `locale` is generally a two-letter language code. Refer to [this gist](https://gist.github.com/towerofnix/d4369e64604c5a0d7dca94954a83ab35) for a list of supported languages, or check the exports from [`scratch-translate-extension-languages`](https://www.npmjs.com/package/scratch-translate-extension-languages).

Uses Google Translate [as of Dec. 9, 2019](https://scratch.mit.edu/discuss/post/3778811).

### `GET https://translate-service.scratch.mit.edu/supported`

Retrieves a list of supported language codes for translating text.

Legacy endpoint - still online, but [no longer used](https://github.com/scratchfoundation/scratch-vm/pull/1159).

## `https://synthesis-service.scratch.mit.edu/`

### `GET /synth?locale=<speech locale>&gender=<gender>&text=<text>`

Retrieves the synthesis of the input text as an audio file. `gender` is either "male" or "female"; `speech locale` is a "speech synth locale" as described in [the extension's source code](https://github.com/scratchfoundation/scratch-vm/blob/489111f4d74909c2adac40ade1618f966ba30c34/src/extensions/scratch3_text2speech/index.js#L194-L341).

Likely uses [Amazon Polly](https://aws.amazon.com/polly/).

0 comments on commit 8f1fef1

Please sign in to comment.