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