@workbenchcrm/sdk 1.2.0 → 1.3.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.d.mts CHANGED
@@ -369,11 +369,11 @@ interface ListJobsOptions extends ListOptions {
369
369
  /**
370
370
  * Service request status values
371
371
  */
372
- type ServiceRequestStatus = 'new' | 'contacted' | 'scheduled' | 'in_progress' | 'completed' | 'cancelled' | 'rejected';
372
+ type ServiceRequestStatus = 'new' | 'in_progress' | 'assessment_complete' | 'completed' | 'cancelled';
373
373
  /**
374
374
  * Service request priority values
375
375
  */
376
- type ServiceRequestPriority = 'low' | 'normal' | 'high' | 'urgent';
376
+ type ServiceRequestPriority = 'low' | 'medium' | 'high' | 'urgent';
377
377
  /**
378
378
  * Service request record
379
379
  */
@@ -612,6 +612,137 @@ interface NotificationResult {
612
612
  /** Error messages if any failures occurred */
613
613
  errors?: string[];
614
614
  }
615
+ /**
616
+ * Integration status values
617
+ */
618
+ type IntegrationStatus = 'draft' | 'pending_review' | 'published' | 'rejected' | 'suspended';
619
+ /**
620
+ * Integration category values
621
+ */
622
+ type IntegrationCategory = 'accounting' | 'analytics' | 'automation' | 'communication' | 'crm' | 'ecommerce' | 'marketing' | 'payments' | 'productivity' | 'scheduling' | 'other';
623
+ /**
624
+ * OAuth scope information
625
+ */
626
+ interface IntegrationScope {
627
+ /** Scope identifier (e.g., 'clients:read') */
628
+ scope: string;
629
+ /** Human-readable description of what the scope allows */
630
+ description: string;
631
+ /** Whether this scope is required for the integration */
632
+ required: boolean;
633
+ }
634
+ /**
635
+ * Published integration in the marketplace
636
+ */
637
+ interface Integration {
638
+ id: string;
639
+ /** URL-friendly identifier */
640
+ slug: string;
641
+ name: string;
642
+ /** Short description (max 200 chars) */
643
+ short_description: string;
644
+ /** Full description with markdown support */
645
+ description: string;
646
+ /** Category for filtering/discovery */
647
+ category: IntegrationCategory;
648
+ /** URL to integration icon/logo */
649
+ icon_url: string | null;
650
+ /** URL to integration website */
651
+ website_url: string | null;
652
+ /** Support email for the integration */
653
+ support_email: string | null;
654
+ /** Privacy policy URL */
655
+ privacy_policy_url: string | null;
656
+ /** Terms of service URL */
657
+ terms_url: string | null;
658
+ /** OAuth scopes required by the integration */
659
+ scopes: IntegrationScope[];
660
+ /** Webhook events the integration subscribes to */
661
+ webhook_events: WebhookEvent[];
662
+ /** Number of businesses using this integration */
663
+ install_count: number;
664
+ /** Average rating (1-5) */
665
+ average_rating: number | null;
666
+ /** Number of reviews */
667
+ review_count: number;
668
+ /** Developer/company information */
669
+ developer: {
670
+ id: string;
671
+ name: string;
672
+ website: string | null;
673
+ verified: boolean;
674
+ };
675
+ /** When the integration was published */
676
+ published_at: string;
677
+ created_at: string;
678
+ updated_at: string | null;
679
+ }
680
+ /**
681
+ * Integration review from a user
682
+ */
683
+ interface IntegrationReview {
684
+ id: string;
685
+ integration_id: string;
686
+ /** Rating 1-5 */
687
+ rating: number;
688
+ /** Review title */
689
+ title: string | null;
690
+ /** Review body */
691
+ content: string | null;
692
+ /** Reviewer display name */
693
+ reviewer_name: string;
694
+ /** When the review was submitted */
695
+ created_at: string;
696
+ }
697
+ /**
698
+ * Options for listing integrations
699
+ */
700
+ interface ListIntegrationsOptions extends ListOptions {
701
+ /** Filter by category */
702
+ category?: IntegrationCategory;
703
+ /** Filter by scope (returns integrations that request this scope) */
704
+ scope?: string;
705
+ /** Sort by: 'popular' | 'recent' | 'rating' | 'name' */
706
+ sort_by?: 'popular' | 'recent' | 'rating' | 'name';
707
+ }
708
+ /**
709
+ * Options for listing integration reviews
710
+ */
711
+ interface ListIntegrationReviewsOptions extends ListOptions {
712
+ /** Minimum rating to filter by */
713
+ min_rating?: number;
714
+ }
715
+ /**
716
+ * Installed integration on a business account
717
+ */
718
+ interface InstalledIntegration {
719
+ id: string;
720
+ integration_id: string;
721
+ integration: Integration;
722
+ /** OAuth access token (masked for security) */
723
+ access_token_prefix: string;
724
+ /** Scopes that were granted */
725
+ granted_scopes: string[];
726
+ /** When the integration was installed */
727
+ installed_at: string;
728
+ /** User who installed the integration */
729
+ installed_by: string | null;
730
+ /** Whether the integration is currently active */
731
+ is_active: boolean;
732
+ }
733
+ /**
734
+ * Options for installing an integration
735
+ */
736
+ interface InstallIntegrationOptions {
737
+ /** Integration ID to install */
738
+ integration_id: string;
739
+ /** Scopes to grant (must be subset of integration's requested scopes) */
740
+ scopes: string[];
741
+ /** OAuth authorization code (from consent flow) */
742
+ authorization_code: string;
743
+ /** PKCE code verifier */
744
+ code_verifier: string;
745
+ }
615
746
 
616
747
  /**
617
748
  * @file resources/clients.ts
@@ -1628,6 +1759,235 @@ declare class NotificationsResource {
1628
1759
  sendCustom(options: SendCustomNotificationOptions): Promise<ApiResponse<NotificationResult>>;
1629
1760
  }
1630
1761
 
1762
+ /**
1763
+ * @file resources/integrations.ts
1764
+ * @description Integration marketplace resource for browsing and managing integrations
1765
+ *
1766
+ * The IntegrationsResource provides methods for:
1767
+ * - Browsing the public integration marketplace
1768
+ * - Viewing integration details and reviews
1769
+ * - Managing installed integrations on your business account
1770
+ */
1771
+
1772
+ /**
1773
+ * Integration marketplace resource
1774
+ *
1775
+ * Provides access to the Workbench integration marketplace, allowing you to
1776
+ * browse published integrations, view reviews, and manage installations.
1777
+ *
1778
+ * @example
1779
+ * ```typescript
1780
+ * // Browse marketplace
1781
+ * const { data: integrations } = await workbench.integrations.list({
1782
+ * category: 'accounting',
1783
+ * sort_by: 'popular'
1784
+ * });
1785
+ *
1786
+ * // Get integration details
1787
+ * const { data: integration } = await workbench.integrations.get('quickbooks');
1788
+ *
1789
+ * // List installed integrations
1790
+ * const { data: installed } = await workbench.integrations.listInstalled();
1791
+ * ```
1792
+ */
1793
+ declare class IntegrationsResource {
1794
+ private readonly client;
1795
+ constructor(client: WorkbenchClient);
1796
+ /**
1797
+ * List published integrations in the marketplace
1798
+ *
1799
+ * Returns a paginated list of published integrations available for installation.
1800
+ * This endpoint is publicly accessible.
1801
+ *
1802
+ * @param options - List options (pagination, filtering, sorting)
1803
+ * @returns Paginated list of integrations
1804
+ *
1805
+ * @example
1806
+ * ```typescript
1807
+ * // List all integrations
1808
+ * const { data, pagination } = await workbench.integrations.list();
1809
+ *
1810
+ * // Filter by category
1811
+ * const { data } = await workbench.integrations.list({
1812
+ * category: 'accounting',
1813
+ * sort_by: 'popular',
1814
+ * per_page: 10
1815
+ * });
1816
+ *
1817
+ * // Search integrations
1818
+ * const { data } = await workbench.integrations.list({
1819
+ * search: 'quickbooks'
1820
+ * });
1821
+ * ```
1822
+ */
1823
+ list(options?: ListIntegrationsOptions): Promise<ListResponse<Integration>>;
1824
+ /**
1825
+ * Get an integration by ID or slug
1826
+ *
1827
+ * Returns detailed information about a specific integration.
1828
+ *
1829
+ * @param idOrSlug - Integration UUID or URL slug
1830
+ * @returns Integration details
1831
+ *
1832
+ * @example
1833
+ * ```typescript
1834
+ * // Get by slug
1835
+ * const { data: integration } = await workbench.integrations.get('quickbooks');
1836
+ *
1837
+ * // Get by ID
1838
+ * const { data: integration } = await workbench.integrations.get('123e4567-e89b-12d3-a456-426614174000');
1839
+ *
1840
+ * console.log(`${integration.name} by ${integration.developer.name}`);
1841
+ * console.log(`Installs: ${integration.install_count}`);
1842
+ * ```
1843
+ */
1844
+ get(idOrSlug: string): Promise<ApiResponse<Integration>>;
1845
+ /**
1846
+ * Get reviews for an integration
1847
+ *
1848
+ * Returns a paginated list of user reviews for a specific integration.
1849
+ *
1850
+ * @param integrationId - Integration UUID or slug
1851
+ * @param options - List options (pagination, filtering)
1852
+ * @returns Paginated list of reviews
1853
+ *
1854
+ * @example
1855
+ * ```typescript
1856
+ * const { data: reviews, pagination } = await workbench.integrations.getReviews('quickbooks', {
1857
+ * min_rating: 4,
1858
+ * per_page: 10
1859
+ * });
1860
+ *
1861
+ * for (const review of reviews) {
1862
+ * console.log(`${review.rating}/5 - ${review.title}`);
1863
+ * }
1864
+ * ```
1865
+ */
1866
+ getReviews(integrationId: string, options?: ListIntegrationReviewsOptions): Promise<ListResponse<IntegrationReview>>;
1867
+ /**
1868
+ * List installed integrations on your business account
1869
+ *
1870
+ * Returns all integrations that have been installed on the authenticated
1871
+ * business account.
1872
+ *
1873
+ * @returns List of installed integrations
1874
+ *
1875
+ * @example
1876
+ * ```typescript
1877
+ * const { data: installed } = await workbench.integrations.listInstalled();
1878
+ *
1879
+ * for (const install of installed) {
1880
+ * console.log(`${install.integration.name} - Active: ${install.is_active}`);
1881
+ * console.log(`Scopes: ${install.granted_scopes.join(', ')}`);
1882
+ * }
1883
+ * ```
1884
+ */
1885
+ listInstalled(): Promise<ListResponse<InstalledIntegration>>;
1886
+ /**
1887
+ * Get an installed integration by ID
1888
+ *
1889
+ * @param installationId - Installation UUID
1890
+ * @returns Installed integration details
1891
+ *
1892
+ * @example
1893
+ * ```typescript
1894
+ * const { data: install } = await workbench.integrations.getInstalled('install-uuid');
1895
+ * console.log(`Installed on: ${install.installed_at}`);
1896
+ * ```
1897
+ */
1898
+ getInstalled(installationId: string): Promise<ApiResponse<InstalledIntegration>>;
1899
+ /**
1900
+ * Install an integration on your business account
1901
+ *
1902
+ * Completes the OAuth flow and installs an integration. This requires an
1903
+ * authorization code obtained from the user consent flow.
1904
+ *
1905
+ * @param options - Installation options including authorization code
1906
+ * @returns Installed integration details
1907
+ *
1908
+ * @example
1909
+ * ```typescript
1910
+ * // After user completes OAuth consent flow:
1911
+ * const { data: install } = await workbench.integrations.install({
1912
+ * integration_id: 'integration-uuid',
1913
+ * scopes: ['clients:read', 'invoices:read'],
1914
+ * authorization_code: 'code_from_oauth_flow',
1915
+ * code_verifier: 'pkce_code_verifier'
1916
+ * });
1917
+ *
1918
+ * console.log(`Installed! Token prefix: ${install.access_token_prefix}`);
1919
+ * ```
1920
+ */
1921
+ install(options: InstallIntegrationOptions): Promise<ApiResponse<InstalledIntegration>>;
1922
+ /**
1923
+ * Uninstall an integration from your business account
1924
+ *
1925
+ * Revokes all access tokens and removes the integration. This action
1926
+ * cannot be undone.
1927
+ *
1928
+ * @param installationId - Installation UUID
1929
+ *
1930
+ * @example
1931
+ * ```typescript
1932
+ * await workbench.integrations.uninstall('install-uuid');
1933
+ * console.log('Integration uninstalled');
1934
+ * ```
1935
+ */
1936
+ uninstall(installationId: string): Promise<void>;
1937
+ /**
1938
+ * Temporarily disable an installed integration
1939
+ *
1940
+ * Pauses the integration without uninstalling it. The integration can
1941
+ * be re-enabled later.
1942
+ *
1943
+ * @param installationId - Installation UUID
1944
+ * @returns Updated installation
1945
+ *
1946
+ * @example
1947
+ * ```typescript
1948
+ * const { data: install } = await workbench.integrations.disable('install-uuid');
1949
+ * console.log(`Active: ${install.is_active}`); // false
1950
+ * ```
1951
+ */
1952
+ disable(installationId: string): Promise<ApiResponse<InstalledIntegration>>;
1953
+ /**
1954
+ * Re-enable a disabled integration
1955
+ *
1956
+ * @param installationId - Installation UUID
1957
+ * @returns Updated installation
1958
+ *
1959
+ * @example
1960
+ * ```typescript
1961
+ * const { data: install } = await workbench.integrations.enable('install-uuid');
1962
+ * console.log(`Active: ${install.is_active}`); // true
1963
+ * ```
1964
+ */
1965
+ enable(installationId: string): Promise<ApiResponse<InstalledIntegration>>;
1966
+ /**
1967
+ * Submit a review for an installed integration
1968
+ *
1969
+ * You can only review integrations that are installed on your business account.
1970
+ *
1971
+ * @param integrationId - Integration UUID
1972
+ * @param review - Review data
1973
+ * @returns Created review
1974
+ *
1975
+ * @example
1976
+ * ```typescript
1977
+ * const { data: review } = await workbench.integrations.submitReview('integration-uuid', {
1978
+ * rating: 5,
1979
+ * title: 'Great integration!',
1980
+ * content: 'This integration saved us hours of manual work...'
1981
+ * });
1982
+ * ```
1983
+ */
1984
+ submitReview(integrationId: string, review: {
1985
+ rating: number;
1986
+ title?: string;
1987
+ content?: string;
1988
+ }): Promise<ApiResponse<IntegrationReview>>;
1989
+ }
1990
+
1631
1991
  /**
1632
1992
  * @file client.ts
1633
1993
  * @description Main Workbench API client class
@@ -1718,6 +2078,8 @@ declare class WorkbenchClient {
1718
2078
  readonly webhooks: WebhooksResource;
1719
2079
  /** Notifications resource */
1720
2080
  readonly notifications: NotificationsResource;
2081
+ /** Integrations marketplace resource */
2082
+ readonly integrations: IntegrationsResource;
1721
2083
  /**
1722
2084
  * Create a new Workbench client
1723
2085
  *
@@ -1899,4 +2261,4 @@ declare function constructWebhookEvent<T = Record<string, unknown>>(payload: str
1899
2261
  timestamp: string;
1900
2262
  };
1901
2263
 
1902
- export { type ApiError, type ApiResponse, type BusinessUserRole, type Client, type ClientStatus, ClientsResource, type CreateClientOptions, type CreateInvoiceOptions, type CreateJobOptions, type CreateQuoteOptions, type CreateServiceRequestOptions, type CreateWebhookOptions, type Invoice, type InvoiceItem, type InvoiceStatus, InvoicesResource, type Job, type JobPriority, type JobStatus, JobsResource, type ListClientsOptions, type ListInvoicesOptions, type ListJobsOptions, type ListOptions, type ListQuotesOptions, type ListResponse, type ListServiceRequestsOptions, type ListWebhookDeliveriesOptions, type NotificationEvent, type NotificationResult, type NotificationType, NotificationsResource, type Pagination, type Quote, type QuoteItem, type QuoteStatus, QuotesResource, type RequestOptions, RequestsResource, type ResponseMeta, type SendCustomNotificationOptions, type SendToClientOptions, type SendToTeamOptions, type ServiceRequest, type ServiceRequestPriority, type ServiceRequestStatus, type UpdateClientOptions, type UpdateInvoiceOptions, type UpdateJobOptions, type UpdateQuoteOptions, type UpdateServiceRequestOptions, type UpdateWebhookOptions, type VerifyOptions, type Webhook, type WebhookDelivery, type WebhookEvent, type WebhookSignature, WebhookVerificationError, WebhooksResource, WorkbenchClient, type WorkbenchConfig, WorkbenchError, computeSignature, constructWebhookEvent, parseSignatureHeader, verifyWebhookSignature };
2264
+ export { type ApiError, type ApiResponse, type BusinessUserRole, type Client, type ClientStatus, ClientsResource, type CreateClientOptions, type CreateInvoiceOptions, type CreateJobOptions, type CreateQuoteOptions, type CreateServiceRequestOptions, type CreateWebhookOptions, type InstallIntegrationOptions, type InstalledIntegration, type Integration, type IntegrationCategory, type IntegrationReview, type IntegrationScope, type IntegrationStatus, IntegrationsResource, type Invoice, type InvoiceItem, type InvoiceStatus, InvoicesResource, type Job, type JobPriority, type JobStatus, JobsResource, type ListClientsOptions, type ListIntegrationReviewsOptions, type ListIntegrationsOptions, type ListInvoicesOptions, type ListJobsOptions, type ListOptions, type ListQuotesOptions, type ListResponse, type ListServiceRequestsOptions, type ListWebhookDeliveriesOptions, type NotificationEvent, type NotificationResult, type NotificationType, NotificationsResource, type Pagination, type Quote, type QuoteItem, type QuoteStatus, QuotesResource, type RequestOptions, RequestsResource, type ResponseMeta, type SendCustomNotificationOptions, type SendToClientOptions, type SendToTeamOptions, type ServiceRequest, type ServiceRequestPriority, type ServiceRequestStatus, type UpdateClientOptions, type UpdateInvoiceOptions, type UpdateJobOptions, type UpdateQuoteOptions, type UpdateServiceRequestOptions, type UpdateWebhookOptions, type VerifyOptions, type Webhook, type WebhookDelivery, type WebhookEvent, type WebhookSignature, WebhookVerificationError, WebhooksResource, WorkbenchClient, type WorkbenchConfig, WorkbenchError, computeSignature, constructWebhookEvent, parseSignatureHeader, verifyWebhookSignature };
package/dist/index.d.ts CHANGED
@@ -369,11 +369,11 @@ interface ListJobsOptions extends ListOptions {
369
369
  /**
370
370
  * Service request status values
371
371
  */
372
- type ServiceRequestStatus = 'new' | 'contacted' | 'scheduled' | 'in_progress' | 'completed' | 'cancelled' | 'rejected';
372
+ type ServiceRequestStatus = 'new' | 'in_progress' | 'assessment_complete' | 'completed' | 'cancelled';
373
373
  /**
374
374
  * Service request priority values
375
375
  */
376
- type ServiceRequestPriority = 'low' | 'normal' | 'high' | 'urgent';
376
+ type ServiceRequestPriority = 'low' | 'medium' | 'high' | 'urgent';
377
377
  /**
378
378
  * Service request record
379
379
  */
@@ -612,6 +612,137 @@ interface NotificationResult {
612
612
  /** Error messages if any failures occurred */
613
613
  errors?: string[];
614
614
  }
615
+ /**
616
+ * Integration status values
617
+ */
618
+ type IntegrationStatus = 'draft' | 'pending_review' | 'published' | 'rejected' | 'suspended';
619
+ /**
620
+ * Integration category values
621
+ */
622
+ type IntegrationCategory = 'accounting' | 'analytics' | 'automation' | 'communication' | 'crm' | 'ecommerce' | 'marketing' | 'payments' | 'productivity' | 'scheduling' | 'other';
623
+ /**
624
+ * OAuth scope information
625
+ */
626
+ interface IntegrationScope {
627
+ /** Scope identifier (e.g., 'clients:read') */
628
+ scope: string;
629
+ /** Human-readable description of what the scope allows */
630
+ description: string;
631
+ /** Whether this scope is required for the integration */
632
+ required: boolean;
633
+ }
634
+ /**
635
+ * Published integration in the marketplace
636
+ */
637
+ interface Integration {
638
+ id: string;
639
+ /** URL-friendly identifier */
640
+ slug: string;
641
+ name: string;
642
+ /** Short description (max 200 chars) */
643
+ short_description: string;
644
+ /** Full description with markdown support */
645
+ description: string;
646
+ /** Category for filtering/discovery */
647
+ category: IntegrationCategory;
648
+ /** URL to integration icon/logo */
649
+ icon_url: string | null;
650
+ /** URL to integration website */
651
+ website_url: string | null;
652
+ /** Support email for the integration */
653
+ support_email: string | null;
654
+ /** Privacy policy URL */
655
+ privacy_policy_url: string | null;
656
+ /** Terms of service URL */
657
+ terms_url: string | null;
658
+ /** OAuth scopes required by the integration */
659
+ scopes: IntegrationScope[];
660
+ /** Webhook events the integration subscribes to */
661
+ webhook_events: WebhookEvent[];
662
+ /** Number of businesses using this integration */
663
+ install_count: number;
664
+ /** Average rating (1-5) */
665
+ average_rating: number | null;
666
+ /** Number of reviews */
667
+ review_count: number;
668
+ /** Developer/company information */
669
+ developer: {
670
+ id: string;
671
+ name: string;
672
+ website: string | null;
673
+ verified: boolean;
674
+ };
675
+ /** When the integration was published */
676
+ published_at: string;
677
+ created_at: string;
678
+ updated_at: string | null;
679
+ }
680
+ /**
681
+ * Integration review from a user
682
+ */
683
+ interface IntegrationReview {
684
+ id: string;
685
+ integration_id: string;
686
+ /** Rating 1-5 */
687
+ rating: number;
688
+ /** Review title */
689
+ title: string | null;
690
+ /** Review body */
691
+ content: string | null;
692
+ /** Reviewer display name */
693
+ reviewer_name: string;
694
+ /** When the review was submitted */
695
+ created_at: string;
696
+ }
697
+ /**
698
+ * Options for listing integrations
699
+ */
700
+ interface ListIntegrationsOptions extends ListOptions {
701
+ /** Filter by category */
702
+ category?: IntegrationCategory;
703
+ /** Filter by scope (returns integrations that request this scope) */
704
+ scope?: string;
705
+ /** Sort by: 'popular' | 'recent' | 'rating' | 'name' */
706
+ sort_by?: 'popular' | 'recent' | 'rating' | 'name';
707
+ }
708
+ /**
709
+ * Options for listing integration reviews
710
+ */
711
+ interface ListIntegrationReviewsOptions extends ListOptions {
712
+ /** Minimum rating to filter by */
713
+ min_rating?: number;
714
+ }
715
+ /**
716
+ * Installed integration on a business account
717
+ */
718
+ interface InstalledIntegration {
719
+ id: string;
720
+ integration_id: string;
721
+ integration: Integration;
722
+ /** OAuth access token (masked for security) */
723
+ access_token_prefix: string;
724
+ /** Scopes that were granted */
725
+ granted_scopes: string[];
726
+ /** When the integration was installed */
727
+ installed_at: string;
728
+ /** User who installed the integration */
729
+ installed_by: string | null;
730
+ /** Whether the integration is currently active */
731
+ is_active: boolean;
732
+ }
733
+ /**
734
+ * Options for installing an integration
735
+ */
736
+ interface InstallIntegrationOptions {
737
+ /** Integration ID to install */
738
+ integration_id: string;
739
+ /** Scopes to grant (must be subset of integration's requested scopes) */
740
+ scopes: string[];
741
+ /** OAuth authorization code (from consent flow) */
742
+ authorization_code: string;
743
+ /** PKCE code verifier */
744
+ code_verifier: string;
745
+ }
615
746
 
616
747
  /**
617
748
  * @file resources/clients.ts
@@ -1628,6 +1759,235 @@ declare class NotificationsResource {
1628
1759
  sendCustom(options: SendCustomNotificationOptions): Promise<ApiResponse<NotificationResult>>;
1629
1760
  }
1630
1761
 
1762
+ /**
1763
+ * @file resources/integrations.ts
1764
+ * @description Integration marketplace resource for browsing and managing integrations
1765
+ *
1766
+ * The IntegrationsResource provides methods for:
1767
+ * - Browsing the public integration marketplace
1768
+ * - Viewing integration details and reviews
1769
+ * - Managing installed integrations on your business account
1770
+ */
1771
+
1772
+ /**
1773
+ * Integration marketplace resource
1774
+ *
1775
+ * Provides access to the Workbench integration marketplace, allowing you to
1776
+ * browse published integrations, view reviews, and manage installations.
1777
+ *
1778
+ * @example
1779
+ * ```typescript
1780
+ * // Browse marketplace
1781
+ * const { data: integrations } = await workbench.integrations.list({
1782
+ * category: 'accounting',
1783
+ * sort_by: 'popular'
1784
+ * });
1785
+ *
1786
+ * // Get integration details
1787
+ * const { data: integration } = await workbench.integrations.get('quickbooks');
1788
+ *
1789
+ * // List installed integrations
1790
+ * const { data: installed } = await workbench.integrations.listInstalled();
1791
+ * ```
1792
+ */
1793
+ declare class IntegrationsResource {
1794
+ private readonly client;
1795
+ constructor(client: WorkbenchClient);
1796
+ /**
1797
+ * List published integrations in the marketplace
1798
+ *
1799
+ * Returns a paginated list of published integrations available for installation.
1800
+ * This endpoint is publicly accessible.
1801
+ *
1802
+ * @param options - List options (pagination, filtering, sorting)
1803
+ * @returns Paginated list of integrations
1804
+ *
1805
+ * @example
1806
+ * ```typescript
1807
+ * // List all integrations
1808
+ * const { data, pagination } = await workbench.integrations.list();
1809
+ *
1810
+ * // Filter by category
1811
+ * const { data } = await workbench.integrations.list({
1812
+ * category: 'accounting',
1813
+ * sort_by: 'popular',
1814
+ * per_page: 10
1815
+ * });
1816
+ *
1817
+ * // Search integrations
1818
+ * const { data } = await workbench.integrations.list({
1819
+ * search: 'quickbooks'
1820
+ * });
1821
+ * ```
1822
+ */
1823
+ list(options?: ListIntegrationsOptions): Promise<ListResponse<Integration>>;
1824
+ /**
1825
+ * Get an integration by ID or slug
1826
+ *
1827
+ * Returns detailed information about a specific integration.
1828
+ *
1829
+ * @param idOrSlug - Integration UUID or URL slug
1830
+ * @returns Integration details
1831
+ *
1832
+ * @example
1833
+ * ```typescript
1834
+ * // Get by slug
1835
+ * const { data: integration } = await workbench.integrations.get('quickbooks');
1836
+ *
1837
+ * // Get by ID
1838
+ * const { data: integration } = await workbench.integrations.get('123e4567-e89b-12d3-a456-426614174000');
1839
+ *
1840
+ * console.log(`${integration.name} by ${integration.developer.name}`);
1841
+ * console.log(`Installs: ${integration.install_count}`);
1842
+ * ```
1843
+ */
1844
+ get(idOrSlug: string): Promise<ApiResponse<Integration>>;
1845
+ /**
1846
+ * Get reviews for an integration
1847
+ *
1848
+ * Returns a paginated list of user reviews for a specific integration.
1849
+ *
1850
+ * @param integrationId - Integration UUID or slug
1851
+ * @param options - List options (pagination, filtering)
1852
+ * @returns Paginated list of reviews
1853
+ *
1854
+ * @example
1855
+ * ```typescript
1856
+ * const { data: reviews, pagination } = await workbench.integrations.getReviews('quickbooks', {
1857
+ * min_rating: 4,
1858
+ * per_page: 10
1859
+ * });
1860
+ *
1861
+ * for (const review of reviews) {
1862
+ * console.log(`${review.rating}/5 - ${review.title}`);
1863
+ * }
1864
+ * ```
1865
+ */
1866
+ getReviews(integrationId: string, options?: ListIntegrationReviewsOptions): Promise<ListResponse<IntegrationReview>>;
1867
+ /**
1868
+ * List installed integrations on your business account
1869
+ *
1870
+ * Returns all integrations that have been installed on the authenticated
1871
+ * business account.
1872
+ *
1873
+ * @returns List of installed integrations
1874
+ *
1875
+ * @example
1876
+ * ```typescript
1877
+ * const { data: installed } = await workbench.integrations.listInstalled();
1878
+ *
1879
+ * for (const install of installed) {
1880
+ * console.log(`${install.integration.name} - Active: ${install.is_active}`);
1881
+ * console.log(`Scopes: ${install.granted_scopes.join(', ')}`);
1882
+ * }
1883
+ * ```
1884
+ */
1885
+ listInstalled(): Promise<ListResponse<InstalledIntegration>>;
1886
+ /**
1887
+ * Get an installed integration by ID
1888
+ *
1889
+ * @param installationId - Installation UUID
1890
+ * @returns Installed integration details
1891
+ *
1892
+ * @example
1893
+ * ```typescript
1894
+ * const { data: install } = await workbench.integrations.getInstalled('install-uuid');
1895
+ * console.log(`Installed on: ${install.installed_at}`);
1896
+ * ```
1897
+ */
1898
+ getInstalled(installationId: string): Promise<ApiResponse<InstalledIntegration>>;
1899
+ /**
1900
+ * Install an integration on your business account
1901
+ *
1902
+ * Completes the OAuth flow and installs an integration. This requires an
1903
+ * authorization code obtained from the user consent flow.
1904
+ *
1905
+ * @param options - Installation options including authorization code
1906
+ * @returns Installed integration details
1907
+ *
1908
+ * @example
1909
+ * ```typescript
1910
+ * // After user completes OAuth consent flow:
1911
+ * const { data: install } = await workbench.integrations.install({
1912
+ * integration_id: 'integration-uuid',
1913
+ * scopes: ['clients:read', 'invoices:read'],
1914
+ * authorization_code: 'code_from_oauth_flow',
1915
+ * code_verifier: 'pkce_code_verifier'
1916
+ * });
1917
+ *
1918
+ * console.log(`Installed! Token prefix: ${install.access_token_prefix}`);
1919
+ * ```
1920
+ */
1921
+ install(options: InstallIntegrationOptions): Promise<ApiResponse<InstalledIntegration>>;
1922
+ /**
1923
+ * Uninstall an integration from your business account
1924
+ *
1925
+ * Revokes all access tokens and removes the integration. This action
1926
+ * cannot be undone.
1927
+ *
1928
+ * @param installationId - Installation UUID
1929
+ *
1930
+ * @example
1931
+ * ```typescript
1932
+ * await workbench.integrations.uninstall('install-uuid');
1933
+ * console.log('Integration uninstalled');
1934
+ * ```
1935
+ */
1936
+ uninstall(installationId: string): Promise<void>;
1937
+ /**
1938
+ * Temporarily disable an installed integration
1939
+ *
1940
+ * Pauses the integration without uninstalling it. The integration can
1941
+ * be re-enabled later.
1942
+ *
1943
+ * @param installationId - Installation UUID
1944
+ * @returns Updated installation
1945
+ *
1946
+ * @example
1947
+ * ```typescript
1948
+ * const { data: install } = await workbench.integrations.disable('install-uuid');
1949
+ * console.log(`Active: ${install.is_active}`); // false
1950
+ * ```
1951
+ */
1952
+ disable(installationId: string): Promise<ApiResponse<InstalledIntegration>>;
1953
+ /**
1954
+ * Re-enable a disabled integration
1955
+ *
1956
+ * @param installationId - Installation UUID
1957
+ * @returns Updated installation
1958
+ *
1959
+ * @example
1960
+ * ```typescript
1961
+ * const { data: install } = await workbench.integrations.enable('install-uuid');
1962
+ * console.log(`Active: ${install.is_active}`); // true
1963
+ * ```
1964
+ */
1965
+ enable(installationId: string): Promise<ApiResponse<InstalledIntegration>>;
1966
+ /**
1967
+ * Submit a review for an installed integration
1968
+ *
1969
+ * You can only review integrations that are installed on your business account.
1970
+ *
1971
+ * @param integrationId - Integration UUID
1972
+ * @param review - Review data
1973
+ * @returns Created review
1974
+ *
1975
+ * @example
1976
+ * ```typescript
1977
+ * const { data: review } = await workbench.integrations.submitReview('integration-uuid', {
1978
+ * rating: 5,
1979
+ * title: 'Great integration!',
1980
+ * content: 'This integration saved us hours of manual work...'
1981
+ * });
1982
+ * ```
1983
+ */
1984
+ submitReview(integrationId: string, review: {
1985
+ rating: number;
1986
+ title?: string;
1987
+ content?: string;
1988
+ }): Promise<ApiResponse<IntegrationReview>>;
1989
+ }
1990
+
1631
1991
  /**
1632
1992
  * @file client.ts
1633
1993
  * @description Main Workbench API client class
@@ -1718,6 +2078,8 @@ declare class WorkbenchClient {
1718
2078
  readonly webhooks: WebhooksResource;
1719
2079
  /** Notifications resource */
1720
2080
  readonly notifications: NotificationsResource;
2081
+ /** Integrations marketplace resource */
2082
+ readonly integrations: IntegrationsResource;
1721
2083
  /**
1722
2084
  * Create a new Workbench client
1723
2085
  *
@@ -1899,4 +2261,4 @@ declare function constructWebhookEvent<T = Record<string, unknown>>(payload: str
1899
2261
  timestamp: string;
1900
2262
  };
1901
2263
 
1902
- export { type ApiError, type ApiResponse, type BusinessUserRole, type Client, type ClientStatus, ClientsResource, type CreateClientOptions, type CreateInvoiceOptions, type CreateJobOptions, type CreateQuoteOptions, type CreateServiceRequestOptions, type CreateWebhookOptions, type Invoice, type InvoiceItem, type InvoiceStatus, InvoicesResource, type Job, type JobPriority, type JobStatus, JobsResource, type ListClientsOptions, type ListInvoicesOptions, type ListJobsOptions, type ListOptions, type ListQuotesOptions, type ListResponse, type ListServiceRequestsOptions, type ListWebhookDeliveriesOptions, type NotificationEvent, type NotificationResult, type NotificationType, NotificationsResource, type Pagination, type Quote, type QuoteItem, type QuoteStatus, QuotesResource, type RequestOptions, RequestsResource, type ResponseMeta, type SendCustomNotificationOptions, type SendToClientOptions, type SendToTeamOptions, type ServiceRequest, type ServiceRequestPriority, type ServiceRequestStatus, type UpdateClientOptions, type UpdateInvoiceOptions, type UpdateJobOptions, type UpdateQuoteOptions, type UpdateServiceRequestOptions, type UpdateWebhookOptions, type VerifyOptions, type Webhook, type WebhookDelivery, type WebhookEvent, type WebhookSignature, WebhookVerificationError, WebhooksResource, WorkbenchClient, type WorkbenchConfig, WorkbenchError, computeSignature, constructWebhookEvent, parseSignatureHeader, verifyWebhookSignature };
2264
+ export { type ApiError, type ApiResponse, type BusinessUserRole, type Client, type ClientStatus, ClientsResource, type CreateClientOptions, type CreateInvoiceOptions, type CreateJobOptions, type CreateQuoteOptions, type CreateServiceRequestOptions, type CreateWebhookOptions, type InstallIntegrationOptions, type InstalledIntegration, type Integration, type IntegrationCategory, type IntegrationReview, type IntegrationScope, type IntegrationStatus, IntegrationsResource, type Invoice, type InvoiceItem, type InvoiceStatus, InvoicesResource, type Job, type JobPriority, type JobStatus, JobsResource, type ListClientsOptions, type ListIntegrationReviewsOptions, type ListIntegrationsOptions, type ListInvoicesOptions, type ListJobsOptions, type ListOptions, type ListQuotesOptions, type ListResponse, type ListServiceRequestsOptions, type ListWebhookDeliveriesOptions, type NotificationEvent, type NotificationResult, type NotificationType, NotificationsResource, type Pagination, type Quote, type QuoteItem, type QuoteStatus, QuotesResource, type RequestOptions, RequestsResource, type ResponseMeta, type SendCustomNotificationOptions, type SendToClientOptions, type SendToTeamOptions, type ServiceRequest, type ServiceRequestPriority, type ServiceRequestStatus, type UpdateClientOptions, type UpdateInvoiceOptions, type UpdateJobOptions, type UpdateQuoteOptions, type UpdateServiceRequestOptions, type UpdateWebhookOptions, type VerifyOptions, type Webhook, type WebhookDelivery, type WebhookEvent, type WebhookSignature, WebhookVerificationError, WebhooksResource, WorkbenchClient, type WorkbenchConfig, WorkbenchError, computeSignature, constructWebhookEvent, parseSignatureHeader, verifyWebhookSignature };
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  ClientsResource: () => ClientsResource,
24
+ IntegrationsResource: () => IntegrationsResource,
24
25
  InvoicesResource: () => InvoicesResource,
25
26
  JobsResource: () => JobsResource,
26
27
  NotificationsResource: () => NotificationsResource,
@@ -1013,6 +1014,258 @@ var NotificationsResource = class {
1013
1014
  }
1014
1015
  };
1015
1016
 
1017
+ // src/resources/integrations.ts
1018
+ var IntegrationsResource = class {
1019
+ client;
1020
+ constructor(client) {
1021
+ this.client = client;
1022
+ }
1023
+ // ===========================================
1024
+ // MARKETPLACE (Public)
1025
+ // ===========================================
1026
+ /**
1027
+ * List published integrations in the marketplace
1028
+ *
1029
+ * Returns a paginated list of published integrations available for installation.
1030
+ * This endpoint is publicly accessible.
1031
+ *
1032
+ * @param options - List options (pagination, filtering, sorting)
1033
+ * @returns Paginated list of integrations
1034
+ *
1035
+ * @example
1036
+ * ```typescript
1037
+ * // List all integrations
1038
+ * const { data, pagination } = await workbench.integrations.list();
1039
+ *
1040
+ * // Filter by category
1041
+ * const { data } = await workbench.integrations.list({
1042
+ * category: 'accounting',
1043
+ * sort_by: 'popular',
1044
+ * per_page: 10
1045
+ * });
1046
+ *
1047
+ * // Search integrations
1048
+ * const { data } = await workbench.integrations.list({
1049
+ * search: 'quickbooks'
1050
+ * });
1051
+ * ```
1052
+ */
1053
+ async list(options = {}) {
1054
+ return this.client.get("/v1/integrations", {
1055
+ page: options.page,
1056
+ per_page: options.per_page,
1057
+ search: options.search,
1058
+ category: options.category,
1059
+ scope: options.scope,
1060
+ sort_by: options.sort_by
1061
+ });
1062
+ }
1063
+ /**
1064
+ * Get an integration by ID or slug
1065
+ *
1066
+ * Returns detailed information about a specific integration.
1067
+ *
1068
+ * @param idOrSlug - Integration UUID or URL slug
1069
+ * @returns Integration details
1070
+ *
1071
+ * @example
1072
+ * ```typescript
1073
+ * // Get by slug
1074
+ * const { data: integration } = await workbench.integrations.get('quickbooks');
1075
+ *
1076
+ * // Get by ID
1077
+ * const { data: integration } = await workbench.integrations.get('123e4567-e89b-12d3-a456-426614174000');
1078
+ *
1079
+ * console.log(`${integration.name} by ${integration.developer.name}`);
1080
+ * console.log(`Installs: ${integration.install_count}`);
1081
+ * ```
1082
+ */
1083
+ async get(idOrSlug) {
1084
+ return this.client.get(`/v1/integrations/${idOrSlug}`);
1085
+ }
1086
+ /**
1087
+ * Get reviews for an integration
1088
+ *
1089
+ * Returns a paginated list of user reviews for a specific integration.
1090
+ *
1091
+ * @param integrationId - Integration UUID or slug
1092
+ * @param options - List options (pagination, filtering)
1093
+ * @returns Paginated list of reviews
1094
+ *
1095
+ * @example
1096
+ * ```typescript
1097
+ * const { data: reviews, pagination } = await workbench.integrations.getReviews('quickbooks', {
1098
+ * min_rating: 4,
1099
+ * per_page: 10
1100
+ * });
1101
+ *
1102
+ * for (const review of reviews) {
1103
+ * console.log(`${review.rating}/5 - ${review.title}`);
1104
+ * }
1105
+ * ```
1106
+ */
1107
+ async getReviews(integrationId, options = {}) {
1108
+ return this.client.get(
1109
+ `/v1/integrations/${integrationId}/reviews`,
1110
+ {
1111
+ page: options.page,
1112
+ per_page: options.per_page,
1113
+ min_rating: options.min_rating
1114
+ }
1115
+ );
1116
+ }
1117
+ // ===========================================
1118
+ // INSTALLED INTEGRATIONS (Authenticated)
1119
+ // ===========================================
1120
+ /**
1121
+ * List installed integrations on your business account
1122
+ *
1123
+ * Returns all integrations that have been installed on the authenticated
1124
+ * business account.
1125
+ *
1126
+ * @returns List of installed integrations
1127
+ *
1128
+ * @example
1129
+ * ```typescript
1130
+ * const { data: installed } = await workbench.integrations.listInstalled();
1131
+ *
1132
+ * for (const install of installed) {
1133
+ * console.log(`${install.integration.name} - Active: ${install.is_active}`);
1134
+ * console.log(`Scopes: ${install.granted_scopes.join(', ')}`);
1135
+ * }
1136
+ * ```
1137
+ */
1138
+ async listInstalled() {
1139
+ return this.client.get("/v1/integrations/installed");
1140
+ }
1141
+ /**
1142
+ * Get an installed integration by ID
1143
+ *
1144
+ * @param installationId - Installation UUID
1145
+ * @returns Installed integration details
1146
+ *
1147
+ * @example
1148
+ * ```typescript
1149
+ * const { data: install } = await workbench.integrations.getInstalled('install-uuid');
1150
+ * console.log(`Installed on: ${install.installed_at}`);
1151
+ * ```
1152
+ */
1153
+ async getInstalled(installationId) {
1154
+ return this.client.get(
1155
+ `/v1/integrations/installed/${installationId}`
1156
+ );
1157
+ }
1158
+ /**
1159
+ * Install an integration on your business account
1160
+ *
1161
+ * Completes the OAuth flow and installs an integration. This requires an
1162
+ * authorization code obtained from the user consent flow.
1163
+ *
1164
+ * @param options - Installation options including authorization code
1165
+ * @returns Installed integration details
1166
+ *
1167
+ * @example
1168
+ * ```typescript
1169
+ * // After user completes OAuth consent flow:
1170
+ * const { data: install } = await workbench.integrations.install({
1171
+ * integration_id: 'integration-uuid',
1172
+ * scopes: ['clients:read', 'invoices:read'],
1173
+ * authorization_code: 'code_from_oauth_flow',
1174
+ * code_verifier: 'pkce_code_verifier'
1175
+ * });
1176
+ *
1177
+ * console.log(`Installed! Token prefix: ${install.access_token_prefix}`);
1178
+ * ```
1179
+ */
1180
+ async install(options) {
1181
+ return this.client.post(
1182
+ "/v1/integrations/install",
1183
+ options
1184
+ );
1185
+ }
1186
+ /**
1187
+ * Uninstall an integration from your business account
1188
+ *
1189
+ * Revokes all access tokens and removes the integration. This action
1190
+ * cannot be undone.
1191
+ *
1192
+ * @param installationId - Installation UUID
1193
+ *
1194
+ * @example
1195
+ * ```typescript
1196
+ * await workbench.integrations.uninstall('install-uuid');
1197
+ * console.log('Integration uninstalled');
1198
+ * ```
1199
+ */
1200
+ async uninstall(installationId) {
1201
+ await this.client.delete(`/v1/integrations/installed/${installationId}`);
1202
+ }
1203
+ /**
1204
+ * Temporarily disable an installed integration
1205
+ *
1206
+ * Pauses the integration without uninstalling it. The integration can
1207
+ * be re-enabled later.
1208
+ *
1209
+ * @param installationId - Installation UUID
1210
+ * @returns Updated installation
1211
+ *
1212
+ * @example
1213
+ * ```typescript
1214
+ * const { data: install } = await workbench.integrations.disable('install-uuid');
1215
+ * console.log(`Active: ${install.is_active}`); // false
1216
+ * ```
1217
+ */
1218
+ async disable(installationId) {
1219
+ return this.client.post(
1220
+ `/v1/integrations/installed/${installationId}/disable`
1221
+ );
1222
+ }
1223
+ /**
1224
+ * Re-enable a disabled integration
1225
+ *
1226
+ * @param installationId - Installation UUID
1227
+ * @returns Updated installation
1228
+ *
1229
+ * @example
1230
+ * ```typescript
1231
+ * const { data: install } = await workbench.integrations.enable('install-uuid');
1232
+ * console.log(`Active: ${install.is_active}`); // true
1233
+ * ```
1234
+ */
1235
+ async enable(installationId) {
1236
+ return this.client.post(
1237
+ `/v1/integrations/installed/${installationId}/enable`
1238
+ );
1239
+ }
1240
+ // ===========================================
1241
+ // REVIEWS (Authenticated)
1242
+ // ===========================================
1243
+ /**
1244
+ * Submit a review for an installed integration
1245
+ *
1246
+ * You can only review integrations that are installed on your business account.
1247
+ *
1248
+ * @param integrationId - Integration UUID
1249
+ * @param review - Review data
1250
+ * @returns Created review
1251
+ *
1252
+ * @example
1253
+ * ```typescript
1254
+ * const { data: review } = await workbench.integrations.submitReview('integration-uuid', {
1255
+ * rating: 5,
1256
+ * title: 'Great integration!',
1257
+ * content: 'This integration saved us hours of manual work...'
1258
+ * });
1259
+ * ```
1260
+ */
1261
+ async submitReview(integrationId, review) {
1262
+ return this.client.post(
1263
+ `/v1/integrations/${integrationId}/reviews`,
1264
+ review
1265
+ );
1266
+ }
1267
+ };
1268
+
1016
1269
  // src/client.ts
