curl --request POST \
--url https://api.weve.cx/v1/clubs/{clubId}/courses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"slug": "<string>",
"description": "<string>",
"show_modules": true
}
'import requests
url = "https://api.weve.cx/v1/clubs/{clubId}/courses"
payload = {
"title": "<string>",
"slug": "<string>",
"description": "<string>",
"show_modules": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
slug: '<string>',
description: '<string>',
show_modules: true
})
};
fetch('https://api.weve.cx/v1/clubs/{clubId}/courses', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.weve.cx/v1/clubs/{clubId}/courses",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'title' => '<string>',
'slug' => '<string>',
'description' => '<string>',
'show_modules' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.weve.cx/v1/clubs/{clubId}/courses"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"show_modules\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.weve.cx/v1/clubs/{clubId}/courses")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"show_modules\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.weve.cx/v1/clubs/{clubId}/courses")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"show_modules\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"slug": "<string>",
"public_id": "<string>",
"visibility": "members",
"show_modules": true,
"release": {
"kind": "all",
"children": "<array>",
"days": 1825,
"at": "2023-11-07T05:31:56Z",
"lesson_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"module_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"count": 2
},
"archived": true,
"created_at": "2023-11-07T05:31:56Z",
"modules": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"course_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"position": 123,
"show_when_empty": true,
"archived": true,
"release": {
"kind": "all",
"children": "<array>",
"days": 1825,
"at": "2023-11-07T05:31:56Z",
"lesson_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"module_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"count": 2
},
"lessons": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"module_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"public_id": "<string>",
"type": "video",
"position": 123,
"archived": true,
"release": {
"kind": "all",
"children": "<array>",
"days": 1825,
"at": "2023-11-07T05:31:56Z",
"lesson_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"module_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"count": 2
},
"created_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"body": "<unknown>",
"media": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kind": "video",
"title": "<string>",
"provider": "bunny_stream",
"status": "uploading",
"visibility": "private",
"archived": true,
"created_at": "2023-11-07T05:31:56Z",
"file_name": "<string>",
"mime": "<string>",
"size_bytes": 123,
"external_id": "<string>",
"error": "<string>",
"duration_seconds": 123,
"width": 123,
"height": 123,
"preview_url": "<string>",
"thumbnail_url": "<string>",
"folder_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"attachments": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kind": "video",
"title": "<string>",
"provider": "bunny_stream",
"status": "uploading",
"visibility": "private",
"archived": true,
"created_at": "2023-11-07T05:31:56Z",
"file_name": "<string>",
"mime": "<string>",
"size_bytes": 123,
"external_id": "<string>",
"error": "<string>",
"duration_seconds": 123,
"width": 123,
"height": 123,
"preview_url": "<string>",
"thumbnail_url": "<string>",
"folder_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"duration_seconds": 123,
"published_at": "2023-11-07T05:31:56Z"
}
]
}
],
"description": "<string>",
"cover": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kind": "video",
"title": "<string>",
"provider": "bunny_stream",
"status": "uploading",
"visibility": "private",
"archived": true,
"created_at": "2023-11-07T05:31:56Z",
"file_name": "<string>",
"mime": "<string>",
"size_bytes": 123,
"external_id": "<string>",
"error": "<string>",
"duration_seconds": 123,
"width": 123,
"height": 123,
"preview_url": "<string>",
"thumbnail_url": "<string>",
"folder_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"published_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Criar curso
Nasce rascunho, com o primeiro módulo, e como entregável.
curl --request POST \
--url https://api.weve.cx/v1/clubs/{clubId}/courses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"slug": "<string>",
"description": "<string>",
"show_modules": true
}
'import requests
url = "https://api.weve.cx/v1/clubs/{clubId}/courses"
payload = {
"title": "<string>",
"slug": "<string>",
"description": "<string>",
"show_modules": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
slug: '<string>',
description: '<string>',
show_modules: true
})
};
fetch('https://api.weve.cx/v1/clubs/{clubId}/courses', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.weve.cx/v1/clubs/{clubId}/courses",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'title' => '<string>',
'slug' => '<string>',
'description' => '<string>',
'show_modules' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.weve.cx/v1/clubs/{clubId}/courses"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"show_modules\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.weve.cx/v1/clubs/{clubId}/courses")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"show_modules\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.weve.cx/v1/clubs/{clubId}/courses")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"show_modules\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"slug": "<string>",
"public_id": "<string>",
"visibility": "members",
"show_modules": true,
"release": {
"kind": "all",
"children": "<array>",
"days": 1825,
"at": "2023-11-07T05:31:56Z",
"lesson_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"module_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"count": 2
},
"archived": true,
"created_at": "2023-11-07T05:31:56Z",
"modules": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"course_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"position": 123,
"show_when_empty": true,
"archived": true,
"release": {
"kind": "all",
"children": "<array>",
"days": 1825,
"at": "2023-11-07T05:31:56Z",
"lesson_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"module_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"count": 2
},
"lessons": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"module_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"public_id": "<string>",
"type": "video",
"position": 123,
"archived": true,
"release": {
"kind": "all",
"children": "<array>",
"days": 1825,
"at": "2023-11-07T05:31:56Z",
"lesson_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"module_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"count": 2
},
"created_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"body": "<unknown>",
"media": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kind": "video",
"title": "<string>",
"provider": "bunny_stream",
"status": "uploading",
"visibility": "private",
"archived": true,
"created_at": "2023-11-07T05:31:56Z",
"file_name": "<string>",
"mime": "<string>",
"size_bytes": 123,
"external_id": "<string>",
"error": "<string>",
"duration_seconds": 123,
"width": 123,
"height": 123,
"preview_url": "<string>",
"thumbnail_url": "<string>",
"folder_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"attachments": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kind": "video",
"title": "<string>",
"provider": "bunny_stream",
"status": "uploading",
"visibility": "private",
"archived": true,
"created_at": "2023-11-07T05:31:56Z",
"file_name": "<string>",
"mime": "<string>",
"size_bytes": 123,
"external_id": "<string>",
"error": "<string>",
"duration_seconds": 123,
"width": 123,
"height": 123,
"preview_url": "<string>",
"thumbnail_url": "<string>",
"folder_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"duration_seconds": 123,
"published_at": "2023-11-07T05:31:56Z"
}
]
}
],
"description": "<string>",
"cover": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kind": "video",
"title": "<string>",
"provider": "bunny_stream",
"status": "uploading",
"visibility": "private",
"archived": true,
"created_at": "2023-11-07T05:31:56Z",
"file_name": "<string>",
"mime": "<string>",
"size_bytes": 123,
"external_id": "<string>",
"error": "<string>",
"duration_seconds": 123,
"width": 123,
"height": 123,
"preview_url": "<string>",
"thumbnail_url": "<string>",
"folder_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"published_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Authorizations
Token OPACO de sessão de quem administra, emitido por
/v1/auth/admin/sign-in e verificado contra a nossa tabela — o mesmo
desenho do studentSession, para a outra identidade.
É o esquema de quem ADMINISTRA — o dashboard. O aluno do classroom usa o
studentSession; uma rota consumida pelos dois declara os dois
esquemas, e o middleware aceita qualquer um deles. As duas credenciais
são opacas e chegam pelo mesmo cabeçalho: quem as separa é a tabela em
que cada uma existe.
O dashboard o guarda em cookie httpOnly, que o BFF troca pelo
Authorization a cada chamada.
Path Parameters
Id público da organização — o mesmo que GET /v1/me devolve em
organization_id.
Na URL o recurso se chama club; no contrato e no domínio, organization.
A divergência é deliberada: clubs é a palavra do produto, e a URL é o que
as pessoas leem.
É o identificador do provedor de autenticação, e é assim de propósito: o cliente precisa nomear a organização ao pedir o token, e o token é o que prova o escopo. Um id só nosso obrigaria a traduzir um no outro antes de ter um token — e a tradução exigiria uma chamada escopada, que é justamente a que ainda não dá para fazer.
O uuid interno da organização não aparece no contrato: ele é o que as chaves estrangeiras do domínio referenciam, e continua sendo nosso.
Body
1 - 200Derivado do título quando ausente.
1 - 1205000Descoberta, não acesso. members lista para todo aluno do club;
entitled só para quem já tem; unlisted só para quem já tem por
matrícula (entrega aberta não basta) — e quem tem o link vê a
página como vitrine, mesmo sem direito.
members, entitled, unlisted A agenda de liberação, como EXPRESSÃO: quando a aula (ou o módulo) abre para quem já tem direito a ela. Nunca amplia direito — só segura o que a matrícula já deu.
Cada condição responde com uma DATA, não com sim ou não, e é por isso
que elas compõem sem ambiguidade: all é a maior das datas, any é a
menor. Condição que depende de algo que o aluno ainda não fez não tem
data: dentro de all ela segura tudo, dentro de any ela é só um
caminho que ainda não abriu.
As folhas são todas MONÓTONAS — uma vez verdadeiras, verdadeiras para sempre:
immediate: sem condição.days_after_start:daysdias depois de o acesso começar (a matrícula mais antiga que abre o curso, ou o início da turma).on_date: na dataat.after_previous: depois de concluir a aula anterior na ordem do curso. Na primeira aula, libera.after_lesson: depois de concluir a aulalesson_id, do mesmo curso.after_module: depois de concluir todas as aulas demodule_id.after_count: depois de concluircountaulas do curso.
days atrasa o que o nó decidiu ("7 dias depois de concluir o módulo
1") e vale em qualquer nó, menos em immediate.
Quem tem direito é pergunta de matrícula, não de agenda: não há condição de turma, de etiqueta nem de perfil aqui, de propósito — elas podem deixar de valer, e acesso que oscila é acesso que ninguém sabe explicar.
A aula referenciada que sai do curso (arquivada, despublicada) deixa de segurar: esperar por uma conclusão que não pode mais acontecer trancaria o curso para sempre.
Show child attributes
Show child attributes
Response
Curso criado, com o módulo inicial
Show child attributes
Show child attributes