@gymspace/sdk 1.2.13 → 1.2.15

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.js CHANGED
@@ -603,6 +603,29 @@ var ContractsResource = class extends BaseResource {
603
603
  async cancelContract(id, data, options) {
604
604
  return this.client.put(`${this.basePath}/${id}/cancel`, data, options);
605
605
  }
606
+ async suspendContract(id, data, options) {
607
+ return this.client.post(`${this.basePath}/${id}/suspend`, data, options);
608
+ }
609
+ async resumeContract(id, data, options) {
610
+ return this.client.post(`${this.basePath}/${id}/resume`, data, options);
611
+ }
612
+ async reactivateContract(id, data, options) {
613
+ return this.client.post(`${this.basePath}/${id}/reactivate`, data, options);
614
+ }
615
+ async getLifecycleHistory(id, options) {
616
+ return this.client.get(
617
+ `${this.basePath}/${id}/lifecycle-history`,
618
+ void 0,
619
+ options
620
+ );
621
+ }
622
+ async getCancellationAnalytics(params, options) {
623
+ return this.client.get(
624
+ `${this.basePath}/analytics/cancellation-reasons`,
625
+ params,
626
+ options
627
+ );
628
+ }
606
629
  async resendWhatsAppNotification(contractId, options) {
607
630
  return this.client.post(
608
631
  `${this.basePath}/${contractId}/resend-whatsapp`,
@@ -689,6 +712,19 @@ var CheckInsResource = class extends BaseResource {
689
712
  super(...arguments);
690
713
  this.basePath = "check-ins";
691
714
  }
715
+ /**
716
+ * Creates a new check-in for a client.
717
+ *
718
+ * **Permissions Required:**
719
+ * - Gym owners with full gym access
720
+ * - Active collaborators with CHECKINS_CREATE permission
721
+ *
722
+ * @param data - The check-in data including client ID and optional notes
723
+ * @param options - Optional request configuration
724
+ * @returns The created check-in record with client and user details
725
+ * @throws {ValidationError} When client is not found or already checked in
726
+ * @throws {AuthorizationError} When user lacks required permissions
727
+ */
692
728
  async createCheckIn(data, options) {
693
729
  return this.client.post(this.basePath, data, options);
694
730
  }
@@ -701,6 +737,25 @@ var CheckInsResource = class extends BaseResource {
701
737
  async getCheckIn(id, options) {
702
738
  return this.client.get(`${this.basePath}/${id}`, void 0, options);
703
739
  }
740
+ /**
741
+ * Deletes a check-in record.
742
+ *
743
+ * **Permissions Required:**
744
+ * - Gym owners with full gym access
745
+ * - Active collaborators with CHECKINS_CREATE permission
746
+ *
747
+ * **Business Rules:**
748
+ * - Only check-ins from today can be deleted
749
+ * - The same permission level required for creation is required for deletion
750
+ * - Cannot delete check-ins from previous days
751
+ *
752
+ * @param id - The ID of the check-in to delete
753
+ * @param options - Optional request configuration
754
+ * @returns Promise that resolves when the check-in is successfully deleted
755
+ * @throws {NotFoundError} When the check-in is not found
756
+ * @throws {AuthorizationError} When user lacks required permissions
757
+ * @throws {ValidationError} When trying to delete a check-in from a previous day
758
+ */
704
759
  async deleteCheckIn(id, options) {
705
760
  return this.client.delete(`${this.basePath}/${id}`, options);
706
761
  }
@@ -1492,6 +1547,165 @@ var BulkMessagingResource = class extends BaseResource {
1492
1547
  }
1493
1548
  };
1494
1549
 
1550
+ // src/resources/activities.ts
1551
+ var ActivitiesResource = class extends BaseResource {
1552
+ constructor() {
1553
+ super(...arguments);
1554
+ this.basePath = "activities";
1555
+ }
1556
+ async createActivity(data, options) {
1557
+ return this.client.post(this.basePath, data, options);
1558
+ }
1559
+ async searchActivities(params, options) {
1560
+ return this.paginate(this.basePath, params, options);
1561
+ }
1562
+ async getActivity(id, options) {
1563
+ return this.client.get(`${this.basePath}/${id}`, void 0, options);
1564
+ }
1565
+ async updateActivity(id, data, options) {
1566
+ return this.client.patch(`${this.basePath}/${id}`, data, options);
1567
+ }
1568
+ async deleteActivity(id, params, options) {
1569
+ const queryString = params?.deleteRecurrence ? "?deleteRecurrence=true" : "";
1570
+ return this.client.delete(`${this.basePath}/${id}${queryString}`, options);
1571
+ }
1572
+ async createNotification(activityId, data, options) {
1573
+ return this.client.post(
1574
+ `${this.basePath}/${activityId}/notifications`,
1575
+ data,
1576
+ options
1577
+ );
1578
+ }
1579
+ async getNotifications(activityId, options) {
1580
+ return this.client.get(
1581
+ `${this.basePath}/${activityId}/notifications`,
1582
+ void 0,
1583
+ options
1584
+ );
1585
+ }
1586
+ async updateNotification(activityId, notificationId, data, options) {
1587
+ return this.client.patch(
1588
+ `${this.basePath}/${activityId}/notifications/${notificationId}`,
1589
+ data,
1590
+ options
1591
+ );
1592
+ }
1593
+ async deleteNotification(activityId, notificationId, options) {
1594
+ return this.client.delete(
1595
+ `${this.basePath}/${activityId}/notifications/${notificationId}`,
1596
+ options
1597
+ );
1598
+ }
1599
+ async getStats(params, options) {
1600
+ return this.client.get(`${this.basePath}/stats`, params, options);
1601
+ }
1602
+ async getEligibleClients(activityId, options) {
1603
+ return this.client.get(
1604
+ `${this.basePath}/${activityId}/eligible-clients`,
1605
+ void 0,
1606
+ options
1607
+ );
1608
+ }
1609
+ };
1610
+
1611
+ // src/resources/tags.ts
1612
+ var TagsResource = class extends BaseResource {
1613
+ constructor() {
1614
+ super(...arguments);
1615
+ this.basePath = "tags";
1616
+ }
1617
+ // ==================== Tag Management ====================
1618
+ /**
1619
+ * Create a new tag
1620
+ * POST /api/v1/tags
1621
+ */
1622
+ async createTag(data, options) {
1623
+ return this.client.post(this.basePath, data, options);
1624
+ }
1625
+ /**
1626
+ * List all tags with optional filters and pagination
1627
+ * GET /api/v1/tags
1628
+ */
1629
+ async searchTags(params, options) {
1630
+ return this.client.get(this.basePath, params, options);
1631
+ }
1632
+ /**
1633
+ * Get a specific tag by ID
1634
+ * GET /api/v1/tags/:id
1635
+ */
1636
+ async getTag(id, options) {
1637
+ return this.client.get(`${this.basePath}/${id}`, void 0, options);
1638
+ }
1639
+ /**
1640
+ * Update an existing tag
1641
+ * PUT /api/v1/tags/:id
1642
+ */
1643
+ async updateTag(id, data, options) {
1644
+ return this.client.put(`${this.basePath}/${id}`, data, options);
1645
+ }
1646
+ /**
1647
+ * Delete a tag (soft delete)
1648
+ * DELETE /api/v1/tags/:id
1649
+ * @param id - Tag ID
1650
+ * @param force - Force deletion even if tag has assigned clients
1651
+ */
1652
+ async deleteTag(id, force, options) {
1653
+ const path = force ? `${this.basePath}/${id}?force=true` : `${this.basePath}/${id}`;
1654
+ return this.client.delete(path, options);
1655
+ }
1656
+ /**
1657
+ * Get clients with a specific tag
1658
+ * GET /api/v1/tags/:id/clients
1659
+ */
1660
+ async getTagClients(id, params, options) {
1661
+ return this.client.get(`${this.basePath}/${id}/clients`, params, options);
1662
+ }
1663
+ /**
1664
+ * Get tag statistics
1665
+ * GET /api/v1/tags/stats
1666
+ */
1667
+ async getTagStats(options) {
1668
+ return this.client.get(`${this.basePath}/stats`, void 0, options);
1669
+ }
1670
+ // ==================== Client Tag Assignment ====================
1671
+ /**
1672
+ * Assign one or multiple tags to a client
1673
+ * POST /api/v1/clients/:clientId/tags
1674
+ */
1675
+ async assignTagsToClient(clientId, data, options) {
1676
+ return this.client.post(`clients/${clientId}/tags`, data, options);
1677
+ }
1678
+ /**
1679
+ * Remove a specific tag from a client
1680
+ * DELETE /api/v1/clients/:clientId/tags/:tagId
1681
+ */
1682
+ async removeTagFromClient(clientId, tagId, options) {
1683
+ return this.client.delete(`clients/${clientId}/tags/${tagId}`, options);
1684
+ }
1685
+ /**
1686
+ * Remove multiple tags from a client
1687
+ * DELETE /api/v1/clients/:clientId/tags
1688
+ * Note: This endpoint requires sending tagIds in the request body
1689
+ */
1690
+ async removeTagsFromClient(clientId, tagIds, options) {
1691
+ return this.request(`clients/${clientId}/tags`, {
1692
+ method: "DELETE",
1693
+ body: JSON.stringify({ tagIds }),
1694
+ headers: {
1695
+ "Content-Type": "application/json",
1696
+ ...options?.headers
1697
+ }
1698
+ });
1699
+ }
1700
+ /**
1701
+ * Get all tags assigned to a client
1702
+ * GET /api/v1/clients/:clientId/tags
1703
+ */
1704
+ async getClientTags(clientId, options) {
1705
+ return this.client.get(`clients/${clientId}/tags`, void 0, options);
1706
+ }
1707
+ };
1708
+
1495
1709
  // src/sdk.ts
1496
1710
  var GymSpaceSdk = class {
1497
1711
  constructor(config) {
@@ -1523,6 +1737,8 @@ var GymSpaceSdk = class {
1523
1737
  this.whatsapp = new WhatsAppResource(this.client);
1524
1738
  this.whatsappTemplates = new WhatsAppTemplatesResource(this.client);
1525
1739
  this.bulkMessaging = new BulkMessagingResource(this.client);
1740
+ this.activities = new ActivitiesResource(this.client);
1741
+ this.tags = new TagsResource(this.client);
1526
1742
  }
1527
1743
  /**
1528
1744
  * Set the authentication token
@@ -1949,6 +2165,25 @@ function getRoleCapabilities(roleName) {
1949
2165
  }
1950
2166
  }
1951
2167
 
2168
+ // src/models/contracts.ts
2169
+ var CancellationReason = /* @__PURE__ */ ((CancellationReason2) => {
2170
+ CancellationReason2["PRICE_TOO_HIGH"] = "PRICE_TOO_HIGH";
2171
+ CancellationReason2["NOT_USING_SERVICE"] = "NOT_USING_SERVICE";
2172
+ CancellationReason2["MOVING_LOCATION"] = "MOVING_LOCATION";
2173
+ CancellationReason2["FINANCIAL_ISSUES"] = "FINANCIAL_ISSUES";
2174
+ CancellationReason2["SERVICE_DISSATISFACTION"] = "SERVICE_DISSATISFACTION";
2175
+ CancellationReason2["TEMPORARY_BREAK"] = "TEMPORARY_BREAK";
2176
+ CancellationReason2["OTHER"] = "OTHER";
2177
+ return CancellationReason2;
2178
+ })(CancellationReason || {});
2179
+ var SuspensionType = /* @__PURE__ */ ((SuspensionType2) => {
2180
+ SuspensionType2["VACATION"] = "vacation";
2181
+ SuspensionType2["MEDICAL"] = "medical";
2182
+ SuspensionType2["FINANCIAL"] = "financial";
2183
+ SuspensionType2["OTHER"] = "other";
2184
+ return SuspensionType2;
2185
+ })(SuspensionType || {});
2186
+
1952
2187
  // src/models/onboarding.ts
1953
2188
  var OnboardingStep = /* @__PURE__ */ ((OnboardingStep2) => {
1954
2189
  OnboardingStep2["ACCOUNT_CREATED"] = "account_created";
@@ -1958,6 +2193,7 @@ var OnboardingStep = /* @__PURE__ */ ((OnboardingStep2) => {
1958
2193
  return OnboardingStep2;
1959
2194
  })(OnboardingStep || {});
1960
2195
 
2196
+ exports.ActivitiesResource = ActivitiesResource;
1961
2197
  exports.AdminSubscriptionManagementResource = AdminSubscriptionManagementResource;
1962
2198
  exports.ApiClient = ApiClient;
1963
2199
  exports.AssetCategory = AssetCategory;
@@ -1968,6 +2204,7 @@ exports.AuthenticationError = AuthenticationError;
1968
2204
  exports.AuthorizationError = AuthorizationError;
1969
2205
  exports.BulkMessagingResource = BulkMessagingResource;
1970
2206
  exports.CACHE_TTL = CACHE_TTL;
2207
+ exports.CancellationReason = CancellationReason;
1971
2208
  exports.CheckInsResource = CheckInsResource;
1972
2209
  exports.ClientStatus = ClientStatus;
1973
2210
  exports.ClientsResource = ClientsResource;
@@ -2015,6 +2252,8 @@ exports.SubscriptionPlansResource = SubscriptionPlansResource;
2015
2252
  exports.SubscriptionStatus = SubscriptionStatus;
2016
2253
  exports.SubscriptionsResource = SubscriptionsResource;
2017
2254
  exports.SuppliersResource = SuppliersResource;
2255
+ exports.SuspensionType = SuspensionType;
2256
+ exports.TagsResource = TagsResource;
2018
2257
  exports.UserType = UserType;
2019
2258
  exports.UsersResource = UsersResource;
2020
2259
  exports.ValidationError = ValidationError;