@bunnyapp/api-client
Version:
Node.js client for Bunny CRM
58 lines • 2.27 kB
TypeScript
import { AxiosInstance } from "axios";
import Webhooks from "./webhooks";
import subscriptionCreate from "./helpers/subscription-create";
import subscriptionCancel from "./helpers/subscription-cancel";
import tenantByCode from "./helpers/tenant-by-code";
import tenantCreate from "./helpers/tenant-create";
import tenantUpdate from "./helpers/tenant-update";
import featureUsageCreate from "./helpers/feature-usage-create";
import portalSessionCreate from "./helpers/portal-session-create";
import accountUpdateByTenantCode from "./helpers/account-update-by-tenant-code";
import tenantMetricsUpdate from "./helpers/tenant-metrics-update";
export * from './types';
declare module 'axios' {
interface InternalAxiosRequestConfig {
retry?: boolean;
}
}
interface BunnyOptions {
baseUrl?: string;
accessToken?: string;
clientId?: string;
clientSecret?: string;
scope?: string;
webhookSigningToken?: string;
}
declare class Bunny {
options: BunnyOptions;
retryEnabled: boolean;
client: AxiosInstance;
webhooks: Webhooks;
subscriptionCreate: typeof subscriptionCreate;
subscriptionCancel: typeof subscriptionCancel;
tenantByCode: typeof tenantByCode;
tenantCreate: typeof tenantCreate;
tenantUpdate: typeof tenantUpdate;
featureUsageCreate: typeof featureUsageCreate;
portalSessionCreate: typeof portalSessionCreate;
accountUpdateByTenantCode: typeof accountUpdateByTenantCode;
tenantMetricsUpdate: typeof tenantMetricsUpdate;
constructor(options?: BunnyOptions);
fetchAccessToken(): Promise<string>;
/**
* Execute a GraphQL query against the Bunny API
* @template TData The expected shape of the response data
* @template TVariables The shape of the variables object
* @param {string} query The GraphQL query string
* @param {TVariables} [variables] Optional variables for the query
* @returns {Promise<{ data?: TData; errors?: Array<{ message: string }> }>}
*/
query<TData = unknown, TVariables = Record<string, unknown>>(query: string, variables?: TVariables): Promise<{
data?: TData;
errors?: Array<{
message: string;
}>;
}>;
}
export default Bunny;
//# sourceMappingURL=index.d.ts.map