@gymspace/sdk 1.2.13 → 1.2.14

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.mjs CHANGED
@@ -597,6 +597,29 @@ var ContractsResource = class extends BaseResource {
597
597
  async cancelContract(id, data, options) {
598
598
  return this.client.put(`${this.basePath}/${id}/cancel`, data, options);
599
599
  }
600
+ async suspendContract(id, data, options) {
601
+ return this.client.post(`${this.basePath}/${id}/suspend`, data, options);
602
+ }
603
+ async resumeContract(id, data, options) {
604
+ return this.client.post(`${this.basePath}/${id}/resume`, data, options);
605
+ }
606
+ async reactivateContract(id, data, options) {
607
+ return this.client.post(`${this.basePath}/${id}/reactivate`, data, options);
608
+ }
609
+ async getLifecycleHistory(id, options) {
610
+ return this.client.get(
611
+ `${this.basePath}/${id}/lifecycle-history`,
612
+ void 0,
613
+ options
614
+ );
615
+ }
616
+ async getCancellationAnalytics(params, options) {
617
+ return this.client.get(
618
+ `${this.basePath}/analytics/cancellation-reasons`,
619
+ params,
620
+ options
621
+ );
622
+ }
600
623
  async resendWhatsAppNotification(contractId, options) {
601
624
  return this.client.post(
602
625
  `${this.basePath}/${contractId}/resend-whatsapp`,
@@ -683,6 +706,19 @@ var CheckInsResource = class extends BaseResource {
683
706
  super(...arguments);
684
707
  this.basePath = "check-ins";
685
708
  }
709
+ /**
710
+ * Creates a new check-in for a client.
711
+ *
712
+ * **Permissions Required:**
713
+ * - Gym owners with full gym access
714
+ * - Active collaborators with CHECKINS_CREATE permission
715
+ *
716
+ * @param data - The check-in data including client ID and optional notes
717
+ * @param options - Optional request configuration
718
+ * @returns The created check-in record with client and user details
719
+ * @throws {ValidationError} When client is not found or already checked in
720
+ * @throws {AuthorizationError} When user lacks required permissions
721
+ */
686
722
  async createCheckIn(data, options) {
687
723
  return this.client.post(this.basePath, data, options);
688
724
  }
@@ -695,6 +731,25 @@ var CheckInsResource = class extends BaseResource {
695
731
  async getCheckIn(id, options) {
696
732
  return this.client.get(`${this.basePath}/${id}`, void 0, options);
697
733
  }
734
+ /**
735
+ * Deletes a check-in record.
736
+ *
737
+ * **Permissions Required:**
738
+ * - Gym owners with full gym access
739
+ * - Active collaborators with CHECKINS_CREATE permission
740
+ *
741
+ * **Business Rules:**
742
+ * - Only check-ins from today can be deleted
743
+ * - The same permission level required for creation is required for deletion
744
+ * - Cannot delete check-ins from previous days
745
+ *
746
+ * @param id - The ID of the check-in to delete
747
+ * @param options - Optional request configuration
748
+ * @returns Promise that resolves when the check-in is successfully deleted
749
+ * @throws {NotFoundError} When the check-in is not found
750
+ * @throws {AuthorizationError} When user lacks required permissions
751
+ * @throws {ValidationError} When trying to delete a check-in from a previous day
752
+ */
698
753
  async deleteCheckIn(id, options) {
699
754
  return this.client.delete(`${this.basePath}/${id}`, options);
700
755
  }
@@ -1486,6 +1541,165 @@ var BulkMessagingResource = class extends BaseResource {
1486
1541
  }
1487
1542
  };
1488
1543
 
1544
+ // src/resources/activities.ts
1545
+ var ActivitiesResource = class extends BaseResource {
1546
+ constructor() {
1547
+ super(...arguments);
1548
+ this.basePath = "activities";
1549
+ }
1550
+ async createActivity(data, options) {
1551
+ return this.client.post(this.basePath, data, options);
1552
+ }
1553
+ async searchActivities(params, options) {
1554
+ return this.paginate(this.basePath, params, options);
1555
+ }
1556
+ async getActivity(id, options) {
1557
+ return this.client.get(`${this.basePath}/${id}`, void 0, options);
1558
+ }
1559
+ async updateActivity(id, data, options) {
1560
+ return this.client.patch(`${this.basePath}/${id}`, data, options);
1561
+ }
1562
+ async deleteActivity(id, params, options) {
1563
+ const queryString = params?.deleteRecurrence ? "?deleteRecurrence=true" : "";
1564
+ return this.client.delete(`${this.basePath}/${id}${queryString}`, options);
1565
+ }
1566
+ async createNotification(activityId, data, options) {
1567
+ return this.client.post(
1568
+ `${this.basePath}/${activityId}/notifications`,
1569
+ data,
1570
+ options
1571
+ );
1572
+ }
1573
+ async getNotifications(activityId, options) {
1574
+ return this.client.get(
1575
+ `${this.basePath}/${activityId}/notifications`,
1576
+ void 0,
1577
+ options
1578
+ );
1579
+ }
1580
+ async updateNotification(activityId, notificationId, data, options) {
1581
+ return this.client.patch(
1582
+ `${this.basePath}/${activityId}/notifications/${notificationId}`,
1583
+ data,
1584
+ options
1585
+ );
1586
+ }
1587
+ async deleteNotification(activityId, notificationId, options) {
1588
+ return this.client.delete(
1589
+ `${this.basePath}/${activityId}/notifications/${notificationId}`,
1590
+ options
1591
+ );
1592
+ }
1593
+ async getStats(params, options) {
1594
+ return this.client.get(`${this.basePath}/stats`, params, options);
1595
+ }
1596
+ async getEligibleClients(activityId, options) {
1597
+ return this.client.get(
1598
+ `${this.basePath}/${activityId}/eligible-clients`,
1599
+ void 0,
1600
+ options
1601
+ );
1602
+ }
1603
+ };
1604
+
1605
+ // src/resources/tags.ts
1606
+ var TagsResource = class extends BaseResource {
1607
+ constructor() {
1608
+ super(...arguments);
1609
+ this.basePath = "tags";
1610
+ }
1611
+ // ==================== Tag Management ====================
1612
+ /**
1613
+ * Create a new tag
1614
+ * POST /api/v1/tags
1615
+ */
1616
+ async createTag(data, options) {
1617
+ return this.client.post(this.basePath, data, options);
1618
+ }
1619
+ /**
1620
+ * List all tags with optional filters and pagination
1621
+ * GET /api/v1/tags
1622
+ */
1623
+ async searchTags(params, options) {
1624
+ return this.client.get(this.basePath, params, options);
1625
+ }
1626
+ /**
1627
+ * Get a specific tag by ID
1628
+ * GET /api/v1/tags/:id
1629
+ */
1630
+ async getTag(id, options) {
1631
+ return this.client.get(`${this.basePath}/${id}`, void 0, options);
1632
+ }
1633
+ /**
1634
+ * Update an existing tag
1635
+ * PUT /api/v1/tags/:id
1636
+ */
1637
+ async updateTag(id, data, options) {
1638
+ return this.client.put(`${this.basePath}/${id}`, data, options);
1639
+ }
1640
+ /**
1641
+ * Delete a tag (soft delete)
1642
+ * DELETE /api/v1/tags/:id
1643
+ * @param id - Tag ID
1644
+ * @param force - Force deletion even if tag has assigned clients
1645
+ */
1646
+ async deleteTag(id, force, options) {
1647
+ const path = force ? `${this.basePath}/${id}?force=true` : `${this.basePath}/${id}`;
1648
+ return this.client.delete(path, options);
1649
+ }
1650
+ /**
1651
+ * Get clients with a specific tag
1652
+ * GET /api/v1/tags/:id/clients
1653
+ */
1654
+ async getTagClients(id, params, options) {
1655
+ return this.client.get(`${this.basePath}/${id}/clients`, params, options);
1656
+ }
1657
+ /**
1658
+ * Get tag statistics
1659
+ * GET /api/v1/tags/stats
1660
+ */
1661
+ async getTagStats(options) {
1662
+ return this.client.get(`${this.basePath}/stats`, void 0, options);
1663
+ }
1664
+ // ==================== Client Tag Assignment ====================
1665
+ /**
1666
+ * Assign one or multiple tags to a client
1667
+ * POST /api/v1/clients/:clientId/tags
1668
+ */
1669
+ async assignTagsToClient(clientId, data, options) {
1670
+ return this.client.post(`clients/${clientId}/tags`, data, options);
1671
+ }
1672
+ /**
1673
+ * Remove a specific tag from a client
1674
+ * DELETE /api/v1/clients/:clientId/tags/:tagId
1675
+ */
1676
+ async removeTagFromClient(clientId, tagId, options) {
1677
+ return this.client.delete(`clients/${clientId}/tags/${tagId}`, options);
1678
+ }
1679
+ /**
1680
+ * Remove multiple tags from a client
1681
+ * DELETE /api/v1/clients/:clientId/tags
1682
+ * Note: This endpoint requires sending tagIds in the request body
1683
+ */
1684
+ async removeTagsFromClient(clientId, tagIds, options) {
1685
+ return this.request(`clients/${clientId}/tags`, {
1686
+ method: "DELETE",
1687
+ body: JSON.stringify({ tagIds }),
1688
+ headers: {
1689
+ "Content-Type": "application/json",
1690
+ ...options?.headers
1691
+ }
1692
+ });
1693
+ }
1694
+ /**
1695
+ * Get all tags assigned to a client
1696
+ * GET /api/v1/clients/:clientId/tags
1697
+ */
1698
+ async getClientTags(clientId, options) {
1699
+ return this.client.get(`clients/${clientId}/tags`, void 0, options);
1700
+ }
1701
+ };
1702
+
1489
1703
  // src/sdk.ts
1490
1704
  var GymSpaceSdk = class {
1491
1705
  constructor(config) {
@@ -1517,6 +1731,8 @@ var GymSpaceSdk = class {
1517
1731
  this.whatsapp = new WhatsAppResource(this.client);
1518
1732
  this.whatsappTemplates = new WhatsAppTemplatesResource(this.client);
1519
1733
  this.bulkMessaging = new BulkMessagingResource(this.client);
1734
+ this.activities = new ActivitiesResource(this.client);
1735
+ this.tags = new TagsResource(this.client);
1520
1736
  }
1521
1737
  /**
1522
1738
  * Set the authentication token
@@ -1943,6 +2159,25 @@ function getRoleCapabilities(roleName) {
1943
2159
  }
1944
2160
  }
1945
2161
 
2162
+ // src/models/contracts.ts
2163
+ var CancellationReason = /* @__PURE__ */ ((CancellationReason2) => {
2164
+ CancellationReason2["PRICE_TOO_HIGH"] = "PRICE_TOO_HIGH";
2165
+ CancellationReason2["NOT_USING_SERVICE"] = "NOT_USING_SERVICE";
2166
+ CancellationReason2["MOVING_LOCATION"] = "MOVING_LOCATION";
2167
+ CancellationReason2["FINANCIAL_ISSUES"] = "FINANCIAL_ISSUES";
2168
+ CancellationReason2["SERVICE_DISSATISFACTION"] = "SERVICE_DISSATISFACTION";
2169
+ CancellationReason2["TEMPORARY_BREAK"] = "TEMPORARY_BREAK";
2170
+ CancellationReason2["OTHER"] = "OTHER";
2171
+ return CancellationReason2;
2172
+ })(CancellationReason || {});
2173
+ var SuspensionType = /* @__PURE__ */ ((SuspensionType2) => {
2174
+ SuspensionType2["VACATION"] = "vacation";
2175
+ SuspensionType2["MEDICAL"] = "medical";
2176
+ SuspensionType2["FINANCIAL"] = "financial";
2177
+ SuspensionType2["OTHER"] = "other";
2178
+ return SuspensionType2;
2179
+ })(SuspensionType || {});
2180
+
1946
2181
  // src/models/onboarding.ts
1947
2182
  var OnboardingStep = /* @__PURE__ */ ((OnboardingStep2) => {
1948
2183
  OnboardingStep2["ACCOUNT_CREATED"] = "account_created";
@@ -1952,6 +2187,6 @@ var OnboardingStep = /* @__PURE__ */ ((OnboardingStep2) => {
1952
2187
  return OnboardingStep2;
1953
2188
  })(OnboardingStep || {});
1954
2189
 
1955
- export { AdminSubscriptionManagementResource, ApiClient, AssetCategory, AssetStatus, AssetsResource, AuthResource, AuthenticationError, AuthorizationError, BulkMessagingResource, CACHE_TTL, CheckInsResource, ClientStatus, ClientsResource, CollaboratorStatus, CollaboratorsResource, CommentType, ContractAssetType, ContractStatus, ContractsResource, DATE_FORMATS, DashboardResource, EvaluationAssetCategory, EvaluationAssetStage, EvaluationStatus, EvaluationType, FILE_LIMITS, FilesResource, GymSpaceError, GymSpaceSdk, GymsResource, HEADERS, HealthResource, InvitationStatus, InvitationsResource, LeadStatus, MembershipPlansResource, NetworkError, NotFoundError, OnboardingResource, OnboardingStep, OrganizationsResource, PAGINATION_DEFAULTS, PERMISSIONS, PaymentFrequency, PaymentMethodsResource, PlanStatus, ProductsResource, PublicCatalogResource, ROLE_NAMES, ROLE_PERMISSIONS, RoleNames, RolesResource, SalesResource, SubscriptionPlansResource, SubscriptionStatus, SubscriptionsResource, SuppliersResource, UserType, UsersResource, ValidationError, WhatsAppResource, WhatsAppTemplatesResource, canAccessFeature, getRoleCapabilities, getRoleDescription, getRoleDisplayName, isAdminRole, isEncargadoRole };
2190
+ export { ActivitiesResource, AdminSubscriptionManagementResource, ApiClient, AssetCategory, AssetStatus, AssetsResource, AuthResource, AuthenticationError, AuthorizationError, BulkMessagingResource, CACHE_TTL, CancellationReason, CheckInsResource, ClientStatus, ClientsResource, CollaboratorStatus, CollaboratorsResource, CommentType, ContractAssetType, ContractStatus, ContractsResource, DATE_FORMATS, DashboardResource, EvaluationAssetCategory, EvaluationAssetStage, EvaluationStatus, EvaluationType, FILE_LIMITS, FilesResource, GymSpaceError, GymSpaceSdk, GymsResource, HEADERS, HealthResource, InvitationStatus, InvitationsResource, LeadStatus, MembershipPlansResource, NetworkError, NotFoundError, OnboardingResource, OnboardingStep, OrganizationsResource, PAGINATION_DEFAULTS, PERMISSIONS, PaymentFrequency, PaymentMethodsResource, PlanStatus, ProductsResource, PublicCatalogResource, ROLE_NAMES, ROLE_PERMISSIONS, RoleNames, RolesResource, SalesResource, SubscriptionPlansResource, SubscriptionStatus, SubscriptionsResource, SuppliersResource, SuspensionType, TagsResource, UserType, UsersResource, ValidationError, WhatsAppResource, WhatsAppTemplatesResource, canAccessFeature, getRoleCapabilities, getRoleDescription, getRoleDisplayName, isAdminRole, isEncargadoRole };
1956
2191
  //# sourceMappingURL=index.mjs.map
1957
2192
  //# sourceMappingURL=index.mjs.map