1017
1270
  var DEFAULT_BASE_URL = "https://api.tryworkbench.app";
1018
1271
  var DEFAULT_TIMEOUT = 3e4;
@@ -1054,6 +1307,8 @@ var WorkbenchClient = class {
1054
1307
  webhooks;
1055
1308
  /** Notifications resource */
1056
1309
  notifications;
1310
+ /** Integrations marketplace resource */
1311
+ integrations;
1057
1312
  /**
1058
1313
  * Create a new Workbench client
1059
1314
  *
@@ -1076,6 +1331,7 @@ var WorkbenchClient = class {
1076
1331
  this.requests = new RequestsResource(this);
1077
1332
  this.webhooks = new WebhooksResource(this);
1078
1333
  this.notifications = new NotificationsResource(this);
1334
+ this.integrations = new IntegrationsResource(this);
1079
1335
  }
1080
1336
  /**
1081
1337
  * Build URL with query parameters
@@ -1288,6 +1544,7 @@ function constructWebhookEvent(payload, signature, secret, options = {}) {
1288
1544
  // Annotate the CommonJS export names for ESM import in node:
1289
1545
  0 && (module.exports = {
1290
1546
  ClientsResource,
1547
+ IntegrationsResource,
1291
1548
  InvoicesResource,
1292
1549
  JobsResource,
1293
1550
  NotificationsResource,
package/dist/index.mjs CHANGED
@@ -974,6 +974,258 @@ var NotificationsResource = class {
974
974
  }
975
975
  };
976
976
 
977
+ // src/resources/integrations.ts
978
+ var IntegrationsResource = class {
979
+ client;
980
+ constructor(client) {
981
+ this.client = client;
982
+ }
983
+ // ===========================================
984
+ // MARKETPLACE (Public)
985
+ // ===========================================
986
+ /**
987
+ * List published integrations in the marketplace
988
+ *
989
+ * Returns a paginated list of published integrations available for installation.
990
+ * This endpoint is publicly accessible.
991
+ *
992
+ * @param options - List options (pagination, filtering, sorting)
993
+ * @returns Paginated list of integrations
994
+ *
995
+ * @example
996
+ * ```typescript
997
+ * // List all integrations
998
+ * const { data, pagination } = await workbench.integrations.list();
999
+ *
1000
+ * // Filter by category
1001
+ * const { data } = await workbench.integrations.list({
1002
+ * category: 'accounting',
1003
+ * sort_by: 'popular',
1004
+ * per_page: 10
1005
+ * });
1006
+ *
1007
+ * // Search integrations
1008
+ * const { data } = await workbench.integrations.list({
1009
+ * search: 'quickbooks'
1010
+ * });
1011
+ * ```
1012
+ */
1013
+ async list(options = {}) {
1014
+ return this.client.get("/v1/integrations", {
1015
+ page: options.page,
1016
+ per_page: options.per_page,
1017
+ search: options.search,
1018
+ category: options.category,
1019
+ scope: options.scope,
1020
+ sort_by: options.sort_by
1021
+ });
1022
+ }
1023
+ /**
1024
+ * Get an integration by ID or slug
1025
+ *
1026
+ * Returns detailed information about a specific integration.
1027
+ *
1028
+ * @param idOrSlug - Integration UUID or URL slug
1029
+ * @returns Integration details
1030
+ *
1031
+ * @example
1032
+ * ```typescript
1033
+ * // Get by slug
1034
+ * const { data: integration } = await workbench.integrations.get('quickbooks');
1035
+ *
1036
+ * // Get by ID
1037
+ * const { data: integration } = await workbench.integrations.get('123e4567-e89b-12d3-a456-426614174000');
1038
+ *
1039
+ * console.log(`${integration.name} by ${integration.developer.name}`);
1040
+ * console.log(`Installs: ${integration.install_count}`);
1041
+ * ```
1042
+ */
1043
+ async get(idOrSlug) {
1044
+ return this.client.get(`/v1/integrations/${idOrSlug}`);
1045
+ }
1046
+ /**
1047
+ * Get reviews for an integration
1048
+ *
1049
+ * Returns a paginated list of user reviews for a specific integration.
1050
+ *
1051
+ * @param integrationId - Integration UUID or slug
1052
+ * @param options - List options (pagination, filtering)
1053
+ * @returns Paginated list of reviews
1054
+ *
1055
+ * @example
1056
+ * ```typescript
1057
+ * const { data: reviews, pagination } = await workbench.integrations.getReviews('quickbooks', {
1058
+ * min_rating: 4,
1059
+ * per_page: 10
1060
+ * });
1061
+ *
1062
+ * for (const review of reviews) {
1063
+ * console.log(`${review.rating}/5 - ${review.title}`);
1064
+ * }
1065
+ * ```
1066
+ */
1067
+ async getReviews(integrationId, options = {}) {
1068
+ return this.client.get(
1069
+ `/v1/integrations/${integrationId}/reviews`,
1070
+ {
1071
+ page: options.page,
1072
+ per_page: options.per_page,
1073
+ min_rating: options.min_rating
1074
+ }
1075
+ );
1076
+ }
1077
+ // ===========================================
1078
+ // INSTALLED INTEGRATIONS (Authenticated)
1079
+ // ===========================================
1080
+ /**
1081
+ * List installed integrations on your business account
1082
+ *
1083
+ * Returns all integrations that have been installed on the authenticated
1084
+ * business account.
1085
+ *
1086
+ * @returns List of installed integrations
1087
+ *
1088
+ * @example
1089
+ * ```typescript
1090
+ * const { data: installed } = await workbench.integrations.listInstalled();
1091
+ *
1092
+ * for (const install of installed) {
1093
+ * console.log(`${install.integration.name} - Active: ${install.is_active}`);
1094
+ * console.log(`Scopes: ${install.granted_scopes.join(', ')}`);
1095
+ * }
1096
+ * ```
1097
+ */
1098
+ async listInstalled() {
1099
+ return this.client.get("/v1/integrations/installed");
1100
+ }
1101
+ /**
1102
+ * Get an installed integration by ID
1103
+ *
1104
+ * @param installationId - Installation UUID
1105
+ * @returns Installed integration details
1106
+ *
1107
+ * @example
1108
+ * ```typescript
1109
+ * const { data: install } = await workbench.integrations.getInstalled('install-uuid');
1110
+ * console.log(`Installed on: ${install.installed_at}`);
1111
+ * ```
1112
+ */
1113
+ async getInstalled(installationId) {
1114
+ return this.client.get(
1115
+ `/v1/integrations/installed/${installationId}`
1116
+ );
1117
+ }
1118
+ /**
1119
+ * Install an integration on your business account
1120
+ *
1121
+ * Completes the OAuth flow and installs an integration. This requires an
1122
+ * authorization code obtained from the user consent flow.
1123
+ *
1124
+ * @param options - Installation options including authorization code
1125
+ * @returns Installed integration details
1126
+ *
1127
+ * @example
1128
+ * ```typescript
1129
+ * // After user completes OAuth consent flow:
1130
+ * const { data: install } = await workbench.integrations.install({
1131
+ * integration_id: 'integration-uuid',
1132
+ * scopes: ['clients:read', 'invoices:read'],
1133
+ * authorization_code: 'code_from_oauth_flow',
1134
+ * code_verifier: 'pkce_code_verifier'
1135
+ * });
1136
+ *
1137
+ * console.log(`Installed! Token prefix: ${install.access_token_prefix}`);
1138
+ * ```
1139
+ */
1140
+ async install(options) {
1141
+ return this.client.post(
1142
+ "/v1/integrations/install",
1143
+ options
1144
+ );
1145
+ }
1146
+ /**
1147
+ * Uninstall an integration from your business account
1148
+ *
1149
+ * Revokes all access tokens and removes the integration. This action
1150
+ * cannot be undone.
1151
+ *
1152
+ * @param installationId - Installation UUID
1153
+ *
1154
+ * @example
1155
+ * ```typescript
1156
+ * await workbench.integrations.uninstall('install-uuid');
1157
+ * console.log('Integration uninstalled');
1158
+ * ```
1159
+ */
1160
+ async uninstall(installationId) {
1161
+ await this.client.delete(`/v1/integrations/installed/${installationId}`);
1162
+ }
1163
+ /**
1164
+ * Temporarily disable an installed integration
1165
+ *
1166
+ * Pauses the integration without uninstalling it. The integration can
1167
+ * be re-enabled later.
1168
+ *
1169
+ * @param installationId - Installation UUID
1170
+ * @returns Updated installation
1171
+ *
1172
+ * @example
1173
+ * ```typescript
1174
+ * const { data: install } = await workbench.integrations.disable('install-uuid');
1175
+ * console.log(`Active: ${install.is_active}`); // false
1176
+ * ```
1177
+ */
1178
+ async disable(installationId) {
1179
+ return this.client.post(
1180
+ `/v1/integrations/installed/${installationId}/disable`
1181
+ );
1182
+ }
1183
+ /**
1184
+ * Re-enable a disabled integration
1185
+ *
1186
+ * @param installationId - Installation UUID
1187
+ * @returns Updated installation
1188
+ *
1189
+ * @example
1190
+ * ```typescript
1191
+ * const { data: install } = await workbench.integrations.enable('install-uuid');
1192
+ * console.log(`Active: ${install.is_active}`); // true
1193
+ * ```
1194
+ */
1195
+ async enable(installationId) {
1196
+ return this.client.post(
1197
+ `/v1/integrations/installed/${installationId}/enable`
1198
+ );
1199
+ }
1200
+ // ===========================================
1201
+ // REVIEWS (Authenticated)
1202
+ // ===========================================
1203
+ /**
1204
+ * Submit a review for an installed integration
1205
+ *
1206
+ * You can only review integrations that are installed on your business account.
1207
+ *
1208
+ * @param integrationId - Integration UUID
1209
+ * @param review - Review data
1210
+ * @returns Created review
1211
+ *
1212
+ * @example
1213
+ * ```typescript
1214
+ * const { data: review } = await workbench.integrations.submitReview('integration-uuid', {
1215
+ * rating: 5,
1216
+ * title: 'Great integration!',
1217
+ * content: 'This integration saved us hours of manual work...'
1218
+ * });
1219
+ * ```
1220
+ */
1221
+ async submitReview(integrationId, review) {
1222
+ return this.client.post(
1223
+ `/v1/integrations/${integrationId}/reviews`,
1224
+ review
1225
+ );
1226
+ }
1227
+ };
1228
+
977
1229
  // src/client.ts
