bc-api-client 0.1.0-beta.1 → 0.1.0-beta.3

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/client.d.ts CHANGED
@@ -1,30 +1,103 @@
1
1
  import { RateLimitOptions, RequestOptions, StoreOptions } from './net';
2
+ /**
3
+ * Options for GET requests to the BigCommerce API
4
+ */
2
5
  export type GetOptions = {
6
+ /** The API endpoint to call */
3
7
  endpoint: string;
8
+ /** Query parameters to include in the request */
4
9
  query?: Record<string, string>;
10
+ /** API version to use (v2 or v3) */
5
11
  version?: 'v2' | 'v3';
6
12
  };
13
+ /**
14
+ * Options for POST/PUT requests to the BigCommerce API
15
+ */
7
16
  export type PostOptions<T> = GetOptions & {
17
+ /** Request body data */
8
18
  body: T;
9
19
  };
20
+ /**
21
+ * Options for controlling concurrent request behavior
22
+ */
10
23
  export type ConcurrencyOptions = {
24
+ /** Maximum number of concurrent requests (default: 10) */
11
25
  concurrency?: number;
26
+ /** Whether to skip errors and continue processing (default: false) */
12
27
  skipErrors?: boolean;
13
28
  };
29
+ /**
30
+ * Options for querying multiple values against a single filter field
31
+ */
14
32
  export type QueryOptions = Omit<GetOptions, 'version'> & ConcurrencyOptions & {
33
+ /** The field name to query against */
15
34
  key: string;
35
+ /** Array of values to query for */
16
36
  values: (string | number)[];
17
37
  };
38
+ /**
39
+ * Configuration options for the BigCommerce client
40
+ */
18
41
  export type Config = StoreOptions & RateLimitOptions;
42
+ /**
43
+ * Client for interacting with the BigCommerce API
44
+ *
45
+ * This client provides methods for making HTTP requests to the BigCommerce API,
46
+ * with support for both v2 and v3 endpoints, pagination, and concurrent requests.
47
+ */
19
48
  export declare class BigCommerceClient {
20
49
  private readonly config;
50
+ /**
51
+ * Creates a new BigCommerce client instance
52
+ * @param config - Configuration options for the client
53
+ */
21
54
  constructor(config: Config);
55
+ /**
56
+ * Makes a GET request to the BigCommerce API
57
+ * @param options - Request options
58
+ * @returns Promise resolving to the response data
59
+ */
22
60
  get<R>(options: GetOptions): Promise<R>;
61
+ /**
62
+ * Makes a POST request to the BigCommerce API
63
+ * @param options - Request options including body data
64
+ * @returns Promise resolving to the response data
65
+ */
23
66
  post<T, R>(options: PostOptions<T>): Promise<R>;
67
+ /**
68
+ * Makes a PUT request to the BigCommerce API
69
+ * @param options - Request options including body data
70
+ * @returns Promise resolving to the response data
71
+ */
24
72
  put<T, R>(options: PostOptions<T>): Promise<R>;
73
+ /**
74
+ * Makes a DELETE request to the BigCommerce API
75
+ * @param endpoint - The API endpoint to delete
76
+ */
25
77
  delete<R>(endpoint: string): Promise<void>;
78
+ /**
79
+ * Executes multiple requests concurrently with controlled concurrency
80
+ * @param requests - Array of request options to execute
81
+ * @param options - Concurrency control options
82
+ * @returns Promise resolving to array of response data
83
+ */
26
84
  concurrent<T, R>(requests: RequestOptions<T>[], options: ConcurrencyOptions): Promise<R[]>;
85
+ /**
86
+ * Collects all pages of data from a paginated v3 API endpoint
87
+ * @param options - Request options with pagination parameters
88
+ * @returns Promise resolving to array of all items across all pages
89
+ */
27
90
  collect<T>(options: Omit<GetOptions, 'version'> & ConcurrencyOptions): Promise<T[]>;
91
+ /**
92
+ * Collects all pages of data from a paginated v2 API endpoint
93
+ * @param options - Request options with pagination parameters
94
+ * @returns Promise resolving to array of all items across all pages
95
+ */
28
96
  collectV2<T>(options: Omit<GetOptions, 'version'> & ConcurrencyOptions): Promise<T[]>;
97
+ /**
98
+ * Queries multiple values against a single field using the v3 API
99
+ * @param options - Query options including field name and values
100
+ * @returns Promise resolving to array of matching items
101
+ */
29
102
  query<T>(options: QueryOptions): Promise<T[]>;
30
103
  }
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './client';
2
2
  export * from './core';
3
3
  export * from './auth';
4
+ export { Methods } from './net';