@pagesolver/sdk 1.2.3 → 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.ts +7 -30
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +3 -3
- package/dist/types.d.ts +90 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,31 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
id: string;
|
|
3
|
-
business_id: number;
|
|
4
|
-
before_url: string;
|
|
5
|
-
after_url: string;
|
|
6
|
-
title: string;
|
|
7
|
-
description: string | null;
|
|
8
|
-
updated_at: Date;
|
|
9
|
-
created_at: Date;
|
|
10
|
-
}
|
|
11
|
-
export interface ShowcaseImage {
|
|
12
|
-
id: string;
|
|
13
|
-
business_id: number;
|
|
14
|
-
image_url: string;
|
|
15
|
-
title: string;
|
|
16
|
-
description: string | null;
|
|
17
|
-
updated_at: Date;
|
|
18
|
-
created_at: Date;
|
|
19
|
-
}
|
|
20
|
-
interface ContactData {
|
|
21
|
-
name: string;
|
|
22
|
-
email: string;
|
|
23
|
-
phone?: string;
|
|
24
|
-
message?: string;
|
|
25
|
-
}
|
|
26
|
-
interface ContactResponse {
|
|
27
|
-
success: boolean;
|
|
28
|
-
}
|
|
1
|
+
import type { ComparisonImage, ContactData, ContactResponse, GoogleHoursResponse, GoogleReviewsResponse, ShowcaseImage, SocialMediaResponse } from "./types";
|
|
29
2
|
export declare class PageSolverClient {
|
|
30
3
|
private baseUrl;
|
|
31
4
|
private businessKey;
|
|
@@ -33,7 +6,11 @@ export declare class PageSolverClient {
|
|
|
33
6
|
private request;
|
|
34
7
|
getComparisons(): Promise<ComparisonImage[]>;
|
|
35
8
|
getShowcases(): Promise<ShowcaseImage[]>;
|
|
36
|
-
|
|
9
|
+
getGoogleReviews(): Promise<GoogleReviewsResponse>;
|
|
10
|
+
getGoogleHours(): Promise<GoogleHoursResponse>;
|
|
11
|
+
getInstagramPosts(): Promise<SocialMediaResponse>;
|
|
12
|
+
getFacebookPosts(): Promise<SocialMediaResponse>;
|
|
13
|
+
contact(data: ContactData): Promise<ContactResponse>;
|
|
37
14
|
}
|
|
38
|
-
export type { ContactData, ContactResponse };
|
|
15
|
+
export type { ComparisonImage, ComparisonsResponse, ShowcaseImage, ShowcasesResponse, ContactData, ContactResponse, GoogleReview, GoogleReviewsResponse, GoogleHoursResponse, BusinessHours, CurrentTime, FacebookPost, InstagramPost, SocialMediaResponse, BusinessInfo, } from "./types";
|
|
39
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EAEf,WAAW,EACX,eAAe,EAEf,mBAAmB,EAEnB,qBAAqB,EAErB,aAAa,EAEb,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAEjB,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,OAAO,CAAmC;IAClD,OAAO,CAAC,WAAW,CAAS;gBAEhB,WAAW,EAAE,MAAM;YAIjB,OAAO;IA0Cf,cAAc,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IAQ5C,YAAY,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAQxC,gBAAgB,IAAI,OAAO,CAAC,qBAAqB,CAAC;IAOlD,cAAc,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAK9C,iBAAiB,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAOjD,gBAAgB,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAKhD,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC;CAM3D;AAGD,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,YAAY,GACb,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
class
|
|
1
|
+
class B{baseUrl="https://pagesolver.com/api/v1";businessKey;constructor(j){this.businessKey=j}async request(j,w={}){try{let q=`${this.baseUrl}${j}`,z={"Content-Type":"application/json","x-business-key":this.businessKey,...w.headers},k=await fetch(q,{...w,headers:z}),v;if(k.headers.get("Content-Type")?.includes("application/json"))v=await k.json();else v=await k.text();if(!k.ok){let A=v?.error||"An unknown error occurred";throw new Error(`API Error (${k.status}): ${A}`)}return v}catch(q){if(q instanceof Error)throw q;throw new Error("Network error occurred")}}async getComparisons(){return(await this.request("/business/comparisons")).comparisons}async getShowcases(){return(await this.request("/business/showcases")).showcases}async getGoogleReviews(){return await this.request("/business/google/reviews")}async getGoogleHours(){return await this.request("/business/google/hours")}async getInstagramPosts(){return await this.request("/business/social/instagram")}async getFacebookPosts(){return await this.request("/business/social/facebook")}async contact(j){return await this.request("/business/contact",{method:"POST",body:JSON.stringify(j)})}}export{B as PageSolverClient};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=1227768361305AF164756E2164756E21
|
package/dist/index.js.map
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"//
|
|
5
|
+
"// Import all types from the types file\nimport type {\n ComparisonImage,\n ComparisonsResponse,\n ContactData,\n ContactResponse,\n FacebookPost,\n GoogleHoursResponse,\n GoogleReview,\n GoogleReviewsResponse,\n InstagramPost,\n ShowcaseImage,\n ShowcasesResponse,\n SocialMediaResponse,\n} from \"./types\";\n\nexport class PageSolverClient {\n private baseUrl = \"https://pagesolver.com/api/v1\";\n private businessKey: string;\n\n constructor(businessKey: string) {\n this.businessKey = businessKey;\n }\n\n private async request<T>(\n endpoint: string,\n options: RequestInit = {}\n ): Promise<T> {\n try {\n const url = `${this.baseUrl}${endpoint}`;\n\n const headers = {\n \"Content-Type\": \"application/json\",\n \"x-business-key\": this.businessKey,\n ...options.headers,\n };\n\n const response = await fetch(url, {\n ...options,\n headers,\n });\n\n let data: unknown;\n const contentType = response.headers.get(\"Content-Type\");\n if (contentType?.includes(\"application/json\")) {\n data = await response.json();\n } else {\n data = await response.text();\n }\n\n if (!response.ok) {\n const errorMessage =\n (data as { error?: string })?.error || \"An unknown error occurred\";\n throw new Error(`API Error (${response.status}): ${errorMessage}`);\n }\n\n return data as T;\n } catch (error) {\n if (error instanceof Error) {\n throw error;\n }\n throw new Error(\"Network error occurred\");\n }\n }\n\n // Comparison Images\n async getComparisons(): Promise<ComparisonImage[]> {\n const response = await this.request<ComparisonsResponse>(\n \"/business/comparisons\"\n );\n return response.comparisons;\n }\n\n // Showcase Images\n async getShowcases(): Promise<ShowcaseImage[]> {\n const response = await this.request<ShowcasesResponse>(\n \"/business/showcases\"\n );\n return response.showcases;\n }\n\n // Google Reviews\n async getGoogleReviews(): Promise<GoogleReviewsResponse> {\n return await this.request<GoogleReviewsResponse>(\n \"/business/google/reviews\"\n );\n }\n\n // Google Hours\n async getGoogleHours(): Promise<GoogleHoursResponse> {\n return await this.request<GoogleHoursResponse>(\"/business/google/hours\");\n }\n\n // Social Media - Instagram\n async getInstagramPosts(): Promise<SocialMediaResponse> {\n return await this.request<SocialMediaResponse>(\n \"/business/social/instagram\"\n );\n }\n\n // Social Media - Facebook\n async getFacebookPosts(): Promise<SocialMediaResponse> {\n return await this.request<SocialMediaResponse>(\"/business/social/facebook\");\n }\n\n // Contact\n async contact(data: ContactData): Promise<ContactResponse> {\n return await this.request<ContactResponse>(\"/business/contact\", {\n method: \"POST\",\n body: JSON.stringify(data),\n });\n }\n}\n\n// Re-export all types for consumers\nexport type {\n ComparisonImage,\n ComparisonsResponse,\n ShowcaseImage,\n ShowcasesResponse,\n ContactData,\n ContactResponse,\n GoogleReview,\n GoogleReviewsResponse,\n GoogleHoursResponse,\n BusinessHours,\n CurrentTime,\n FacebookPost,\n InstagramPost,\n SocialMediaResponse,\n BusinessInfo,\n} from \"./types\";\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": "
|
|
8
|
-
"debugId": "
|
|
7
|
+
"mappings": "AAgBO,MAAM,CAAiB,CACpB,QAAU,gCACV,YAER,WAAW,CAAC,EAAqB,CAC/B,KAAK,YAAc,OAGP,QAAU,CACtB,EACA,EAAuB,CAAC,EACZ,CACZ,GAAI,CACF,IAAM,EAAM,GAAG,KAAK,UAAU,IAExB,EAAU,CACd,eAAgB,mBAChB,iBAAkB,KAAK,eACpB,EAAQ,OACb,EAEM,EAAW,MAAM,MAAM,EAAK,IAC7B,EACH,SACF,CAAC,EAEG,EAEJ,GADoB,EAAS,QAAQ,IAAI,cAAc,GACtC,SAAS,kBAAkB,EAC1C,EAAO,MAAM,EAAS,KAAK,EAE3B,OAAO,MAAM,EAAS,KAAK,EAG7B,IAAK,EAAS,GAAI,CAChB,IAAM,EACH,GAA6B,OAAS,4BACzC,MAAM,IAAI,MAAM,cAAc,EAAS,YAAY,GAAc,EAGnE,OAAO,EACP,MAAO,EAAO,CACd,GAAI,aAAiB,MACnB,MAAM,EAER,MAAM,IAAI,MAAM,wBAAwB,QAKtC,eAAc,EAA+B,CAIjD,OAHiB,MAAM,KAAK,QAC1B,uBACF,GACgB,iBAIZ,aAAY,EAA6B,CAI7C,OAHiB,MAAM,KAAK,QAC1B,qBACF,GACgB,eAIZ,iBAAgB,EAAmC,CACvD,OAAO,MAAM,KAAK,QAChB,0BACF,OAII,eAAc,EAAiC,CACnD,OAAO,MAAM,KAAK,QAA6B,wBAAwB,OAInE,kBAAiB,EAAiC,CACtD,OAAO,MAAM,KAAK,QAChB,4BACF,OAII,iBAAgB,EAAiC,CACrD,OAAO,MAAM,KAAK,QAA6B,2BAA2B,OAItE,QAAO,CAAC,EAA6C,CACzD,OAAO,MAAM,KAAK,QAAyB,oBAAqB,CAC9D,OAAQ,OACR,KAAM,KAAK,UAAU,CAAI,CAC3B,CAAC,EAEL",
|
|
8
|
+
"debugId": "1227768361305AF164756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export interface BusinessInfo {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
address?: string;
|
|
5
|
+
phone?: string;
|
|
6
|
+
website?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ComparisonImage {
|
|
9
|
+
id: string;
|
|
10
|
+
business_id: number;
|
|
11
|
+
before_url: string;
|
|
12
|
+
after_url: string;
|
|
13
|
+
title: string;
|
|
14
|
+
description: string | null;
|
|
15
|
+
updated_at: string;
|
|
16
|
+
created_at: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ComparisonsResponse {
|
|
19
|
+
comparisons: ComparisonImage[];
|
|
20
|
+
}
|
|
21
|
+
export interface ShowcaseImage {
|
|
22
|
+
id: string;
|
|
23
|
+
business_id: number;
|
|
24
|
+
image_url: string[];
|
|
25
|
+
title: string;
|
|
26
|
+
description: string | null;
|
|
27
|
+
updated_at: string;
|
|
28
|
+
created_at: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ShowcasesResponse {
|
|
31
|
+
showcases: ShowcaseImage[];
|
|
32
|
+
}
|
|
33
|
+
export interface ContactData {
|
|
34
|
+
name: string;
|
|
35
|
+
email: string;
|
|
36
|
+
phone?: string;
|
|
37
|
+
message?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ContactResponse {
|
|
40
|
+
success: boolean;
|
|
41
|
+
message: string;
|
|
42
|
+
}
|
|
43
|
+
export interface GoogleReview {
|
|
44
|
+
rating: number;
|
|
45
|
+
text: string;
|
|
46
|
+
author: string;
|
|
47
|
+
publishTime: string;
|
|
48
|
+
}
|
|
49
|
+
export interface GoogleReviewsResponse {
|
|
50
|
+
business: BusinessInfo;
|
|
51
|
+
rating: number | null;
|
|
52
|
+
totalReviews: number;
|
|
53
|
+
reviews: GoogleReview[];
|
|
54
|
+
}
|
|
55
|
+
export interface BusinessHours {
|
|
56
|
+
day: string;
|
|
57
|
+
hours: string;
|
|
58
|
+
}
|
|
59
|
+
export interface CurrentTime {
|
|
60
|
+
day: string;
|
|
61
|
+
time: string;
|
|
62
|
+
}
|
|
63
|
+
export interface GoogleHoursResponse {
|
|
64
|
+
business: BusinessInfo;
|
|
65
|
+
status: string;
|
|
66
|
+
isOpenNow: boolean;
|
|
67
|
+
hours: BusinessHours[];
|
|
68
|
+
currentTime: CurrentTime;
|
|
69
|
+
}
|
|
70
|
+
export interface FacebookPost {
|
|
71
|
+
id: string;
|
|
72
|
+
message?: string;
|
|
73
|
+
created_time: string;
|
|
74
|
+
permalink_url?: string;
|
|
75
|
+
full_picture?: string;
|
|
76
|
+
}
|
|
77
|
+
export interface InstagramPost {
|
|
78
|
+
id: string;
|
|
79
|
+
caption?: string;
|
|
80
|
+
media_type: "IMAGE" | "VIDEO" | "CAROUSEL_ALBUM";
|
|
81
|
+
media_url: string;
|
|
82
|
+
permalink: string;
|
|
83
|
+
timestamp: string;
|
|
84
|
+
}
|
|
85
|
+
export interface SocialMediaResponse {
|
|
86
|
+
business: BusinessInfo;
|
|
87
|
+
posts: FacebookPost[] | InstagramPost[];
|
|
88
|
+
platform: "facebook" | "instagram";
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,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