@distilled.cloud/pinterest 0.0.0 → 1.0.0-rc.22

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.
Files changed (48) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +102 -4
  3. package/lib/.lazy.json +1 -0
  4. package/lib/_bundle/lazy.js +4 -0
  5. package/lib/_bundle/sdk.js +2 -0
  6. package/lib/_bundle/sdk.js.map +1 -0
  7. package/lib/credentials.d.ts +31 -0
  8. package/lib/credentials.d.ts.map +1 -0
  9. package/lib/credentials.js +1 -0
  10. package/lib/errors.d.ts +49 -0
  11. package/lib/errors.d.ts.map +1 -0
  12. package/lib/errors.js +1 -0
  13. package/lib/index.d.ts +27 -0
  14. package/lib/index.d.ts.map +1 -0
  15. package/lib/index.js +8 -0
  16. package/lib/index.lazy.js +8 -0
  17. package/lib/index.lazy.js.map +1 -0
  18. package/lib/pagination.d.ts +11 -0
  19. package/lib/pagination.d.ts.map +1 -0
  20. package/lib/pagination.js +1 -0
  21. package/lib/protocol.d.ts +20 -0
  22. package/lib/protocol.d.ts.map +1 -0
  23. package/lib/protocol.js +1 -0
  24. package/lib/retry.d.ts +50 -0
  25. package/lib/retry.d.ts.map +1 -0
  26. package/lib/retry.js +1 -0
  27. package/lib/services/index.d.ts +2 -0
  28. package/lib/services/index.d.ts.map +1 -0
  29. package/lib/services/index.js +1 -0
  30. package/lib/services/pinterest.d.ts +17070 -0
  31. package/lib/services/pinterest.d.ts.map +1 -0
  32. package/lib/services/pinterest.js +451 -0
  33. package/lib/services/pinterest.js.map +1 -0
  34. package/lib/services.lazy/index.js +3 -0
  35. package/lib/services.lazy/pinterest.js +4 -0
  36. package/lib/traits.d.ts +11 -0
  37. package/lib/traits.d.ts.map +1 -0
  38. package/lib/traits.js +1 -0
  39. package/package.json +83 -2
  40. package/src/credentials.ts +79 -0
  41. package/src/errors.ts +62 -0
  42. package/src/index.ts +34 -0
  43. package/src/pagination.ts +10 -0
  44. package/src/protocol.ts +52 -0
  45. package/src/retry.ts +69 -0
  46. package/src/services/index.ts +2 -0
  47. package/src/services/pinterest.ts +43548 -0
  48. package/src/traits.ts +47 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,9 +1,107 @@
1
1
  # @distilled.cloud/pinterest
2
2
 
