/** * [SERVICE_NAME] Integration for WORKWAY * * [Brief description of what this integration enables] * * Implements the SDK patterns: * - Extends BaseAPIClient for DRY HTTP handling * - ActionResult narrow waist for output * - IntegrationError narrow waist for errors * - Automatic token refresh support * - Honest ActionCapabilities declaration * * @example * ```typescript * import { ServiceName } from '@workwayco/integrations/service-name'; * * const client = new ServiceName({ accessToken: env.SERVICE_API_KEY }); * * // Get a resource (uses getJson helper) * const result = await client.getResource('resource-id'); * if (result.success) { * console.log(result.data); * } * * // Update a resource (uses patchJson helper) * const updated = await client.updateResource('resource-id', { name: 'New Name' }); * ``` */ import { ActionResult } from '@workwayco/sdk'; import { BaseAPIClient } from '../core/index.js'; /** * Integration configuration */ export interface ServiceNameConfig { /** OAuth access token */ accessToken: string; /** Optional: Override API endpoint (for testing) */ apiUrl?: string; /** Request timeout in milliseconds (default: 30000) */ timeout?: number; /** Optional: OAuth refresh token for automatic token refresh */ refreshToken?: string; /** Optional: OAuth client ID for token refresh */ clientId?: string; /** Optional: OAuth client secret for token refresh */ clientSecret?: string; /** Optional: Callback to update tokens after refresh */ onTokenRefreshed?: (newAccessToken: string, newRefreshToken?: string) => void | Promise; } /** * Example resource type - replace with actual types */ export interface ServiceResource { id: string; name: string; createdAt: number; updatedAt: number; metadata: Record; } /** * List response wrapper */ export interface ServiceList { items: T[]; hasMore: boolean; cursor?: string; } export interface CreateResourceOptions { name: string; description?: string; metadata?: Record; } export interface ListResourcesOptions { /** Maximum number of results (default: 10, max: 100) */ limit?: number; /** Pagination cursor */ cursor?: string; } /** * [SERVICE_NAME] Integration * * Extends BaseAPIClient for DRY HTTP handling with automatic token refresh. */ export declare class ServiceName extends BaseAPIClient { constructor(config: ServiceNameConfig); /** * Get a resource by ID */ getResource(id: string): Promise>; /** * Create a new resource */ createResource(options: CreateResourceOptions): Promise>; /** * Update a resource */ updateResource(id: string, updates: Partial): Promise>; /** * List resources with pagination */ listResources(options?: ListResourcesOptions): Promise>>; /** * Delete a resource */ deleteResource(id: string): Promise>; /** * Parse and verify a webhook event * * This is a template-specific helper. Adjust signature verification * based on your service's webhook signature format. * * @param payload - Raw request body * @param signature - Signature header from webhook * @param webhookSecret - Webhook secret for verification */ parseWebhookEvent(payload: string, signature: string, webhookSecret: string): Promise>; /** * Get capabilities - be honest about what this integration can do */ private getCapabilities; /** * Compute HMAC-SHA256 signature for webhook verification * * Template-specific helper: Keep this method when using this template. * Different services use different signature algorithms (HMAC-SHA256, * HMAC-SHA1, etc.). Adjust as needed for your service. */ private computeHmac; } //# sourceMappingURL=index.d.ts.map