academe-kit 0.13.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -6403,6 +6403,7 @@ function createSubmissionService(apiClient) {
6403
6403
  * Moves status from submitted → ai_evaluated.
6404
6404
  */
6405
6405
  aiEvaluate(submissionId, data) {
6406
+ // Path não tipado no OpenAPI (ver AiEvaluationBody) → cast, padrão do kit.
6406
6407
  return apiClient.POST("/submissions/{id}/ai-evaluation", {
6407
6408
  params: { path: { id: submissionId } },
6408
6409
  body: data,
@@ -6548,6 +6549,112 @@ function createVitrineService(apiClient) {
6548
6549
  };
6549
6550
  }
6550
6551
 
6552
+ function createWatchlistService(apiClient) {
6553
+ return {
6554
+ /** Itens da "Minha lista" + contagem. */
6555
+ async getMine() {
6556
+ const res = await apiClient.GET("/me/watchlist");
6557
+ return (res.data?.data ?? { items: [], count: 0 });
6558
+ },
6559
+ /** Adiciona um conteúdo (idempotente). */
6560
+ async add(type, id) {
6561
+ await apiClient.PUT("/me/watchlist", { body: { type, id } });
6562
+ },
6563
+ /** Remove um conteúdo pelo alvo. */
6564
+ async remove(type, id) {
6565
+ await apiClient.DELETE("/me/watchlist/{type}/{id}", {
6566
+ params: { path: { type, id } },
6567
+ });
6568
+ },
6569
+ };
6570
+ }
6571
+
6572
+ function createChallengeGroupService(apiClient) {
6573
+ // Paths novos ainda não tipados no schema gerado — cast (ver docstring acima).
6574
+ const GET = apiClient.GET;
6575
+ const POST = apiClient.POST;
6576
+ const DELETE = apiClient.DELETE;
6577
+ return {
6578
+ // ----- Grupos ---------------------------------------------------------
6579
+ /** Lista os grupos de um desafio (com membros). */
6580
+ listGroups(challengeId) {
6581
+ return GET("/challenge-groups", {
6582
+ params: { query: { challengeId } },
6583
+ });
6584
+ },
6585
+ /** Detalha um grupo (com desafio e membros). */
6586
+ getGroup(groupId) {
6587
+ return GET("/challenge-groups/{id}", {
6588
+ params: { path: { id: groupId } },
6589
+ });
6590
+ },
6591
+ /** Cria um grupo. Com `joinAsMember`, o criador entra como líder. */
6592
+ createGroup(body) {
6593
+ return POST("/challenge-groups", { body });
6594
+ },
6595
+ /** Lista membros de um grupo. */
6596
+ listMembers(groupId) {
6597
+ return GET("/challenge-groups/{id}/members", {
6598
+ params: { path: { id: groupId } },
6599
+ });
6600
+ },
6601
+ /** Remove um membro do grupo (sair/expulsar). */
6602
+ removeMember(groupId, userId) {
6603
+ return DELETE("/challenge-groups/{id}/members/{userId}", {
6604
+ params: { path: { id: groupId, userId } },
6605
+ });
6606
+ },
6607
+ /** Remove o grupo. */
6608
+ deleteGroup(groupId) {
6609
+ return DELETE("/challenge-groups/{id}", {
6610
+ params: { path: { id: groupId } },
6611
+ });
6612
+ },
6613
+ // ----- Colegas elegíveis ---------------------------------------------
6614
+ /**
6615
+ * Colegas de turma elegíveis para convidar (mesma turma do aluno, anotados
6616
+ * com `membership`: free | in_group | invited).
6617
+ */
6618
+ getEligibleClassmates(challengeId, institutionId) {
6619
+ return GET("/challenges/{id}/eligible-classmates", {
6620
+ params: {
6621
+ path: { id: challengeId },
6622
+ query: institutionId ? { institutionId } : {},
6623
+ },
6624
+ });
6625
+ },
6626
+ // ----- Convites -------------------------------------------------------
6627
+ /** Meus convites (recebidos por padrão), opcionalmente filtrados por status. */
6628
+ listInvites(params) {
6629
+ return GET("/challenge-group-invites", {
6630
+ params: { query: params ?? {} },
6631
+ });
6632
+ },
6633
+ /** Convida um colega para um grupo. */
6634
+ createInvite(body) {
6635
+ return POST("/challenge-group-invites", { body });
6636
+ },
6637
+ /** Aceita um convite recebido (cria a membership no backend). */
6638
+ acceptInvite(inviteId) {
6639
+ return POST("/challenge-group-invites/{id}/accept", {
6640
+ params: { path: { id: inviteId } },
6641
+ });
6642
+ },
6643
+ /** Recusa um convite recebido. */
6644
+ declineInvite(inviteId) {
6645
+ return POST("/challenge-group-invites/{id}/decline", {
6646
+ params: { path: { id: inviteId } },
6647
+ });
6648
+ },
6649
+ /** Cancela um convite pendente que EU enviei. */
6650
+ cancelInvite(inviteId) {
6651
+ return DELETE("/challenge-group-invites/{id}", {
6652
+ params: { path: { id: inviteId } },
6653
+ });
6654
+ },
6655
+ };
6656
+ }
6657
+
6551
6658
  function createAcademeApiClient(baseUrl) {
6552
6659
  return createClient({ baseUrl });
6553
6660
  }
@@ -6576,6 +6683,8 @@ function createAcademeServices(apiClient) {
6576
6683
  submission: createSubmissionService(apiClient),
6577
6684
  userProgress: createUserProgressService(apiClient),
6578
6685
  vitrine: createVitrineService(apiClient),
6686
+ watchlist: createWatchlistService(apiClient),
6687
+ challengeGroup: createChallengeGroupService(apiClient),
6579
6688
  };
6580
6689
  }
6581
6690