You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This API provides a way to programmatically import data into the p5.js Web Editor.
3
+
Essa API provê uma forma de importar informações para o p5.js Web Editor de forma programática.
4
4
5
-
# Authentication
5
+
# Authenticação
6
6
7
-
Access to the API is available via a Personal Access Token, linked to an existing editor user account. Tokens can be created and deleted via logged-in user’s Settings page.
7
+
Acesso à API está disponível via um Token de Acesso Pessoal, relacionado à uma conta de editor existente. Tokens podem ser criados e deletados na tela de Configurações de um usuário loggado.
8
8
9
-
When contacting the API, the username and token must be sent with every request using basic auth.
9
+
Quando entrar em contato com a API, o nome de usuário e token devem ser enviados em todas requisições usando autenticação básica.
10
10
11
-
This involved sending the base64 encoded`${username}:${personalAccessToken}`in the`Authorization` header. For example:
11
+
Isso envolve enviar o base64 codificado`${username}:${personalAccessToken}`no header`Authorization`, Por exemplo:
12
12
`Authorization: Basic cDU6YWJjMTIzYWJj`
13
13
14
-
# API Access
14
+
# Acesso à API
15
15
16
-
-All requests send and receive`Content-Type: application/json`unless otherwise stated
16
+
-Toda requisição envia e recebe`Content-Type: application/json`a não ser que seja declarado o contrário
17
17
18
-
# Versioning
18
+
# Versionamento
19
19
20
-
The API is versioned and this version is indicated in the root URL path e.g. version 1 of the API can be found at`http://editor.p5js.org/api/v1`.
20
+
A API é versionada e essa versão está indicada no caminho raíz da URL e.g. a versão 1 da API pode ser encontrada em`http://editor.p5js.org/api/v1`.
21
21
22
-
You must provide the version number when accessing the API.
22
+
Você deve fornecer o número da versão quando acessar a API.
23
23
24
-
|Version|Release date|
25
-
| -------| ------------ |
26
-
| v1 | Unreleased|
24
+
|Versão|Data de lançamento|
25
+
| ------ |------------------ |
26
+
| v1 | Não lançado |
27
27
28
28
# Models
29
29
30
-
The API accepts and returns the following model objects, as JSON.
30
+
A API aceita e retorna as seguintes Models como JSON.
| files | DirectoryContents |Os arquivos e diretórios no esboço. Veja`DirectoryContents`para a estrutura. |
38
+
| slug | String |Um caminho que pode ser usado para acessar o esboço|
39
39
40
40
41
41
{
@@ -45,16 +45,15 @@ The API accepts and returns the following model objects, as JSON.
45
45
"slug": String // optional
46
46
}
47
47
48
-
### Validations
48
+
### Validações
49
49
50
-
-`files`must have exactly one top-level file with the `.html` extension. If none is provided, then a default `index.html`and associated `style.css`will be automatically created.
51
-
-`slug`must be an URL-safe string
52
-
-`slug`must be unique across all user's sketches
50
+
-`files`devem ter exatamente exatamente um arquivo no nível mais alto com a extenção `.html`. Se nenhum for fornecido um `index.html`padrão e um `style.css`associado serão automaticamente criados.
51
+
-`slug`deve ser uma string segura pra URL
52
+
-`slug`deve ser única entre todos os esboços do usuário
53
53
54
54
## DirectoryContents
55
55
56
-
A map of filenames to `File` or `Directory`. The key of each item is used as the filename. Using a map ensures that filenames are unique in the directory.
57
-
56
+
Um map de nomes de arquivo para `File` ou `Directory`. A chave para cada item é usada como nome do arquivo. Usar um map assegura que nomes de arquivo sejam únicos no diretório.
58
57
59
58
{
60
59
[String]: File | Directory
@@ -68,62 +67,62 @@ A map of filenames to `File` or `Directory`. The key of each item is used as the
68
67
69
68
## DirectFile
70
69
71
-
This file is editable in the Editor UI and stored in the Editor's database.
70
+
Isso é editável na interfáce do editor e guardada no bando de dados do Editor.
| files | DirectoryContents |Um map dos conteúdos ddo diretório|
103
102
104
103
{
105
104
"files": DirectoryContents
106
105
}
107
106
108
-
# API endpoints
107
+
# Endpoints da API
109
108
110
109
## Sketches
111
110
112
111
## `GET /:user/sketches`
113
112
114
-
List a user’s sketches.
113
+
Liste os esboços de um usuário.
115
114
116
-
This will not return the files within the sketch, just the sketch metadata.
115
+
Isso não irá retornar os arquivos dentro de um esboço, apenas a metadata do esboço.
117
116
118
-
### Request format
119
-
No body.
117
+
### Formato da requisição
118
+
Sem corpo.
120
119
121
-
### Response format
120
+
### Formato da resposta
122
121
{
123
122
"sketches": Array<Sketch>
124
123
}
125
124
126
-
### Example
125
+
### Exemplo
127
126
128
127
GET /p5/sketches
129
128
@@ -137,19 +136,19 @@ No body.
137
136
138
137
## `POST /:user/sketches`
139
138
140
-
Create a new sketch.
139
+
Criar um novo esboço.
141
140
142
-
A sketch must contain at least one file with the `.html` extension. If none if provided in the payload, a default `index.html`and linked `style.css`file will be created automatically.
141
+
Um esboço deve conter pelo menos um arquivo com a extenção `.html`. Se nenhum for fornecido no payload, um `index.html`padrão e um arquivo `style.css`associado serão criados automaticamente.
143
142
144
-
### Request format
145
-
See`Sketch`in Models above.
143
+
### Formato da requisição
144
+
Veja`Sketch`nas Models abaixo.
146
145
147
-
### Response format
146
+
### Formato da resposta
148
147
{
149
148
"id": String
150
149
}
151
150
152
-
### Example
151
+
### Exemplo
153
152
154
153
POST /p5/sketches
155
154
@@ -161,7 +160,7 @@ See `Sketch` in Models above.
161
160
}
162
161
}
163
162
164
-
`files`can be nested to represent a folder structure. For example, this will create an empty “data” directory in the sketch:
163
+
`files`podem possuir uma hierarquia para representar uma estrutura de pastas. Por exemplo, isso irá criar um diretório "data" vazio no esboço:
165
164
166
165
167
166
POST /p5/sketches
@@ -181,15 +180,15 @@ See `Sketch` in Models above.
0 commit comments