proofio-sdk 1.0.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/README.md +319 -0
- package/dist/cjs/client/api-client.js +284 -0
- package/dist/cjs/index.js +74 -0
- package/dist/cjs/resources/competitors.js +45 -0
- package/dist/cjs/resources/insights.js +101 -0
- package/dist/cjs/resources/reviews.js +69 -0
- package/dist/cjs/resources/widget.js +58 -0
- package/dist/cjs/types/index.js +7 -0
- package/dist/cjs/utils/errors.js +50 -0
- package/dist/client/api-client.d.ts +68 -0
- package/dist/client/api-client.d.ts.map +1 -0
- package/dist/esm/client/api-client.js +280 -0
- package/dist/esm/index.js +68 -0
- package/dist/esm/resources/competitors.js +41 -0
- package/dist/esm/resources/insights.js +97 -0
- package/dist/esm/resources/reviews.js +65 -0
- package/dist/esm/resources/widget.js +54 -0
- package/dist/esm/types/index.js +6 -0
- package/dist/esm/utils/errors.js +46 -0
- package/dist/index.d.ts +66 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/resources/competitors.d.ts +33 -0
- package/dist/resources/competitors.d.ts.map +1 -0
- package/dist/resources/insights.d.ts +46 -0
- package/dist/resources/insights.d.ts.map +1 -0
- package/dist/resources/reviews.d.ts +29 -0
- package/dist/resources/reviews.d.ts.map +1 -0
- package/dist/resources/widget.d.ts +44 -0
- package/dist/resources/widget.d.ts.map +1 -0
- package/dist/types/index.d.ts +217 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/errors.d.ts +32 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Proofio SDK
|
|
3
|
+
*
|
|
4
|
+
* Official JavaScript/TypeScript SDK for Proofio API
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { Proofio } from 'proofio-sdk';
|
|
9
|
+
*
|
|
10
|
+
* const proofio = new Proofio({ apiKey: 'your-api-key' });
|
|
11
|
+
*
|
|
12
|
+
* const reviews = await proofio.reviews.list();
|
|
13
|
+
* const summary = await proofio.insights.summary();
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
import { ApiClient } from './client/api-client';
|
|
17
|
+
import { ReviewsResource } from './resources/reviews';
|
|
18
|
+
import { InsightsResource } from './resources/insights';
|
|
19
|
+
import { CompetitorsResource } from './resources/competitors';
|
|
20
|
+
import { WidgetResource } from './resources/widget';
|
|
21
|
+
export { ProofioError } from './utils/errors';
|
|
22
|
+
export { ApiClient } from './client/api-client';
|
|
23
|
+
/**
|
|
24
|
+
* Main Proofio SDK Client
|
|
25
|
+
*
|
|
26
|
+
* Provides access to all Proofio API resources:
|
|
27
|
+
* - reviews: List and get reviews
|
|
28
|
+
* - insights: Get summaries and trends
|
|
29
|
+
* - competitors: Compare with competitors
|
|
30
|
+
* - widget: Get widget data and configuration
|
|
31
|
+
*/
|
|
32
|
+
export class Proofio {
|
|
33
|
+
/**
|
|
34
|
+
* Create a new Proofio SDK instance
|
|
35
|
+
*
|
|
36
|
+
* @param config - SDK configuration
|
|
37
|
+
* @param config.apiKey - Your Proofio API key (required)
|
|
38
|
+
* @param config.baseURL - Base URL for API (default: https://proofio.app)
|
|
39
|
+
* @param config.timeout - Request timeout in milliseconds (default: 30000)
|
|
40
|
+
* @param config.maxRetries - Maximum number of retries (default: 3)
|
|
41
|
+
* @param config.retryDelay - Delay between retries in milliseconds (default: 1000)
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const proofio = new Proofio({
|
|
46
|
+
* apiKey: 'your-api-key-here',
|
|
47
|
+
* baseURL: 'https://proofio.app', // optional
|
|
48
|
+
* timeout: 30000, // optional
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
constructor(config) {
|
|
53
|
+
this.client = new ApiClient(config);
|
|
54
|
+
// Initialize resources
|
|
55
|
+
this.reviews = new ReviewsResource(this.client);
|
|
56
|
+
this.insights = new InsightsResource(this.client);
|
|
57
|
+
this.competitors = new CompetitorsResource(this.client);
|
|
58
|
+
this.widget = new WidgetResource(this.client);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get the underlying API client (for advanced usage)
|
|
62
|
+
*/
|
|
63
|
+
getClient() {
|
|
64
|
+
return this.client;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// Default export
|
|
68
|
+
export default Proofio;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Competitors Resource
|
|
3
|
+
*
|
|
4
|
+
* Handles competitor comparison functionality
|
|
5
|
+
*
|
|
6
|
+
* Note: Competitor comparison requires authentication and is typically
|
|
7
|
+
* accessed via the dashboard API. This resource provides a placeholder
|
|
8
|
+
* structure that matches the SDK API style.
|
|
9
|
+
*/
|
|
10
|
+
export class CompetitorsResource {
|
|
11
|
+
constructor(client) {
|
|
12
|
+
this.client = client;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Compare with a competitor
|
|
16
|
+
*
|
|
17
|
+
* Generates an AI-powered comparison between your product and a competitor.
|
|
18
|
+
*
|
|
19
|
+
* Note: This endpoint requires dashboard API access (authentication).
|
|
20
|
+
* The public API doesn't support competitor comparisons directly.
|
|
21
|
+
* This method is provided for API consistency but may require
|
|
22
|
+
* additional authentication setup.
|
|
23
|
+
*
|
|
24
|
+
* @param competitorId - Competitor ID
|
|
25
|
+
* @param options - Optional parameters (e.g., force refresh)
|
|
26
|
+
* @returns Promise with competitor comparison
|
|
27
|
+
*/
|
|
28
|
+
async compare(competitorId, options) {
|
|
29
|
+
const queryParams = {};
|
|
30
|
+
if (options?.force) {
|
|
31
|
+
queryParams.force = 'true';
|
|
32
|
+
}
|
|
33
|
+
// Note: This endpoint typically requires authentication
|
|
34
|
+
// The public API doesn't expose competitor comparisons
|
|
35
|
+
// This is a placeholder that matches the expected API structure
|
|
36
|
+
const response = await this.client.get(`/api/dashboard/competitors/${competitorId}/comparison`, {
|
|
37
|
+
queryParams,
|
|
38
|
+
});
|
|
39
|
+
return response.data;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Insights Resource
|
|
3
|
+
*
|
|
4
|
+
* Handles insights, summaries, and trend analysis
|
|
5
|
+
*/
|
|
6
|
+
export class InsightsResource {
|
|
7
|
+
constructor(client) {
|
|
8
|
+
this.client = client;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Get insight summary
|
|
12
|
+
*
|
|
13
|
+
* Returns aggregated statistics including:
|
|
14
|
+
* - Total reviews
|
|
15
|
+
* - Average rating
|
|
16
|
+
* - Rating distribution
|
|
17
|
+
* - Sentiment distribution
|
|
18
|
+
* - Source breakdown
|
|
19
|
+
* - AI summary (if available for paid plans)
|
|
20
|
+
*
|
|
21
|
+
* @returns Promise with insight summary
|
|
22
|
+
*/
|
|
23
|
+
async summary() {
|
|
24
|
+
const response = await this.client.get('/api/v1/public/aggregations');
|
|
25
|
+
return response.data;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get trend analysis
|
|
29
|
+
*
|
|
30
|
+
* Returns detailed trend data including:
|
|
31
|
+
* - Trend over time (last 30 days)
|
|
32
|
+
* - Review volume (7, 30, 90 days)
|
|
33
|
+
* - Top topics
|
|
34
|
+
* - Key takeaways
|
|
35
|
+
* - Recent changes
|
|
36
|
+
*
|
|
37
|
+
* Note: The public API provides limited trend data. For full trend analysis
|
|
38
|
+
* including trendOverTime, topTopics, and recentChanges, you need access
|
|
39
|
+
* to the dashboard API (requires authentication).
|
|
40
|
+
*
|
|
41
|
+
* This method returns available data from the public aggregations endpoint
|
|
42
|
+
* and sets default/empty values for fields not available in the public API.
|
|
43
|
+
*
|
|
44
|
+
* @returns Promise with trend data
|
|
45
|
+
*/
|
|
46
|
+
async trends() {
|
|
47
|
+
// Get data from public aggregations endpoint
|
|
48
|
+
const response = await this.client.get('/api/v1/public/aggregations');
|
|
49
|
+
const data = response.data;
|
|
50
|
+
// Calculate positive percentage
|
|
51
|
+
const positivePercentage = data.totalReviews > 0
|
|
52
|
+
? (data.sentimentDistribution.positive / data.totalReviews) * 100
|
|
53
|
+
: 0;
|
|
54
|
+
// Transform to InsightTrends format
|
|
55
|
+
// Note: The public API doesn't provide all trend fields,
|
|
56
|
+
// so we provide what's available and set defaults for missing fields
|
|
57
|
+
return {
|
|
58
|
+
totalReviews: data.totalReviews,
|
|
59
|
+
averageRating: data.averageRating,
|
|
60
|
+
ratingDistribution: data.ratingDistribution,
|
|
61
|
+
sentimentDistribution: data.sentimentDistribution,
|
|
62
|
+
thisWeekCount: 0, // Not available in public API
|
|
63
|
+
thisWeekChange: 0, // Not available in public API
|
|
64
|
+
positivePercentage: Math.round(positivePercentage * 10) / 10,
|
|
65
|
+
reviewVolume: {
|
|
66
|
+
last7Days: 0, // Not available in public API
|
|
67
|
+
last30Days: 0, // Not available in public API
|
|
68
|
+
last90Days: 0, // Not available in public API
|
|
69
|
+
total: data.totalReviews,
|
|
70
|
+
},
|
|
71
|
+
sourceBreakdown: data.sources.reduce((acc, source) => {
|
|
72
|
+
acc[source.id] = {
|
|
73
|
+
count: source.total,
|
|
74
|
+
avgRating: source.averageRating,
|
|
75
|
+
sentiment: {
|
|
76
|
+
positive: 0, // Not available in public API
|
|
77
|
+
neutral: 0,
|
|
78
|
+
negative: 0,
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
return acc;
|
|
82
|
+
}, {}),
|
|
83
|
+
sourcesMap: data.sources.reduce((acc, source) => {
|
|
84
|
+
acc[source.id] = {
|
|
85
|
+
name: source.name || source.type || 'Unknown',
|
|
86
|
+
type: source.type || 'UNKNOWN',
|
|
87
|
+
};
|
|
88
|
+
return acc;
|
|
89
|
+
}, {}),
|
|
90
|
+
trendOverTime: [], // Not available in public API - requires dashboard API
|
|
91
|
+
topTopics: [], // Not available in public API - requires dashboard API
|
|
92
|
+
keyTakeaways: [], // Not available in public API - requires dashboard API
|
|
93
|
+
recentChanges: [], // Not available in public API - requires dashboard API
|
|
94
|
+
lastSync: null, // Not available in public API
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reviews Resource
|
|
3
|
+
*
|
|
4
|
+
* Handles all review-related API calls
|
|
5
|
+
*/
|
|
6
|
+
export class ReviewsResource {
|
|
7
|
+
constructor(client) {
|
|
8
|
+
this.client = client;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* List reviews
|
|
12
|
+
*
|
|
13
|
+
* @param options - Filter and pagination options
|
|
14
|
+
* @returns Promise with array of reviews
|
|
15
|
+
*/
|
|
16
|
+
async list(options) {
|
|
17
|
+
const queryParams = {};
|
|
18
|
+
if (options?.limit !== undefined) {
|
|
19
|
+
queryParams.limit = Math.min(options.limit, 100); // Max 100 per API
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
queryParams.limit = 10; // Default
|
|
23
|
+
}
|
|
24
|
+
if (options?.offset !== undefined) {
|
|
25
|
+
queryParams.offset = options.offset;
|
|
26
|
+
}
|
|
27
|
+
if (options?.minRating !== undefined) {
|
|
28
|
+
queryParams.minRating = options.minRating;
|
|
29
|
+
}
|
|
30
|
+
if (options?.maxRating !== undefined) {
|
|
31
|
+
queryParams.maxRating = options.maxRating;
|
|
32
|
+
}
|
|
33
|
+
if (options?.sentiment) {
|
|
34
|
+
queryParams.sentiment = options.sentiment;
|
|
35
|
+
}
|
|
36
|
+
if (options?.language) {
|
|
37
|
+
queryParams.language = options.language;
|
|
38
|
+
}
|
|
39
|
+
if (options?.sourceId) {
|
|
40
|
+
queryParams.sourceId = options.sourceId;
|
|
41
|
+
}
|
|
42
|
+
if (options?.since) {
|
|
43
|
+
queryParams.since = options.since;
|
|
44
|
+
}
|
|
45
|
+
const response = await this.client.get('/api/v1/public/reviews', {
|
|
46
|
+
queryParams,
|
|
47
|
+
});
|
|
48
|
+
return response.data;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get a single review by ID
|
|
52
|
+
*
|
|
53
|
+
* Note: The API doesn't have a direct GET /reviews/:id endpoint,
|
|
54
|
+
* so we fetch the list and filter. This is a convenience method.
|
|
55
|
+
*
|
|
56
|
+
* @param id - Review ID
|
|
57
|
+
* @returns Promise with review or null if not found
|
|
58
|
+
*/
|
|
59
|
+
async get(id) {
|
|
60
|
+
// Since there's no direct GET endpoint, we need to fetch and filter
|
|
61
|
+
// In a real implementation, you might want to cache reviews or use a different approach
|
|
62
|
+
const reviews = await this.list({ limit: 100 });
|
|
63
|
+
return reviews.find((review) => review.id === id) || null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Widget Resource
|
|
3
|
+
*
|
|
4
|
+
* Handles widget-related API calls
|
|
5
|
+
*/
|
|
6
|
+
export class WidgetResource {
|
|
7
|
+
constructor(client) {
|
|
8
|
+
this.client = client;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Get widget data
|
|
12
|
+
*
|
|
13
|
+
* Returns widget statistics and settings including:
|
|
14
|
+
* - Total reviews
|
|
15
|
+
* - Average rating
|
|
16
|
+
* - Number of platforms
|
|
17
|
+
* - Widget configuration (language, theme, badges, branding)
|
|
18
|
+
*
|
|
19
|
+
* @returns Promise with widget data
|
|
20
|
+
*/
|
|
21
|
+
async get() {
|
|
22
|
+
const response = await this.client.get('/api/v1/public/widget');
|
|
23
|
+
return response.data;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Get widget configuration
|
|
27
|
+
*
|
|
28
|
+
* Returns only the widget settings/configuration.
|
|
29
|
+
* This is a convenience method that extracts settings from get().
|
|
30
|
+
*
|
|
31
|
+
* @returns Promise with widget settings
|
|
32
|
+
*/
|
|
33
|
+
async config() {
|
|
34
|
+
const data = await this.get();
|
|
35
|
+
return data.settings;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Update widget configuration
|
|
39
|
+
*
|
|
40
|
+
* Note: Widget configuration updates typically require dashboard API access.
|
|
41
|
+
* This method is provided for API consistency but may require
|
|
42
|
+
* additional authentication setup.
|
|
43
|
+
*
|
|
44
|
+
* @param options - Widget configuration options
|
|
45
|
+
* @returns Promise with updated widget settings
|
|
46
|
+
*/
|
|
47
|
+
async updateConfig(options) {
|
|
48
|
+
// Note: This endpoint typically requires authentication
|
|
49
|
+
// The public API doesn't support widget config updates
|
|
50
|
+
// This is a placeholder that matches the expected API structure
|
|
51
|
+
const response = await this.client.post('/api/dashboard/widget-settings', options);
|
|
52
|
+
return response.data;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Proofio Error Handling
|
|
3
|
+
*
|
|
4
|
+
* Normalized error class for all SDK errors
|
|
5
|
+
*/
|
|
6
|
+
export class ProofioError extends Error {
|
|
7
|
+
constructor(data) {
|
|
8
|
+
super(data.message);
|
|
9
|
+
this.name = 'ProofioError';
|
|
10
|
+
this.status = data.status;
|
|
11
|
+
this.code = data.code;
|
|
12
|
+
this.requestId = data.requestId;
|
|
13
|
+
this.retryAfter = data.retryAfter;
|
|
14
|
+
this.rateLimitRemaining = data.rateLimitRemaining;
|
|
15
|
+
this.rateLimitReset = data.rateLimitReset;
|
|
16
|
+
// Maintains proper stack trace for where our error was thrown (only available on V8/Node.js)
|
|
17
|
+
if (typeof Error.captureStackTrace === 'function') {
|
|
18
|
+
Error.captureStackTrace(this, ProofioError);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Check if error is retryable
|
|
23
|
+
*/
|
|
24
|
+
isRetryable() {
|
|
25
|
+
return (this.status >= 500 ||
|
|
26
|
+
this.status === 429 ||
|
|
27
|
+
this.status === 408 ||
|
|
28
|
+
this.status === 0 // Network error
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Convert to JSON (sanitized, no sensitive data)
|
|
33
|
+
*/
|
|
34
|
+
toJSON() {
|
|
35
|
+
return {
|
|
36
|
+
name: this.name,
|
|
37
|
+
message: this.message,
|
|
38
|
+
status: this.status,
|
|
39
|
+
code: this.code,
|
|
40
|
+
requestId: this.requestId,
|
|
41
|
+
retryAfter: this.retryAfter,
|
|
42
|
+
rateLimitRemaining: this.rateLimitRemaining,
|
|
43
|
+
rateLimitReset: this.rateLimitReset,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Proofio SDK
|
|
3
|
+
*
|
|
4
|
+
* Official JavaScript/TypeScript SDK for Proofio API
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { Proofio } from 'proofio-sdk';
|
|
9
|
+
*
|
|
10
|
+
* const proofio = new Proofio({ apiKey: 'your-api-key' });
|
|
11
|
+
*
|
|
12
|
+
* const reviews = await proofio.reviews.list();
|
|
13
|
+
* const summary = await proofio.insights.summary();
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
import { ApiClient, type ProofioConfig } from './client/api-client';
|
|
17
|
+
import { ReviewsResource } from './resources/reviews';
|
|
18
|
+
import { InsightsResource } from './resources/insights';
|
|
19
|
+
import { CompetitorsResource } from './resources/competitors';
|
|
20
|
+
import { WidgetResource } from './resources/widget';
|
|
21
|
+
export { ProofioError } from './utils/errors';
|
|
22
|
+
export { ApiClient } from './client/api-client';
|
|
23
|
+
export type { ProofioConfig } from './client/api-client';
|
|
24
|
+
export type { Review, InsightSummary, InsightTrends, CompetitorComparison, WidgetData, WidgetSettings, WidgetStats, ReviewFilterOptions, PaginationOptions, RatingDistribution, SentimentDistribution, TrendDataPoint, TopTopic, } from './types';
|
|
25
|
+
/**
|
|
26
|
+
* Main Proofio SDK Client
|
|
27
|
+
*
|
|
28
|
+
* Provides access to all Proofio API resources:
|
|
29
|
+
* - reviews: List and get reviews
|
|
30
|
+
* - insights: Get summaries and trends
|
|
31
|
+
* - competitors: Compare with competitors
|
|
32
|
+
* - widget: Get widget data and configuration
|
|
33
|
+
*/
|
|
34
|
+
export declare class Proofio {
|
|
35
|
+
readonly reviews: ReviewsResource;
|
|
36
|
+
readonly insights: InsightsResource;
|
|
37
|
+
readonly competitors: CompetitorsResource;
|
|
38
|
+
readonly widget: WidgetResource;
|
|
39
|
+
private client;
|
|
40
|
+
/**
|
|
41
|
+
* Create a new Proofio SDK instance
|
|
42
|
+
*
|
|
43
|
+
* @param config - SDK configuration
|
|
44
|
+
* @param config.apiKey - Your Proofio API key (required)
|
|
45
|
+
* @param config.baseURL - Base URL for API (default: https://proofio.app)
|
|
46
|
+
* @param config.timeout - Request timeout in milliseconds (default: 30000)
|
|
47
|
+
* @param config.maxRetries - Maximum number of retries (default: 3)
|
|
48
|
+
* @param config.retryDelay - Delay between retries in milliseconds (default: 1000)
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const proofio = new Proofio({
|
|
53
|
+
* apiKey: 'your-api-key-here',
|
|
54
|
+
* baseURL: 'https://proofio.app', // optional
|
|
55
|
+
* timeout: 30000, // optional
|
|
56
|
+
* });
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
constructor(config: ProofioConfig);
|
|
60
|
+
/**
|
|
61
|
+
* Get the underlying API client (for advanced usage)
|
|
62
|
+
*/
|
|
63
|
+
getClient(): ApiClient;
|
|
64
|
+
}
|
|
65
|
+
export default Proofio;
|
|
66
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACxD,YAAY,EACV,MAAM,EACN,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,UAAU,EACV,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,cAAc,EACd,QAAQ,GACT,MAAM,SAAS,CAAA;AAEhB;;;;;;;;GAQG;AACH,qBAAa,OAAO;IAClB,SAAgB,OAAO,EAAE,eAAe,CAAA;IACxC,SAAgB,QAAQ,EAAE,gBAAgB,CAAA;IAC1C,SAAgB,WAAW,EAAE,mBAAmB,CAAA;IAChD,SAAgB,MAAM,EAAE,cAAc,CAAA;IAEtC,OAAO,CAAC,MAAM,CAAW;IAEzB;;;;;;;;;;;;;;;;;;OAkBG;gBACS,MAAM,EAAE,aAAa;IAUjC;;OAEG;IACH,SAAS,IAAI,SAAS;CAGvB;AAGD,eAAe,OAAO,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Competitors Resource
|
|
3
|
+
*
|
|
4
|
+
* Handles competitor comparison functionality
|
|
5
|
+
*
|
|
6
|
+
* Note: Competitor comparison requires authentication and is typically
|
|
7
|
+
* accessed via the dashboard API. This resource provides a placeholder
|
|
8
|
+
* structure that matches the SDK API style.
|
|
9
|
+
*/
|
|
10
|
+
import { ApiClient } from '../client/api-client';
|
|
11
|
+
import type { CompetitorComparison } from '../types';
|
|
12
|
+
export declare class CompetitorsResource {
|
|
13
|
+
private client;
|
|
14
|
+
constructor(client: ApiClient);
|
|
15
|
+
/**
|
|
16
|
+
* Compare with a competitor
|
|
17
|
+
*
|
|
18
|
+
* Generates an AI-powered comparison between your product and a competitor.
|
|
19
|
+
*
|
|
20
|
+
* Note: This endpoint requires dashboard API access (authentication).
|
|
21
|
+
* The public API doesn't support competitor comparisons directly.
|
|
22
|
+
* This method is provided for API consistency but may require
|
|
23
|
+
* additional authentication setup.
|
|
24
|
+
*
|
|
25
|
+
* @param competitorId - Competitor ID
|
|
26
|
+
* @param options - Optional parameters (e.g., force refresh)
|
|
27
|
+
* @returns Promise with competitor comparison
|
|
28
|
+
*/
|
|
29
|
+
compare(competitorId: string, options?: {
|
|
30
|
+
force?: boolean;
|
|
31
|
+
}): Promise<CompetitorComparison>;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=competitors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"competitors.d.ts","sourceRoot":"","sources":["../../src/resources/competitors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,KAAK,EAAE,oBAAoB,EAAY,MAAM,UAAU,CAAA;AAE9D,qBAAa,mBAAmB;IAClB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,SAAS;IAErC;;;;;;;;;;;;;OAaG;IACG,OAAO,CACX,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAC5B,OAAO,CAAC,oBAAoB,CAAC;CAmBjC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Insights Resource
|
|
3
|
+
*
|
|
4
|
+
* Handles insights, summaries, and trend analysis
|
|
5
|
+
*/
|
|
6
|
+
import { ApiClient } from '../client/api-client';
|
|
7
|
+
import type { InsightSummary, InsightTrends } from '../types';
|
|
8
|
+
export declare class InsightsResource {
|
|
9
|
+
private client;
|
|
10
|
+
constructor(client: ApiClient);
|
|
11
|
+
/**
|
|
12
|
+
* Get insight summary
|
|
13
|
+
*
|
|
14
|
+
* Returns aggregated statistics including:
|
|
15
|
+
* - Total reviews
|
|
16
|
+
* - Average rating
|
|
17
|
+
* - Rating distribution
|
|
18
|
+
* - Sentiment distribution
|
|
19
|
+
* - Source breakdown
|
|
20
|
+
* - AI summary (if available for paid plans)
|
|
21
|
+
*
|
|
22
|
+
* @returns Promise with insight summary
|
|
23
|
+
*/
|
|
24
|
+
summary(): Promise<InsightSummary>;
|
|
25
|
+
/**
|
|
26
|
+
* Get trend analysis
|
|
27
|
+
*
|
|
28
|
+
* Returns detailed trend data including:
|
|
29
|
+
* - Trend over time (last 30 days)
|
|
30
|
+
* - Review volume (7, 30, 90 days)
|
|
31
|
+
* - Top topics
|
|
32
|
+
* - Key takeaways
|
|
33
|
+
* - Recent changes
|
|
34
|
+
*
|
|
35
|
+
* Note: The public API provides limited trend data. For full trend analysis
|
|
36
|
+
* including trendOverTime, topTopics, and recentChanges, you need access
|
|
37
|
+
* to the dashboard API (requires authentication).
|
|
38
|
+
*
|
|
39
|
+
* This method returns available data from the public aggregations endpoint
|
|
40
|
+
* and sets default/empty values for fields not available in the public API.
|
|
41
|
+
*
|
|
42
|
+
* @returns Promise with trend data
|
|
43
|
+
*/
|
|
44
|
+
trends(): Promise<InsightTrends>;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=insights.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insights.d.ts","sourceRoot":"","sources":["../../src/resources/insights.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAY,MAAM,UAAU,CAAA;AAEvE,qBAAa,gBAAgB;IACf,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,SAAS;IAErC;;;;;;;;;;;;OAYG;IACG,OAAO,IAAI,OAAO,CAAC,cAAc,CAAC;IAKxC;;;;;;;;;;;;;;;;;;OAkBG;IACG,MAAM,IAAI,OAAO,CAAC,aAAa,CAAC;CAkEvC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reviews Resource
|
|
3
|
+
*
|
|
4
|
+
* Handles all review-related API calls
|
|
5
|
+
*/
|
|
6
|
+
import { ApiClient } from '../client/api-client';
|
|
7
|
+
import type { Review, ReviewFilterOptions } from '../types';
|
|
8
|
+
export declare class ReviewsResource {
|
|
9
|
+
private client;
|
|
10
|
+
constructor(client: ApiClient);
|
|
11
|
+
/**
|
|
12
|
+
* List reviews
|
|
13
|
+
*
|
|
14
|
+
* @param options - Filter and pagination options
|
|
15
|
+
* @returns Promise with array of reviews
|
|
16
|
+
*/
|
|
17
|
+
list(options?: ReviewFilterOptions): Promise<Review[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Get a single review by ID
|
|
20
|
+
*
|
|
21
|
+
* Note: The API doesn't have a direct GET /reviews/:id endpoint,
|
|
22
|
+
* so we fetch the list and filter. This is a convenience method.
|
|
23
|
+
*
|
|
24
|
+
* @param id - Review ID
|
|
25
|
+
* @returns Promise with review or null if not found
|
|
26
|
+
*/
|
|
27
|
+
get(id: string): Promise<Review | null>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=reviews.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reviews.d.ts","sourceRoot":"","sources":["../../src/resources/reviews.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAY,MAAM,UAAU,CAAA;AAErE,qBAAa,eAAe;IACd,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,SAAS;IAErC;;;;;OAKG;IACG,IAAI,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IA4C5D;;;;;;;;OAQG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAM9C"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Widget Resource
|
|
3
|
+
*
|
|
4
|
+
* Handles widget-related API calls
|
|
5
|
+
*/
|
|
6
|
+
import { ApiClient } from '../client/api-client';
|
|
7
|
+
import type { WidgetData, WidgetConfigOptions } from '../types';
|
|
8
|
+
export declare class WidgetResource {
|
|
9
|
+
private client;
|
|
10
|
+
constructor(client: ApiClient);
|
|
11
|
+
/**
|
|
12
|
+
* Get widget data
|
|
13
|
+
*
|
|
14
|
+
* Returns widget statistics and settings including:
|
|
15
|
+
* - Total reviews
|
|
16
|
+
* - Average rating
|
|
17
|
+
* - Number of platforms
|
|
18
|
+
* - Widget configuration (language, theme, badges, branding)
|
|
19
|
+
*
|
|
20
|
+
* @returns Promise with widget data
|
|
21
|
+
*/
|
|
22
|
+
get(): Promise<WidgetData>;
|
|
23
|
+
/**
|
|
24
|
+
* Get widget configuration
|
|
25
|
+
*
|
|
26
|
+
* Returns only the widget settings/configuration.
|
|
27
|
+
* This is a convenience method that extracts settings from get().
|
|
28
|
+
*
|
|
29
|
+
* @returns Promise with widget settings
|
|
30
|
+
*/
|
|
31
|
+
config(): Promise<WidgetData['settings']>;
|
|
32
|
+
/**
|
|
33
|
+
* Update widget configuration
|
|
34
|
+
*
|
|
35
|
+
* Note: Widget configuration updates typically require dashboard API access.
|
|
36
|
+
* This method is provided for API consistency but may require
|
|
37
|
+
* additional authentication setup.
|
|
38
|
+
*
|
|
39
|
+
* @param options - Widget configuration options
|
|
40
|
+
* @returns Promise with updated widget settings
|
|
41
|
+
*/
|
|
42
|
+
updateConfig(options: WidgetConfigOptions): Promise<WidgetData['settings']>;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=widget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../../src/resources/widget.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAY,MAAM,UAAU,CAAA;AAEzE,qBAAa,cAAc;IACb,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,SAAS;IAErC;;;;;;;;;;OAUG;IACG,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC;IAKhC;;;;;;;OAOG;IACG,MAAM,IAAI,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAK/C;;;;;;;;;OASG;IACG,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;CAWlF"}
|