1 | export interface PinterestUser {
|
2 | /**
|
3 | * The unique string of numbers and letters that identifies the user on Pinterest.
|
4 | */
|
5 | id?: string;
|
6 | /**
|
7 | * The user’s Pinterest username.
|
8 | */
|
9 | username?: string;
|
10 | /**
|
11 | * The user’s first name.
|
12 | */
|
13 | first_name?: string;
|
14 | /**
|
15 | * The user’s last name.
|
16 | */
|
17 | last_name?: string;
|
18 | /**
|
19 | * The text in the user’s “About you” section in their profile.
|
20 | */
|
21 | bio?: string;
|
22 | /**
|
23 | * The date the user created their account in ISO 8601 format
|
24 | */
|
25 | created_at?: string;
|
26 | /**
|
27 | * The user’s stats, including how many Pins, follows, boards and likes they have.
|
28 | */
|
29 | counts?: any;
|
30 | /**
|
31 | * The user’s profile image. The response returns the image’s URL, width and height.
|
32 | */
|
33 | image?: any;
|
34 | }
|
35 | export interface PinterestBoard {
|
36 | /**
|
37 | * The unique string of numbers and letters that identifies the board on Pinterest.
|
38 | */
|
39 | id?: string;
|
40 | /**
|
41 | * The name of the board.
|
42 | */
|
43 | name?: string;
|
44 | /**
|
45 | * The link to the board.
|
46 | */
|
47 | url?: string;
|
48 | /**
|
49 | * The user-entered description of the board.
|
50 | */
|
51 | description?: string;
|
52 | /**
|
53 | * The first and last name, ID and profile URL of the user who created the board.
|
54 | */
|
55 | creator?: PinterestUser;
|
56 | /**
|
57 | * The date the user created the board.
|
58 | */
|
59 | created_at?: string;
|
60 | /**
|
61 | * The board’s stats, including how many Pins, followers, user's following and collaborators it has.
|
62 | */
|
63 | counts?: any;
|
64 | /**
|
65 | * The user’s profile image. The response returns the image’s URL, width and height.
|
66 | */
|
67 | image?: any;
|
68 | }
|
69 | export interface PinterestPin {
|
70 | /**
|
71 | * The unique string of numbers and letters that identifies the Pin on Pinterest.
|
72 | */
|
73 | id?: string;
|
74 | /**
|
75 | * The URL of the webpage where the Pin was created.
|
76 | */
|
77 | link?: string;
|
78 | /**
|
79 | * The URL of the Pin on Pinterest.
|
80 | */
|
81 | url?: string;
|
82 | /**
|
83 | * The first and last name, ID and profile URL of the user who created the board.
|
84 | */
|
85 | creator?: PinterestUser;
|
86 | /**
|
87 | * The board that the Pin is on.
|
88 | */
|
89 | board?: PinterestBoard;
|
90 | /**
|
91 | * The date the Pin was created.
|
92 | */
|
93 | created_at?: string;
|
94 | /**
|
95 | * The user-entered description of the Pin.
|
96 | */
|
97 | note?: string;
|
98 | /**
|
99 | * The dominant color of the Pin’s image in hex code format.
|
100 | */
|
101 | color?: string;
|
102 | /**
|
103 | * The Pin’s stats, including the number of repins, comments and likes.
|
104 | */
|
105 | counts?: any;
|
106 | /**
|
107 | * The media type of the Pin (image or video).
|
108 | */
|
109 | media?: any;
|
110 | /**
|
111 | * The source data for videos, including the title, URL, provider, author name, author URL and provider name.
|
112 | */
|
113 | attribution?: any;
|
114 | /**
|
115 | * The Pin’s image. The default response returns the image’s URL, width and height.
|
116 | */
|
117 | image?: any;
|
118 | /**
|
119 | * Extra information about the Pin for Rich Pins. Includes the Pin type (e.g., article, recipe) and related information (e.g., ingredients, author).
|
120 | */
|
121 | metadata?: any;
|
122 | }
|
123 | /**
|
124 | * @beta
|
125 | * @name Pinterest
|
126 | * @description
|
127 | * Cordova plugin for Pinterest
|
128 | *
|
129 | * @usage
|
130 | * ```
|
131 | * import { Pinterest, PinterestUser, PinterestPin, PinterestBoard } from 'ionic-native';
|
132 | *
|
133 | * const scopes = [
|
134 | * Pinterest.SCOPES.READ_PUBLIC,
|
135 | * Pinterest.SCOPES.WRITE_PUBLIC,
|
136 | * Pinterest.SCOPES.READ_RELATIONSHIPS,
|
137 | * Pinterest.SCOPES.WRITE_RELATIONSHIPS
|
138 | * ];
|
139 | *
|
140 | * Pinterest.login(scopes)
|
141 | * .then(res => console.log('Logged in!', res))
|
142 | * .catch(err => console.error('Error loggin in', err));
|
143 | *
|
144 | * Pinterest.getMyPins()
|
145 | * .then((pins: Array<PinterestPin>) => console.log(pins))
|
146 | * .catch(err => console.error(err));
|
147 | *
|
148 | * Pinterest.getMe()
|
149 | * .then((user: PinterestUser) => console.log(user));
|
150 | *
|
151 | * Pinterest.getMyBoards()
|
152 | * .then((boards: Array<PinterestBoard>) => console.log(boards));
|
153 | *
|
154 | * ```
|
155 | * @interfaces
|
156 | * PinterestUser
|
157 | * PinterestBoard
|
158 | * PinterestPin
|
159 | */
|
160 | export declare class Pinterest {
|
161 | /**
|
162 | * Convenience constant for authentication scopes
|
163 | */
|
164 | SCOPES: {
|
165 | READ_PUBLIC: string;
|
166 | WRITE_PUBLIC: string;
|
167 | READ_RELATIONSHIPS: string;
|
168 | WRITE_RELATIONSHIPS: string;
|
169 | };
|
170 | /**
|
171 | * Logs the user in using their Pinterest account.
|
172 | * @param scopes {Array<string>} Array of scopes that you need access to. You can use Pinterest.SCOPES constant for convenience.
|
173 | * @returns {Promise<any>} The response object will contain the user's profile data, as well as the access token (if you need to use it elsewhere, example: send it to your server and perform actions on behalf of the user).
|
174 | */
|
175 | static login(scopes: string[]): Promise<any>;
|
176 | /**
|
177 | * Gets the authenticated user's profile
|
178 | * @param fields {string} Fields to retrieve, separated by commas. Defaults to all available fields.
|
179 | * @returns {Promise<PinterestUser>} Returns a promise that resolves with the user's object
|
180 | */
|
181 | static getMe(fields?: string): Promise<PinterestUser>;
|
182 | /**
|
183 | *
|
184 | * @param fields {string} Optional fields separated by comma
|
185 | * @param limit {number} Optional limit, defaults to 100, maximum is 100.
|
186 | * @returns {Promise<Array<PinterestPin>>}
|
187 | */
|
188 | static getMyPins(fields?: string, limit?: number): Promise<Array<PinterestPin>>;
|
189 | /**
|
190 | *
|
191 | * @param fields {string} Optional fields separated by comma
|
192 | * @param limit {number} Optional limit, defaults to 100, maximum is 100.
|
193 | * @returns {Promise<Array<PinterestBoard>>}
|
194 | */
|
195 | static getMyBoards(fields?: string, limit?: number): Promise<Array<PinterestBoard>>;
|
196 | /**
|
197 | * Get the authenticated user's likes.
|
198 | * @param fields {string} Optional fields separated by comma
|
199 | * @param limit {number} Optional limit, defaults to 100, maximum is 100.
|
200 | * @returns {Promise<Array<PinterestPin>>}
|
201 | */
|
202 | static getMyLikes(fields?: string, limit?: number): Promise<Array<PinterestPin>>;
|
203 | /**
|
204 | * Get the authenticated user's followers.
|
205 | * @param fields {string} Optional fields separated by comma
|
206 | * @param limit {number} Optional limit, defaults to 100, maximum is 100.
|
207 | * @returns {Promise<Array<PinterestUser>>}
|
208 | */
|
209 | static getMyFollowers(fields?: string, limit?: number): Promise<Array<PinterestUser>>;
|
210 | /**
|
211 | * Get the authenticated user's followed boards.
|
212 | * @param fields {string} Optional fields separated by comma
|
213 | * @param limit {number} Optional limit, defaults to 100, maximum is 100.
|
214 | * @returns {Promise<Array<PinterestBoard>>}
|
215 | */
|
216 | static getMyFollowedBoards(fields?: string, limit?: number): Promise<Array<PinterestBoard>>;
|
217 | /**
|
218 | * Get the authenticated user's followed interests.
|
219 | * @param fields {string} Optional fields separated by comma
|
220 | * @param limit {number} Optional limit, defaults to 100, maximum is 100.
|
221 | * @returns {Promise<any>}
|
222 | */
|
223 | static getMyFollowedInterests(fields?: string, limit?: number): Promise<any>;
|
224 | /**
|
225 | * Get a user's profile.
|
226 | * @param username
|
227 | * @param fields
|
228 | * @returns {Promise<PinterestUser>}
|
229 | */
|
230 | static getUser(username: string, fields?: string): Promise<PinterestUser>;
|
231 | /**
|
232 | * Get a board's data.
|
233 | * @param boardId
|
234 | * @param fields
|
235 | * @returns {Promise<PinterestBoard>}
|
236 | */
|
237 | static getBoard(boardId: string, fields?: string): Promise<PinterestBoard>;
|
238 | /**
|
239 | * Get Pins of a specific board.
|
240 | * @param boardId {string} The ID of the board
|
241 | * @param fields {string} Optional fields separated by comma
|
242 | * @param limit {number} Optional limit, defaults to 100, maximum is 100.
|
243 | * @returns {Promise<Array<PinterestPin>>}
|
244 | */
|
245 | static getBoardPins(boardId: string, fields?: string, limit?: number): Promise<Array<PinterestPin>>;
|
246 | /**
|
247 | * Delete a board.
|
248 | * @param boardId {string} The ID of the board
|
249 | * @returns {Promise<PinterestUser>}
|
250 | */
|
251 | static deleteBoard(boardId: string): Promise<any>;
|
252 | /**
|
253 | * Create a new board for the authenticated user.
|
254 | * @param name {string} Name of the board
|
255 | * @param desc {string} Optional description of the board
|
256 | * @returns {Promise<PinterestBoard>}
|
257 | */
|
258 | static createBoard(name: string, desc?: string): Promise<PinterestBoard>;
|
259 | /**
|
260 | * Get a Pin by ID.
|
261 | * @param pinId {string} The ID of the Pin
|
262 | * @param fields {string} Optional fields separated by comma
|
263 | * @returns {Promise<PinterestPin>}
|
264 | */
|
265 | static getPin(pinId: string, fields?: string): Promise<PinterestPin>;
|
266 | /**
|
267 | * Deletes a pin
|
268 | * @param pinId {string} The ID of the pin
|
269 | * @returns {Promise<any>}
|
270 | */
|
271 | static deletePin(pinId: string): Promise<any>;
|
272 | /**
|
273 | * Creates a Pin
|
274 | * @param note {string} Note/Description of the pin
|
275 | * @param boardId {string} Board ID to put the Pin under
|
276 | * @param imageUrl {string} URL of the image to share
|
277 | * @param link {string} Optional link to share
|
278 | * @returns {Promise<PinterestPin>}
|
279 | */
|
280 | static createPin(note: string, boardId: string, imageUrl: string, link?: string): Promise<PinterestPin>;
|
281 | }
|