978
1230
  var DEFAULT_BASE_URL = "https://api.tryworkbench.app";
979
1231
  var DEFAULT_TIMEOUT = 3e4;
@@ -1015,6 +1267,8 @@ var WorkbenchClient = class {
1015
1267
  webhooks;
1016
1268
  /** Notifications resource */
1017
1269
  notifications;
1270
+ /** Integrations marketplace resource */
1271
+ integrations;
1018
1272
  /**
1019
1273
  * Create a new Workbench client
1020
1274
  *
@@ -1037,6 +1291,7 @@ var WorkbenchClient = class {
1037
1291
  this.requests = new RequestsResource(this);
1038
1292
  this.webhooks = new WebhooksResource(this);
1039
1293
  this.notifications = new NotificationsResource(this);
1294
+ this.integrations = new IntegrationsResource(this);
1040
1295
  }
1041
1296
  /**
1042
1297
  * Build URL with query parameters
@@ -1248,6 +1503,7 @@ function constructWebhookEvent(payload, signature, secret, options = {}) {
1248
1503
  }
1249
1504
  export {
1250
1505
  ClientsResource,
1506
+ IntegrationsResource,
1251
1507
  InvoicesResource,
1252
1508
  JobsResource,
1253
1509
  NotificationsResource,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workbenchcrm/sdk",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Official Node.js SDK for the Workbench CRM API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",