3
- 🐣 This package name has been claimed with [fledgling](https://github.com/dmno-dev/fledgling) for [https://github.com/alchemy-run/distilled](https://github.com/alchemy-run/distilled), and a real release will land here soon.
3
+ Effect-native [Pinterest API v5](https://developers.pinterest.com/docs/api/v5/)
4
+ SDK, generated from Pinterest's own OpenAPI description,
5
+ [`pinterest/api-description` `v5/openapi.json`](https://github.com/pinterest/api-description/tree/main/v5).
4
6
 
5
- This is a placeholder — there is nothing to install yet.
7
+ Every operation of the spec is here, exported from the package root: the user
8
+ account and its analytics, boards and board sections, Pins and Pin
9
+ analytics, media uploads, ad accounts, campaigns, ad groups, ads and their
10
+ analytics, audiences, conversions, catalogs, businesses, search, trends and
11
+ the rest. The two OAuth token routes are left out (see Auth).
6
12
 
7
- ---
13
+ ## Installation
8
14
 
9
- Want to claim a name of your own? Run `npx fledgling add <name> --new --yes` — it reserves the name on npm and can set up token-less (OIDC trusted) publishing for when you are ready.
15
+ ```bash
16
+ npm install @distilled.cloud/pinterest effect
17
+ ```
18
+
19
+ ## Quick start
20
+
21
+ Pin an image to a board, then read the account's analytics for the last
22
+ week.
23
+
24
+ ```ts
25
+ import { Effect, Layer, Stream } from "effect";
26
+ import * as FetchHttpClient from "effect/http/FetchHttpClient";
27
+ import * as Pinterest from "@distilled.cloud/pinterest";
28
+
29
+ const program = Effect.gen(function* () {
30
+ const account = yield* Pinterest.getUserAccount({});
31
+ yield* Effect.log(`Signed in as ${account.username}`);
32
+
33
+ // 1. Find the board to pin to, fetching more pages as the stream needs them.
34
+ const boards = yield* Pinterest.listBoards
35
+ .items({ page_size: 100 })
36
+ .pipe(Stream.runCollect);
37
+ const board = boards.find((b) => b.name === "Launches") ?? boards[0];
38
+
39
+ // 2. Create an image Pin from a public URL.
40
+ const pin = yield* Pinterest.createPin({
41
+ board_id: board.id,
42
+ title: "We just launched",
43
+ description: "Read the changelog",
44
+ link: "https://example.com/changelog",
45
+ media_source: { source_type: "image_url", url: "https://example.com/launch.png" },
46
+ });
47
+ yield* Effect.log(`Created Pin ${pin.id}`);
48
+
49
+ // 3. Read impressions and saves for the last 7 days.
50
+ const day = (offset: number) =>
51
+ new Date(Date.now() - offset * 86_400_000).toISOString().slice(0, 10);
52
+ const analytics = yield* Pinterest.getUserAccountAnalytics({
53
+ start_date: day(7),
54
+ end_date: day(0),
55
+ metric_types: ["IMPRESSION", "SAVE"],
56
+ });
57
+ yield* Effect.log(analytics.all?.summary_metrics);
58
+ });
59
+
60
+ const Live = Layer.mergeAll(FetchHttpClient.layer, Pinterest.CredentialsFromEnv);
61
+
62
+ program.pipe(Effect.provide(Live), Effect.runPromise);
63
+ ```
64
+
65
+ ## Auth
66
+
67
+ `PINTEREST_ACCESS_TOKEN` is sent as `Authorization: Bearer`. It is an OAuth
68
+ 2.0 access token: a user access token from the authorization code flow (it
69
+ acts as that user), a client credentials token for the ad and catalog reads
70
+ that accept one, or the conversion access token from Ads Manager for the
71
+ conversion events endpoints.
72
+
73
+ `PINTEREST_BASE_URL` sets another API origin (default
74
+ `https://api.pinterest.com`; the SDK adds `/v5`). Apps on trial access use
75
+ the sandbox, `Pinterest.SANDBOX_BASE_URL` (`https://api-sandbox.pinterest.com`).
76
+ `Pinterest.fromAccessToken({ accessToken: Redacted.make(token) })` builds
77
+ the same layer from a value.
78
+
79
+ The token exchange (`POST /oauth/token`, code exchange and refresh) and
80
+ `POST /oauth/token/revoke` authenticate with HTTP Basic (the app's client id
81
+ and secret), while every other route takes the bearer token, so the SDK
82
+ leaves them out. Run the exchange with your OAuth client. An access token
83
+ expires after 30 days; to refresh it, provide your own
84
+ `Pinterest.Credentials` layer, whose effect runs on every request.
85
+
86
+ ## Pagination
87
+
88
+ Lists that answer `{ items, bookmark }` are paginated: `.pages(input)`
89
+ streams each response and `.items(input)` streams the entries of `items`,
90
+ passing `bookmark` back until it is null.
91
+
92
+ ## Video Pins
93
+
94
+ A video Pin takes three steps. `createMedia({ media_type: "video" })`
95
+ returns an `upload_url` and `upload_parameters` for a multipart POST to a
96
+ storage host outside the API; send the file there with your HTTP client.
97
+ `getMedia({ media_id })` then reports the upload's `status`, and once it is
98
+ `succeeded`, `createPin` takes
99
+ `media_source: { source_type: "video_id", media_id, cover_image_url }`.
100
+
101
+ ## Errors
102
+
103
+ Pinterest answers a failed call with `{ code, message }`. 400, 403, 404, 409
104
+ and 422 fail with this package's `BadRequest`, `Forbidden`, `NotFound`,
105
+ `Conflict` and `UnprocessableEntity`, which carry that `code` and `message`;
106
+ 401, 429 and the 5xx fail with core's `Unauthorized`, `TooManyRequests` and
107
+ server error classes.
package/lib/.lazy.json ADDED
@@ -0,0 +1 @@
1
+ {"serviceDirs":["services"],"twins":["index.js"]}
@@ -0,0 +1,4 @@
1
+ import*as $0 from"./sdk.js";
2
+ import{api$lazyService as L}from"@distilled.cloud/core/_bundle/base";
3
+ const u=import.meta.url,N=[$0];
4
+ export const $L=(s,k,a,l,x)=>L(u,s,k,a===void 0?void 0:x?N.concat(x):N,a,l);
@@ -0,0 +1,2 @@
1
+ import{api$D as e,api$call as t,api$error as n,api$named as r,api$newError as i,api$op as a,api$opPaginated as o,category$withAuthError as ee,category$withBadRequestError as te,category$withConflictError as ne,category$withParseError as re,config$Redacted as ie,config$String as ae,config$all as s,config$withDefault as c,pagination$paginateCursor as l,retry$capped as u,retry$jittered as d,retry$makeDefault as f,retry$throttlingFactory as p,retry$throttlingOptions as m,retry$transientFactory as h,retry$transientOptions as g,schema_lite_typed$TaggedError as _,schema_lite_typed$Unknown as v,trait$Body as y,trait$FormDataFile as b,trait$Header as x,trait$Http as S,trait$HttpBody as C,trait$IdempotencyToken as w,trait$KeyDictionary as T,trait$Label as E,trait$Query as D,trait$ResponseCode as O,trait$UnionCases as k,trait$applyErrorMatchers as A,trait$bodySymbol as j,trait$errorMatchersSymbol as M,trait$formDataFileSymbol as N,trait$getErrorMatchers as P,trait$headerSymbol as F,trait$httpBodySymbol as I,trait$httpSymbol as L,trait$keyDictionarySymbol as R,trait$labelSymbol as z,trait$querySymbol as B,trait$responseCodeSymbol as V,trait$unionCasesSymbol as H}from"@distilled.cloud/core/_bundle/base";import{errors$API_ERRORS as U,errors$BadGateway as W,errors$BadRequest as G,errors$ConfigError as K,errors$Conflict as q,errors$DEFAULT_ERRORS as J,errors$Forbidden as oe,errors$GatewayTimeout as se,errors$HTTP_STATUS_MAP as ce,errors$InternalServerError as le,errors$Locked as Y,errors$NotFound as ue,errors$ServiceUnavailable as de,errors$TooManyRequests as fe,errors$Unauthorized as pe,errors$UnknownErrorFields as me,errors$UnprocessableEntity as he,protocol_http$originFromConfig as ge,protocol_rest$BinaryResponse as _e,protocol_rest$RawResponse as ve,protocol_rest$RawResponseRoot as ye,protocol_rest$SensitiveValue as be,protocol_rest$rawResponseRootSymbol as xe,protocol_rest$rawResponseSymbol as Se,protocol_rest$restProtocol as Ce,protocol_rest$sensitiveValueSymbol as we,protocol_rest$unknownErrorProps as Te,schema_lite$Array as Ee,schema_lite$Boolean as De,schema_lite$NullOr as Oe,schema_lite$Number as ke,schema_lite$Record as Ae,schema_lite$String as je,schema_lite$Struct as Me,schema_lite$StructWithRest as Ne,schema_lite$TaggedError as Pe,schema_lite$Union as Fe,schema_lite$Unknown as Ie,schema_lite$at as Le,schema_lite$optional as Re,schema_lite$suspend as ze}from"@distilled.cloud/core/_bundle/rest";import*as X from"effect/Context";import*as Z from"effect/Effect";import*as Q from"effect/Layer";import*as Be from"effect/Redacted";const $=`https://api.pinterest.com`;const Ve=`https://api-sandbox.pinterest.com`;var Credentials=class extends (/*@__PURE__*/ X.Service()(`PinterestCredentials`)){};const check=(e,t)=>{const n=ge(`Pinterest base URL`,t??`https://api.pinterest.com`);return typeof n===`string`?Z.succeed(Z.succeed({accessToken:e,baseUrl:n})):Z.fail(n)};const He=/*@__PURE__*/ Q.effect(Credentials,/*@__PURE__*/ s({accessToken:/*@__PURE__*/ ie(`PINTEREST_ACCESS_TOKEN`),baseUrl:/*@__PURE__*/ ae(`PINTEREST_BASE_URL`).pipe(/*@__PURE__*/ c($))}).pipe(/*@__PURE__*/ Z.mapError(()=>new K({message:`PINTEREST_ACCESS_TOKEN environment variable is required`})),/*@__PURE__*/ Z.flatMap(({accessToken:e,baseUrl:t})=>check(e,t))));const fromAccessToken=e=>Q.effect(Credentials,check(e.accessToken,e.baseUrl));var UnknownPinterestError=class extends (/*@__PURE__*/ _()(`UnknownPinterestError`,me)){};var PinterestParseError=class extends (/*@__PURE__*/ _()(`PinterestParseError`,{body:v,cause:v}).pipe(re)){};const Ue=U;const We=/*@__PURE__*/ Ce({credentials:/*@__PURE__*/ Z.flatten(Credentials),baseUrl:e=>`${e.baseUrl}/v5`,headers:e=>({Authorization:`Bearer ${Be.value(e.accessToken)}`}),unknownError:e=>new UnknownPinterestError(Te(e)),parseError:({body:e,cause:t})=>new PinterestParseError({body:e,cause:t})});var Retry=class extends (/*@__PURE__*/ X.Service()(`PinterestRetry`)){};const policy=e=>Z.provide(Q.succeed(Retry,e));const Ge=/*@__PURE__*/ Z.provide(/*@__PURE__*/ Q.succeed(Retry,{while:()=>false}));const Ke=f;const qe=d;const Je=u;const Ye=m;const Xe=/*@__PURE__*/ policy(p);const Ze=g;const Qe=/*@__PURE__*/ policy(h);export{ne as Ca,Ee as Xc,De as Yc,e as a,t as b,Credentials as credentials$Credentials,He as credentials$CredentialsFromEnv,$ as credentials$DEFAULT_BASE_URL,Ve as credentials$SANDBOX_BASE_URL,fromAccessToken as credentials$fromAccessToken,U as errors$API_ERRORS,W as errors$BadGateway,G as errors$BadRequest,K as errors$ConfigError,q as errors$Conflict,J as errors$DEFAULT_ERRORS,oe as errors$Forbidden,se as errors$GatewayTimeout,ce as errors$HTTP_STATUS_MAP,le as errors$InternalServerError,Y as errors$Locked,ue as errors$NotFound,PinterestParseError as errors$PinterestParseError,Ue as errors$PinterestServiceErrors,de as errors$ServiceUnavailable,fe as errors$TooManyRequests,pe as errors$Unauthorized,UnknownPinterestError as errors$UnknownPinterestError,he as errors$UnprocessableEntity,n as f,Oe as fd,ke as gd,Ae as hd,je as jd,Me as kd,r as l,Ne as ld,i as m,Pe as md,a as n,o,Fe as od,l as pagination$paginateCursor,Ie as pd,We as protocol$PinterestProtocol,Le as rd,Retry as retry$Retry,Je as retry$capped,qe as retry$jittered,Ke as retry$makeDefault,Ge as retry$none,policy as retry$policy,Xe as retry$throttling,Ye as retry$throttlingOptions,Qe as retry$transient,Ze as retry$transientOptions,_e as traits$BinaryResponse,y as traits$Body,b as traits$FormDataFile,x as traits$Header,S as traits$Http,C as traits$HttpBody,w as traits$IdempotencyToken,T as traits$KeyDictionary,E as traits$Label,D as traits$Query,ve as traits$RawResponse,ye as traits$RawResponseRoot,O as traits$ResponseCode,be as traits$SensitiveValue,k as traits$UnionCases,A as traits$applyErrorMatchers,j as traits$bodySymbol,M as traits$errorMatchersSymbol,N as traits$formDataFileSymbol,P as traits$getErrorMatchers,F as traits$headerSymbol,I as traits$httpBodySymbol,L as traits$httpSymbol,R as traits$keyDictionarySymbol,z as traits$labelSymbol,B as traits$querySymbol,xe as traits$rawResponseRootSymbol,Se as traits$rawResponseSymbol,V as traits$responseCodeSymbol,we as traits$sensitiveValueSymbol,H as traits$unionCasesSymbol,Re as wd,ze as xd,ee as ya,te as za};
2
+ //# sourceMappingURL=sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.js","names":["Schema.Unknown","Category.withParseError","Retries.makeDefault","Retries.jittered","Retries.capped","Retries.throttlingOptions","Retries.throttlingFactory","Retries.transientOptions","Retries.transientFactory","D","call","error","named","newError","op","opPaginated","withAuthError","withBadRequestError","withConflictError","withParseError","Redacted$3","String$2","all$1","withDefault","paginateCursor","capped$1","jittered$1","makeDefault$1","throttlingFactory","throttlingOptions$1","transientFactory","transientOptions$1","TaggedError$1","Unknown$1","Body","FormDataFile","Header","Http","HttpBody","IdempotencyToken","KeyDictionary","Label","Query","ResponseCode","UnionCases","applyErrorMatchers","bodySymbol","errorMatchersSymbol","formDataFileSymbol","getErrorMatchers","headerSymbol","httpBodySymbol","httpSymbol","keyDictionarySymbol","labelSymbol","querySymbol","responseCodeSymbol","unionCasesSymbol","API_ERRORS","BadGateway","BadRequest","ConfigError","Conflict","DEFAULT_ERRORS","Forbidden","GatewayTimeout","HTTP_STATUS_MAP","InternalServerError","Locked","NotFound","ServiceUnavailable","TooManyRequests","Unauthorized","UnknownErrorFields","UnprocessableEntity","originFromConfig","BinaryResponse","RawResponse","RawResponseRoot","SensitiveValue","rawResponseRootSymbol","rawResponseSymbol","restProtocol","sensitiveValueSymbol","unknownErrorProps","Array","Boolean","NullOr","Number","Record","String","Struct","StructWithRest","TaggedError","Union","Unknown","at","optional","suspend","Context","Effect","Layer","Redacted","DEFAULT_BASE_URL","SANDBOX_BASE_URL","origin","baseUrl","CredentialsFromEnv","accessToken","config","PinterestServiceErrors","PinterestProtocol","creds","info","optionsOrFactory","none","makeDefault","jittered","capped","throttlingOptions","throttling","transientOptions","transient"],"sources":["../../src/credentials.ts","../../src/errors.ts","../../src/protocol.ts","../../src/retry.ts"],"mappings":"qgFAyBA,MAAauG,EAAmB,4BAGhC,MAAaC,GAAmB,oCAShC,IAAa,YAAb,eACwB,gBAAQ,QAA4C,CAAC,CACzE,sBACF,EAAA,AAAE,CAAC,EAGL,MAAM,OACJ,EACA,IACsD,CACtD,MAAMC,EAAS9B,GAAiB,qBAAsB+B,GAAA,2BAA2B,EACjF,OAAO,OAAOD,IAAW,SACrBL,EAAO,QAAQA,EAAO,QAAQ,CAAE,cAAa,QAASK,CAAO,CAAC,CAAC,EAC/DL,EAAO,KAAKK,CAAM,CACxB,EAOA,MAAaE,GAA0E,gBAAM,OAC3F,YACc,gBAAiB,CAC7B,YAA2B,iBAAsB,wBAAwB,EACzE,QAAuB,iBAAoB,oBAAoB,CAAC,CAAC,KACjD,gBAAyBJ,CAAgB,CACzD,CACF,CAAC,CAAC,CAAC,KACa,gBAAO,aACb,IAAI1C,EAAY,CAAE,QAAS,yDAA0D,CAAC,CAC9F,EACc,gBAAO,SAAS,CAAE,cAAa,aAAc,MAAM+C,EAAaF,CAAO,CAAC,CACxF,CACF,EAGA,MAAa,gBAAmB,GAI9BL,EAAM,OAAO,YAAa,MAAMQ,EAAO,YAAaA,EAAO,OAAO,CAAC,ECpCrE,IAAa,sBAAb,eACwB,gBAA0C,CAAC,CAC/D,wBACApC,EACF,EAAA,AAAE,CAAC,EAGL,IAAa,oBAAb,eACwB,gBAAwC,CAAC,CAAC,sBAAuB,CACrF,KAAMzE,EACN,MAAOA,CACT,CAAC,CAAC,CAAC,KAAKC,EAAuB,EAAA,AAAE,CAAC,EAOpC,MAAa6G,GAAyBpD,ECpBtC,MAAaqD,GAAkC,iBAAa,CAG1D,YAA2B,gBAAO,QAAQ,WAAW,EAErD,QAAU,GAAU,GAAGC,EAAM,QAAQ,KACrC,QAAU,IAAW,CACnB,cAAe,UAAUV,GAAS,MAAMU,EAAM,WAAW,GAC3D,GACA,aAAe,GAAS,IAAI,sBAAsB5B,GAAkB6B,CAAI,CAAC,EACzE,YAAa,CAAE,OAAM,WAAY,IAAI,oBAAoB,CAAE,OAAM,OAAM,CAAC,CAC1E,CAAC,EC1BD,IAAa,MAAb,eAAyC,gBAAQ,QAAuB,CAAC,CAAC,gBAAgB,EAAA,AAAE,CAAC,EAG7F,MAAa,OAOR,GAAwCb,EAAO,QAAQC,EAAM,QAAQ,MAAOa,CAAgB,CAAC,EAGlG,MAAaC,GAE+C,gBAAO,QACnD,gBAAM,QAAQ,MAAO,CAAE,UAAa,KAAM,CAAC,CAC3D,EAOA,MAAaC,GAAuBlH,EAEpC,MAAamH,GAAWlH,EACxB,MAAamH,GAASlH,EAGtB,MAAamH,GAA6BlH,EAG1C,MAAamH,GAE+C,qBAAOlH,CAAyB,EAG5F,MAAamH,GAA4BlH,EAGzC,MAAamH,GAE+C,qBAAOlH,CAAwB"}
@@ -0,0 +1,31 @@
1
+ import { ConfigError } from "@distilled.cloud/core/errors";
2
+ import * as Context from "effect/Context";
3
+ import * as Effect from "effect/Effect";
4
+ import * as Layer from "effect/Layer";
5
+ import * as Redacted from "effect/Redacted";
6
+ /** The Pinterest API host (the spec's `servers` entry, without `/v5`). */
7
+ export declare const DEFAULT_BASE_URL = "https://api.pinterest.com";
8
+ /** The sandbox host, for apps on trial access. */
9
+ export declare const SANDBOX_BASE_URL = "https://api-sandbox.pinterest.com";
10
+ export interface Config {
11
+ /** OAuth 2.0 access token (user, client credentials or conversion token). */
12
+ readonly accessToken: Redacted.Redacted<string>;
13
+ /** API origin, without a trailing slash. The protocol adds `/v5`. */
14
+ readonly baseUrl: string;
15
+ }
16
+ declare const Credentials_base: Context.ServiceClass<Credentials, "PinterestCredentials", Effect.Effect<Config, never, never>>;
17
+ export declare class Credentials extends /*@__PURE__*/ Credentials_base {
18
+ }
19
+ /**
20
+ * Reads `PINTEREST_ACCESS_TOKEN` (required) and `PINTEREST_BASE_URL`
21
+ * (optional), once: when the layer is built. A missing token or a bad base
22
+ * URL fails the layer with `ConfigError`.
23
+ */
24
+ export declare const CredentialsFromEnv: Layer.Layer<Credentials, ConfigError>;
25
+ /** Credentials from a redacted access token and an optional base URL. */
26
+ export declare const fromAccessToken: (config: {
27
+ readonly accessToken: Redacted.Redacted<string>;
28
+ readonly baseUrl?: string;
29
+ }) => Layer.Layer<Credentials, ConfigError>;
30
+ export {};
31
+ //# sourceMappingURL=credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.d.ts","sources":["../src/credentials.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C,0EAA0E;AAC1E,eAAO,MAAM,gBAAgB,8BAA8B,CAAC;AAE5D,kDAAkD;AAClD,eAAO,MAAM,gBAAgB,sCAAsC,CAAC;AAEpE,MAAM,WAAW,MAAM;IACrB,6EAA6E;IAC7E,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAChD,qEAAqE;IACrE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;;AAED,qBAAa,WACX,SAAQ,aAAa,CAAC,gBAErB;CAAG;AAaN;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAapE,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,eAAe,WAAY;IACtC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAChD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B,KAAG,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAC8B,CAAC"}
@@ -0,0 +1 @@
1
+ export { credentials$Credentials as Credentials, credentials$CredentialsFromEnv as CredentialsFromEnv, credentials$DEFAULT_BASE_URL as DEFAULT_BASE_URL, credentials$SANDBOX_BASE_URL as SANDBOX_BASE_URL, credentials$fromAccessToken as fromAccessToken } from "./_bundle/sdk.js";
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Pinterest-specific error types.
3
+ *
4
+ * Re-exports the shared HTTP status errors from core and adds the
5
+ * Pinterest fallback and parse errors.
6
+ *
7
+ * Pinterest answers a failed call with `{ code, message }`
8
+ * (`Pinterest.Lib.Error` in the spec), where `code` is a number such as
9
+ * `2` and `message` the reason (`"AdAccount not found."`). The spec
10
+ * declares that body for 400, 401, 403, 404 and 429 on nearly every
11
+ * operation. 400, 403, 404, 409 and 422 are generated per operation as
12
+ * service-local classes with `code` and `message`; 401, 429 and the 5xx
13
+ * map to core's status classes; any other status is an
14
+ * {@link UnknownPinterestError} carrying the `code`.
15
+ */
16
+ export { BadGateway, BadRequest, Conflict, ConfigError, Forbidden, GatewayTimeout, InternalServerError, Locked, NotFound, ServiceUnavailable, TooManyRequests, Unauthorized, UnprocessableEntity, HTTP_STATUS_MAP, DEFAULT_ERRORS, API_ERRORS, } from "@distilled.cloud/core/errors";
17
+ export type { DefaultErrors } from "@distilled.cloud/core/errors";
18
+ import * as Schema from "@distilled.cloud/core/schema-lite-typed";
19
+ declare const UnknownPinterestError_base: Schema.TaggedErrorClass<"UnknownPinterestError", {
20
+ status: import("effect/Schema").Number;
21
+ code: import("effect/Schema").optional<import("effect/Schema").String>;
22
+ message: import("effect/Schema").optional<import("effect/Schema").String>;
23
+ body: import("effect/Schema").Unknown;
24
+ }>;
25
+ /**
26
+ * Unknown Pinterest error -- returned when an error response matches
27
+ * neither an operation's typed errors nor a shared HTTP status class.
28
+ */
29
+ export declare class UnknownPinterestError extends /*@__PURE__*/ UnknownPinterestError_base {
30
+ }
31
+ declare const PinterestParseError_base: Schema.TaggedErrorClass<"PinterestParseError", {
32
+ readonly body: import("effect/Schema").Unknown;
33
+ readonly cause: import("effect/Schema").Unknown;
34
+ }> & (new (...args: any[]) => {
35
+ "@distilled.cloud/error/categories": {
36
+ ParseError: true;
37
+ };
38
+ });
39
+ /** A 2xx response that does not match the operation's output schema. */
40
+ export declare class PinterestParseError extends /*@__PURE__*/ PinterestParseError_base {
41
+ }
42
+ /**
43
+ * The errors declared on the Pinterest service: any operation can return them,
44
+ * and every generated operation lists them as its `serviceErrors`. Today that
45
+ * is each of core's status classes (400, 401, 403, 404, 409, 429, the 5xx ...).
46
+ */
47
+ export declare const PinterestServiceErrors: readonly [typeof import("@distilled.cloud/core/errors").Unauthorized, typeof import("@distilled.cloud/core/errors").Forbidden, typeof import("@distilled.cloud/core/errors").NotFound, typeof import("@distilled.cloud/core/errors").BadRequest, typeof import("@distilled.cloud/core/errors").Conflict, typeof import("@distilled.cloud/core/errors").UnprocessableEntity, typeof import("@distilled.cloud/core/errors").TooManyRequests, typeof import("@distilled.cloud/core/errors").Locked, typeof import("@distilled.cloud/core/errors").InternalServerError, typeof import("@distilled.cloud/core/errors").BadGateway, typeof import("@distilled.cloud/core/errors").ServiceUnavailable, typeof import("@distilled.cloud/core/errors").GatewayTimeout];
48
+ export type PinterestServiceError = InstanceType<(typeof PinterestServiceErrors)[number]>;
49
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGlE,OAAO,KAAK,MAAM,MAAM,yCAAyC,CAAC;;;;;;;AAElE;;;GAGG;AACH,qBAAa,qBACX,SAAQ,aAAa,CAAC,0BAGrB;CAAG;;;;;;;;;AAEN,wEAAwE;AACxE,qBAAa,mBACX,SAAQ,aAAa,CAAC,wBAGU;CAAG;AAErC;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,+tBAAa,CAAC;AACjD,MAAM,MAAM,qBAAqB,GAAG,YAAY,CAAC,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC"}
package/lib/errors.js ADDED
@@ -0,0 +1 @@
1
+ export { errors$API_ERRORS as API_ERRORS, errors$BadGateway as BadGateway, errors$BadRequest as BadRequest, errors$ConfigError as ConfigError, errors$Conflict as Conflict, errors$DEFAULT_ERRORS as DEFAULT_ERRORS, errors$Forbidden as Forbidden, errors$GatewayTimeout as GatewayTimeout, errors$HTTP_STATUS_MAP as HTTP_STATUS_MAP, errors$InternalServerError as InternalServerError, errors$Locked as Locked, errors$NotFound as NotFound, errors$PinterestParseError as PinterestParseError, errors$PinterestServiceErrors as PinterestServiceErrors, errors$ServiceUnavailable as ServiceUnavailable, errors$TooManyRequests as TooManyRequests, errors$Unauthorized as Unauthorized, errors$UnknownPinterestError as UnknownPinterestError, errors$UnprocessableEntity as UnprocessableEntity } from "./_bundle/sdk.js";
package/lib/index.d.ts ADDED
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @distilled.cloud/pinterest -- Pinterest API v5 SDK for Effect.
3
+ *
4
+ * `./services` is generated by `scripts/generate.ts` from the Smithy model
5
+ * that `scripts/convert.ts` converts from the OpenAPI document mirrored at
6
+ * `specs/spec-mirror-pinterest/specs/openapi.json`. Everything else in this
7
+ * folder is hand-written.
8
+ *
9
+ * Pinterest API v5 is one service, so its operations are exported straight
10
+ * off the package root.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import * as Pinterest from "@distilled.cloud/pinterest";
15
+ *
16
+ * const account = yield* Pinterest.getUserAccount({});
17
+ * ```
18
+ */
19
+ export * from "./credentials.ts";
20
+ export * from "./errors.ts";
21
+ export * as T from "./traits.ts";
22
+ export { PinterestProtocol, type PinterestOpError, type PinterestOpContext } from "./protocol.ts";
23
+ export { paginateCursor } from "./pagination.ts";
24
+ export * as Retry from "./retry.ts";
25
+ export * from "./services/pinterest.ts";
26
+ export { BadRequest, Conflict, Forbidden, NotFound, UnprocessableEntity, } from "./services/pinterest.ts";
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,cAAc,yBAAyB,CAAC;AAGxC,OAAO,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,mBAAmB,GACpB,MAAM,yBAAyB,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,8 @@
1
+ export * from "./credentials.js";
2
+ export * from "./errors.js";
3
+ export * as T from "./traits.js";
4
+ export { PinterestProtocol } from "./protocol.js";
5
+ export { paginateCursor } from "./pagination.js";
6
+ export * as Retry from "./retry.js";
7
+ export * from "./services/pinterest.js";
8
+ export { BadRequest, Conflict, Forbidden, NotFound, UnprocessableEntity } from "./services/pinterest.js";
@@ -0,0 +1,8 @@
1
+ export * from "./credentials.js";
2
+ export * from "./errors.js";
3
+ export * as T from "./traits.js";
4
+ export { PinterestProtocol } from "./protocol.js";
5
+ export { paginateCursor } from "./pagination.js";
6
+ export * as Retry from "./retry.js";
7
+ export * from "./services.lazy/pinterest.js";
8
+ export { BadRequest, Conflict, Forbidden, NotFound, UnprocessableEntity } from "./services.lazy/pinterest.js";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAkD,MAAM,eAAe,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,0EAA0E;AAC1E,sEAAsE;AACtE,OAAO,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,mBAAmB,GACpB,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Pinterest pagination -- hand-written.
3
+ *
4
+ * Pinterest API v5 lists answer `{ items, bookmark }` and take `bookmark`
5
+ * back as a query parameter; `bookmark` is null on the last page.
6
+ * `patches/pagination.json` stamps that on each list, and generated
7
+ * operations pass core's {@link paginateCursor} strategy to
8
+ * `API.makePaginated`.
9
+ */
10
+ export { paginateCursor } from "@distilled.cloud/core/pagination";
11
+ //# sourceMappingURL=pagination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.d.ts","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC"}
@@ -0,0 +1 @@
1
+ export { pagination$paginateCursor as paginateCursor } from "./_bundle/sdk.js";
@@ -0,0 +1,20 @@
1
+ import type { ErrorOf } from "@distilled.cloud/core/protocol";
2
+ import type * as HttpClient from "effect/http/HttpClient";
3
+ import { Credentials } from "./credentials.ts";
4
+ import { PinterestParseError, UnknownPinterestError, type PinterestServiceError } from "./errors.ts";
5
+ /**
6
+ * What every generated Pinterest operation fails with besides its own
7
+ * errors: the errors declared on the service, and the errors declared on
8
+ * the protocol. Nobody lists the protocol's: its type carries what its code
9
+ * fails with (a response that does not match its schema, a failed response
10
+ * nothing declares, core's REST errors, and what resolving the credentials
11
+ * fails with). Generated service files annotate operations with
12
+ * `API.OperationMethod<I, O, PinterestOpError, PinterestOpContext>`
13
+ * explicitly so the compiler never infers these back out of the schema
14
+ * generics.
15
+ */
16
+ export type PinterestOpError = PinterestServiceError | ErrorOf<typeof PinterestProtocol>;
17
+ /** Context (requirements) shared by every generated Pinterest operation. */
18
+ export type PinterestOpContext = Credentials | HttpClient.HttpClient;
19
+ export declare const PinterestProtocol: import("@distilled.cloud/core/protocol").Protocol<PinterestParseError | UnknownPinterestError | import("@distilled.cloud/core/protocol-rest").RestProtocolError, Credentials>;
20
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAe9D,OAAO,KAAK,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,qBAAqB,EAC3B,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,GAAG,OAAO,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEzF,4EAA4E;AAC5E,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC;AAErE,eAAO,MAAM,iBAAiB,+KAW5B,CAAC"}
@@ -0,0 +1 @@
1
+ export { protocol$PinterestProtocol as PinterestProtocol } from "./_bundle/sdk.js";
package/lib/retry.d.ts ADDED
@@ -0,0 +1,50 @@
1
+ import * as Retries from "@distilled.cloud/core/retry";
2
+ /**
3
+ * Pinterest retry surface -- a veneer over `@distilled.cloud/core/retry`.
4
+ *
5
+ * The `Retry` service tag is threaded into every generated operation via
6
+ * `API.make({ retry: Retry })`, so a caller-installed policy applies to all
7
+ * Pinterest calls below it and core's `makeDefault` is the fallback when none is
8
+ * provided.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * import * as Pinterest from "@distilled.cloud/pinterest";
13
+ *
14
+ * myEffect.pipe(Pinterest.Retry.transient);
15
+ * ```
16
+ */
17
+ import * as Context from "effect/Context";
18
+ import * as Effect from "effect/Effect";
19
+ export type Options = Retries.Options;
20
+ export type Factory = Retries.Factory;
21
+ export type Policy = Retries.Policy;
22
+ declare const Retry_base: Context.ServiceClass<Retry, "PinterestRetry", Retries.Policy>;
23
+ /** Context tag for configuring retry behavior of Pinterest API calls. */
24
+ export declare class Retry extends /*@__PURE__*/ Retry_base {
25
+ }
26
+ /** Provides a custom retry policy to every Pinterest API call below it. */
27
+ export declare const policy: {
28
+ (options: Options): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
29
+ (factory: Factory): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
30
+ };
31
+ /** Disables all automatic retries. */
32
+ export declare const none: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
33
+ /**
34
+ * The default retry policy (core's): transient/throttling/retryable errors,
35
+ * capped exponential backoff with jitter, server `retryAfter` hints honored
36
+ * with precedence.
37
+ */
38
+ export declare const makeDefault: Factory;
39
+ export declare const jittered: <Error, Env>(self: import("effect/Schedule").Schedule<unknown, unknown, Error, Env>) => import("effect/Schedule").Schedule<unknown, unknown, Error, Env>;
40
+ export declare const capped: (max: import("effect/Duration").Duration) => <Error, Env>(self: import("effect/Schedule").Schedule<unknown, unknown, Error, Env>) => import("effect/Schedule").Schedule<unknown, unknown, Error, Env>;
41
+ /** Retry options that retry all throttling errors indefinitely. */
42
+ export declare const throttlingOptions: Options;
43
+ /** Retries all throttling errors indefinitely (honoring server hints). */
44
+ export declare const throttling: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
45
+ /** Retry options that retry all transient errors indefinitely. */
46
+ export declare const transientOptions: Options;
47
+ /** Retries all transient errors indefinitely. */
48
+ export declare const transient: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
49
+ export {};
50
+ //# sourceMappingURL=retry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.d.ts","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AACvD;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;AACtC,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;AACtC,MAAM,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;;AAEpC,yEAAyE;AACzE,qBAAa,KAAM,SAAQ,aAAa,CAAC,UAAkD;CAAG;AAE9F,2EAA2E;AAC3E,eAAO,MAAM,MAAM,EAAE;IACnB,CACE,OAAO,EAAE,OAAO,GACf,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;IACvF,CACE,OAAO,EAAE,OAAO,GACf,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;CACU,CAAC;AAEpG,sCAAsC;AACtC,eAAO,MAAM,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EACzB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAC3B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAEzC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,OAA6B,CAAC;AAExD,eAAO,MAAM,QAAQ,0JAAmB,CAAC;AACzC,eAAO,MAAM,MAAM,uMAAiB,CAAC;AAErC,mEAAmE;AACnE,eAAO,MAAM,iBAAiB,EAAE,OAAmC,CAAC;AAEpE,0EAA0E;AAC1E,eAAO,MAAM,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAC3B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAmD,CAAC;AAE9F,kEAAkE;AAClE,eAAO,MAAM,gBAAgB,EAAE,OAAkC,CAAC;AAElE,iDAAiD;AACjD,eAAO,MAAM,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAC3B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAkD,CAAC"}
package/lib/retry.js ADDED
@@ -0,0 +1 @@
1
+ export { retry$Retry as Retry, retry$capped as capped, retry$jittered as jittered, retry$makeDefault as makeDefault, retry$none as none, retry$policy as policy, retry$throttling as throttling, retry$throttlingOptions as throttlingOptions, retry$transient as transient, retry$transientOptions as transientOptions } from "./_bundle/sdk.js";
@@ -0,0 +1,2 @@
1
+ export * as pinterest from "./pinterest.ts";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sources":["../../src/services/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1 @@
1
+ export * as pinterest from "./pinterest.js";