diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d37febe..1a55fdb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: - name: Compile run: yarn && yarn build - + test: runs-on: ubuntu-latest @@ -27,22 +27,31 @@ jobs: uses: actions/setup-node@v3 - name: Compile - run: yarn && yarn test - + run: yarn && yarn test + publish: needs: [ compile, test ] if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') runs-on: ubuntu-latest - steps: - name: Checkout repo uses: actions/checkout@v3 - - name: Set up node uses: actions/setup-node@v3 - - name: Install dependencies run: yarn install - - name: Build - run: yarn build \ No newline at end of file + run: yarn build + + - name: Publish to npm + run: | + npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} + if [[ ${GITHUB_REF} == *alpha* ]]; then + npm publish --access public --tag alpha + elif [[ ${GITHUB_REF} == *beta* ]]; then + npm publish --access public --tag beta + else + npm publish --access public + fi + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 1498321..72271e0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,3 @@ node_modules .DS_Store -/dist -/Client.d.ts -/Client.js -/environments.d.ts -/environments.js -/index.d.ts -/index.js -/api -/core -/errors -/serialization \ No newline at end of file +/dist \ No newline at end of file diff --git a/.npmignore b/.npmignore index e62938d..6db0876 100644 --- a/.npmignore +++ b/.npmignore @@ -1,5 +1,6 @@ node_modules src +tests .gitignore .github .fernignore diff --git a/jest.config.js b/jest.config.js index 3a09892..35d6e65 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,5 +1,5 @@ -/** @type {import('ts-jest').JestConfigWithTsJest} */ +/** @type {import('jest').Config} */ module.exports = { preset: "ts-jest", testEnvironment: "node", -}; \ No newline at end of file +}; diff --git a/package.json b/package.json index d38a850..050632a 100644 --- a/package.json +++ b/package.json @@ -1,19 +1,20 @@ { - "name": "", - "version": "0.1.2", + "name": "beehiiv", + "version": "0.1.3", "private": false, - "repository": "https://github.com/fern-demo/beehiiv-typescript", + "repository": "https://github.com/beehiiv/typescript-sdk", "main": "./index.js", "types": "./index.d.ts", "scripts": { - "format": "prettier --write 'src/**/*.ts'", + "format": "prettier . --write --ignore-unknown", "build": "tsc", "prepack": "cp -rv dist/. .", "test": "jest" }, "dependencies": { "url-join": "4.0.1", - "form-data": "4.0.0", + "form-data": "^4.0.0", + "formdata-node": "^6.0.3", "node-fetch": "2.7.0", "qs": "6.11.2", "js-base64": "3.7.2" @@ -22,11 +23,17 @@ "@types/url-join": "4.0.1", "@types/qs": "6.9.8", "@types/node-fetch": "2.6.9", - "jest": "^29.7.0", - "@types/jest": "^29.5.5", - "ts-jest": "^29.1.1", + "jest": "29.7.0", + "@types/jest": "29.5.5", + "ts-jest": "29.1.1", + "jest-environment-jsdom": "29.7.0", "@types/node": "17.0.33", "prettier": "2.7.1", "typescript": "4.6.4" + }, + "browser": { + "fs": false, + "os": false, + "path": false } -} \ No newline at end of file +} diff --git a/reference.md b/reference.md index aa237c2..b5710ce 100644 --- a/reference.md +++ b/reference.md @@ -1,669 +1,472 @@ +# Reference ## Publications - -
beehiiv.publications.list({ ...params }) -> Beehiiv.PublicationsListResponse - +
client.publications.list({ ...params }) -> Beehiiv.PublicationsListResponse
-
#### 📝 Description
-
-
Retrieve all publications associated with your API key.
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.publications.list(); +```typescript +await client.publications.list({ + expand: Beehiiv.PublicationsListRequestExpandItem.Stats, +}); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**request: `Beehiiv.PublicationsListRequest`** - +**request:** `Beehiiv.PublicationsListRequest`
-
-
- -**requestOptions: `Publications.RequestOptions`** - +**requestOptions:** `Publications.RequestOptions`
-
-
-
- -
-
- -
beehiiv.publications.get(publicationId, { ...params }) -> Beehiiv.PublicationsGetResponse - +
client.publications.get(publicationId, { ...params }) -> Beehiiv.PublicationsGetResponse
-
#### 📝 Description
-
-
Retrieve a single publication
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.publications.get("pub_00000000-0000-0000-0000-000000000000"); +```typescript +await client.publications.get("pub_ad76629e-4a39-43ad-8055-0ee89dc6db15", { + expand: Beehiiv.PublicationsGetRequestExpandItem.Stats, +}); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**request: `Beehiiv.PublicationsGetRequest`** - +**request:** `Beehiiv.PublicationsGetRequest`
-
-
- -**requestOptions: `Publications.RequestOptions`** - +**requestOptions:** `Publications.RequestOptions`
-
-
-
- -
-
- - - ## Posts - -
beehiiv.posts.list(publicationId, { ...params }) -> Beehiiv.PostsListResponse - +
client.posts.list(publicationId, { ...params }) -> Beehiiv.PostsListResponse
-
#### 📝 Description
-
-
Retrieve all posts belonging to a specific publication
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.posts.list("pub_00000000-0000-0000-0000-000000000000"); +```typescript +await client.posts.list("pub_00000000-0000-0000-0000-000000000000"); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**request: `Beehiiv.PostsListRequest`** - +**request:** `Beehiiv.PostsListRequest`
-
-
- -**requestOptions: `Posts.RequestOptions`** - +**requestOptions:** `Posts.RequestOptions`
-
-
-
- -
-
- -
beehiiv.posts.get(postId, publicationId, { ...params }) -> Beehiiv.PostsGetResponse - +
client.posts.get(postId, publicationId, { ...params }) -> Beehiiv.PostsGetResponse
-
#### 📝 Description
-
-
Retreive a single Post belonging to a specific publication
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.posts.get("post_00000000-0000-0000-0000-000000000000", "pub_00000000-0000-0000-0000-000000000000"); +```typescript +await client.posts.get("post_00000000-0000-0000-0000-000000000000", "pub_00000000-0000-0000-0000-000000000000"); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**postId: `string`** — The prefixed ID of the post object - +**postId:** `string` — The prefixed ID of the post object
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**request: `Beehiiv.PostsGetRequest`** - +**request:** `Beehiiv.PostsGetRequest`
-
-
- -**requestOptions: `Posts.RequestOptions`** - +**requestOptions:** `Posts.RequestOptions`
-
-
-
- -
-
- -
beehiiv.posts.delete(postId, publicationId) -> Beehiiv.PostsDeleteResponse - +
client.posts.delete(postId, publicationId) -> Beehiiv.PostsDeleteResponse
-
#### 📝 Description
-
-
Delete or Archive a post. Any post that has been confirmed will have it's status changed to `archived`. Posts in the `draft` status will be permenantly deleted.
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.posts.delete("post_00000000-0000-0000-0000-000000000000", "pub_00000000-0000-0000-0000-000000000000"); +```typescript +await client.posts.delete("post_00000000-0000-0000-0000-000000000000", "pub_00000000-0000-0000-0000-000000000000"); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**postId: `string`** — The prefixed ID of the post object - +**postId:** `string` — The prefixed ID of the post object
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**requestOptions: `Posts.RequestOptions`** - +**requestOptions:** `Posts.RequestOptions`
-
-
-
- -
-
- - - ## Subscriptions - -
beehiiv.subscriptions.list(publicationId, { ...params }) -> Beehiiv.SubscriptionsListResponse - +
client.subscriptions.list(publicationId, { ...params }) -> Beehiiv.SubscriptionsListResponse
-
#### 📝 Description
-
-
Retrieve all subscriptions belonging to a specific publication
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.subscriptions.list("pub_00000000-0000-0000-0000-000000000000", { - email: "clark@dailyplanet.com" +```typescript +await client.subscriptions.list("pub_00000000-0000-0000-0000-000000000000", { + email: "clark@dailyplanet.com", }); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**request: `Beehiiv.SubscriptionsListRequest`** - +**request:** `Beehiiv.SubscriptionsListRequest`
-
-
- -**requestOptions: `Subscriptions.RequestOptions`** - +**requestOptions:** `Subscriptions.RequestOptions`
-
-
-
- -
-
- -
beehiiv.subscriptions.create(publicationId, { ...params }) -> Beehiiv.SubscriptionsCreateResponse - +
client.subscriptions.create(publicationId, { ...params }) -> Beehiiv.SubscriptionsCreateResponse
-
#### 📝 Description
-
-
Create new subscriptions for a publication.
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.subscriptions.create("pub_00000000-0000-0000-0000-000000000000", { +```typescript +await client.subscriptions.create("pub_00000000-0000-0000-0000-000000000000", { email: "bruce.wayne@wayneenterprise.com", reactivateExisting: false, sendWelcomeEmail: false, @@ -671,411 +474,291 @@ await beehiiv.subscriptions.create("pub_00000000-0000-0000-0000-000000000000", { utmMedium: "organic", utmCampaign: "fall_2022_promotion", referringSite: "www.wayneenterprise.com/blog", - customFields: [{ + customFields: [ + { name: "First Name", - value: "Bruce" - }, { + value: "Bruce", + }, + { name: "Last Name", - value: "Wayne" - }], - automationIds: ["aut_00000000-0000-0000-0000-000000000000"] + value: "Wayne", + }, + ], + stripeCustomerId: "stripe_customer_id", }); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**request: `Beehiiv.SubscriptionsCreateRequest`** - +**request:** `Beehiiv.SubscriptionsCreateRequest`
-
-
- -**requestOptions: `Subscriptions.RequestOptions`** - +**requestOptions:** `Subscriptions.RequestOptions`
-
-
-
- -
-
- -
beehiiv.subscriptions.put(publicationId, { ...params }) -> Beehiiv.SubscriptionsPutResponse - +
client.subscriptions.put(publicationId, { ...params }) -> Beehiiv.SubscriptionsPutResponse
-
#### 📝 Description
-
-
Bulk update subscriptions' field values (standard fields and custom fields)
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.subscriptions.put("publicationId"); +```typescript +await client.subscriptions.put("publicationId"); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**request: `Beehiiv.SubscriptionsPutRequest`** - +**request:** `Beehiiv.SubscriptionsPutRequest`
-
-
- -**requestOptions: `Subscriptions.RequestOptions`** - +**requestOptions:** `Subscriptions.RequestOptions`
-
-
-
- -
-
- -
beehiiv.subscriptions.patch(publicationId, { ...params }) -> Beehiiv.SubscriptionsPatchResponse - +
client.subscriptions.patch(publicationId, { ...params }) -> Beehiiv.SubscriptionsPatchResponse
-
#### 📝 Description
-
-
Bulk update subscriptions' field values (standard fields and custom fields)
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.subscriptions.patch("publicationId"); +```typescript +await client.subscriptions.patch("publicationId"); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**request: `Beehiiv.SubscriptionsPatchRequest`** - +**request:** `Beehiiv.SubscriptionsPatchRequest`
-
-
- -**requestOptions: `Subscriptions.RequestOptions`** - +**requestOptions:** `Subscriptions.RequestOptions`
-
-
-
- -
-
- -
beehiiv.subscriptions.get(publicationId, email, { ...params }) -> Beehiiv.SubscriptionsGetResponse - +
client.subscriptions.get(publicationId, email, { ...params }) -> Beehiiv.SubscriptionsGetResponse
-
#### 📝 Description
-
-
Retrieve a single subscription belonging to a specific email address in a specific publication
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.subscriptions.get("pub_00000000-0000-0000-0000-000000000000", "work@example.com"); +```typescript +await client.subscriptions.get("pub_00000000-0000-0000-0000-000000000000", "work@example.com"); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**email: `string`** — The ID of the subscriber object - +**email:** `string` — The ID of the subscriber object
-
-
- -**request: `Beehiiv.SubscriptionsGetRequest`** - +**request:** `Beehiiv.SubscriptionsGetRequest`
-
-
- -**requestOptions: `Subscriptions.RequestOptions`** - +**requestOptions:** `Subscriptions.RequestOptions`
-
-
-
- -
-
- -
beehiiv.subscriptions.delete(subscriptionId, publicationId) -> Record - +
client.subscriptions.delete(subscriptionId, publicationId) -> Record
-
#### 📝 Description
-
-
Delete a subscription. @@ -1085,1592 +768,1105 @@ Delete a subscription. If a premium subscription is deleted they will no longer be billed.
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.subscriptions.delete("sub_00000000-0000-0000-0000-000000000000", "pub_00000000-0000-0000-0000-000000000000"); +```typescript +await client.subscriptions.delete( + "sub_00000000-0000-0000-0000-000000000000", + "pub_00000000-0000-0000-0000-000000000000" +); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**subscriptionId: `string`** — The prefixed ID of the subscription object - +**subscriptionId:** `string` — The prefixed ID of the subscription object
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**requestOptions: `Subscriptions.RequestOptions`** - +**requestOptions:** `Subscriptions.RequestOptions`
-
-
-
- -
-
- - - ## Segments - -
beehiiv.segments.list(publicationId, { ...params }) -> Beehiiv.SegmentsListResponse - +
client.segments.list(publicationId, { ...params }) -> Beehiiv.SegmentsListResponse
-
#### 📝 Description
-
-
Retrieve information about all segments belonging to a specific publication
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.segments.list("pub_00000000-0000-0000-0000-000000000000"); +```typescript +await client.segments.list("pub_00000000-0000-0000-0000-000000000000"); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**request: `Beehiiv.SegmentsListRequest`** - +**request:** `Beehiiv.SegmentsListRequest`
-
-
- -**requestOptions: `Segments.RequestOptions`** - +**requestOptions:** `Segments.RequestOptions`
-
-
-
- -
-
- -
beehiiv.segments.get(publicationId, segmentId, { ...params }) -> Beehiiv.SegmentsGetResponse - +
client.segments.get(publicationId, segmentId, { ...params }) -> Beehiiv.SegmentsGetResponse
-
#### 📝 Description
-
-
List the Subscriber Ids from the most recent calculation of a specific publication.
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.segments.get("pub_00000000-0000-0000-0000-000000000000", "seg_00000000-0000-0000-0000-000000000000"); +```typescript +await client.segments.get("pub_00000000-0000-0000-0000-000000000000", "seg_00000000-0000-0000-0000-000000000000"); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**segmentId: `string`** — The prefixed ID of the segment object - +**segmentId:** `string` — The prefixed ID of the segment object
-
-
- -**request: `Beehiiv.SegmentsGetRequest`** - +**request:** `Beehiiv.SegmentsGetRequest`
-
-
- -**requestOptions: `Segments.RequestOptions`** - +**requestOptions:** `Segments.RequestOptions`
-
-
-
- -
-
- -
beehiiv.segments.delete(publicationId, segmentId) -> Record - +
client.segments.delete(publicationId, segmentId) -> Record
-
#### 📝 Description
-
-
Delete a segment. Deleting the segment does not effect the subscriptions in the segment.
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.segments.delete("pub_00000000-0000-0000-0000-000000000000", "seg_00000000-0000-0000-0000-000000000000"); +```typescript +await client.segments.delete("pub_00000000-0000-0000-0000-000000000000", "seg_00000000-0000-0000-0000-000000000000"); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**segmentId: `string`** — The prefixed ID of the segment object - +**segmentId:** `string` — The prefixed ID of the segment object
-
-
- -**requestOptions: `Segments.RequestOptions`** - +**requestOptions:** `Segments.RequestOptions`
-
-
-
- -
-
- - - ## Email Blasts - -
beehiiv.emailBlasts.list(publicationId, { ...params }) -> Beehiiv.EmailBlastsListResponse - +
client.emailBlasts.list(publicationId, { ...params }) -> Beehiiv.EmailBlastsListResponse
-
#### 📝 Description
-
-
Retrieve all Email Blasts
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.emailBlasts.list("pub_00000000-0000-0000-0000-000000000000"); +```typescript +await client.emailBlasts.list("pub_00000000-0000-0000-0000-000000000000"); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**request: `Beehiiv.EmailBlastsListRequest`** - +**request:** `Beehiiv.EmailBlastsListRequest`
-
-
- -**requestOptions: `EmailBlasts.RequestOptions`** - +**requestOptions:** `EmailBlasts.RequestOptions`
-
-
-
- -
-
- -
beehiiv.emailBlasts.get(publicationId, emailBlastId, { ...params }) -> Beehiiv.EmailBlastsGetResponse - +
client.emailBlasts.get(publicationId, emailBlastId, { ...params }) -> Beehiiv.EmailBlastsGetResponse
-
#### 📝 Description
-
-
Retrieve an Email Blast
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.emailBlasts.get("pub_00000000-0000-0000-0000-000000000000", "blast_00000000-0000-0000-0000-000000000000"); +```typescript +await client.emailBlasts.get("pub_00000000-0000-0000-0000-000000000000", "blast_00000000-0000-0000-0000-000000000000"); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**emailBlastId: `string`** — The prefixed ID of the email blast object - +**emailBlastId:** `string` — The prefixed ID of the email blast object
-
-
- -**request: `Beehiiv.EmailBlastsGetRequest`** - +**request:** `Beehiiv.EmailBlastsGetRequest`
-
-
- -**requestOptions: `EmailBlasts.RequestOptions`** - +**requestOptions:** `EmailBlasts.RequestOptions`
-
-
-
- -
-
- - - ## Referral Program - -
beehiiv.referralProgram.get(publicationId, { ...params }) -> Beehiiv.ReferralProgramGetResponse - +
client.referralProgram.get(publicationId, { ...params }) -> Beehiiv.ReferralProgramGetResponse
-
#### 📝 Description
-
-
Retrieve details about the publication's referral program, including milestones and rewards.
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.referralProgram.get("pub_00000000-0000-0000-0000-000000000000"); +```typescript +await client.referralProgram.get("pub_00000000-0000-0000-0000-000000000000"); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**request: `Beehiiv.ReferralProgramGetRequest`** - +**request:** `Beehiiv.ReferralProgramGetRequest`
-
-
- -**requestOptions: `ReferralProgram.RequestOptions`** - +**requestOptions:** `ReferralProgram.RequestOptions`
-
-
-
- -
-
- - - ## Custom Fields - -
beehiiv.customFields.get(publicationId, id) -> Beehiiv.CustomFieldsGetResponse - +
client.customFields.get(publicationId, id) -> Beehiiv.CustomFieldsGetResponse
-
#### 📝 Description
-
-
View a specific custom field on a publication
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.customFields.get("publicationId", "id"); +```typescript +await client.customFields.get("publicationId", "id"); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**id: `string`** — The ID of the Custom Fields object - +**id:** `string` — The ID of the Custom Fields object
-
-
- -**requestOptions: `CustomFields.RequestOptions`** - +**requestOptions:** `CustomFields.RequestOptions`
-
-
-
- -
-
- -
beehiiv.customFields.create(publicationId, { ...params }) -> Beehiiv.CustomFieldsCreateResponse - +
client.customFields.create(publicationId, { ...params }) -> Beehiiv.CustomFieldsCreateResponse
-
#### 📝 Description
-
-
Create a custom field on a publication, for use in subscriptions
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.customFields.create("publicationId", { +```typescript +await client.customFields.create("publicationId", { kind: Beehiiv.CustomFieldsCreateRequestKind.String, - display: "display" + display: "display", }); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**request: `Beehiiv.CustomFieldsCreateRequest`** - +**request:** `Beehiiv.CustomFieldsCreateRequest`
-
-
- -**requestOptions: `CustomFields.RequestOptions`** - +**requestOptions:** `CustomFields.RequestOptions`
-
-
-
- -
-
- -
beehiiv.customFields.put(publicationId, id, { ...params }) -> Beehiiv.CustomFieldsPutResponse - +
client.customFields.put(publicationId, id, { ...params }) -> Beehiiv.CustomFieldsPutResponse
-
#### 📝 Description
-
-
Update a custom field on a publication
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.customFields.put("publicationId", "id"); +```typescript +await client.customFields.put("publicationId", "id"); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**id: `string`** — The ID of the Custom Fields object - +**id:** `string` — The ID of the Custom Fields object
-
-
- -**request: `Beehiiv.CustomFieldsPutRequest`** - +**request:** `Beehiiv.CustomFieldsPutRequest`
-
-
- -**requestOptions: `CustomFields.RequestOptions`** - +**requestOptions:** `CustomFields.RequestOptions`
-
-
-
- -
-
- -
beehiiv.customFields.delete(publicationId, id) -> Beehiiv.CustomFieldsDeleteResponse - +
client.customFields.delete(publicationId, id) -> Beehiiv.CustomFieldsDeleteResponse
-
#### 📝 Description
-
-
Delete a custom field from a publication
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.customFields.delete("publicationId", "id"); +```typescript +await client.customFields.delete("publicationId", "id"); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**id: `string`** — The ID of the Custom Fields object - +**id:** `string` — The ID of the Custom Fields object
-
-
- -**requestOptions: `CustomFields.RequestOptions`** - +**requestOptions:** `CustomFields.RequestOptions`
-
-
-
- -
-
- -
beehiiv.customFields.patch(publicationId, id, { ...params }) -> Beehiiv.CustomFieldsPatchResponse - +
client.customFields.patch(publicationId, id, { ...params }) -> Beehiiv.CustomFieldsPatchResponse
-
#### 📝 Description
-
-
Update a custom field on a publication
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.customFields.patch("publicationId", "id"); +```typescript +await client.customFields.patch("publicationId", "id"); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**id: `string`** — The ID of the Custom Fields object - +**id:** `string` — The ID of the Custom Fields object
-
-
- -**request: `Beehiiv.CustomFieldsPatchRequest`** - +**request:** `Beehiiv.CustomFieldsPatchRequest`
-
-
- -**requestOptions: `CustomFields.RequestOptions`** - +**requestOptions:** `CustomFields.RequestOptions`
-
-
-
- -
-
- - - ## Bulk Subscription Updates - -
beehiiv.bulkSubscriptionUpdates.list(publicationId) -> Beehiiv.BulkSubscriptionUpdatesListResponse - +
client.bulkSubscriptionUpdates.list(publicationId) -> Beehiiv.BulkSubscriptionUpdatesListResponse
-
#### 📝 Description
-
-
Returns a list of Subscription Update objects for a publication
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.bulkSubscriptionUpdates.list("publicationId"); +```typescript +await client.bulkSubscriptionUpdates.list("publicationId"); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**requestOptions: `BulkSubscriptionUpdates.RequestOptions`** - +**requestOptions:** `BulkSubscriptionUpdates.RequestOptions`
-
-
-
- -
-
- -
beehiiv.bulkSubscriptionUpdates.get(publicationId, id) -> Beehiiv.BulkSubscriptionUpdatesGetResponse - +
client.bulkSubscriptionUpdates.get(publicationId, id) -> Beehiiv.BulkSubscriptionUpdatesGetResponse
-
#### 📝 Description
-
-
Returns a single Subscription Update object for a publication
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.bulkSubscriptionUpdates.get("publicationId", "id"); +```typescript +await client.bulkSubscriptionUpdates.get("publicationId", "id"); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**id: `string`** — The ID of the Subscription Update object - +**id:** `string` — The ID of the Subscription Update object
-
-
- -**requestOptions: `BulkSubscriptionUpdates.RequestOptions`** - +**requestOptions:** `BulkSubscriptionUpdates.RequestOptions`
-
-
-
- -
-
- - - ## Automation Journeys - -
beehiiv.automationJourneys.get(publicationId, automationId, automationJourneyId) -> Beehiiv.AutomationJourneysGetResponse - +
client.automationJourneys.get(publicationId, automationId, automationJourneyId) -> Beehiiv.AutomationJourneysGetResponse
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.automationJourneys.get("pub_00000000-0000-0000-0000-000000000000", "aut_00000000-0000-0000-0000-000000000000", "aj_00000000-0000-0000-0000-000000000000"); +```typescript +await client.automationJourneys.get( + "pub_00000000-0000-0000-0000-000000000000", + "aut_00000000-0000-0000-0000-000000000000", + "aj_00000000-0000-0000-0000-000000000000" +); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**automationId: `string`** — The prefixed ID of the automation object - +**automationId:** `string` — The prefixed ID of the automation object
-
-
- -**automationJourneyId: `string`** — The prefixed automation journey id - +**automationJourneyId:** `string` — The prefixed automation journey id
-
-
- -**requestOptions: `AutomationJourneys.RequestOptions`** - +**requestOptions:** `AutomationJourneys.RequestOptions`
-
-
-
- -
-
- -
beehiiv.automationJourneys.create(publicationId, automationId, { ...params }) -> Beehiiv.AutomationJourneysCreateResponse - +
client.automationJourneys.create(publicationId, automationId, { ...params }) -> Beehiiv.AutomationJourneysCreateResponse
-
#### 📝 Description
-
-
Add an existing subscription to an automation flow. Requires the automation to have an active _Add by API_ trigger. @@ -2678,394 +1874,1025 @@ Add an existing subscription to an automation flow. Requires the automation to h The specified `email` or `subscription_id` will be matched against your existing subscribers. If an existing subscriber is found, they will be enrolled immediately. -Looking to enroll new subscribers? Use the **[Subscriptions Create](https://beehiiv.stoplight.io/docs/v2/1a77a563675ee-create)** endpoint instead and specify the `automation_ids` param. +Looking to enroll new subscribers? Use the **[Create Subscription](/api-reference/subscriptions/create)** endpoint instead and specify the `automation_ids` param.
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.automationJourneys.create("pub_00000000-0000-0000-0000-000000000000", "aut_00000000-0000-0000-0000-000000000000", { - email: "example@example.com", - subscriptionId: "sub_00000000-0000-0000-0000-000000000000" -}); +```typescript +await client.automationJourneys.create( + "pub_00000000-0000-0000-0000-000000000000", + "aut_00000000-0000-0000-0000-000000000000" +); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
- -**automationId: `string`** — The prefixed ID of the automation object - +**automationId:** `string` — The prefixed ID of the automation object
-
-
- -**request: `Beehiiv.AutomationJourneysCreateRequest`** - +**request:** `Beehiiv.AutomationJourneysCreateRequest`
-
-
- -**requestOptions: `AutomationJourneys.RequestOptions`** - +**requestOptions:** `AutomationJourneys.RequestOptions`
-
-
-
- -
-
- - - ## Automations - -
beehiiv.automations.list(publicationId, { ...params }) -> Beehiiv.AutomationsListResponse - +
client.automations.list(publicationId, { ...params }) -> Beehiiv.AutomationsListResponse
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.automations.list("pub_00000000-0000-0000-0000-000000000000"); +```typescript +await client.automations.list("pub_00000000-0000-0000-0000-000000000000"); ```
-
-
-
#### ⚙️ Parameters
-
+
+ +**publicationId:** `string` — The prefixed ID of the publication object + +
+
+
+**request:** `Beehiiv.AutomationsListRequest` + +
+
-**publicationId: `string`** — The prefixed ID of the publication object +
+
+**requestOptions:** `Automations.RequestOptions`
+
+
+
+
+
+
client.automations.get(publicationId, automationId) -> Beehiiv.AutomationsGetResponse
-
+#### 🔌 Usage -**request: `Beehiiv.AutomationsListRequest`** +
+
+
+
-
+```typescript +await client.automations.get("pub_00000000-0000-0000-0000-000000000000", "aut_00000000-0000-0000-0000-000000000000"); +``` +
+
+
-
+#### ⚙️ Parameters +
+
+
-**requestOptions: `Automations.RequestOptions`** - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
+
+
+ +**automationId:** `string` — The prefixed ID of the automation object +
+
+
+**requestOptions:** `Automations.RequestOptions`
+
+ +
+
+## Subscription Tags + +
client.subscriptionTags.create(publicationId, subscriptionId, { ...params }) -> Beehiiv.SubscriptionTagsCreateResponse +
+
-
beehiiv.automations.get(publicationId, automationId) -> Beehiiv.AutomationsGetResponse +#### 📝 Description
+
+
+Create new subscription tags for a subscription. If the tag does not exist on the publication, it will be created automatically. + +
+
+
+
+ #### 🔌 Usage
-
-
-```ts -await beehiiv.automations.get("pub_00000000-0000-0000-0000-000000000000", "aut_00000000-0000-0000-0000-000000000000"); +```typescript +await client.subscriptionTags.create("publicationId", "subscriptionId"); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**publicationId: `string`** — The prefixed ID of the publication object - +**publicationId:** `string`
-
-
- -**automationId: `string`** — The prefixed ID of the automation object - +**subscriptionId:** `string`
-
-
+**request:** `Beehiiv.SubscriptionTagsCreateRequest` + +
+
-**requestOptions: `Automations.RequestOptions`** +
+
+**requestOptions:** `SubscriptionTags.RequestOptions`
-
-
-
- -
-
+## Tiers - - -## Subscription Tags - - -
beehiiv.subscriptionTags.create(publicationId, subscriptionId, { ...params }) -> Beehiiv.SubscriptionTagsCreateResponse - +
client.tiers.getPublicationsPublicationIdTiers(publicationId, { ...params }) -> Beehiiv.GetPublicationsPublicationIdTiersResponse
-
#### 📝 Description
-
-
-Create new subscription tags for a subscription. If the tag does not exist on the publication, it will be created automatically. +Retrieve all tiers belonging to a specific publication
-
-
-
#### 🔌 Usage
-
-
-```ts -await beehiiv.subscriptionTags.create("publicationId", "subscriptionId", { - tags: ["Premium"] -}); +```typescript +await client.tiers.getPublicationsPublicationIdTiers("pub_00000000-0000-0000-0000-000000000000"); ```
-
-
-
#### ⚙️ Parameters
-
-
- -**publicationId: `string`** - +**publicationId:** `string` — The prefixed ID of the publication object
-
-
+**request:** `Beehiiv.GetPublicationsPublicationIdTiersRequest` + +
+
-**subscriptionId: `string`** +
+
+**requestOptions:** `Tiers.RequestOptions`
+
+
+
+
+
+
client.tiers.postPublicationsPublicationIdTiers(publicationId, { ...params }) -> Beehiiv.PostPublicationsPublicationIdTiersResponse
-
+#### 📝 Description + +
+
-**request: `Beehiiv.SubscriptionTagsCreateRequest`** +
+
+Create a new tier for a publication.
-
+
+
+ +#### 🔌 Usage
+
+
+```typescript +await client.tiers.postPublicationsPublicationIdTiers("pub_00000000-0000-0000-0000-000000000000", { + name: "name", +}); +``` -**requestOptions: `SubscriptionTags.RequestOptions`** +
+
+
+
+#### ⚙️ Parameters -
+
+
-
+
+
+ +**publicationId:** `string` — The prefixed ID of the publication object
+
+ +
+
+**request:** `Beehiiv.PostPublicationsPublicationIdTiersRequest` + +
+
+
+**requestOptions:** `Tiers.RequestOptions`
+
+ +
+
+
client.tiers.getPublicationsPublicationIdTiersTierId(publicationId, tierId, { ...params }) -> Beehiiv.GetPublicationsPublicationIdTiersTierIdResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve a single tier belonging to a specific publication + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.tiers.getPublicationsPublicationIdTiersTierId( + "pub_00000000-0000-0000-0000-000000000000", + "tier_00000000-0000-0000-0000-000000000000" +); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**publicationId:** `string` — The prefixed ID of the publication object + +
+
+ +
+
+ +**tierId:** `string` — The prefixed ID of the tier object + +
+
+ +
+
+ +**request:** `Beehiiv.GetPublicationsPublicationIdTiersTierIdRequest` + +
+
+ +
+
+ +**requestOptions:** `Tiers.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.tiers.putPublicationsPublicationIdTiersTierId(publicationId, tierId, { ...params }) -> Beehiiv.PutPublicationsPublicationIdTiersTierIdResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update an existing tier belonging to a specific publication + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.tiers.putPublicationsPublicationIdTiersTierId( + "pub_00000000-0000-0000-0000-000000000000", + "tier_00000000-0000-0000-0000-000000000000" +); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**publicationId:** `string` — The prefixed ID of the publication object + +
+
+ +
+
+ +**tierId:** `string` — The prefixed ID of the tier object + +
+
+ +
+
+ +**request:** `Beehiiv.PutPublicationsPublicationIdTiersTierIdRequest` + +
+
+ +
+
+ +**requestOptions:** `Tiers.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.tiers.patchPublicationsPublicationIdTiersTierId(publicationId, tierId, { ...params }) -> Beehiiv.PatchPublicationsPublicationIdTiersTierIdResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update an existing tier belonging to a specific publication + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.tiers.patchPublicationsPublicationIdTiersTierId( + "pub_00000000-0000-0000-0000-000000000000", + "tier_00000000-0000-0000-0000-000000000000" +); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**publicationId:** `string` — The prefixed ID of the publication object + +
+
+ +
+
+ +**tierId:** `string` — The prefixed ID of the tier object + +
+
+ +
+
+ +**request:** `Beehiiv.PatchPublicationsPublicationIdTiersTierIdRequest` + +
+
+ +
+
+ +**requestOptions:** `Tiers.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Webhooks + +
client.webhooks.getWebhooks(publicationId, { ...params }) -> Beehiiv.GetWebhooksResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve all webhooks belonging to a specific publication. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.webhooks.getWebhooks("pub_00000000-0000-0000-0000-000000000000"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**publicationId:** `string` — The prefixed ID of the publication object + +
+
+ +
+
+ +**request:** `Beehiiv.GetWebhooksRequest` + +
+
+ +
+
+ +**requestOptions:** `Webhooks.RequestOptions` + +
+
+
+
+ +
+
+
+
client.webhooks.postWebhooks(publicationId, { ...params }) -> Beehiiv.PostWebhooksResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new webhook for a given publication. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.webhooks.postWebhooks("pub_00000000-0000-0000-0000-000000000000", { + url: "https://example.com/webhook", + eventTypes: [Beehiiv.PostWebhooksRequestEventTypesItem.PostSent], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**publicationId:** `string` — The prefixed ID of the publication object + +
+
+ +
+
+ +**request:** `Beehiiv.PostWebhooksRequest` + +
+
+ +
+
+ +**requestOptions:** `Webhooks.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.webhooks.getWebhooksWebhookId(publicationId, webhookId) -> Beehiiv.GetWebhooksWebhookIdResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve a specific webhook belonging to a publication. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.webhooks.getWebhooksWebhookId( + "pub_00000000-0000-0000-0000-000000000000", + "ep_0000000000000000000000000000" +); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**publicationId:** `string` — The prefixed ID of the publication object + +
+
+ +
+
+ +**webhookId:** `string` — The prefixed ID of the webhook object + +
+
+ +
+
+ +**requestOptions:** `Webhooks.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.webhooks.deleteWebhooksWebhookId(publicationId, webhookId) -> Record +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a webhook subscription from a publication. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.webhooks.deleteWebhooksWebhookId( + "pub_00000000-0000-0000-0000-000000000000", + "ep_0000000000000000000000000000" +); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**publicationId:** `string` — The prefixed ID of the publication object + +
+
+ +
+
+ +**webhookId:** `string` — The prefixed ID of the webhook object + +
+
+ +
+
+ +**requestOptions:** `Webhooks.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.webhooks.test(publicationId, webhookId) -> Beehiiv.GetPublicationsPublicationIdWebhooksWebhookIdTestsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Send test info to an already set up webhook endpoint. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.webhooks.test("pub_00000000-0000-0000-0000-000000000000", "ep_0000000000000000000000000000"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**publicationId:** `string` — The prefixed ID of the publication object + +
+
+ +
+
+ +**webhookId:** `string` — The prefixed ID of the webhook object + +
+
+ +
+
+ +**requestOptions:** `Webhooks.RequestOptions` + +
+
+
+
+ +
+
+
diff --git a/src/Client.ts b/src/Client.ts index 84264eb..8b69aed 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -15,6 +15,8 @@ import { BulkSubscriptionUpdates } from "./api/resources/bulkSubscriptionUpdates import { AutomationJourneys } from "./api/resources/automationJourneys/client/Client"; import { Automations } from "./api/resources/automations/client/Client"; import { SubscriptionTags } from "./api/resources/subscriptionTags/client/Client"; +import { Tiers } from "./api/resources/tiers/client/Client"; +import { Webhooks } from "./api/resources/webhooks/client/Client"; export declare namespace BeehiivClient { interface Options { @@ -24,8 +26,12 @@ export declare namespace BeehiivClient { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; } } @@ -97,4 +103,16 @@ export class BeehiivClient { public get subscriptionTags(): SubscriptionTags { return (this._subscriptionTags ??= new SubscriptionTags(this._options)); } + + protected _tiers: Tiers | undefined; + + public get tiers(): Tiers { + return (this._tiers ??= new Tiers(this._options)); + } + + protected _webhooks: Webhooks | undefined; + + public get webhooks(): Webhooks { + return (this._webhooks ??= new Webhooks(this._options)); + } } diff --git a/src/api/errors/BadRequestError.ts b/src/api/errors/BadRequestError.ts index 9142ad5..80ae955 100644 --- a/src/api/errors/BadRequestError.ts +++ b/src/api/errors/BadRequestError.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as errors from "../../errors"; -import * as Beehiiv from ".."; +import * as errors from "../../errors/index"; +import * as Beehiiv from "../index"; export class BadRequestError extends errors.BeehiivError { constructor(body: Beehiiv.Error_) { diff --git a/src/api/errors/InternalServerError.ts b/src/api/errors/InternalServerError.ts index fe9ee45..a3f8922 100644 --- a/src/api/errors/InternalServerError.ts +++ b/src/api/errors/InternalServerError.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as errors from "../../errors"; -import * as Beehiiv from ".."; +import * as errors from "../../errors/index"; +import * as Beehiiv from "../index"; export class InternalServerError extends errors.BeehiivError { constructor(body: Beehiiv.Error_) { diff --git a/src/api/errors/NotFoundError.ts b/src/api/errors/NotFoundError.ts index b925637..ea2f639 100644 --- a/src/api/errors/NotFoundError.ts +++ b/src/api/errors/NotFoundError.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as errors from "../../errors"; -import * as Beehiiv from ".."; +import * as errors from "../../errors/index"; +import * as Beehiiv from "../index"; export class NotFoundError extends errors.BeehiivError { constructor(body: Beehiiv.Error_) { diff --git a/src/api/errors/TooManyRequestsError.ts b/src/api/errors/TooManyRequestsError.ts index 556f64b..113112f 100644 --- a/src/api/errors/TooManyRequestsError.ts +++ b/src/api/errors/TooManyRequestsError.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as errors from "../../errors"; -import * as Beehiiv from ".."; +import * as errors from "../../errors/index"; +import * as Beehiiv from "../index"; export class TooManyRequestsError extends errors.BeehiivError { constructor(body: Beehiiv.Error_) { diff --git a/src/api/resources/automationJourneys/client/Client.ts b/src/api/resources/automationJourneys/client/Client.ts index 1e2d573..4804693 100644 --- a/src/api/resources/automationJourneys/client/Client.ts +++ b/src/api/resources/automationJourneys/client/Client.ts @@ -4,10 +4,10 @@ import * as environments from "../../../../environments"; import * as core from "../../../../core"; -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; import urlJoin from "url-join"; -import * as serializers from "../../../../serialization"; -import * as errors from "../../../../errors"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; export declare namespace AutomationJourneys { interface Options { @@ -17,8 +17,12 @@ export declare namespace AutomationJourneys { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; } } @@ -26,13 +30,18 @@ export class AutomationJourneys { constructor(protected readonly _options: AutomationJourneys.Options) {} /** + * @param {string} publicationId - The prefixed ID of the publication object + * @param {string} automationId - The prefixed ID of the automation object + * @param {string} automationJourneyId - The prefixed automation journey id + * @param {AutomationJourneys.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.automationJourneys.get("pub_00000000-0000-0000-0000-000000000000", "aut_00000000-0000-0000-0000-000000000000", "aj_00000000-0000-0000-0000-000000000000") + * await client.automationJourneys.get("pub_00000000-0000-0000-0000-000000000000", "aut_00000000-0000-0000-0000-000000000000", "aj_00000000-0000-0000-0000-000000000000") */ public async get( publicationId: string, @@ -43,23 +52,27 @@ export class AutomationJourneys { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/automations/${automationId}/journeys/${automationJourneyId}` + `publications/${encodeURIComponent(publicationId)}/automations/${encodeURIComponent( + automationId + )}/journeys/${encodeURIComponent(automationJourneyId)}` ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.AutomationJourneysGetResponse.parseOrThrow(_response.body, { + return serializers.AutomationJourneysGetResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -72,7 +85,7 @@ export class AutomationJourneys { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -82,7 +95,7 @@ export class AutomationJourneys { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -92,7 +105,7 @@ export class AutomationJourneys { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -102,7 +115,7 @@ export class AutomationJourneys { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -139,17 +152,20 @@ export class AutomationJourneys { * The specified `email` or `subscription_id` will be matched against your existing subscribers. * If an existing subscriber is found, they will be enrolled immediately. * - * Looking to enroll new subscribers? Use the **[Subscriptions Create](https://beehiiv.stoplight.io/docs/v2/1a77a563675ee-create)** endpoint instead and specify the `automation_ids` param. + * Looking to enroll new subscribers? Use the **[Create Subscription](/api-reference/subscriptions/create)** endpoint instead and specify the `automation_ids` param. + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {string} automationId - The prefixed ID of the automation object + * @param {Beehiiv.AutomationJourneysCreateRequest} request + * @param {AutomationJourneys.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.automationJourneys.create("pub_00000000-0000-0000-0000-000000000000", "aut_00000000-0000-0000-0000-000000000000", { - * email: "example@example.com", - * subscriptionId: "sub_00000000-0000-0000-0000-000000000000" - * }) + * await client.automationJourneys.create("pub_00000000-0000-0000-0000-000000000000", "aut_00000000-0000-0000-0000-000000000000") */ public async create( publicationId: string, @@ -160,26 +176,32 @@ export class AutomationJourneys { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/automations/${automationId}/journeys` + `publications/${encodeURIComponent(publicationId)}/automations/${encodeURIComponent( + automationId + )}/journeys` ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.AutomationJourneysCreateRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", + requestType: "json", + body: serializers.AutomationJourneysCreateRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.AutomationJourneysCreateResponse.parseOrThrow(_response.body, { + return serializers.AutomationJourneysCreateResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -192,7 +214,7 @@ export class AutomationJourneys { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -202,7 +224,7 @@ export class AutomationJourneys { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -212,7 +234,7 @@ export class AutomationJourneys { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -222,7 +244,7 @@ export class AutomationJourneys { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -253,7 +275,7 @@ export class AutomationJourneys { } } - protected async _getAuthorizationHeader() { + protected async _getAuthorizationHeader(): Promise { return `Bearer ${await core.Supplier.get(this._options.token)}`; } } diff --git a/src/api/resources/automationJourneys/client/requests/AutomationJourneysCreateRequest.ts b/src/api/resources/automationJourneys/client/requests/AutomationJourneysCreateRequest.ts index 12c76e6..97d215c 100644 --- a/src/api/resources/automationJourneys/client/requests/AutomationJourneysCreateRequest.ts +++ b/src/api/resources/automationJourneys/client/requests/AutomationJourneysCreateRequest.ts @@ -2,19 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../../.."; +import * as Beehiiv from "../../../../index"; /** * @example - * { - * email: "example@example.com", - * subscriptionId: "sub_00000000-0000-0000-0000-000000000000" - * } + * {} */ export interface AutomationJourneysCreateRequest { - /** The email address associated with the subscription */ + /** The email address associated with the subscription. */ email?: string; - /** The prefixed ID of the subscription */ + /** The prefixed ID of the subscription. */ subscriptionId?: string; /** Override publication double-opt settings for this subscription. */ doubleOptOverride?: Beehiiv.AutomationJourneysCreateRequestDoubleOptOverride; diff --git a/src/api/resources/automationJourneys/client/requests/index.ts b/src/api/resources/automationJourneys/client/requests/index.ts index 88353bc..85bf6fd 100644 --- a/src/api/resources/automationJourneys/client/requests/index.ts +++ b/src/api/resources/automationJourneys/client/requests/index.ts @@ -1 +1 @@ -export { AutomationJourneysCreateRequest } from "./AutomationJourneysCreateRequest"; +export { type AutomationJourneysCreateRequest } from "./AutomationJourneysCreateRequest"; diff --git a/src/api/resources/automationJourneys/types/AutomationJourneysCreateResponse.ts b/src/api/resources/automationJourneys/types/AutomationJourneysCreateResponse.ts index 53cb38a..795349b 100644 --- a/src/api/resources/automationJourneys/types/AutomationJourneysCreateResponse.ts +++ b/src/api/resources/automationJourneys/types/AutomationJourneysCreateResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface AutomationJourneysCreateResponse { data?: Beehiiv.AutomationJourney; diff --git a/src/api/resources/automationJourneys/types/AutomationJourneysGetResponse.ts b/src/api/resources/automationJourneys/types/AutomationJourneysGetResponse.ts index af03b5c..a1dcbc4 100644 --- a/src/api/resources/automationJourneys/types/AutomationJourneysGetResponse.ts +++ b/src/api/resources/automationJourneys/types/AutomationJourneysGetResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface AutomationJourneysGetResponse { data?: Beehiiv.AutomationJourney; diff --git a/src/api/resources/automations/client/Client.ts b/src/api/resources/automations/client/Client.ts index bead751..7355cbb 100644 --- a/src/api/resources/automations/client/Client.ts +++ b/src/api/resources/automations/client/Client.ts @@ -4,10 +4,10 @@ import * as environments from "../../../../environments"; import * as core from "../../../../core"; -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; import urlJoin from "url-join"; -import * as serializers from "../../../../serialization"; -import * as errors from "../../../../errors"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; export declare namespace Automations { interface Options { @@ -17,8 +17,12 @@ export declare namespace Automations { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; } } @@ -26,13 +30,17 @@ export class Automations { constructor(protected readonly _options: Automations.Options) {} /** + * @param {string} publicationId - The prefixed ID of the publication object + * @param {Beehiiv.AutomationsListRequest} request + * @param {Automations.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.automations.list("pub_00000000-0000-0000-0000-000000000000") + * await client.automations.list("pub_00000000-0000-0000-0000-000000000000") */ public async list( publicationId: string, @@ -52,24 +60,26 @@ export class Automations { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/automations` + `publications/${encodeURIComponent(publicationId)}/automations` ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.AutomationsListResponse.parseOrThrow(_response.body, { + return serializers.AutomationsListResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -82,7 +92,7 @@ export class Automations { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -92,7 +102,7 @@ export class Automations { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -102,7 +112,7 @@ export class Automations { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -112,7 +122,7 @@ export class Automations { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -144,13 +154,17 @@ export class Automations { } /** + * @param {string} publicationId - The prefixed ID of the publication object + * @param {string} automationId - The prefixed ID of the automation object + * @param {Automations.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.automations.get("pub_00000000-0000-0000-0000-000000000000", "aut_00000000-0000-0000-0000-000000000000") + * await client.automations.get("pub_00000000-0000-0000-0000-000000000000", "aut_00000000-0000-0000-0000-000000000000") */ public async get( publicationId: string, @@ -160,23 +174,25 @@ export class Automations { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/automations/${automationId}` + `publications/${encodeURIComponent(publicationId)}/automations/${encodeURIComponent(automationId)}` ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.AutomationsGetResponse.parseOrThrow(_response.body, { + return serializers.AutomationsGetResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -189,7 +205,7 @@ export class Automations { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -199,7 +215,7 @@ export class Automations { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -209,7 +225,7 @@ export class Automations { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -219,7 +235,7 @@ export class Automations { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -250,7 +266,7 @@ export class Automations { } } - protected async _getAuthorizationHeader() { + protected async _getAuthorizationHeader(): Promise { return `Bearer ${await core.Supplier.get(this._options.token)}`; } } diff --git a/src/api/resources/automations/client/requests/index.ts b/src/api/resources/automations/client/requests/index.ts index 563a1e8..0627c13 100644 --- a/src/api/resources/automations/client/requests/index.ts +++ b/src/api/resources/automations/client/requests/index.ts @@ -1 +1 @@ -export { AutomationsListRequest } from "./AutomationsListRequest"; +export { type AutomationsListRequest } from "./AutomationsListRequest"; diff --git a/src/api/resources/automations/types/AutomationsGetResponse.ts b/src/api/resources/automations/types/AutomationsGetResponse.ts index c2075b6..15c3040 100644 --- a/src/api/resources/automations/types/AutomationsGetResponse.ts +++ b/src/api/resources/automations/types/AutomationsGetResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface AutomationsGetResponse { data?: Beehiiv.Automation; diff --git a/src/api/resources/automations/types/AutomationsListResponse.ts b/src/api/resources/automations/types/AutomationsListResponse.ts index 866bbe3..ce4d4f0 100644 --- a/src/api/resources/automations/types/AutomationsListResponse.ts +++ b/src/api/resources/automations/types/AutomationsListResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface AutomationsListResponse { data?: Beehiiv.Automation[]; diff --git a/src/api/resources/bulkSubscriptionUpdates/client/Client.ts b/src/api/resources/bulkSubscriptionUpdates/client/Client.ts index e5336a7..3b720fc 100644 --- a/src/api/resources/bulkSubscriptionUpdates/client/Client.ts +++ b/src/api/resources/bulkSubscriptionUpdates/client/Client.ts @@ -4,10 +4,10 @@ import * as environments from "../../../../environments"; import * as core from "../../../../core"; -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; import urlJoin from "url-join"; -import * as serializers from "../../../../serialization"; -import * as errors from "../../../../errors"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; export declare namespace BulkSubscriptionUpdates { interface Options { @@ -17,8 +17,12 @@ export declare namespace BulkSubscriptionUpdates { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; } } @@ -27,13 +31,17 @@ export class BulkSubscriptionUpdates { /** * Returns a list of Subscription Update objects for a publication + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {BulkSubscriptionUpdates.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.bulkSubscriptionUpdates.list("publicationId") + * await client.bulkSubscriptionUpdates.list("publicationId") */ public async list( publicationId: string, @@ -42,23 +50,25 @@ export class BulkSubscriptionUpdates { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/bulk_subscription_updates` + `publications/${encodeURIComponent(publicationId)}/bulk_subscription_updates` ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.BulkSubscriptionUpdatesListResponse.parseOrThrow(_response.body, { + return serializers.BulkSubscriptionUpdatesListResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -71,7 +81,7 @@ export class BulkSubscriptionUpdates { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -81,7 +91,7 @@ export class BulkSubscriptionUpdates { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -91,7 +101,7 @@ export class BulkSubscriptionUpdates { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -101,7 +111,7 @@ export class BulkSubscriptionUpdates { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -134,13 +144,18 @@ export class BulkSubscriptionUpdates { /** * Returns a single Subscription Update object for a publication + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {string} id - The ID of the Subscription Update object + * @param {BulkSubscriptionUpdates.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.bulkSubscriptionUpdates.get("publicationId", "id") + * await client.bulkSubscriptionUpdates.get("publicationId", "id") */ public async get( publicationId: string, @@ -150,23 +165,25 @@ export class BulkSubscriptionUpdates { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/bulk_subscription_updates/${id}` + `publications/${encodeURIComponent(publicationId)}/bulk_subscription_updates/${encodeURIComponent(id)}` ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.BulkSubscriptionUpdatesGetResponse.parseOrThrow(_response.body, { + return serializers.BulkSubscriptionUpdatesGetResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -179,7 +196,7 @@ export class BulkSubscriptionUpdates { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -189,7 +206,7 @@ export class BulkSubscriptionUpdates { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -199,7 +216,7 @@ export class BulkSubscriptionUpdates { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -209,7 +226,7 @@ export class BulkSubscriptionUpdates { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -240,7 +257,7 @@ export class BulkSubscriptionUpdates { } } - protected async _getAuthorizationHeader() { + protected async _getAuthorizationHeader(): Promise { return `Bearer ${await core.Supplier.get(this._options.token)}`; } } diff --git a/src/api/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesGetResponse.ts b/src/api/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesGetResponse.ts index 4082e1e..b2009f0 100644 --- a/src/api/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesGetResponse.ts +++ b/src/api/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesGetResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface BulkSubscriptionUpdatesGetResponse { data?: Beehiiv.BulkSubscriptionUpdatesGetResponseData; diff --git a/src/api/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesGetResponseData.ts b/src/api/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesGetResponseData.ts index f3af8a5..8a24996 100644 --- a/src/api/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesGetResponseData.ts +++ b/src/api/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesGetResponseData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface BulkSubscriptionUpdatesGetResponseData { /** The ID of the update object */ diff --git a/src/api/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesListResponse.ts b/src/api/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesListResponse.ts index 16f1737..cdfeaa6 100644 --- a/src/api/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesListResponse.ts +++ b/src/api/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesListResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface BulkSubscriptionUpdatesListResponse { /** An array of Subscription Update objects */ diff --git a/src/api/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesListResponseDataItem.ts b/src/api/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesListResponseDataItem.ts index f7cb972..fa4ed0a 100644 --- a/src/api/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesListResponseDataItem.ts +++ b/src/api/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesListResponseDataItem.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface BulkSubscriptionUpdatesListResponseDataItem { /** The ID of the update object */ diff --git a/src/api/resources/customFields/client/Client.ts b/src/api/resources/customFields/client/Client.ts index 1b22bbe..e731309 100644 --- a/src/api/resources/customFields/client/Client.ts +++ b/src/api/resources/customFields/client/Client.ts @@ -4,10 +4,10 @@ import * as environments from "../../../../environments"; import * as core from "../../../../core"; -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; import urlJoin from "url-join"; -import * as serializers from "../../../../serialization"; -import * as errors from "../../../../errors"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; export declare namespace CustomFields { interface Options { @@ -17,8 +17,12 @@ export declare namespace CustomFields { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; } } @@ -27,13 +31,18 @@ export class CustomFields { /** * View a specific custom field on a publication + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {string} id - The ID of the Custom Fields object + * @param {CustomFields.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.customFields.get("publicationId", "id") + * await client.customFields.get("publicationId", "id") */ public async get( publicationId: string, @@ -43,23 +52,25 @@ export class CustomFields { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/custom_fields/${id}` + `publications/${encodeURIComponent(publicationId)}/custom_fields/${encodeURIComponent(id)}` ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.CustomFieldsGetResponse.parseOrThrow(_response.body, { + return serializers.CustomFieldsGetResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -72,7 +83,7 @@ export class CustomFields { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -82,7 +93,7 @@ export class CustomFields { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -92,7 +103,7 @@ export class CustomFields { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -102,7 +113,7 @@ export class CustomFields { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -135,13 +146,18 @@ export class CustomFields { /** * Create a custom field on a publication, for use in subscriptions + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {Beehiiv.CustomFieldsCreateRequest} request + * @param {CustomFields.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.customFields.create("publicationId", { + * await client.customFields.create("publicationId", { * kind: Beehiiv.CustomFieldsCreateRequestKind.String, * display: "display" * }) @@ -154,24 +170,30 @@ export class CustomFields { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/custom_fields` + `publications/${encodeURIComponent(publicationId)}/custom_fields` ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.CustomFieldsCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.CustomFieldsCreateRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.CustomFieldsCreateResponse.parseOrThrow(_response.body, { + return serializers.CustomFieldsCreateResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -184,7 +206,7 @@ export class CustomFields { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -194,7 +216,7 @@ export class CustomFields { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -204,7 +226,7 @@ export class CustomFields { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -214,7 +236,7 @@ export class CustomFields { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -247,13 +269,19 @@ export class CustomFields { /** * Update a custom field on a publication + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {string} id - The ID of the Custom Fields object + * @param {Beehiiv.CustomFieldsPutRequest} request + * @param {CustomFields.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.customFields.put("publicationId", "id") + * await client.customFields.put("publicationId", "id") */ public async put( publicationId: string, @@ -264,24 +292,30 @@ export class CustomFields { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/custom_fields/${id}` + `publications/${encodeURIComponent(publicationId)}/custom_fields/${encodeURIComponent(id)}` ), method: "PUT", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.CustomFieldsPutRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.CustomFieldsPutRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.CustomFieldsPutResponse.parseOrThrow(_response.body, { + return serializers.CustomFieldsPutResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -294,7 +328,7 @@ export class CustomFields { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -304,7 +338,7 @@ export class CustomFields { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -314,7 +348,7 @@ export class CustomFields { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -324,7 +358,7 @@ export class CustomFields { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -357,13 +391,18 @@ export class CustomFields { /** * Delete a custom field from a publication + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {string} id - The ID of the Custom Fields object + * @param {CustomFields.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.customFields.delete("publicationId", "id") + * await client.customFields.delete("publicationId", "id") */ public async delete( publicationId: string, @@ -373,23 +412,25 @@ export class CustomFields { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/custom_fields/${id}` + `publications/${encodeURIComponent(publicationId)}/custom_fields/${encodeURIComponent(id)}` ), method: "DELETE", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.CustomFieldsDeleteResponse.parseOrThrow(_response.body, { + return serializers.CustomFieldsDeleteResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -402,7 +443,7 @@ export class CustomFields { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -412,7 +453,7 @@ export class CustomFields { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -422,7 +463,7 @@ export class CustomFields { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -432,7 +473,7 @@ export class CustomFields { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -465,13 +506,19 @@ export class CustomFields { /** * Update a custom field on a publication + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {string} id - The ID of the Custom Fields object + * @param {Beehiiv.CustomFieldsPatchRequest} request + * @param {CustomFields.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.customFields.patch("publicationId", "id") + * await client.customFields.patch("publicationId", "id") */ public async patch( publicationId: string, @@ -482,24 +529,30 @@ export class CustomFields { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/custom_fields/${id}` + `publications/${encodeURIComponent(publicationId)}/custom_fields/${encodeURIComponent(id)}` ), method: "PATCH", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.CustomFieldsPatchRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.CustomFieldsPatchRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.CustomFieldsPatchResponse.parseOrThrow(_response.body, { + return serializers.CustomFieldsPatchResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -512,7 +565,7 @@ export class CustomFields { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -522,7 +575,7 @@ export class CustomFields { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -532,7 +585,7 @@ export class CustomFields { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -542,7 +595,7 @@ export class CustomFields { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -573,7 +626,7 @@ export class CustomFields { } } - protected async _getAuthorizationHeader() { + protected async _getAuthorizationHeader(): Promise { return `Bearer ${await core.Supplier.get(this._options.token)}`; } } diff --git a/src/api/resources/customFields/client/requests/CustomFieldsCreateRequest.ts b/src/api/resources/customFields/client/requests/CustomFieldsCreateRequest.ts index 2e1cda6..a6a56f8 100644 --- a/src/api/resources/customFields/client/requests/CustomFieldsCreateRequest.ts +++ b/src/api/resources/customFields/client/requests/CustomFieldsCreateRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../../.."; +import * as Beehiiv from "../../../../index"; /** * @example diff --git a/src/api/resources/customFields/client/requests/index.ts b/src/api/resources/customFields/client/requests/index.ts index fd44eb2..871ea94 100644 --- a/src/api/resources/customFields/client/requests/index.ts +++ b/src/api/resources/customFields/client/requests/index.ts @@ -1,3 +1,3 @@ -export { CustomFieldsCreateRequest } from "./CustomFieldsCreateRequest"; -export { CustomFieldsPutRequest } from "./CustomFieldsPutRequest"; -export { CustomFieldsPatchRequest } from "./CustomFieldsPatchRequest"; +export { type CustomFieldsCreateRequest } from "./CustomFieldsCreateRequest"; +export { type CustomFieldsPutRequest } from "./CustomFieldsPutRequest"; +export { type CustomFieldsPatchRequest } from "./CustomFieldsPatchRequest"; diff --git a/src/api/resources/customFields/types/CustomFieldsCreateResponse.ts b/src/api/resources/customFields/types/CustomFieldsCreateResponse.ts index a33fc0c..a2ccfd5 100644 --- a/src/api/resources/customFields/types/CustomFieldsCreateResponse.ts +++ b/src/api/resources/customFields/types/CustomFieldsCreateResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface CustomFieldsCreateResponse { data?: Beehiiv.CustomFieldsCreateResponseData; diff --git a/src/api/resources/customFields/types/CustomFieldsCreateResponseData.ts b/src/api/resources/customFields/types/CustomFieldsCreateResponseData.ts index d600233..0830043 100644 --- a/src/api/resources/customFields/types/CustomFieldsCreateResponseData.ts +++ b/src/api/resources/customFields/types/CustomFieldsCreateResponseData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface CustomFieldsCreateResponseData { id: string; diff --git a/src/api/resources/customFields/types/CustomFieldsGetResponse.ts b/src/api/resources/customFields/types/CustomFieldsGetResponse.ts index 1a4a5c1..6bf0d3a 100644 --- a/src/api/resources/customFields/types/CustomFieldsGetResponse.ts +++ b/src/api/resources/customFields/types/CustomFieldsGetResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface CustomFieldsGetResponse { data?: Beehiiv.CustomFieldsGetResponseData; diff --git a/src/api/resources/customFields/types/CustomFieldsGetResponseData.ts b/src/api/resources/customFields/types/CustomFieldsGetResponseData.ts index f264af8..3fc3cea 100644 --- a/src/api/resources/customFields/types/CustomFieldsGetResponseData.ts +++ b/src/api/resources/customFields/types/CustomFieldsGetResponseData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface CustomFieldsGetResponseData { id?: string; diff --git a/src/api/resources/customFields/types/CustomFieldsGetResponseDataItem.ts b/src/api/resources/customFields/types/CustomFieldsGetResponseDataItem.ts index 5ec1e84..0e43d47 100644 --- a/src/api/resources/customFields/types/CustomFieldsGetResponseDataItem.ts +++ b/src/api/resources/customFields/types/CustomFieldsGetResponseDataItem.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface CustomFieldsGetResponseDataItem { id?: string; diff --git a/src/api/resources/customFields/types/CustomFieldsPatchResponse.ts b/src/api/resources/customFields/types/CustomFieldsPatchResponse.ts index 61b2f50..84681be 100644 --- a/src/api/resources/customFields/types/CustomFieldsPatchResponse.ts +++ b/src/api/resources/customFields/types/CustomFieldsPatchResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface CustomFieldsPatchResponse { data?: Beehiiv.CustomFieldsPatchResponseData; diff --git a/src/api/resources/customFields/types/CustomFieldsPatchResponseData.ts b/src/api/resources/customFields/types/CustomFieldsPatchResponseData.ts index 263326c..43566c1 100644 --- a/src/api/resources/customFields/types/CustomFieldsPatchResponseData.ts +++ b/src/api/resources/customFields/types/CustomFieldsPatchResponseData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface CustomFieldsPatchResponseData { id?: string; diff --git a/src/api/resources/customFields/types/CustomFieldsPutResponse.ts b/src/api/resources/customFields/types/CustomFieldsPutResponse.ts index 80db595..7e883b0 100644 --- a/src/api/resources/customFields/types/CustomFieldsPutResponse.ts +++ b/src/api/resources/customFields/types/CustomFieldsPutResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface CustomFieldsPutResponse { data?: Beehiiv.CustomFieldsPutResponseData; diff --git a/src/api/resources/customFields/types/CustomFieldsPutResponseData.ts b/src/api/resources/customFields/types/CustomFieldsPutResponseData.ts index d10daad..2b32c92 100644 --- a/src/api/resources/customFields/types/CustomFieldsPutResponseData.ts +++ b/src/api/resources/customFields/types/CustomFieldsPutResponseData.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface CustomFieldsPutResponseData { id?: string; diff --git a/src/api/resources/emailBlasts/client/Client.ts b/src/api/resources/emailBlasts/client/Client.ts index 17524d7..04126eb 100644 --- a/src/api/resources/emailBlasts/client/Client.ts +++ b/src/api/resources/emailBlasts/client/Client.ts @@ -4,10 +4,10 @@ import * as environments from "../../../../environments"; import * as core from "../../../../core"; -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; import urlJoin from "url-join"; -import * as serializers from "../../../../serialization"; -import * as errors from "../../../../errors"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; export declare namespace EmailBlasts { interface Options { @@ -17,8 +17,12 @@ export declare namespace EmailBlasts { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; } } @@ -27,13 +31,18 @@ export class EmailBlasts { /** * Retrieve all Email Blasts + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {Beehiiv.EmailBlastsListRequest} request + * @param {EmailBlasts.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.emailBlasts.list("pub_00000000-0000-0000-0000-000000000000") + * await client.emailBlasts.list("pub_00000000-0000-0000-0000-000000000000") */ public async list( publicationId: string, @@ -69,24 +78,26 @@ export class EmailBlasts { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/email_blasts` + `publications/${encodeURIComponent(publicationId)}/email_blasts` ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.EmailBlastsListResponse.parseOrThrow(_response.body, { + return serializers.EmailBlastsListResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -99,7 +110,7 @@ export class EmailBlasts { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -109,7 +120,7 @@ export class EmailBlasts { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -119,7 +130,7 @@ export class EmailBlasts { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -129,7 +140,7 @@ export class EmailBlasts { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -162,13 +173,19 @@ export class EmailBlasts { /** * Retrieve an Email Blast + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {string} emailBlastId - The prefixed ID of the email blast object + * @param {Beehiiv.EmailBlastsGetRequest} request + * @param {EmailBlasts.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.emailBlasts.get("pub_00000000-0000-0000-0000-000000000000", "blast_00000000-0000-0000-0000-000000000000") + * await client.emailBlasts.get("pub_00000000-0000-0000-0000-000000000000", "blast_00000000-0000-0000-0000-000000000000") */ public async get( publicationId: string, @@ -189,24 +206,26 @@ export class EmailBlasts { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/email_blasts/${emailBlastId}` + `publications/${encodeURIComponent(publicationId)}/email_blasts/${encodeURIComponent(emailBlastId)}` ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.EmailBlastsGetResponse.parseOrThrow(_response.body, { + return serializers.EmailBlastsGetResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -219,7 +238,7 @@ export class EmailBlasts { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -229,7 +248,7 @@ export class EmailBlasts { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -239,7 +258,7 @@ export class EmailBlasts { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -249,7 +268,7 @@ export class EmailBlasts { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -280,7 +299,7 @@ export class EmailBlasts { } } - protected async _getAuthorizationHeader() { + protected async _getAuthorizationHeader(): Promise { return `Bearer ${await core.Supplier.get(this._options.token)}`; } } diff --git a/src/api/resources/emailBlasts/client/requests/EmailBlastsGetRequest.ts b/src/api/resources/emailBlasts/client/requests/EmailBlastsGetRequest.ts index 8e39274..6fa3336 100644 --- a/src/api/resources/emailBlasts/client/requests/EmailBlastsGetRequest.ts +++ b/src/api/resources/emailBlasts/client/requests/EmailBlastsGetRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../../.."; +import * as Beehiiv from "../../../../index"; /** * @example diff --git a/src/api/resources/emailBlasts/client/requests/EmailBlastsListRequest.ts b/src/api/resources/emailBlasts/client/requests/EmailBlastsListRequest.ts index 56820a4..99e3680 100644 --- a/src/api/resources/emailBlasts/client/requests/EmailBlastsListRequest.ts +++ b/src/api/resources/emailBlasts/client/requests/EmailBlastsListRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../../.."; +import * as Beehiiv from "../../../../index"; /** * @example diff --git a/src/api/resources/emailBlasts/client/requests/index.ts b/src/api/resources/emailBlasts/client/requests/index.ts index b641e94..12480e0 100644 --- a/src/api/resources/emailBlasts/client/requests/index.ts +++ b/src/api/resources/emailBlasts/client/requests/index.ts @@ -1,2 +1,2 @@ -export { EmailBlastsListRequest } from "./EmailBlastsListRequest"; -export { EmailBlastsGetRequest } from "./EmailBlastsGetRequest"; +export { type EmailBlastsListRequest } from "./EmailBlastsListRequest"; +export { type EmailBlastsGetRequest } from "./EmailBlastsGetRequest"; diff --git a/src/api/resources/emailBlasts/types/EmailBlastsGetRequestExpandItem.ts b/src/api/resources/emailBlasts/types/EmailBlastsGetRequestExpandItem.ts index d7f1848..66f7fc0 100644 --- a/src/api/resources/emailBlasts/types/EmailBlastsGetRequestExpandItem.ts +++ b/src/api/resources/emailBlasts/types/EmailBlastsGetRequestExpandItem.ts @@ -2,7 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -export type EmailBlastsGetRequestExpandItem = "stats" | "free_email_content" | "premium_email_content"; +export type EmailBlastsGetRequestExpandItem = + /** + * Returns statistics about the email blast(s). */ + | "stats" + /** + * Returns the email HTML rendered to a free reader. */ + | "free_email_content" + /** + * Returns the email HTML rendered to a premium reader. */ + | "premium_email_content"; export const EmailBlastsGetRequestExpandItem = { Stats: "stats", diff --git a/src/api/resources/emailBlasts/types/EmailBlastsGetResponse.ts b/src/api/resources/emailBlasts/types/EmailBlastsGetResponse.ts index bab947b..68f81e0 100644 --- a/src/api/resources/emailBlasts/types/EmailBlastsGetResponse.ts +++ b/src/api/resources/emailBlasts/types/EmailBlastsGetResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface EmailBlastsGetResponse { data: Beehiiv.EmailBlast; diff --git a/src/api/resources/emailBlasts/types/EmailBlastsListRequestExpandItem.ts b/src/api/resources/emailBlasts/types/EmailBlastsListRequestExpandItem.ts index 5461d18..e6a799c 100644 --- a/src/api/resources/emailBlasts/types/EmailBlastsListRequestExpandItem.ts +++ b/src/api/resources/emailBlasts/types/EmailBlastsListRequestExpandItem.ts @@ -2,7 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -export type EmailBlastsListRequestExpandItem = "stats" | "free_email_content" | "premium_email_content"; +export type EmailBlastsListRequestExpandItem = + /** + * Returns statistics about the email blast(s). */ + | "stats" + /** + * Returns the email HTML rendered to a free reader. */ + | "free_email_content" + /** + * Returns the email HTML rendered to a premium reader. */ + | "premium_email_content"; export const EmailBlastsListRequestExpandItem = { Stats: "stats", diff --git a/src/api/resources/emailBlasts/types/EmailBlastsListResponse.ts b/src/api/resources/emailBlasts/types/EmailBlastsListResponse.ts index e9ce1e6..5a94d92 100644 --- a/src/api/resources/emailBlasts/types/EmailBlastsListResponse.ts +++ b/src/api/resources/emailBlasts/types/EmailBlastsListResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface EmailBlastsListResponse { data: Beehiiv.EmailBlast[]; diff --git a/src/api/resources/index.ts b/src/api/resources/index.ts index afbea5f..c444350 100644 --- a/src/api/resources/index.ts +++ b/src/api/resources/index.ts @@ -20,6 +20,10 @@ export * as automations from "./automations"; export * from "./automations/types"; export * as subscriptionTags from "./subscriptionTags"; export * from "./subscriptionTags/types"; +export * as tiers from "./tiers"; +export * from "./tiers/types"; +export * as webhooks from "./webhooks"; +export * from "./webhooks/types"; export * from "./publications/client/requests"; export * from "./posts/client/requests"; export * from "./subscriptions/client/requests"; @@ -30,3 +34,5 @@ export * from "./customFields/client/requests"; export * from "./automationJourneys/client/requests"; export * from "./automations/client/requests"; export * from "./subscriptionTags/client/requests"; +export * from "./tiers/client/requests"; +export * from "./webhooks/client/requests"; diff --git a/src/api/resources/posts/client/Client.ts b/src/api/resources/posts/client/Client.ts index 4576d9d..8fb8085 100644 --- a/src/api/resources/posts/client/Client.ts +++ b/src/api/resources/posts/client/Client.ts @@ -4,10 +4,10 @@ import * as environments from "../../../../environments"; import * as core from "../../../../core"; -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; import urlJoin from "url-join"; -import * as serializers from "../../../../serialization"; -import * as errors from "../../../../errors"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; export declare namespace Posts { interface Options { @@ -17,8 +17,12 @@ export declare namespace Posts { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; } } @@ -27,13 +31,18 @@ export class Posts { /** * Retrieve all posts belonging to a specific publication + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {Beehiiv.PostsListRequest} request + * @param {Posts.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.posts.list("pub_00000000-0000-0000-0000-000000000000") + * await client.posts.list("pub_00000000-0000-0000-0000-000000000000") */ public async list( publicationId: string, @@ -94,24 +103,26 @@ export class Posts { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/posts` + `publications/${encodeURIComponent(publicationId)}/posts` ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.PostsListResponse.parseOrThrow(_response.body, { + return serializers.PostsListResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -124,7 +135,7 @@ export class Posts { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -134,7 +145,7 @@ export class Posts { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -144,7 +155,7 @@ export class Posts { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -154,7 +165,7 @@ export class Posts { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -187,13 +198,19 @@ export class Posts { /** * Retreive a single Post belonging to a specific publication + * + * @param {string} postId - The prefixed ID of the post object + * @param {string} publicationId - The prefixed ID of the publication object + * @param {Beehiiv.PostsGetRequest} request + * @param {Posts.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.posts.get("post_00000000-0000-0000-0000-000000000000", "pub_00000000-0000-0000-0000-000000000000") + * await client.posts.get("post_00000000-0000-0000-0000-000000000000", "pub_00000000-0000-0000-0000-000000000000") */ public async get( postId: string, @@ -214,24 +231,26 @@ export class Posts { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/posts/${postId}` + `publications/${encodeURIComponent(publicationId)}/posts/${encodeURIComponent(postId)}` ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.PostsGetResponse.parseOrThrow(_response.body, { + return serializers.PostsGetResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -244,7 +263,7 @@ export class Posts { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -254,7 +273,7 @@ export class Posts { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -264,7 +283,7 @@ export class Posts { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -274,7 +293,7 @@ export class Posts { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -307,13 +326,18 @@ export class Posts { /** * Delete or Archive a post. Any post that has been confirmed will have it's status changed to `archived`. Posts in the `draft` status will be permenantly deleted. + * + * @param {string} postId - The prefixed ID of the post object + * @param {string} publicationId - The prefixed ID of the publication object + * @param {Posts.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.posts.delete("post_00000000-0000-0000-0000-000000000000", "pub_00000000-0000-0000-0000-000000000000") + * await client.posts.delete("post_00000000-0000-0000-0000-000000000000", "pub_00000000-0000-0000-0000-000000000000") */ public async delete( postId: string, @@ -323,23 +347,25 @@ export class Posts { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/posts/${postId}` + `publications/${encodeURIComponent(publicationId)}/posts/${encodeURIComponent(postId)}` ), method: "DELETE", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.PostsDeleteResponse.parseOrThrow(_response.body, { + return serializers.PostsDeleteResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -352,7 +378,7 @@ export class Posts { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -362,7 +388,7 @@ export class Posts { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -372,7 +398,7 @@ export class Posts { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -382,7 +408,7 @@ export class Posts { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -413,7 +439,7 @@ export class Posts { } } - protected async _getAuthorizationHeader() { + protected async _getAuthorizationHeader(): Promise { return `Bearer ${await core.Supplier.get(this._options.token)}`; } } diff --git a/src/api/resources/posts/client/requests/PostsGetRequest.ts b/src/api/resources/posts/client/requests/PostsGetRequest.ts index 06a5ca7..ed05b42 100644 --- a/src/api/resources/posts/client/requests/PostsGetRequest.ts +++ b/src/api/resources/posts/client/requests/PostsGetRequest.ts @@ -2,15 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../../.."; +import * as Beehiiv from "../../../../index"; /** * @example * {} */ export interface PostsGetRequest { - /** - * Optional list of expandable objects.
`stats` - Returns statistics about the post(s)
`free_web_content` - Returns the web HTML rendered to a free reader
`free_email_content` - Returns the email HTML rendered to a free reader
`free_rss_content` - Returns the RSS feed HTML
`premium_web_content` - Returns the web HTML rendered to a premium reader
`premium_email_content` - Returns the email HTML rendered to a premium reader - */ expand?: Beehiiv.PostsGetRequestExpandItem | Beehiiv.PostsGetRequestExpandItem[]; } diff --git a/src/api/resources/posts/client/requests/PostsListRequest.ts b/src/api/resources/posts/client/requests/PostsListRequest.ts index a5a05d7..8018342 100644 --- a/src/api/resources/posts/client/requests/PostsListRequest.ts +++ b/src/api/resources/posts/client/requests/PostsListRequest.ts @@ -2,16 +2,13 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../../.."; +import * as Beehiiv from "../../../../index"; /** * @example * {} */ export interface PostsListRequest { - /** - * Optional list of expandable objects.
`stats` - Returns statistics about the post(s)
`free_web_content` - Returns the web HTML rendered to a free reader
`free_email_content` - Returns the email HTML rendered to a free reader
`free_rss_content` - Returns the RSS feed HTML
`premium_web_content` - Returns the web HTML rendered to a premium reader
`premium_email_content` - Returns the email HTML rendered to a premium reader - */ expand?: Beehiiv.PostsListRequestExpandItem | Beehiiv.PostsListRequestExpandItem[]; /** * Optionally filter the results by audience diff --git a/src/api/resources/posts/client/requests/index.ts b/src/api/resources/posts/client/requests/index.ts index 4d3f815..fde30e7 100644 --- a/src/api/resources/posts/client/requests/index.ts +++ b/src/api/resources/posts/client/requests/index.ts @@ -1,2 +1,2 @@ -export { PostsListRequest } from "./PostsListRequest"; -export { PostsGetRequest } from "./PostsGetRequest"; +export { type PostsListRequest } from "./PostsListRequest"; +export { type PostsGetRequest } from "./PostsGetRequest"; diff --git a/src/api/resources/posts/types/PostsGetRequestExpandItem.ts b/src/api/resources/posts/types/PostsGetRequestExpandItem.ts index 8e1f3e4..7d35a71 100644 --- a/src/api/resources/posts/types/PostsGetRequestExpandItem.ts +++ b/src/api/resources/posts/types/PostsGetRequestExpandItem.ts @@ -3,11 +3,23 @@ */ export type PostsGetRequestExpandItem = + /** + * Returns statistics about the post(s). */ | "stats" + /** + * Returns the web HTML rendered to a free reader. */ | "free_web_content" + /** + * Returns the email HTML rendered to a free reader. */ | "free_email_content" + /** + * Returns the RSS feed HTML. */ | "free_rss_content" + /** + * Returns the web HTML rendered to a premium reader. */ | "premium_web_content" + /** + * Returns the email HTML rendered to a premium reader. */ | "premium_email_content"; export const PostsGetRequestExpandItem = { diff --git a/src/api/resources/posts/types/PostsGetResponse.ts b/src/api/resources/posts/types/PostsGetResponse.ts index 75e3f35..bc250bf 100644 --- a/src/api/resources/posts/types/PostsGetResponse.ts +++ b/src/api/resources/posts/types/PostsGetResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface PostsGetResponse { data: Beehiiv.Post; diff --git a/src/api/resources/posts/types/PostsListRequestExpandItem.ts b/src/api/resources/posts/types/PostsListRequestExpandItem.ts index 581423e..274d214 100644 --- a/src/api/resources/posts/types/PostsListRequestExpandItem.ts +++ b/src/api/resources/posts/types/PostsListRequestExpandItem.ts @@ -3,11 +3,23 @@ */ export type PostsListRequestExpandItem = + /** + * Returns statistics about the post(s). */ | "stats" + /** + * Returns the web HTML rendered to a free reader. */ | "free_web_content" + /** + * Returns the email HTML rendered to a free reader. */ | "free_email_content" + /** + * Returns the RSS feed HTML. */ | "free_rss_content" + /** + * Returns the web HTML rendered to a premium reader. */ | "premium_web_content" + /** + * Returns the email HTML rendered to a premium reader. */ | "premium_email_content"; export const PostsListRequestExpandItem = { diff --git a/src/api/resources/posts/types/PostsListResponse.ts b/src/api/resources/posts/types/PostsListResponse.ts index e55e4a3..293454c 100644 --- a/src/api/resources/posts/types/PostsListResponse.ts +++ b/src/api/resources/posts/types/PostsListResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface PostsListResponse { data: Beehiiv.Post[]; diff --git a/src/api/resources/publications/client/Client.ts b/src/api/resources/publications/client/Client.ts index 74f6c92..08d65ea 100644 --- a/src/api/resources/publications/client/Client.ts +++ b/src/api/resources/publications/client/Client.ts @@ -4,10 +4,10 @@ import * as environments from "../../../../environments"; import * as core from "../../../../core"; -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; import urlJoin from "url-join"; -import * as serializers from "../../../../serialization"; -import * as errors from "../../../../errors"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; export declare namespace Publications { interface Options { @@ -17,8 +17,12 @@ export declare namespace Publications { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; } } @@ -27,13 +31,19 @@ export class Publications { /** * Retrieve all publications associated with your API key. + * + * @param {Beehiiv.PublicationsListRequest} request + * @param {Publications.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.publications.list() + * await client.publications.list({ + * expand: Beehiiv.PublicationsListRequestExpandItem.Stats + * }) */ public async list( request: Beehiiv.PublicationsListRequest = {}, @@ -74,18 +84,20 @@ export class Publications { headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.PublicationsListResponse.parseOrThrow(_response.body, { + return serializers.PublicationsListResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -98,7 +110,7 @@ export class Publications { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -108,7 +120,7 @@ export class Publications { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -118,7 +130,7 @@ export class Publications { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -128,7 +140,7 @@ export class Publications { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -161,13 +173,20 @@ export class Publications { /** * Retrieve a single publication + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {Beehiiv.PublicationsGetRequest} request + * @param {Publications.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.publications.get("pub_00000000-0000-0000-0000-000000000000") + * await client.publications.get("pub_ad76629e-4a39-43ad-8055-0ee89dc6db15", { + * expand: Beehiiv.PublicationsGetRequestExpandItem.Stats + * }) */ public async get( publicationId: string, @@ -187,24 +206,26 @@ export class Publications { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}` + `publications/${encodeURIComponent(publicationId)}` ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.PublicationsGetResponse.parseOrThrow(_response.body, { + return serializers.PublicationsGetResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -217,7 +238,7 @@ export class Publications { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -227,7 +248,7 @@ export class Publications { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -237,7 +258,7 @@ export class Publications { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -247,7 +268,7 @@ export class Publications { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -278,7 +299,7 @@ export class Publications { } } - protected async _getAuthorizationHeader() { + protected async _getAuthorizationHeader(): Promise { return `Bearer ${await core.Supplier.get(this._options.token)}`; } } diff --git a/src/api/resources/publications/client/requests/PublicationsGetRequest.ts b/src/api/resources/publications/client/requests/PublicationsGetRequest.ts index 897bdb5..3ef5c18 100644 --- a/src/api/resources/publications/client/requests/PublicationsGetRequest.ts +++ b/src/api/resources/publications/client/requests/PublicationsGetRequest.ts @@ -2,13 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ +import * as Beehiiv from "../../../../index"; + /** * @example - * {} + * { + * expand: Beehiiv.PublicationsGetRequestExpandItem.Stats + * } */ export interface PublicationsGetRequest { - /** - * Optional list of expandable objects.
`stats` - Returns all statistics about the publication(s)
`stat_active_subscriptions` - Total number of active free and premium subscriptions
`stat_active_premium_subscriptions` - Total number of active premium/paid subscriptions
`stat_active_free_subscriptions` - Total number of active free subscriptions
`stat_average_open_rate` - The publications historical average open rate
`stat_average_click_rate` - The publications historical average click through rate
`stat_total_sent` - Total number of emails sent
`stat_total_unique_opened` - Total number of uniquely opened emails. Only counts the first open for each subscriber.
`stat_total_clicked` - The total number of links clicked from emails. - */ - expand?: "stats" | "stats"[]; + expand?: Beehiiv.PublicationsGetRequestExpandItem | Beehiiv.PublicationsGetRequestExpandItem[]; } diff --git a/src/api/resources/publications/client/requests/PublicationsListRequest.ts b/src/api/resources/publications/client/requests/PublicationsListRequest.ts index cb42936..52731fa 100644 --- a/src/api/resources/publications/client/requests/PublicationsListRequest.ts +++ b/src/api/resources/publications/client/requests/PublicationsListRequest.ts @@ -2,17 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../../.."; +import * as Beehiiv from "../../../../index"; /** * @example - * {} + * { + * expand: Beehiiv.PublicationsListRequestExpandItem.Stats + * } */ export interface PublicationsListRequest { - /** - * Optional list of expandable objects.
`stats` - Returns all statistics about the publication(s)
`stat_active_subscriptions` - Total number of active free and premium subscriptions
`stat_active_premium_subscriptions` - Total number of active premium/paid subscriptions
`stat_active_free_subscriptions` - Total number of active free subscriptions
`stat_average_open_rate` - The publications historical average open rate
`stat_average_click_rate` - The publications historical average click through rate
`stat_total_sent` - Total number of emails sent
`stat_total_unique_opened` - Total number of uniquely opened emails. Only counts the first open for each subscriber.
`stat_total_clicked` - The total number of links clicked from emails. - */ - expand?: "stats" | "stats"[]; + expand?: Beehiiv.PublicationsListRequestExpandItem | Beehiiv.PublicationsListRequestExpandItem[]; /** * A limit on the number of objects to be returned. The limit can range between 1 and 100, and the default is 10. */ diff --git a/src/api/resources/publications/client/requests/index.ts b/src/api/resources/publications/client/requests/index.ts index 1b22944..0c2f144 100644 --- a/src/api/resources/publications/client/requests/index.ts +++ b/src/api/resources/publications/client/requests/index.ts @@ -1,2 +1,2 @@ -export { PublicationsListRequest } from "./PublicationsListRequest"; -export { PublicationsGetRequest } from "./PublicationsGetRequest"; +export { type PublicationsListRequest } from "./PublicationsListRequest"; +export { type PublicationsGetRequest } from "./PublicationsGetRequest"; diff --git a/src/api/resources/publications/types/PublicationsGetRequestExpandItem.ts b/src/api/resources/publications/types/PublicationsGetRequestExpandItem.ts new file mode 100644 index 0000000..d6779cb --- /dev/null +++ b/src/api/resources/publications/types/PublicationsGetRequestExpandItem.ts @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type PublicationsGetRequestExpandItem = + /** + * Returns all statistics about the publication(s). */ + | "stats" + /** + * Total number of active free and premium subscriptions. */ + | "stat_active_subscriptions" + /** + * Total number of active premium/paid subscriptions. */ + | "stat_active_premium_subscriptions" + /** + * Total number of active free subscriptions. */ + | "stat_active_free_subscriptions" + /** + * The publications historical average open rate. */ + | "stat_average_open_rate" + /** + * The publications historical average click through rate. */ + | "stat_average_click_rate" + /** + * Total number of emails sent. */ + | "stat_total_sent" + /** + * Total number of uniquely opened emails. Only counts the first open for each subscriber. */ + | "stat_total_unique_opened" + /** + * The total number of links clicked from emails. */ + | "stat_total_clicked"; + +export const PublicationsGetRequestExpandItem = { + Stats: "stats", + StatActiveSubscriptions: "stat_active_subscriptions", + StatActivePremiumSubscriptions: "stat_active_premium_subscriptions", + StatActiveFreeSubscriptions: "stat_active_free_subscriptions", + StatAverageOpenRate: "stat_average_open_rate", + StatAverageClickRate: "stat_average_click_rate", + StatTotalSent: "stat_total_sent", + StatTotalUniqueOpened: "stat_total_unique_opened", + StatTotalClicked: "stat_total_clicked", +} as const; diff --git a/src/api/resources/publications/types/PublicationsGetResponse.ts b/src/api/resources/publications/types/PublicationsGetResponse.ts index 32277b9..7ad05e7 100644 --- a/src/api/resources/publications/types/PublicationsGetResponse.ts +++ b/src/api/resources/publications/types/PublicationsGetResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface PublicationsGetResponse { data: Beehiiv.Publication; diff --git a/src/api/resources/publications/types/PublicationsListRequestExpandItem.ts b/src/api/resources/publications/types/PublicationsListRequestExpandItem.ts new file mode 100644 index 0000000..c9f4163 --- /dev/null +++ b/src/api/resources/publications/types/PublicationsListRequestExpandItem.ts @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type PublicationsListRequestExpandItem = + /** + * Returns all statistics about the publication(s). */ + | "stats" + /** + * Total number of active free and premium subscriptions. */ + | "stat_active_subscriptions" + /** + * Total number of active premium/paid subscriptions. */ + | "stat_active_premium_subscriptions" + /** + * Total number of active free subscriptions. */ + | "stat_active_free_subscriptions" + /** + * The publications historical average open rate. */ + | "stat_average_open_rate" + /** + * The publications historical average click through rate. */ + | "stat_average_click_rate" + /** + * Total number of emails sent. */ + | "stat_total_sent" + /** + * Total number of uniquely opened emails. Only counts the first open for each subscriber. */ + | "stat_total_unique_opened" + /** + * The total number of links clicked from emails. */ + | "stat_total_clicked"; + +export const PublicationsListRequestExpandItem = { + Stats: "stats", + StatActiveSubscriptions: "stat_active_subscriptions", + StatActivePremiumSubscriptions: "stat_active_premium_subscriptions", + StatActiveFreeSubscriptions: "stat_active_free_subscriptions", + StatAverageOpenRate: "stat_average_open_rate", + StatAverageClickRate: "stat_average_click_rate", + StatTotalSent: "stat_total_sent", + StatTotalUniqueOpened: "stat_total_unique_opened", + StatTotalClicked: "stat_total_clicked", +} as const; diff --git a/src/api/resources/publications/types/PublicationsListResponse.ts b/src/api/resources/publications/types/PublicationsListResponse.ts index 385f951..dfc44b3 100644 --- a/src/api/resources/publications/types/PublicationsListResponse.ts +++ b/src/api/resources/publications/types/PublicationsListResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface PublicationsListResponse { data: Beehiiv.Publication[]; diff --git a/src/api/resources/publications/types/index.ts b/src/api/resources/publications/types/index.ts index 71ac15a..c96220c 100644 --- a/src/api/resources/publications/types/index.ts +++ b/src/api/resources/publications/types/index.ts @@ -1,4 +1,6 @@ +export * from "./PublicationsListRequestExpandItem"; export * from "./PublicationsListRequestDirection"; export * from "./PublicationsListRequestOrderBy"; export * from "./PublicationsListResponse"; +export * from "./PublicationsGetRequestExpandItem"; export * from "./PublicationsGetResponse"; diff --git a/src/api/resources/referralProgram/client/Client.ts b/src/api/resources/referralProgram/client/Client.ts index 6d47662..771b7ed 100644 --- a/src/api/resources/referralProgram/client/Client.ts +++ b/src/api/resources/referralProgram/client/Client.ts @@ -4,10 +4,10 @@ import * as environments from "../../../../environments"; import * as core from "../../../../core"; -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; import urlJoin from "url-join"; -import * as serializers from "../../../../serialization"; -import * as errors from "../../../../errors"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; export declare namespace ReferralProgram { interface Options { @@ -17,8 +17,12 @@ export declare namespace ReferralProgram { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; } } @@ -27,13 +31,18 @@ export class ReferralProgram { /** * Retrieve details about the publication's referral program, including milestones and rewards. + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {Beehiiv.ReferralProgramGetRequest} request + * @param {ReferralProgram.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.referralProgram.get("pub_00000000-0000-0000-0000-000000000000") + * await client.referralProgram.get("pub_00000000-0000-0000-0000-000000000000") */ public async get( publicationId: string, @@ -53,24 +62,26 @@ export class ReferralProgram { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/referral_program` + `publications/${encodeURIComponent(publicationId)}/referral_program` ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.ReferralProgramGetResponse.parseOrThrow(_response.body, { + return serializers.ReferralProgramGetResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -83,7 +94,7 @@ export class ReferralProgram { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -93,7 +104,7 @@ export class ReferralProgram { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -103,7 +114,7 @@ export class ReferralProgram { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -113,7 +124,7 @@ export class ReferralProgram { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -144,7 +155,7 @@ export class ReferralProgram { } } - protected async _getAuthorizationHeader() { + protected async _getAuthorizationHeader(): Promise { return `Bearer ${await core.Supplier.get(this._options.token)}`; } } diff --git a/src/api/resources/referralProgram/client/requests/index.ts b/src/api/resources/referralProgram/client/requests/index.ts index c71a21c..f33ba4f 100644 --- a/src/api/resources/referralProgram/client/requests/index.ts +++ b/src/api/resources/referralProgram/client/requests/index.ts @@ -1 +1 @@ -export { ReferralProgramGetRequest } from "./ReferralProgramGetRequest"; +export { type ReferralProgramGetRequest } from "./ReferralProgramGetRequest"; diff --git a/src/api/resources/referralProgram/types/ReferralProgramGetResponse.ts b/src/api/resources/referralProgram/types/ReferralProgramGetResponse.ts index 35d5537..3639e3e 100644 --- a/src/api/resources/referralProgram/types/ReferralProgramGetResponse.ts +++ b/src/api/resources/referralProgram/types/ReferralProgramGetResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface ReferralProgramGetResponse { /** A list of the milestones related to this publication's referral program. */ diff --git a/src/api/resources/segments/client/Client.ts b/src/api/resources/segments/client/Client.ts index 637a89e..ae3ae43 100644 --- a/src/api/resources/segments/client/Client.ts +++ b/src/api/resources/segments/client/Client.ts @@ -4,10 +4,10 @@ import * as environments from "../../../../environments"; import * as core from "../../../../core"; -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; import urlJoin from "url-join"; -import * as serializers from "../../../../serialization"; -import * as errors from "../../../../errors"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; export declare namespace Segments { interface Options { @@ -17,8 +17,12 @@ export declare namespace Segments { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; } } @@ -27,13 +31,18 @@ export class Segments { /** * Retrieve information about all segments belonging to a specific publication + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {Beehiiv.SegmentsListRequest} request + * @param {Segments.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.segments.list("pub_00000000-0000-0000-0000-000000000000") + * await client.segments.list("pub_00000000-0000-0000-0000-000000000000") */ public async list( publicationId: string, @@ -69,24 +78,26 @@ export class Segments { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/segments` + `publications/${encodeURIComponent(publicationId)}/segments` ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.SegmentsListResponse.parseOrThrow(_response.body, { + return serializers.SegmentsListResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -99,7 +110,7 @@ export class Segments { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -109,7 +120,7 @@ export class Segments { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -119,7 +130,7 @@ export class Segments { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -129,7 +140,7 @@ export class Segments { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -162,13 +173,19 @@ export class Segments { /** * List the Subscriber Ids from the most recent calculation of a specific publication. + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {string} segmentId - The prefixed ID of the segment object + * @param {Beehiiv.SegmentsGetRequest} request + * @param {Segments.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.segments.get("pub_00000000-0000-0000-0000-000000000000", "seg_00000000-0000-0000-0000-000000000000") + * await client.segments.get("pub_00000000-0000-0000-0000-000000000000", "seg_00000000-0000-0000-0000-000000000000") */ public async get( publicationId: string, @@ -189,24 +206,26 @@ export class Segments { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/segments/${segmentId}/results` + `publications/${encodeURIComponent(publicationId)}/segments/${encodeURIComponent(segmentId)}/results` ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.SegmentsGetResponse.parseOrThrow(_response.body, { + return serializers.SegmentsGetResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -219,7 +238,7 @@ export class Segments { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -229,7 +248,7 @@ export class Segments { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -239,7 +258,7 @@ export class Segments { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -249,7 +268,7 @@ export class Segments { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -282,12 +301,17 @@ export class Segments { /** * Delete a segment. Deleting the segment does not effect the subscriptions in the segment. + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {string} segmentId - The prefixed ID of the segment object + * @param {Segments.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.segments.delete("pub_00000000-0000-0000-0000-000000000000", "seg_00000000-0000-0000-0000-000000000000") + * await client.segments.delete("pub_00000000-0000-0000-0000-000000000000", "seg_00000000-0000-0000-0000-000000000000") */ public async delete( publicationId: string, @@ -297,23 +321,25 @@ export class Segments { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/segments/${segmentId}` + `publications/${encodeURIComponent(publicationId)}/segments/${encodeURIComponent(segmentId)}` ), method: "DELETE", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.segments.delete.Response.parseOrThrow(_response.body, { + return serializers.segments.delete.Response.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -326,7 +352,7 @@ export class Segments { switch (_response.error.statusCode) { case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -336,7 +362,7 @@ export class Segments { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -346,7 +372,7 @@ export class Segments { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -377,7 +403,7 @@ export class Segments { } } - protected async _getAuthorizationHeader() { + protected async _getAuthorizationHeader(): Promise { return `Bearer ${await core.Supplier.get(this._options.token)}`; } } diff --git a/src/api/resources/segments/client/requests/SegmentsListRequest.ts b/src/api/resources/segments/client/requests/SegmentsListRequest.ts index 381bc09..c9eaffe 100644 --- a/src/api/resources/segments/client/requests/SegmentsListRequest.ts +++ b/src/api/resources/segments/client/requests/SegmentsListRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../../.."; +import * as Beehiiv from "../../../../index"; /** * @example diff --git a/src/api/resources/segments/client/requests/index.ts b/src/api/resources/segments/client/requests/index.ts index b02d813..e24b0f4 100644 --- a/src/api/resources/segments/client/requests/index.ts +++ b/src/api/resources/segments/client/requests/index.ts @@ -1,2 +1,2 @@ -export { SegmentsListRequest } from "./SegmentsListRequest"; -export { SegmentsGetRequest } from "./SegmentsGetRequest"; +export { type SegmentsListRequest } from "./SegmentsListRequest"; +export { type SegmentsGetRequest } from "./SegmentsGetRequest"; diff --git a/src/api/resources/segments/types/SegmentsListResponse.ts b/src/api/resources/segments/types/SegmentsListResponse.ts index e21288d..369d4ad 100644 --- a/src/api/resources/segments/types/SegmentsListResponse.ts +++ b/src/api/resources/segments/types/SegmentsListResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface SegmentsListResponse { /** An array of all segments. */ diff --git a/src/api/resources/subscriptionTags/client/Client.ts b/src/api/resources/subscriptionTags/client/Client.ts index 6a4833b..0e20802 100644 --- a/src/api/resources/subscriptionTags/client/Client.ts +++ b/src/api/resources/subscriptionTags/client/Client.ts @@ -4,10 +4,10 @@ import * as environments from "../../../../environments"; import * as core from "../../../../core"; -import * as Beehiiv from "../../.."; -import * as serializers from "../../../../serialization"; +import * as Beehiiv from "../../../index"; +import * as serializers from "../../../../serialization/index"; import urlJoin from "url-join"; -import * as errors from "../../../../errors"; +import * as errors from "../../../../errors/index"; export declare namespace SubscriptionTags { interface Options { @@ -17,8 +17,12 @@ export declare namespace SubscriptionTags { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; } } @@ -27,15 +31,19 @@ export class SubscriptionTags { /** * Create new subscription tags for a subscription. If the tag does not exist on the publication, it will be created automatically. + * + * @param {string} publicationId + * @param {string} subscriptionId + * @param {Beehiiv.SubscriptionTagsCreateRequest} request + * @param {SubscriptionTags.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.subscriptionTags.create("publicationId", "subscriptionId", { - * tags: ["Premium"] - * }) + * await client.subscriptionTags.create("publicationId", "subscriptionId") */ public async create( publicationId: string, @@ -46,26 +54,32 @@ export class SubscriptionTags { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/subscriptions/${subscriptionId}/tags` + `publications/${encodeURIComponent(publicationId)}/subscriptions/${encodeURIComponent( + subscriptionId + )}/tags` ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.SubscriptionTagsCreateRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", + requestType: "json", + body: serializers.SubscriptionTagsCreateRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.SubscriptionTagsCreateResponse.parseOrThrow(_response.body, { + return serializers.SubscriptionTagsCreateResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -78,7 +92,7 @@ export class SubscriptionTags { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -88,7 +102,7 @@ export class SubscriptionTags { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -98,7 +112,7 @@ export class SubscriptionTags { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -108,7 +122,7 @@ export class SubscriptionTags { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -139,7 +153,7 @@ export class SubscriptionTags { } } - protected async _getAuthorizationHeader() { + protected async _getAuthorizationHeader(): Promise { return `Bearer ${await core.Supplier.get(this._options.token)}`; } } diff --git a/src/api/resources/subscriptionTags/client/requests/SubscriptionTagsCreateRequest.ts b/src/api/resources/subscriptionTags/client/requests/SubscriptionTagsCreateRequest.ts index 9886edc..300bed5 100644 --- a/src/api/resources/subscriptionTags/client/requests/SubscriptionTagsCreateRequest.ts +++ b/src/api/resources/subscriptionTags/client/requests/SubscriptionTagsCreateRequest.ts @@ -4,9 +4,7 @@ /** * @example - * { - * tags: ["Premium"] - * } + * {} */ export interface SubscriptionTagsCreateRequest { /** Tags that can be used to group subscribers */ diff --git a/src/api/resources/subscriptionTags/client/requests/index.ts b/src/api/resources/subscriptionTags/client/requests/index.ts index fa3eadf..fc3d10d 100644 --- a/src/api/resources/subscriptionTags/client/requests/index.ts +++ b/src/api/resources/subscriptionTags/client/requests/index.ts @@ -1 +1 @@ -export { SubscriptionTagsCreateRequest } from "./SubscriptionTagsCreateRequest"; +export { type SubscriptionTagsCreateRequest } from "./SubscriptionTagsCreateRequest"; diff --git a/src/api/resources/subscriptionTags/types/SubscriptionTagsCreateResponse.ts b/src/api/resources/subscriptionTags/types/SubscriptionTagsCreateResponse.ts index 52a6029..6705a2a 100644 --- a/src/api/resources/subscriptionTags/types/SubscriptionTagsCreateResponse.ts +++ b/src/api/resources/subscriptionTags/types/SubscriptionTagsCreateResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface SubscriptionTagsCreateResponse { data?: Beehiiv.Subscription; diff --git a/src/api/resources/subscriptions/client/Client.ts b/src/api/resources/subscriptions/client/Client.ts index 9a22ac9..eeef7c8 100644 --- a/src/api/resources/subscriptions/client/Client.ts +++ b/src/api/resources/subscriptions/client/Client.ts @@ -4,10 +4,10 @@ import * as environments from "../../../../environments"; import * as core from "../../../../core"; -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; import urlJoin from "url-join"; -import * as serializers from "../../../../serialization"; -import * as errors from "../../../../errors"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; export declare namespace Subscriptions { interface Options { @@ -17,8 +17,12 @@ export declare namespace Subscriptions { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; } } @@ -27,13 +31,18 @@ export class Subscriptions { /** * Retrieve all subscriptions belonging to a specific publication + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {Beehiiv.SubscriptionsListRequest} request + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.subscriptions.list("pub_00000000-0000-0000-0000-000000000000", { + * await client.subscriptions.list("pub_00000000-0000-0000-0000-000000000000", { * email: "clark@dailyplanet.com" * }) */ @@ -42,7 +51,7 @@ export class Subscriptions { request: Beehiiv.SubscriptionsListRequest = {}, requestOptions?: Subscriptions.RequestOptions ): Promise { - const { expand, status, tier, limit, page, email, orderBy, direction } = request; + const { expand, status, tier, premiumTiers, premiumTierIds, limit, page, email, orderBy, direction } = request; const _queryParams: Record = {}; if (expand != null) { if (Array.isArray(expand)) { @@ -60,6 +69,22 @@ export class Subscriptions { _queryParams["tier"] = tier; } + if (premiumTiers != null) { + if (Array.isArray(premiumTiers)) { + _queryParams["premium_tiers[]"] = premiumTiers.map((item) => item); + } else { + _queryParams["premium_tiers[]"] = premiumTiers; + } + } + + if (premiumTierIds != null) { + if (Array.isArray(premiumTierIds)) { + _queryParams["premium_tier_ids[]"] = premiumTierIds.map((item) => item); + } else { + _queryParams["premium_tier_ids[]"] = premiumTierIds; + } + } + if (limit != null) { _queryParams["limit"] = limit.toString(); } @@ -83,24 +108,26 @@ export class Subscriptions { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/subscriptions` + `publications/${encodeURIComponent(publicationId)}/subscriptions` ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.SubscriptionsListResponse.parseOrThrow(_response.body, { + return serializers.SubscriptionsListResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -113,7 +140,7 @@ export class Subscriptions { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -123,7 +150,7 @@ export class Subscriptions { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -133,7 +160,7 @@ export class Subscriptions { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -143,7 +170,7 @@ export class Subscriptions { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -176,13 +203,18 @@ export class Subscriptions { /** * Create new subscriptions for a publication. + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {Beehiiv.SubscriptionsCreateRequest} request + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.subscriptions.create("pub_00000000-0000-0000-0000-000000000000", { + * await client.subscriptions.create("pub_00000000-0000-0000-0000-000000000000", { * email: "bruce.wayne@wayneenterprise.com", * reactivateExisting: false, * sendWelcomeEmail: false, @@ -197,7 +229,7 @@ export class Subscriptions { * name: "Last Name", * value: "Wayne" * }], - * automationIds: ["aut_00000000-0000-0000-0000-000000000000"] + * stripeCustomerId: "stripe_customer_id" * }) */ public async create( @@ -214,25 +246,31 @@ export class Subscriptions { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/subscriptions` + `publications/${encodeURIComponent(publicationId)}/subscriptions` ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, - body: await serializers.SubscriptionsCreateRequest.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.SubscriptionsCreateRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.SubscriptionsCreateResponse.parseOrThrow(_response.body, { + return serializers.SubscriptionsCreateResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -245,7 +283,7 @@ export class Subscriptions { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -255,7 +293,7 @@ export class Subscriptions { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -265,7 +303,7 @@ export class Subscriptions { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -275,7 +313,7 @@ export class Subscriptions { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -308,13 +346,18 @@ export class Subscriptions { /** * Bulk update subscriptions' field values (standard fields and custom fields) + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {Beehiiv.SubscriptionsPutRequest} request + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.subscriptions.put("publicationId") + * await client.subscriptions.put("publicationId") */ public async put( publicationId: string, @@ -324,24 +367,30 @@ export class Subscriptions { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/subscriptions/bulk_actions` + `publications/${encodeURIComponent(publicationId)}/subscriptions/bulk_actions` ), method: "PUT", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.SubscriptionsPutRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.SubscriptionsPutRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.SubscriptionsPutResponse.parseOrThrow(_response.body, { + return serializers.SubscriptionsPutResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -354,7 +403,7 @@ export class Subscriptions { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -364,7 +413,7 @@ export class Subscriptions { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -374,7 +423,7 @@ export class Subscriptions { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -384,7 +433,7 @@ export class Subscriptions { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -417,13 +466,18 @@ export class Subscriptions { /** * Bulk update subscriptions' field values (standard fields and custom fields) + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {Beehiiv.SubscriptionsPatchRequest} request + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.subscriptions.patch("publicationId") + * await client.subscriptions.patch("publicationId") */ public async patch( publicationId: string, @@ -433,24 +487,30 @@ export class Subscriptions { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/subscriptions/bulk_actions` + `publications/${encodeURIComponent(publicationId)}/subscriptions/bulk_actions` ), method: "PATCH", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.SubscriptionsPatchRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.SubscriptionsPatchRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.SubscriptionsPatchResponse.parseOrThrow(_response.body, { + return serializers.SubscriptionsPatchResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -463,7 +523,7 @@ export class Subscriptions { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -473,7 +533,7 @@ export class Subscriptions { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -483,7 +543,7 @@ export class Subscriptions { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -493,7 +553,7 @@ export class Subscriptions { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -526,13 +586,19 @@ export class Subscriptions { /** * Retrieve a single subscription belonging to a specific email address in a specific publication + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {string} email - The ID of the subscriber object + * @param {Beehiiv.SubscriptionsGetRequest} request + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.subscriptions.get("pub_00000000-0000-0000-0000-000000000000", "work@example.com") + * await client.subscriptions.get("pub_00000000-0000-0000-0000-000000000000", "work@example.com") */ public async get( publicationId: string, @@ -553,24 +619,26 @@ export class Subscriptions { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/subscriptions/by_email/${email}` + `publications/${encodeURIComponent(publicationId)}/subscriptions/by_email/${encodeURIComponent(email)}` ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.SubscriptionsGetResponse.parseOrThrow(_response.body, { + return serializers.SubscriptionsGetResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -583,7 +651,7 @@ export class Subscriptions { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -593,7 +661,7 @@ export class Subscriptions { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -603,7 +671,7 @@ export class Subscriptions { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -613,7 +681,7 @@ export class Subscriptions { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -650,13 +718,18 @@ export class Subscriptions { * **This cannot be undone** All data associated with the subscription will also be deleted. We recommend unsubscribing when possible instead of deleting. * * If a premium subscription is deleted they will no longer be billed. + * + * @param {string} subscriptionId - The prefixed ID of the subscription object + * @param {string} publicationId - The prefixed ID of the publication object + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * * @throws {@link Beehiiv.BadRequestError} * @throws {@link Beehiiv.NotFoundError} * @throws {@link Beehiiv.TooManyRequestsError} * @throws {@link Beehiiv.InternalServerError} * * @example - * await beehiiv.subscriptions.delete("sub_00000000-0000-0000-0000-000000000000", "pub_00000000-0000-0000-0000-000000000000") + * await client.subscriptions.delete("sub_00000000-0000-0000-0000-000000000000", "pub_00000000-0000-0000-0000-000000000000") */ public async delete( subscriptionId: string, @@ -666,23 +739,25 @@ export class Subscriptions { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, - `publications/${publicationId}/subscriptions/${subscriptionId}` + `publications/${encodeURIComponent(publicationId)}/subscriptions/${encodeURIComponent(subscriptionId)}` ), method: "DELETE", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "", - "X-Fern-SDK-Version": "0.1.2", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.subscriptions.delete.Response.parseOrThrow(_response.body, { + return serializers.subscriptions.delete.Response.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -695,7 +770,7 @@ export class Subscriptions { switch (_response.error.statusCode) { case 400: throw new Beehiiv.BadRequestError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -705,7 +780,7 @@ export class Subscriptions { ); case 404: throw new Beehiiv.NotFoundError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -715,7 +790,7 @@ export class Subscriptions { ); case 429: throw new Beehiiv.TooManyRequestsError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -725,7 +800,7 @@ export class Subscriptions { ); case 500: throw new Beehiiv.InternalServerError( - await serializers.Error_.parseOrThrow(_response.error.body, { + serializers.Error_.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -756,7 +831,7 @@ export class Subscriptions { } } - protected async _getAuthorizationHeader() { + protected async _getAuthorizationHeader(): Promise { return `Bearer ${await core.Supplier.get(this._options.token)}`; } } diff --git a/src/api/resources/subscriptions/client/requests/SubscriptionsCreateRequest.ts b/src/api/resources/subscriptions/client/requests/SubscriptionsCreateRequest.ts index ef3a737..d79da5f 100644 --- a/src/api/resources/subscriptions/client/requests/SubscriptionsCreateRequest.ts +++ b/src/api/resources/subscriptions/client/requests/SubscriptionsCreateRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../../.."; +import * as Beehiiv from "../../../../index"; /** * @example @@ -21,7 +21,7 @@ import * as Beehiiv from "../../../.."; * name: "Last Name", * value: "Wayne" * }], - * automationIds: ["aut_00000000-0000-0000-0000-000000000000"] + * stripeCustomerId: "stripe_customer_id" * } */ export interface SubscriptionsCreateRequest { @@ -47,6 +47,12 @@ export interface SubscriptionsCreateRequest { doubleOptOverride?: Beehiiv.SubscriptionsCreateRequestDoubleOptOverride; /** The tier for this subscription. */ tier?: Beehiiv.SubscriptionsCreateRequestTier; + /** The names of the premium tiers this subscription is associated with. Ignored if `premium_tier_ids` is given. */ + premiumTiers?: string[]; + /** The ids of the premium tiers this subscription is associated with. */ + premiumTierIds?: string[]; + /** The Stripe customer ID for this subscription. */ + stripeCustomerId?: string; /** Enroll the subscriber into automations after their subscription has been created. Requires the automations to have an active *Add by API* trigger. */ automationIds?: string[]; } diff --git a/src/api/resources/subscriptions/client/requests/SubscriptionsGetRequest.ts b/src/api/resources/subscriptions/client/requests/SubscriptionsGetRequest.ts index a01c1a8..3d1fdec 100644 --- a/src/api/resources/subscriptions/client/requests/SubscriptionsGetRequest.ts +++ b/src/api/resources/subscriptions/client/requests/SubscriptionsGetRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../../.."; +import * as Beehiiv from "../../../../index"; /** * @example @@ -10,7 +10,7 @@ import * as Beehiiv from "../../../.."; */ export interface SubscriptionsGetRequest { /** - * Optional list of expandable objects.
`stats` - Returns statistics about the subscription(s).
`custom_fields` - Returns an array of custom field values that have been set on the subscription.
`referrals` - Returns an array of subscriptions with limited data - `id`, `email`, and `status`. These are the subscriptions that were referred by this subscription. + * Optional list of expandable objects.
`subscription_premium_tiers ` - Returns an array of tiers the subscription is associated with.
`referrals` - Returns an array of subscriptions with limited data - `id`, `email`, and `status`. These are the subscriptions that were referred by this subscription.
`stats` - Returns statistics about the subscription(s).
`custom_fields` - Returns an array of custom field values that have been set on the subscription. */ expand?: Beehiiv.SubscriptionsGetRequestExpandItem | Beehiiv.SubscriptionsGetRequestExpandItem[]; } diff --git a/src/api/resources/subscriptions/client/requests/SubscriptionsListRequest.ts b/src/api/resources/subscriptions/client/requests/SubscriptionsListRequest.ts index f281a6a..fd541f2 100644 --- a/src/api/resources/subscriptions/client/requests/SubscriptionsListRequest.ts +++ b/src/api/resources/subscriptions/client/requests/SubscriptionsListRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../../.."; +import * as Beehiiv from "../../../../index"; /** * @example @@ -12,7 +12,7 @@ import * as Beehiiv from "../../../.."; */ export interface SubscriptionsListRequest { /** - * Optional list of expandable objects.
`stats` - Returns statistics about the subscription(s).
`custom_fields` - Returns an array of custom field values that have been set on the subscription.
`referrals` - Returns an array of subscriptions with limited data - `id`, `email`, and `status`. These are the subscriptions that were referred by this subscription. + * Optional list of expandable objects.
`subscription_premium_tiers ` - Returns an array of tiers the subscription is associated with.
`referrals` - Returns an array of subscriptions with limited data - `id`, `email`, and `status`. These are the subscriptions that were referred by this subscription.
`stats` - Returns statistics about the subscription(s).
`custom_fields` - Returns an array of custom field values that have been set on the subscription. */ expand?: Beehiiv.SubscriptionsListRequestExpandItem | Beehiiv.SubscriptionsListRequestExpandItem[]; /** @@ -23,6 +23,14 @@ export interface SubscriptionsListRequest { * Optionally filter the results by a their tier */ tier?: Beehiiv.SubscriptionsListRequestTier; + /** + * Optionally filter the results by one or multiple premium tiers + */ + premiumTiers?: string | string[]; + /** + * Optionally filter the results by one or multiple premium tier ids + */ + premiumTierIds?: string | string[]; /** * A limit on the number of objects to be returned. The limit can range between 1 and 100, and the default is 10. */ diff --git a/src/api/resources/subscriptions/client/requests/SubscriptionsPatchRequest.ts b/src/api/resources/subscriptions/client/requests/SubscriptionsPatchRequest.ts index 1e4960d..bfc7b12 100644 --- a/src/api/resources/subscriptions/client/requests/SubscriptionsPatchRequest.ts +++ b/src/api/resources/subscriptions/client/requests/SubscriptionsPatchRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../../.."; +import * as Beehiiv from "../../../../index"; /** * @example diff --git a/src/api/resources/subscriptions/client/requests/SubscriptionsPutRequest.ts b/src/api/resources/subscriptions/client/requests/SubscriptionsPutRequest.ts index 57c853c..17af061 100644 --- a/src/api/resources/subscriptions/client/requests/SubscriptionsPutRequest.ts +++ b/src/api/resources/subscriptions/client/requests/SubscriptionsPutRequest.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../../.."; +import * as Beehiiv from "../../../../index"; /** * @example diff --git a/src/api/resources/subscriptions/client/requests/index.ts b/src/api/resources/subscriptions/client/requests/index.ts index 1966cd1..aa52131 100644 --- a/src/api/resources/subscriptions/client/requests/index.ts +++ b/src/api/resources/subscriptions/client/requests/index.ts @@ -1,5 +1,5 @@ -export { SubscriptionsListRequest } from "./SubscriptionsListRequest"; -export { SubscriptionsCreateRequest } from "./SubscriptionsCreateRequest"; -export { SubscriptionsPutRequest } from "./SubscriptionsPutRequest"; -export { SubscriptionsPatchRequest } from "./SubscriptionsPatchRequest"; -export { SubscriptionsGetRequest } from "./SubscriptionsGetRequest"; +export { type SubscriptionsListRequest } from "./SubscriptionsListRequest"; +export { type SubscriptionsCreateRequest } from "./SubscriptionsCreateRequest"; +export { type SubscriptionsPutRequest } from "./SubscriptionsPutRequest"; +export { type SubscriptionsPatchRequest } from "./SubscriptionsPatchRequest"; +export { type SubscriptionsGetRequest } from "./SubscriptionsGetRequest"; diff --git a/src/api/resources/subscriptions/types/SubscriptionsCreateResponse.ts b/src/api/resources/subscriptions/types/SubscriptionsCreateResponse.ts index b4ffa2c..11541c2 100644 --- a/src/api/resources/subscriptions/types/SubscriptionsCreateResponse.ts +++ b/src/api/resources/subscriptions/types/SubscriptionsCreateResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface SubscriptionsCreateResponse { data: Beehiiv.Subscription; diff --git a/src/api/resources/subscriptions/types/SubscriptionsGetRequestExpandItem.ts b/src/api/resources/subscriptions/types/SubscriptionsGetRequestExpandItem.ts index df89d71..6653cdd 100644 --- a/src/api/resources/subscriptions/types/SubscriptionsGetRequestExpandItem.ts +++ b/src/api/resources/subscriptions/types/SubscriptionsGetRequestExpandItem.ts @@ -2,7 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -export type SubscriptionsGetRequestExpandItem = "stats" | "custom_fields" | "referrals"; +export type SubscriptionsGetRequestExpandItem = + /** + * Returns statistics about the subscription(s). */ + | "stats" + /** + * Returns an array of custom field values that have been set on the subscription. */ + | "custom_fields" + /** + * Returns an array of subscriptions with limited data - id, email, and status. These are the subscriptions that were referred by this subscription. */ + | "referrals"; export const SubscriptionsGetRequestExpandItem = { Stats: "stats", diff --git a/src/api/resources/subscriptions/types/SubscriptionsGetResponse.ts b/src/api/resources/subscriptions/types/SubscriptionsGetResponse.ts index 608c1f5..82f4c7b 100644 --- a/src/api/resources/subscriptions/types/SubscriptionsGetResponse.ts +++ b/src/api/resources/subscriptions/types/SubscriptionsGetResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; /** * The requested subscription object diff --git a/src/api/resources/subscriptions/types/SubscriptionsListRequestExpandItem.ts b/src/api/resources/subscriptions/types/SubscriptionsListRequestExpandItem.ts index 2596dcb..a2ce5e7 100644 --- a/src/api/resources/subscriptions/types/SubscriptionsListRequestExpandItem.ts +++ b/src/api/resources/subscriptions/types/SubscriptionsListRequestExpandItem.ts @@ -2,7 +2,16 @@ * This file was auto-generated by Fern from our API Definition. */ -export type SubscriptionsListRequestExpandItem = "stats" | "custom_fields" | "referrals"; +export type SubscriptionsListRequestExpandItem = + /** + * Returns statistics about the subscription(s). */ + | "stats" + /** + * Returns an array of custom field values that have been set on the subscription. */ + | "custom_fields" + /** + * Returns an array of subscriptions with limited data - id, email, and status. These are the subscriptions that were referred by this subscription. */ + | "referrals"; export const SubscriptionsListRequestExpandItem = { Stats: "stats", diff --git a/src/api/resources/subscriptions/types/SubscriptionsListResponse.ts b/src/api/resources/subscriptions/types/SubscriptionsListResponse.ts index 9b77684..ac71046 100644 --- a/src/api/resources/subscriptions/types/SubscriptionsListResponse.ts +++ b/src/api/resources/subscriptions/types/SubscriptionsListResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface SubscriptionsListResponse { data: Beehiiv.Subscription[]; diff --git a/src/api/resources/subscriptions/types/SubscriptionsPatchRequestSubscriptionsItem.ts b/src/api/resources/subscriptions/types/SubscriptionsPatchRequestSubscriptionsItem.ts index 4890bbc..c787f23 100644 --- a/src/api/resources/subscriptions/types/SubscriptionsPatchRequestSubscriptionsItem.ts +++ b/src/api/resources/subscriptions/types/SubscriptionsPatchRequestSubscriptionsItem.ts @@ -2,13 +2,15 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface SubscriptionsPatchRequestSubscriptionsItem { /** The prefixed subscription ID */ subscriptionId: string; /** The Tier of the Subscription (not required) */ tier?: Beehiiv.SubscriptionsPatchRequestSubscriptionsItemTier; + /** The Stripe Customer ID of the subscription (not required) */ + stripeCustomerId?: string; /** A boolean value specifying whether to unsubscribe this subscription from the publication (not required) */ unsubscribe?: boolean; /** An array of custom field objects to update */ diff --git a/src/api/resources/subscriptions/types/SubscriptionsPatchResponse.ts b/src/api/resources/subscriptions/types/SubscriptionsPatchResponse.ts index f3eb408..f0c3103 100644 --- a/src/api/resources/subscriptions/types/SubscriptionsPatchResponse.ts +++ b/src/api/resources/subscriptions/types/SubscriptionsPatchResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface SubscriptionsPatchResponse { data: Beehiiv.SubscriptionsPatchResponseData; diff --git a/src/api/resources/subscriptions/types/SubscriptionsPutRequestSubscriptionsItem.ts b/src/api/resources/subscriptions/types/SubscriptionsPutRequestSubscriptionsItem.ts index b1c2e8c..0a00d82 100644 --- a/src/api/resources/subscriptions/types/SubscriptionsPutRequestSubscriptionsItem.ts +++ b/src/api/resources/subscriptions/types/SubscriptionsPutRequestSubscriptionsItem.ts @@ -2,13 +2,15 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface SubscriptionsPutRequestSubscriptionsItem { /** The prefixed subscription ID */ subscriptionId: string; /** The Tier of the Subscription (not required) */ tier?: Beehiiv.SubscriptionsPutRequestSubscriptionsItemTier; + /** The Stripe Customer ID of the subscription (not required) */ + stripeCustomerId?: string; /** A boolean value specifying whether to unsubscribe this subscription from the publication (not required) */ unsubscribe?: boolean; /** An array of custom field objects to update */ diff --git a/src/api/resources/subscriptions/types/SubscriptionsPutResponse.ts b/src/api/resources/subscriptions/types/SubscriptionsPutResponse.ts index f08361f..241670c 100644 --- a/src/api/resources/subscriptions/types/SubscriptionsPutResponse.ts +++ b/src/api/resources/subscriptions/types/SubscriptionsPutResponse.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from "../../.."; +import * as Beehiiv from "../../../index"; export interface SubscriptionsPutResponse { data: Beehiiv.SubscriptionsPutResponseData; diff --git a/src/api/resources/tiers/client/Client.ts b/src/api/resources/tiers/client/Client.ts new file mode 100644 index 0000000..fcb4624 --- /dev/null +++ b/src/api/resources/tiers/client/Client.ts @@ -0,0 +1,667 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Beehiiv from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; + +export declare namespace Tiers { + interface Options { + environment?: core.Supplier; + token: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + } +} + +export class Tiers { + constructor(protected readonly _options: Tiers.Options) {} + + /** + * Retrieve all tiers belonging to a specific publication + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {Beehiiv.GetPublicationsPublicationIdTiersRequest} request + * @param {Tiers.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Beehiiv.BadRequestError} + * @throws {@link Beehiiv.NotFoundError} + * @throws {@link Beehiiv.TooManyRequestsError} + * @throws {@link Beehiiv.InternalServerError} + * + * @example + * await client.tiers.getPublicationsPublicationIdTiers("pub_00000000-0000-0000-0000-000000000000") + */ + public async getPublicationsPublicationIdTiers( + publicationId: string, + request: Beehiiv.GetPublicationsPublicationIdTiersRequest = {}, + requestOptions?: Tiers.RequestOptions + ): Promise { + const { expand, limit, page, direction } = request; + const _queryParams: Record = {}; + if (expand != null) { + if (Array.isArray(expand)) { + _queryParams["expand[]"] = expand.map((item) => item); + } else { + _queryParams["expand[]"] = expand; + } + } + + if (limit != null) { + _queryParams["limit"] = limit.toString(); + } + + if (page != null) { + _queryParams["page"] = page.toString(); + } + + if (direction != null) { + _queryParams["direction"] = direction; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, + `publications/${encodeURIComponent(publicationId)}/tiers` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetPublicationsPublicationIdTiersResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Beehiiv.BadRequestError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 404: + throw new Beehiiv.NotFoundError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 429: + throw new Beehiiv.TooManyRequestsError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 500: + throw new Beehiiv.InternalServerError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.BeehiivError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.BeehiivError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.BeehiivTimeoutError(); + case "unknown": + throw new errors.BeehiivError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Create a new tier for a publication. + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {Beehiiv.PostPublicationsPublicationIdTiersRequest} request + * @param {Tiers.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Beehiiv.BadRequestError} + * @throws {@link Beehiiv.NotFoundError} + * @throws {@link Beehiiv.TooManyRequestsError} + * @throws {@link Beehiiv.InternalServerError} + * + * @example + * await client.tiers.postPublicationsPublicationIdTiers("pub_00000000-0000-0000-0000-000000000000", { + * name: "name" + * }) + */ + public async postPublicationsPublicationIdTiers( + publicationId: string, + request: Beehiiv.PostPublicationsPublicationIdTiersRequest, + requestOptions?: Tiers.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, + `publications/${encodeURIComponent(publicationId)}/tiers` + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + }, + contentType: "application/json", + requestType: "json", + body: serializers.PostPublicationsPublicationIdTiersRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.PostPublicationsPublicationIdTiersResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Beehiiv.BadRequestError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 404: + throw new Beehiiv.NotFoundError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 429: + throw new Beehiiv.TooManyRequestsError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 500: + throw new Beehiiv.InternalServerError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.BeehiivError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.BeehiivError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.BeehiivTimeoutError(); + case "unknown": + throw new errors.BeehiivError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieve a single tier belonging to a specific publication + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {string} tierId - The prefixed ID of the tier object + * @param {Beehiiv.GetPublicationsPublicationIdTiersTierIdRequest} request + * @param {Tiers.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Beehiiv.BadRequestError} + * @throws {@link Beehiiv.NotFoundError} + * @throws {@link Beehiiv.TooManyRequestsError} + * @throws {@link Beehiiv.InternalServerError} + * + * @example + * await client.tiers.getPublicationsPublicationIdTiersTierId("pub_00000000-0000-0000-0000-000000000000", "tier_00000000-0000-0000-0000-000000000000") + */ + public async getPublicationsPublicationIdTiersTierId( + publicationId: string, + tierId: string, + request: Beehiiv.GetPublicationsPublicationIdTiersTierIdRequest = {}, + requestOptions?: Tiers.RequestOptions + ): Promise { + const { expand } = request; + const _queryParams: Record = {}; + if (expand != null) { + if (Array.isArray(expand)) { + _queryParams["expand[]"] = expand.map((item) => item); + } else { + _queryParams["expand[]"] = expand; + } + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, + `publications/${encodeURIComponent(publicationId)}/tiers/${encodeURIComponent(tierId)}` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetPublicationsPublicationIdTiersTierIdResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Beehiiv.BadRequestError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 404: + throw new Beehiiv.NotFoundError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 429: + throw new Beehiiv.TooManyRequestsError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 500: + throw new Beehiiv.InternalServerError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.BeehiivError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.BeehiivError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.BeehiivTimeoutError(); + case "unknown": + throw new errors.BeehiivError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Update an existing tier belonging to a specific publication + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {string} tierId - The prefixed ID of the tier object + * @param {Beehiiv.PutPublicationsPublicationIdTiersTierIdRequest} request + * @param {Tiers.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Beehiiv.BadRequestError} + * @throws {@link Beehiiv.NotFoundError} + * @throws {@link Beehiiv.TooManyRequestsError} + * @throws {@link Beehiiv.InternalServerError} + * + * @example + * await client.tiers.putPublicationsPublicationIdTiersTierId("pub_00000000-0000-0000-0000-000000000000", "tier_00000000-0000-0000-0000-000000000000") + */ + public async putPublicationsPublicationIdTiersTierId( + publicationId: string, + tierId: string, + request: Beehiiv.PutPublicationsPublicationIdTiersTierIdRequest = {}, + requestOptions?: Tiers.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, + `publications/${encodeURIComponent(publicationId)}/tiers/${encodeURIComponent(tierId)}` + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + }, + contentType: "application/json", + requestType: "json", + body: serializers.PutPublicationsPublicationIdTiersTierIdRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.PutPublicationsPublicationIdTiersTierIdResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Beehiiv.BadRequestError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 404: + throw new Beehiiv.NotFoundError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 429: + throw new Beehiiv.TooManyRequestsError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 500: + throw new Beehiiv.InternalServerError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.BeehiivError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.BeehiivError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.BeehiivTimeoutError(); + case "unknown": + throw new errors.BeehiivError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Update an existing tier belonging to a specific publication + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {string} tierId - The prefixed ID of the tier object + * @param {Beehiiv.PatchPublicationsPublicationIdTiersTierIdRequest} request + * @param {Tiers.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Beehiiv.BadRequestError} + * @throws {@link Beehiiv.NotFoundError} + * @throws {@link Beehiiv.TooManyRequestsError} + * @throws {@link Beehiiv.InternalServerError} + * + * @example + * await client.tiers.patchPublicationsPublicationIdTiersTierId("pub_00000000-0000-0000-0000-000000000000", "tier_00000000-0000-0000-0000-000000000000") + */ + public async patchPublicationsPublicationIdTiersTierId( + publicationId: string, + tierId: string, + request: Beehiiv.PatchPublicationsPublicationIdTiersTierIdRequest = {}, + requestOptions?: Tiers.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, + `publications/${encodeURIComponent(publicationId)}/tiers/${encodeURIComponent(tierId)}` + ), + method: "PATCH", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + }, + contentType: "application/json", + requestType: "json", + body: serializers.PatchPublicationsPublicationIdTiersTierIdRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.PatchPublicationsPublicationIdTiersTierIdResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Beehiiv.BadRequestError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 404: + throw new Beehiiv.NotFoundError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 429: + throw new Beehiiv.TooManyRequestsError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 500: + throw new Beehiiv.InternalServerError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.BeehiivError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.BeehiivError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.BeehiivTimeoutError(); + case "unknown": + throw new errors.BeehiivError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + return `Bearer ${await core.Supplier.get(this._options.token)}`; + } +} diff --git a/src/api/resources/tiers/client/index.ts b/src/api/resources/tiers/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/tiers/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/tiers/client/requests/GetPublicationsPublicationIdTiersRequest.ts b/src/api/resources/tiers/client/requests/GetPublicationsPublicationIdTiersRequest.ts new file mode 100644 index 0000000..3e8f92d --- /dev/null +++ b/src/api/resources/tiers/client/requests/GetPublicationsPublicationIdTiersRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Beehiiv from "../../../../index"; + +/** + * @example + * {} + */ +export interface GetPublicationsPublicationIdTiersRequest { + /** + * Optional list of expandable objects.
`stats` - Returns statistics about the tier(s).
`prices` - Returns prices for the tier(s). + */ + expand?: string | string[]; + /** + * A limit on the number of objects to be returned. The limit can range between 1 and 100, and the default is 10. + */ + limit?: number; + /** + * Pagination returns the results in pages. Each page contains the number of results specified by the `limit` (default: 10).
If not specified, results 1-10 from page 1 will be returned. + */ + page?: number; + /** + * The direction that the results are sorted in. Defaults to asc
`asc` - Ascending, sorts from smallest to largest.
`desc` - Descending, sorts from largest to smallest. + */ + direction?: Beehiiv.GetPublicationsPublicationIdTiersRequestDirection; +} diff --git a/src/api/resources/tiers/client/requests/GetPublicationsPublicationIdTiersTierIdRequest.ts b/src/api/resources/tiers/client/requests/GetPublicationsPublicationIdTiersTierIdRequest.ts new file mode 100644 index 0000000..752e0ef --- /dev/null +++ b/src/api/resources/tiers/client/requests/GetPublicationsPublicationIdTiersTierIdRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface GetPublicationsPublicationIdTiersTierIdRequest { + /** + * Optional list of expandable objects.
`stats` - Returns statistics about the tier(s).
`prices` - Returns prices for the tier(s). + */ + expand?: string | string[]; +} diff --git a/src/api/resources/tiers/client/requests/PatchPublicationsPublicationIdTiersTierIdRequest.ts b/src/api/resources/tiers/client/requests/PatchPublicationsPublicationIdTiersTierIdRequest.ts new file mode 100644 index 0000000..8603581 --- /dev/null +++ b/src/api/resources/tiers/client/requests/PatchPublicationsPublicationIdTiersTierIdRequest.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Beehiiv from "../../../../index"; + +/** + * @example + * {} + */ +export interface PatchPublicationsPublicationIdTiersTierIdRequest { + name?: string; + description?: string; + pricesAttributes?: Beehiiv.PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem[]; +} diff --git a/src/api/resources/tiers/client/requests/PostPublicationsPublicationIdTiersRequest.ts b/src/api/resources/tiers/client/requests/PostPublicationsPublicationIdTiersRequest.ts new file mode 100644 index 0000000..8b43a69 --- /dev/null +++ b/src/api/resources/tiers/client/requests/PostPublicationsPublicationIdTiersRequest.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Beehiiv from "../../../../index"; + +/** + * @example + * { + * name: "name" + * } + */ +export interface PostPublicationsPublicationIdTiersRequest { + name: string; + description?: string; + pricesAttributes?: Beehiiv.PostPublicationsPublicationIdTiersRequestPricesAttributesItem[]; +} diff --git a/src/api/resources/tiers/client/requests/PutPublicationsPublicationIdTiersTierIdRequest.ts b/src/api/resources/tiers/client/requests/PutPublicationsPublicationIdTiersTierIdRequest.ts new file mode 100644 index 0000000..0f10230 --- /dev/null +++ b/src/api/resources/tiers/client/requests/PutPublicationsPublicationIdTiersTierIdRequest.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Beehiiv from "../../../../index"; + +/** + * @example + * {} + */ +export interface PutPublicationsPublicationIdTiersTierIdRequest { + name?: string; + description?: string; + pricesAttributes?: Beehiiv.PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem[]; +} diff --git a/src/api/resources/tiers/client/requests/index.ts b/src/api/resources/tiers/client/requests/index.ts new file mode 100644 index 0000000..f65a33c --- /dev/null +++ b/src/api/resources/tiers/client/requests/index.ts @@ -0,0 +1,5 @@ +export { type GetPublicationsPublicationIdTiersRequest } from "./GetPublicationsPublicationIdTiersRequest"; +export { type PostPublicationsPublicationIdTiersRequest } from "./PostPublicationsPublicationIdTiersRequest"; +export { type GetPublicationsPublicationIdTiersTierIdRequest } from "./GetPublicationsPublicationIdTiersTierIdRequest"; +export { type PutPublicationsPublicationIdTiersTierIdRequest } from "./PutPublicationsPublicationIdTiersTierIdRequest"; +export { type PatchPublicationsPublicationIdTiersTierIdRequest } from "./PatchPublicationsPublicationIdTiersTierIdRequest"; diff --git a/src/api/resources/tiers/index.ts b/src/api/resources/tiers/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/api/resources/tiers/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/tiers/types/GetPublicationsPublicationIdTiersRequestDirection.ts b/src/api/resources/tiers/types/GetPublicationsPublicationIdTiersRequestDirection.ts new file mode 100644 index 0000000..13ded96 --- /dev/null +++ b/src/api/resources/tiers/types/GetPublicationsPublicationIdTiersRequestDirection.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type GetPublicationsPublicationIdTiersRequestDirection = "asc" | "desc"; + +export const GetPublicationsPublicationIdTiersRequestDirection = { + Asc: "asc", + Desc: "desc", +} as const; diff --git a/src/api/resources/tiers/types/GetPublicationsPublicationIdTiersResponse.ts b/src/api/resources/tiers/types/GetPublicationsPublicationIdTiersResponse.ts new file mode 100644 index 0000000..24a7c68 --- /dev/null +++ b/src/api/resources/tiers/types/GetPublicationsPublicationIdTiersResponse.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Beehiiv from "../../../index"; + +export interface GetPublicationsPublicationIdTiersResponse { + data: Beehiiv.Tier[]; + /** The limit placed on the results. If no limit was specified in the request,this defaults to 10. */ + limit: number; + /** The page number the results are from. If no page was specified in the request, this defaults to page 1. */ + page: number; + /** The total number of results from all pages. */ + totalResults: number; + /** The total number of pages. */ + totalPages: number; +} diff --git a/src/api/resources/tiers/types/GetPublicationsPublicationIdTiersTierIdResponse.ts b/src/api/resources/tiers/types/GetPublicationsPublicationIdTiersTierIdResponse.ts new file mode 100644 index 0000000..50705be --- /dev/null +++ b/src/api/resources/tiers/types/GetPublicationsPublicationIdTiersTierIdResponse.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Beehiiv from "../../../index"; + +export interface GetPublicationsPublicationIdTiersTierIdResponse { + data?: Beehiiv.Tier; +} diff --git a/src/api/resources/tiers/types/PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem.ts b/src/api/resources/tiers/types/PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem.ts new file mode 100644 index 0000000..fefffb8 --- /dev/null +++ b/src/api/resources/tiers/types/PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Beehiiv from "../../../index"; + +export interface PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem { + /** ID of the existing price. */ + id: string; + currency: Beehiiv.PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency; + amountCents: number; + interval: Beehiiv.PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval; + intervalDisplay?: string; + cta?: string; + features?: string[]; + /** Optionally delete the price when updating the tier. */ + delete?: boolean; +} diff --git a/src/api/resources/tiers/types/PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency.ts b/src/api/resources/tiers/types/PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency.ts new file mode 100644 index 0000000..d4559ed --- /dev/null +++ b/src/api/resources/tiers/types/PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency = + | "usd" + | "aud" + | "cad" + | "eur" + | "inr" + | "brl"; + +export const PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency = { + Usd: "usd", + Aud: "aud", + Cad: "cad", + Eur: "eur", + Inr: "inr", + Brl: "brl", +} as const; diff --git a/src/api/resources/tiers/types/PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval.ts b/src/api/resources/tiers/types/PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval.ts new file mode 100644 index 0000000..5b49eb1 --- /dev/null +++ b/src/api/resources/tiers/types/PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval = "month" | "year"; + +export const PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval = { + Month: "month", + Year: "year", +} as const; diff --git a/src/api/resources/tiers/types/PatchPublicationsPublicationIdTiersTierIdResponse.ts b/src/api/resources/tiers/types/PatchPublicationsPublicationIdTiersTierIdResponse.ts new file mode 100644 index 0000000..286f8d3 --- /dev/null +++ b/src/api/resources/tiers/types/PatchPublicationsPublicationIdTiersTierIdResponse.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Beehiiv from "../../../index"; + +export interface PatchPublicationsPublicationIdTiersTierIdResponse { + data?: Beehiiv.Tier; +} diff --git a/src/api/resources/tiers/types/PostPublicationsPublicationIdTiersRequestPricesAttributesItem.ts b/src/api/resources/tiers/types/PostPublicationsPublicationIdTiersRequestPricesAttributesItem.ts new file mode 100644 index 0000000..e53445e --- /dev/null +++ b/src/api/resources/tiers/types/PostPublicationsPublicationIdTiersRequestPricesAttributesItem.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Beehiiv from "../../../index"; + +export interface PostPublicationsPublicationIdTiersRequestPricesAttributesItem { + currency: Beehiiv.PostPublicationsPublicationIdTiersRequestPricesAttributesItemCurrency; + amountCents: number; + enabled?: boolean; + interval: Beehiiv.PostPublicationsPublicationIdTiersRequestPricesAttributesItemInterval; + intervalDisplay?: string; + cta?: string; + features?: string[]; +} diff --git a/src/api/resources/tiers/types/PostPublicationsPublicationIdTiersRequestPricesAttributesItemCurrency.ts b/src/api/resources/tiers/types/PostPublicationsPublicationIdTiersRequestPricesAttributesItemCurrency.ts new file mode 100644 index 0000000..37ade26 --- /dev/null +++ b/src/api/resources/tiers/types/PostPublicationsPublicationIdTiersRequestPricesAttributesItemCurrency.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type PostPublicationsPublicationIdTiersRequestPricesAttributesItemCurrency = + | "usd" + | "aud" + | "cad" + | "eur" + | "inr" + | "brl"; + +export const PostPublicationsPublicationIdTiersRequestPricesAttributesItemCurrency = { + Usd: "usd", + Aud: "aud", + Cad: "cad", + Eur: "eur", + Inr: "inr", + Brl: "brl", +} as const; diff --git a/src/api/resources/tiers/types/PostPublicationsPublicationIdTiersRequestPricesAttributesItemInterval.ts b/src/api/resources/tiers/types/PostPublicationsPublicationIdTiersRequestPricesAttributesItemInterval.ts new file mode 100644 index 0000000..ef8b02d --- /dev/null +++ b/src/api/resources/tiers/types/PostPublicationsPublicationIdTiersRequestPricesAttributesItemInterval.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type PostPublicationsPublicationIdTiersRequestPricesAttributesItemInterval = "month" | "year"; + +export const PostPublicationsPublicationIdTiersRequestPricesAttributesItemInterval = { + Month: "month", + Year: "year", +} as const; diff --git a/src/api/resources/tiers/types/PostPublicationsPublicationIdTiersResponse.ts b/src/api/resources/tiers/types/PostPublicationsPublicationIdTiersResponse.ts new file mode 100644 index 0000000..a4daf5b --- /dev/null +++ b/src/api/resources/tiers/types/PostPublicationsPublicationIdTiersResponse.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Beehiiv from "../../../index"; + +export interface PostPublicationsPublicationIdTiersResponse { + data?: Beehiiv.Tier; +} diff --git a/src/api/resources/tiers/types/PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem.ts b/src/api/resources/tiers/types/PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem.ts new file mode 100644 index 0000000..be43fb4 --- /dev/null +++ b/src/api/resources/tiers/types/PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Beehiiv from "../../../index"; + +export interface PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem { + /** ID of the existing price. */ + id: string; + currency: Beehiiv.PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency; + amountCents: number; + interval: Beehiiv.PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval; + intervalDisplay?: string; + cta?: string; + features?: string[]; + /** Optionally delete the price when updating the tier. */ + delete?: boolean; +} diff --git a/src/api/resources/tiers/types/PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency.ts b/src/api/resources/tiers/types/PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency.ts new file mode 100644 index 0000000..e4d74f3 --- /dev/null +++ b/src/api/resources/tiers/types/PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency = + | "usd" + | "aud" + | "cad" + | "eur" + | "inr" + | "brl"; + +export const PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency = { + Usd: "usd", + Aud: "aud", + Cad: "cad", + Eur: "eur", + Inr: "inr", + Brl: "brl", +} as const; diff --git a/src/api/resources/tiers/types/PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval.ts b/src/api/resources/tiers/types/PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval.ts new file mode 100644 index 0000000..c6c83fa --- /dev/null +++ b/src/api/resources/tiers/types/PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval = "month" | "year"; + +export const PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval = { + Month: "month", + Year: "year", +} as const; diff --git a/src/api/resources/tiers/types/PutPublicationsPublicationIdTiersTierIdResponse.ts b/src/api/resources/tiers/types/PutPublicationsPublicationIdTiersTierIdResponse.ts new file mode 100644 index 0000000..b413bca --- /dev/null +++ b/src/api/resources/tiers/types/PutPublicationsPublicationIdTiersTierIdResponse.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Beehiiv from "../../../index"; + +export interface PutPublicationsPublicationIdTiersTierIdResponse { + data?: Beehiiv.Tier; +} diff --git a/src/api/resources/tiers/types/index.ts b/src/api/resources/tiers/types/index.ts new file mode 100644 index 0000000..2414d89 --- /dev/null +++ b/src/api/resources/tiers/types/index.ts @@ -0,0 +1,15 @@ +export * from "./GetPublicationsPublicationIdTiersRequestDirection"; +export * from "./GetPublicationsPublicationIdTiersResponse"; +export * from "./PostPublicationsPublicationIdTiersRequestPricesAttributesItemCurrency"; +export * from "./PostPublicationsPublicationIdTiersRequestPricesAttributesItemInterval"; +export * from "./PostPublicationsPublicationIdTiersRequestPricesAttributesItem"; +export * from "./PostPublicationsPublicationIdTiersResponse"; +export * from "./GetPublicationsPublicationIdTiersTierIdResponse"; +export * from "./PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency"; +export * from "./PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval"; +export * from "./PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem"; +export * from "./PutPublicationsPublicationIdTiersTierIdResponse"; +export * from "./PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency"; +export * from "./PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval"; +export * from "./PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem"; +export * from "./PatchPublicationsPublicationIdTiersTierIdResponse"; diff --git a/src/api/resources/webhooks/client/Client.ts b/src/api/resources/webhooks/client/Client.ts new file mode 100644 index 0000000..c8be13a --- /dev/null +++ b/src/api/resources/webhooks/client/Client.ts @@ -0,0 +1,603 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Beehiiv from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; + +export declare namespace Webhooks { + interface Options { + environment?: core.Supplier; + token: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + } +} + +export class Webhooks { + constructor(protected readonly _options: Webhooks.Options) {} + + /** + * Retrieve all webhooks belonging to a specific publication. + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {Beehiiv.GetWebhooksRequest} request + * @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Beehiiv.BadRequestError} + * @throws {@link Beehiiv.NotFoundError} + * @throws {@link Beehiiv.TooManyRequestsError} + * @throws {@link Beehiiv.InternalServerError} + * + * @example + * await client.webhooks.getWebhooks("pub_00000000-0000-0000-0000-000000000000") + */ + public async getWebhooks( + publicationId: string, + request: Beehiiv.GetWebhooksRequest = {}, + requestOptions?: Webhooks.RequestOptions + ): Promise { + const { limit } = request; + const _queryParams: Record = {}; + if (limit != null) { + _queryParams["limit"] = limit.toString(); + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, + `publications/${encodeURIComponent(publicationId)}/webhooks` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetWebhooksResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Beehiiv.BadRequestError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 404: + throw new Beehiiv.NotFoundError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 429: + throw new Beehiiv.TooManyRequestsError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 500: + throw new Beehiiv.InternalServerError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.BeehiivError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.BeehiivError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.BeehiivTimeoutError(); + case "unknown": + throw new errors.BeehiivError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Create a new webhook for a given publication. + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {Beehiiv.PostWebhooksRequest} request + * @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Beehiiv.BadRequestError} + * @throws {@link Beehiiv.NotFoundError} + * @throws {@link Beehiiv.TooManyRequestsError} + * @throws {@link Beehiiv.InternalServerError} + * + * @example + * await client.webhooks.postWebhooks("pub_00000000-0000-0000-0000-000000000000", { + * url: "https://example.com/webhook", + * eventTypes: [Beehiiv.PostWebhooksRequestEventTypesItem.PostSent] + * }) + */ + public async postWebhooks( + publicationId: string, + request: Beehiiv.PostWebhooksRequest, + requestOptions?: Webhooks.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, + `publications/${encodeURIComponent(publicationId)}/webhooks` + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + }, + contentType: "application/json", + requestType: "json", + body: serializers.PostWebhooksRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.PostWebhooksResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Beehiiv.BadRequestError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 404: + throw new Beehiiv.NotFoundError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 429: + throw new Beehiiv.TooManyRequestsError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 500: + throw new Beehiiv.InternalServerError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.BeehiivError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.BeehiivError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.BeehiivTimeoutError(); + case "unknown": + throw new errors.BeehiivError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieve a specific webhook belonging to a publication. + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {string} webhookId - The prefixed ID of the webhook object + * @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Beehiiv.BadRequestError} + * @throws {@link Beehiiv.NotFoundError} + * @throws {@link Beehiiv.TooManyRequestsError} + * @throws {@link Beehiiv.InternalServerError} + * + * @example + * await client.webhooks.getWebhooksWebhookId("pub_00000000-0000-0000-0000-000000000000", "ep_0000000000000000000000000000") + */ + public async getWebhooksWebhookId( + publicationId: string, + webhookId: string, + requestOptions?: Webhooks.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, + `publications/${encodeURIComponent(publicationId)}/webhooks/${encodeURIComponent(webhookId)}` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetWebhooksWebhookIdResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Beehiiv.BadRequestError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 404: + throw new Beehiiv.NotFoundError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 429: + throw new Beehiiv.TooManyRequestsError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 500: + throw new Beehiiv.InternalServerError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.BeehiivError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.BeehiivError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.BeehiivTimeoutError(); + case "unknown": + throw new errors.BeehiivError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Delete a webhook subscription from a publication. + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {string} webhookId - The prefixed ID of the webhook object + * @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Beehiiv.BadRequestError} + * @throws {@link Beehiiv.NotFoundError} + * @throws {@link Beehiiv.TooManyRequestsError} + * @throws {@link Beehiiv.InternalServerError} + * + * @example + * await client.webhooks.deleteWebhooksWebhookId("pub_00000000-0000-0000-0000-000000000000", "ep_0000000000000000000000000000") + */ + public async deleteWebhooksWebhookId( + publicationId: string, + webhookId: string, + requestOptions?: Webhooks.RequestOptions + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, + `publications/${encodeURIComponent(publicationId)}/webhooks/${encodeURIComponent(webhookId)}` + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.webhooks.deleteWebhooksWebhookId.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Beehiiv.BadRequestError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 404: + throw new Beehiiv.NotFoundError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 429: + throw new Beehiiv.TooManyRequestsError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 500: + throw new Beehiiv.InternalServerError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.BeehiivError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.BeehiivError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.BeehiivTimeoutError(); + case "unknown": + throw new errors.BeehiivError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Send test info to an already set up webhook endpoint. + * + * @param {string} publicationId - The prefixed ID of the publication object + * @param {string} webhookId - The prefixed ID of the webhook object + * @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Beehiiv.BadRequestError} + * @throws {@link Beehiiv.InternalServerError} + * + * @example + * await client.webhooks.test("pub_00000000-0000-0000-0000-000000000000", "ep_0000000000000000000000000000") + */ + public async test( + publicationId: string, + webhookId: string, + requestOptions?: Webhooks.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.BeehiivEnvironment.Default, + `publications/${encodeURIComponent(publicationId)}/webhooks/${encodeURIComponent(webhookId)}/tests` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "beehiiv", + "X-Fern-SDK-Version": "0.1.3", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetPublicationsPublicationIdWebhooksWebhookIdTestsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Beehiiv.BadRequestError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 500: + throw new Beehiiv.InternalServerError( + serializers.Error_.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.BeehiivError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.BeehiivError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.BeehiivTimeoutError(); + case "unknown": + throw new errors.BeehiivError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + return `Bearer ${await core.Supplier.get(this._options.token)}`; + } +} diff --git a/src/api/resources/webhooks/client/index.ts b/src/api/resources/webhooks/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/webhooks/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/webhooks/client/requests/GetWebhooksRequest.ts b/src/api/resources/webhooks/client/requests/GetWebhooksRequest.ts new file mode 100644 index 0000000..28372b6 --- /dev/null +++ b/src/api/resources/webhooks/client/requests/GetWebhooksRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface GetWebhooksRequest { + /** + * A limit on the number of objects to be returned. The limit can range between 1 and 100, and the default is 10. + */ + limit?: number; +} diff --git a/src/api/resources/webhooks/client/requests/PostWebhooksRequest.ts b/src/api/resources/webhooks/client/requests/PostWebhooksRequest.ts new file mode 100644 index 0000000..b12ec14 --- /dev/null +++ b/src/api/resources/webhooks/client/requests/PostWebhooksRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Beehiiv from "../../../../index"; + +/** + * @example + * { + * url: "https://example.com/webhook", + * eventTypes: [Beehiiv.PostWebhooksRequestEventTypesItem.PostSent] + * } + */ +export interface PostWebhooksRequest { + /** The webhook URL to send events to. */ + url: string; + /** The types of events the webhook will receive. */ + eventTypes: Beehiiv.PostWebhooksRequestEventTypesItem[]; + /** A description of the webhook. */ + description?: string; +} diff --git a/src/api/resources/webhooks/client/requests/index.ts b/src/api/resources/webhooks/client/requests/index.ts new file mode 100644 index 0000000..4eb7151 --- /dev/null +++ b/src/api/resources/webhooks/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type GetWebhooksRequest } from "./GetWebhooksRequest"; +export { type PostWebhooksRequest } from "./PostWebhooksRequest"; diff --git a/src/api/resources/webhooks/index.ts b/src/api/resources/webhooks/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/api/resources/webhooks/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/webhooks/types/GetPublicationsPublicationIdWebhooksWebhookIdTestsResponse.ts b/src/api/resources/webhooks/types/GetPublicationsPublicationIdWebhooksWebhookIdTestsResponse.ts new file mode 100644 index 0000000..38df169 --- /dev/null +++ b/src/api/resources/webhooks/types/GetPublicationsPublicationIdWebhooksWebhookIdTestsResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface GetPublicationsPublicationIdWebhooksWebhookIdTestsResponse { + /** The test event. */ + data: Record; + /** The timestamp of the test event. */ + eventTimestamp: number; + /** The type of webhook events that the endpoint is set up to receive. */ + eventType: string; + /** The unique identifier for the test event. */ + uid: string; +} diff --git a/src/api/resources/webhooks/types/GetWebhooksResponse.ts b/src/api/resources/webhooks/types/GetWebhooksResponse.ts new file mode 100644 index 0000000..9b6b80f --- /dev/null +++ b/src/api/resources/webhooks/types/GetWebhooksResponse.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Beehiiv from "../../../index"; + +export interface GetWebhooksResponse { + data: Beehiiv.Webhook[]; +} diff --git a/src/api/resources/webhooks/types/GetWebhooksWebhookIdResponse.ts b/src/api/resources/webhooks/types/GetWebhooksWebhookIdResponse.ts new file mode 100644 index 0000000..a7e21e0 --- /dev/null +++ b/src/api/resources/webhooks/types/GetWebhooksWebhookIdResponse.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Beehiiv from "../../../index"; + +export interface GetWebhooksWebhookIdResponse { + data: Beehiiv.Webhook; +} diff --git a/src/api/resources/webhooks/types/PostWebhooksRequestEventTypesItem.ts b/src/api/resources/webhooks/types/PostWebhooksRequestEventTypesItem.ts new file mode 100644 index 0000000..1e34817 --- /dev/null +++ b/src/api/resources/webhooks/types/PostWebhooksRequestEventTypesItem.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type PostWebhooksRequestEventTypesItem = + | "post.sent" + | "subscription.confirmed" + | "subscription.created" + | "subscription.downgraded" + | "subscription.upgraded" + | "subscription.deleted" + | "survey.response_submitted"; + +export const PostWebhooksRequestEventTypesItem = { + PostSent: "post.sent", + SubscriptionConfirmed: "subscription.confirmed", + SubscriptionCreated: "subscription.created", + SubscriptionDowngraded: "subscription.downgraded", + SubscriptionUpgraded: "subscription.upgraded", + SubscriptionDeleted: "subscription.deleted", + SurveyResponseSubmitted: "survey.response_submitted", +} as const; diff --git a/src/api/resources/webhooks/types/PostWebhooksResponse.ts b/src/api/resources/webhooks/types/PostWebhooksResponse.ts new file mode 100644 index 0000000..f66598e --- /dev/null +++ b/src/api/resources/webhooks/types/PostWebhooksResponse.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Beehiiv from "../../../index"; + +export interface PostWebhooksResponse { + data: Beehiiv.Webhook; +} diff --git a/src/api/resources/webhooks/types/index.ts b/src/api/resources/webhooks/types/index.ts new file mode 100644 index 0000000..412e013 --- /dev/null +++ b/src/api/resources/webhooks/types/index.ts @@ -0,0 +1,5 @@ +export * from "./GetWebhooksResponse"; +export * from "./PostWebhooksRequestEventTypesItem"; +export * from "./PostWebhooksResponse"; +export * from "./GetWebhooksWebhookIdResponse"; +export * from "./GetPublicationsPublicationIdWebhooksWebhookIdTestsResponse"; diff --git a/src/api/types/Automation.ts b/src/api/types/Automation.ts index 0639cb5..fe408c2 100644 --- a/src/api/types/Automation.ts +++ b/src/api/types/Automation.ts @@ -2,12 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from ".."; +import * as Beehiiv from "../index"; export interface Automation { /** A unique prefixed id of the automation */ id: string; status: Beehiiv.AutomationStatus; name: string; + /** The types of events that can trigger the automation. */ + triggerEvents: Beehiiv.AutomationTriggerEventsItem[]; description?: string; } diff --git a/src/api/types/AutomationJourney.ts b/src/api/types/AutomationJourney.ts index 4b6a555..68a1549 100644 --- a/src/api/types/AutomationJourney.ts +++ b/src/api/types/AutomationJourney.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from ".."; +import * as Beehiiv from "../index"; /** * A subscribers' journey through an automation flow. diff --git a/src/api/types/AutomationTriggerEventsItem.ts b/src/api/types/AutomationTriggerEventsItem.ts new file mode 100644 index 0000000..686042e --- /dev/null +++ b/src/api/types/AutomationTriggerEventsItem.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type AutomationTriggerEventsItem = + | "api" + | "downgrade" + | "email_submission" + | "form_submission" + | "manual" + | "poll_submission" + | "referral_action" + | "segment_action" + | "signup" + | "unengaged" + | "upgrade"; + +export const AutomationTriggerEventsItem = { + Api: "api", + Downgrade: "downgrade", + EmailSubmission: "email_submission", + FormSubmission: "form_submission", + Manual: "manual", + PollSubmission: "poll_submission", + ReferralAction: "referral_action", + SegmentAction: "segment_action", + Signup: "signup", + Unengaged: "unengaged", + Upgrade: "upgrade", +} as const; diff --git a/src/api/types/ClickStats.ts b/src/api/types/ClickStats.ts index 7c7a296..ba7b985 100644 --- a/src/api/types/ClickStats.ts +++ b/src/api/types/ClickStats.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from ".."; +import * as Beehiiv from "../index"; /** * Details about specific URL's click stats from a post. diff --git a/src/api/types/CustomField.ts b/src/api/types/CustomField.ts index 4af83ae..e7fc2c7 100644 --- a/src/api/types/CustomField.ts +++ b/src/api/types/CustomField.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from ".."; +import * as Beehiiv from "../index"; export interface CustomField { /** The name of the existing custom field */ diff --git a/src/api/types/CustomFieldKind.ts b/src/api/types/CustomFieldKind.ts index 540f85c..b469596 100644 --- a/src/api/types/CustomFieldKind.ts +++ b/src/api/types/CustomFieldKind.ts @@ -5,7 +5,7 @@ /** * The type of value being stored in the custom field. */ -export type CustomFieldKind = "string" | "integer" | "boolean" | "date" | "datetime"; +export type CustomFieldKind = "string" | "integer" | "boolean" | "date" | "datetime" | "list"; export const CustomFieldKind = { String: "string", @@ -13,4 +13,5 @@ export const CustomFieldKind = { Boolean: "boolean", Date: "date", Datetime: "datetime", + List: "list", } as const; diff --git a/src/api/types/EmailBlast.ts b/src/api/types/EmailBlast.ts index 40ff254..9b616f9 100644 --- a/src/api/types/EmailBlast.ts +++ b/src/api/types/EmailBlast.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from ".."; +import * as Beehiiv from "../index"; export interface EmailBlast { /** The prefixed email blast id */ diff --git a/src/api/types/EmailBlastContent.ts b/src/api/types/EmailBlastContent.ts index 767cc3b..c0e20e9 100644 --- a/src/api/types/EmailBlastContent.ts +++ b/src/api/types/EmailBlastContent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from ".."; +import * as Beehiiv from "../index"; /** * Optional html content for an email blast. Retrievable by including any of `expand: [free_email_content, premium_email_content]` in the post request body. diff --git a/src/api/types/EmailBlastStats.ts b/src/api/types/EmailBlastStats.ts index 2be24bf..21b9e72 100644 --- a/src/api/types/EmailBlastStats.ts +++ b/src/api/types/EmailBlastStats.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from ".."; +import * as Beehiiv from "../index"; /** * Optional list of stats for an email blast. Retrievable by including `expand: [stats]` in the email blast request body. diff --git a/src/api/types/Error_.ts b/src/api/types/Error_.ts index 5943e5f..067940c 100644 --- a/src/api/types/Error_.ts +++ b/src/api/types/Error_.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from ".."; +import * as Beehiiv from "../index"; /** * The top level error response. diff --git a/src/api/types/Milestone.ts b/src/api/types/Milestone.ts index 2ae426d..768b32e 100644 --- a/src/api/types/Milestone.ts +++ b/src/api/types/Milestone.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from ".."; +import * as Beehiiv from "../index"; /** * The milestone object. diff --git a/src/api/types/MilestoneReward.ts b/src/api/types/MilestoneReward.ts index 7294a52..506f13f 100644 --- a/src/api/types/MilestoneReward.ts +++ b/src/api/types/MilestoneReward.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from ".."; +import * as Beehiiv from "../index"; /** * The reward object. diff --git a/src/api/types/Post.ts b/src/api/types/Post.ts index bc93585..ccb85a2 100644 --- a/src/api/types/Post.ts +++ b/src/api/types/Post.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from ".."; +import * as Beehiiv from "../index"; export interface Post { /** The prefixed post id */ diff --git a/src/api/types/PostContent.ts b/src/api/types/PostContent.ts index d5133c5..0cd6919 100644 --- a/src/api/types/PostContent.ts +++ b/src/api/types/PostContent.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from ".."; +import * as Beehiiv from "../index"; /** * Optional html content for a post. Retrievable by including any of `expand: [free_web_content, free_email_content, free_rss_content, premium_web_content, premium_email_content]` in the post request body. diff --git a/src/api/types/PostStats.ts b/src/api/types/PostStats.ts index 4fb0a4e..68729c4 100644 --- a/src/api/types/PostStats.ts +++ b/src/api/types/PostStats.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from ".."; +import * as Beehiiv from "../index"; /** * Optional list of stats for a post. Retrievable by including `expand: [stats]` in the post request body. diff --git a/src/api/types/Publication.ts b/src/api/types/Publication.ts index 5fb5001..b27698c 100644 --- a/src/api/types/Publication.ts +++ b/src/api/types/Publication.ts @@ -2,13 +2,15 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from ".."; +import * as Beehiiv from "../index"; export interface Publication { /** A unique prefixed id of the publication */ id: string; /** The name of the publication */ name: string; + /** The name of the organization */ + organizationName: string; /** A boolean field indicating whether the referral program is active for this publication. */ referralProgramEnabled: boolean; /** The time that the publication was created. Measured in seconds since the Unix epoch */ diff --git a/src/api/types/PublicationStats.ts b/src/api/types/PublicationStats.ts index 207a225..6bfc4b8 100644 --- a/src/api/types/PublicationStats.ts +++ b/src/api/types/PublicationStats.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from ".."; +import * as Beehiiv from "../index"; /** * Optional list of stats for a publication. Retrievable by including an `expand` array in the publication request body. Add `"stats"` to the array to retrieve all, or add individual stats (prefaced with `stat_`) to only retrieve specific ones. diff --git a/src/api/types/Segment.ts b/src/api/types/Segment.ts index ec32d5d..b46da0c 100644 --- a/src/api/types/Segment.ts +++ b/src/api/types/Segment.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from ".."; +import * as Beehiiv from "../index"; /** * The segment object. To expand results, see the results endpoint. diff --git a/src/api/types/Subscription.ts b/src/api/types/Subscription.ts index eb456ef..94d26a3 100644 --- a/src/api/types/Subscription.ts +++ b/src/api/types/Subscription.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from ".."; +import * as Beehiiv from "../index"; /** * The subscription object @@ -17,6 +17,8 @@ export interface Subscription { created: number; /** The current tier of the subscription. */ subscriptionTier: Beehiiv.SubscriptionExpandedSubscriptionTier; + /** The current premium tiers of the subscription. Empty if the subscriber is not associated with any premium tiers. */ + subscriptionPremiumTierNames: string[]; /** The acquisition source; where the subscriber came from */ utmSource: string; /** The acquisition medium; how the subscriber got to your publication */ @@ -29,7 +31,8 @@ export interface Subscription { referringSite: string; /** The code associated to this subscriber to refer others. When a new subscription is created with this referral code, credit for the referral goes to this subscription. */ referralCode: string; + subscriptionPremiumTiers?: Beehiiv.SubscriptionTiers; customFields?: Beehiiv.SubscriptionCustomFields; - stats?: Beehiiv.SubscriptionStats; tags?: Beehiiv.SubscriptionTags; + stats?: Beehiiv.SubscriptionStats; } diff --git a/src/api/types/SubscriptionCustomFields.ts b/src/api/types/SubscriptionCustomFields.ts index 354608e..c97781b 100644 --- a/src/api/types/SubscriptionCustomFields.ts +++ b/src/api/types/SubscriptionCustomFields.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Beehiiv from ".."; +import * as Beehiiv from "../index"; /** * Optional list of custom fields for a subscription. Retrievable by including `expand: [custom_field]` in the request body. diff --git a/src/api/types/SubscriptionTags.ts b/src/api/types/SubscriptionTags.ts index f93fd62..e4ead15 100644 --- a/src/api/types/SubscriptionTags.ts +++ b/src/api/types/SubscriptionTags.ts @@ -3,7 +3,7 @@ */ /** - * Optional list of tags form a subscription. Retrievable by including `expand: [tags]` in the request body. + * Optional list of tags for a subscription. Retrievable by including `expand: [tags]` in the request body. * Max limit of 100 unique tags per publication. */ export type SubscriptionTags = string[]; diff --git a/src/api/types/SubscriptionTiers.ts b/src/api/types/SubscriptionTiers.ts new file mode 100644 index 0000000..0a9e567 --- /dev/null +++ b/src/api/types/SubscriptionTiers.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Beehiiv from "../index"; + +/** + * Optional list of tiers for a subscription. Retrievable by including `expand: [subscription_premium_tiers]` in the request body. + */ +export type SubscriptionTiers = Beehiiv.SubscriptionTiersItem[]; diff --git a/src/api/types/SubscriptionTiersItem.ts b/src/api/types/SubscriptionTiersItem.ts new file mode 100644 index 0000000..9ce9fb3 --- /dev/null +++ b/src/api/types/SubscriptionTiersItem.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Beehiiv from "../index"; + +export interface SubscriptionTiersItem { + id: string; + name: string; + /** Returns whether or not the tier has any active prices. */ + status: Beehiiv.SubscriptionTiersItemStatus; +} diff --git a/src/api/types/SubscriptionTiersItemStatus.ts b/src/api/types/SubscriptionTiersItemStatus.ts new file mode 100644 index 0000000..8e3ffdd --- /dev/null +++ b/src/api/types/SubscriptionTiersItemStatus.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Returns whether or not the tier has any active prices. + */ +export type SubscriptionTiersItemStatus = "active" | "archived"; + +export const SubscriptionTiersItemStatus = { + Active: "active", + Archived: "archived", +} as const; diff --git a/src/api/types/Tier.ts b/src/api/types/Tier.ts new file mode 100644 index 0000000..8cbe35b --- /dev/null +++ b/src/api/types/Tier.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Beehiiv from "../index"; + +/** + * The subscription tier object. + */ +export interface Tier { + id: string; + name: string; + /** Returns whether or not the tier has any active prices. */ + status: Beehiiv.TierStatus; + description?: string; + stats?: Beehiiv.TierStats; + /** Optional list of prices for a tier. Retrievable by including `expand: [prices]` in the tier request body. */ + prices?: Beehiiv.TierPrice[]; +} diff --git a/src/api/types/TierPrice.ts b/src/api/types/TierPrice.ts new file mode 100644 index 0000000..d5cfc8a --- /dev/null +++ b/src/api/types/TierPrice.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Beehiiv from "../index"; + +/** + * Price belonging to a Tier + */ +export interface TierPrice { + id?: string; + currency?: Beehiiv.TierPriceCurrency; + amountCents?: number; + enabled?: boolean; + interval?: Beehiiv.TierPriceInterval; + denominator?: string; + /** When using the external Stripe checkout, this text will be displayed on the button */ + cta?: string; + features?: string[]; +} diff --git a/src/api/types/TierPriceCurrency.ts b/src/api/types/TierPriceCurrency.ts new file mode 100644 index 0000000..69cd2c5 --- /dev/null +++ b/src/api/types/TierPriceCurrency.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type TierPriceCurrency = "usd" | "aud" | "cad" | "eur" | "inr" | "brl"; + +export const TierPriceCurrency = { + Usd: "usd", + Aud: "aud", + Cad: "cad", + Eur: "eur", + Inr: "inr", + Brl: "brl", +} as const; diff --git a/src/api/types/TierPriceInterval.ts b/src/api/types/TierPriceInterval.ts new file mode 100644 index 0000000..89a71b3 --- /dev/null +++ b/src/api/types/TierPriceInterval.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type TierPriceInterval = "month" | "year"; + +export const TierPriceInterval = { + Month: "month", + Year: "year", +} as const; diff --git a/src/api/types/TierStats.ts b/src/api/types/TierStats.ts new file mode 100644 index 0000000..93ae44d --- /dev/null +++ b/src/api/types/TierStats.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Optional list of stats for a tier. Retrievable by including `expand: [stats]` in the tier request body. + */ +export interface TierStats { + /** Total number of active subscriptions belonging to this tier. */ + activeSubscriptions: number; +} diff --git a/src/api/types/TierStatus.ts b/src/api/types/TierStatus.ts new file mode 100644 index 0000000..0e4e8c6 --- /dev/null +++ b/src/api/types/TierStatus.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Returns whether or not the tier has any active prices. + */ +export type TierStatus = "active" | "archived"; + +export const TierStatus = { + Active: "active", + Archived: "archived", +} as const; diff --git a/src/api/types/Webhook.ts b/src/api/types/Webhook.ts new file mode 100644 index 0000000..6eb0845 --- /dev/null +++ b/src/api/types/Webhook.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Beehiiv from "../index"; + +export interface Webhook { + /** The prefixed ID for the webhook. */ + id?: string; + /** The webhook URL to send events to. */ + url: string; + /** The date the webhook was created. Measured in seconds since the Unix epoch. */ + created: number; + /** The date the webhook was last updated. Measured in seconds since the Unix epoch. */ + updated: number; + /** The types of events the webhook will receive. */ + eventTypes: Beehiiv.WebhookEventTypesItem[]; + /** The user-defined description for the webhook. */ + description: string; +} diff --git a/src/api/types/WebhookEventTypesItem.ts b/src/api/types/WebhookEventTypesItem.ts new file mode 100644 index 0000000..9ec6476 --- /dev/null +++ b/src/api/types/WebhookEventTypesItem.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type WebhookEventTypesItem = + | "post.sent" + | "subscription.confirmed" + | "subscription.created" + | "subscription.deleted" + | "subscription.downgraded" + | "subscription.upgraded" + | "survey.response_submitted"; + +export const WebhookEventTypesItem = { + PostSent: "post.sent", + SubscriptionConfirmed: "subscription.confirmed", + SubscriptionCreated: "subscription.created", + SubscriptionDeleted: "subscription.deleted", + SubscriptionDowngraded: "subscription.downgraded", + SubscriptionUpgraded: "subscription.upgraded", + SurveyResponseSubmitted: "survey.response_submitted", +} as const; diff --git a/src/api/types/index.ts b/src/api/types/index.ts index 7c45cac..a1ee19f 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -26,6 +26,9 @@ export * from "./SubscriptionExpandedUtmChannel"; export * from "./SubscriptionCustomFields"; export * from "./SubscriptionStats"; export * from "./SubscriptionTags"; +export * from "./SubscriptionTiersItemStatus"; +export * from "./SubscriptionTiersItem"; +export * from "./SubscriptionTiers"; export * from "./PostStatus"; export * from "./PostAudience"; export * from "./PostPlatform"; @@ -53,6 +56,15 @@ export * from "./SegmentType"; export * from "./SegmentStatus"; export * from "./Segment"; export * from "./AutomationStatus"; +export * from "./AutomationTriggerEventsItem"; export * from "./Automation"; export * from "./AutomationJourneyStatus"; export * from "./AutomationJourney"; +export * from "./TierStatus"; +export * from "./Tier"; +export * from "./TierStats"; +export * from "./TierPriceCurrency"; +export * from "./TierPriceInterval"; +export * from "./TierPrice"; +export * from "./WebhookEventTypesItem"; +export * from "./Webhook"; diff --git a/src/core/fetcher/Fetcher.ts b/src/core/fetcher/Fetcher.ts index c08e0fd..02af7dc 100644 --- a/src/core/fetcher/Fetcher.ts +++ b/src/core/fetcher/Fetcher.ts @@ -1,7 +1,10 @@ -import { default as FormData } from "form-data"; -import qs from "qs"; -import { RUNTIME } from "../runtime"; import { APIResponse } from "./APIResponse"; +import { createRequestUrl } from "./createRequestUrl"; +import { getFetchFn } from "./getFetchFn"; +import { getRequestBody } from "./getRequestBody"; +import { getResponseBody } from "./getResponseBody"; +import { makeRequest } from "./makeRequest"; +import { requestWithRetries } from "./requestWithRetries"; export type FetchFunction = (args: Fetcher.Args) => Promise>; @@ -16,7 +19,10 @@ export declare namespace Fetcher { timeoutMs?: number; maxRetries?: number; withCredentials?: boolean; - responseType?: "json" | "blob" | "streaming"; + abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; + responseType?: "json" | "blob" | "streaming" | "text"; + duplex?: "half"; } export type Error = FailedStatusCodeError | NonJsonError | TimeoutError | UnknownError; @@ -43,11 +49,7 @@ export declare namespace Fetcher { } } -const INITIAL_RETRY_DELAY = 1; -const MAX_RETRY_DELAY = 60; -const DEFAULT_MAX_RETRIES = 2; - -async function fetcherImpl(args: Fetcher.Args): Promise> { +export async function fetcherImpl(args: Fetcher.Args): Promise> { const headers: Record = {}; if (args.body !== undefined && args.contentType != null) { headers["Content-Type"] = args.contentType; @@ -61,97 +63,39 @@ async function fetcherImpl(args: Fetcher.Args): Promise 0 - ? `${args.url}?${qs.stringify(args.queryParameters, { arrayFormat: "repeat" })}` - : args.url; - - let body: BodyInit | undefined = undefined; - if (args.body instanceof FormData) { - // @ts-expect-error - body = args.body; - } else if (args.body instanceof Uint8Array) { - body = args.body; - } else { - body = JSON.stringify(args.body); - } - - // In Node.js environments, the SDK always uses`node-fetch`. - // If not in Node.js the SDK uses global fetch if available, - // and falls back to node-fetch. - const fetchFn = - RUNTIME.type === "node" - ? // `.default` is required due to this issue: - // https://github.com/node-fetch/node-fetch/issues/450#issuecomment-387045223 - require("node-fetch").default - : typeof fetch == "function" - ? fetch - : require("node-fetch").default; - - const makeRequest = async (): Promise => { - const controller = new AbortController(); - let abortId = undefined; - if (args.timeoutMs != null) { - abortId = setTimeout(() => controller.abort(), args.timeoutMs); - } - const response = await fetchFn(url, { - method: args.method, - headers, - body, - signal: controller.signal, - credentials: args.withCredentials ? "include" : undefined, - }); - if (abortId != null) { - clearTimeout(abortId); - } - return response; - }; + const url = createRequestUrl(args.url, args.queryParameters); + let requestBody: BodyInit | undefined = await getRequestBody({ + body: args.body, + type: args.requestType === "json" ? "json" : "other", + }); + const fetchFn = await getFetchFn(); try { - let response = await makeRequest(); - - for (let i = 0; i < (args.maxRetries ?? DEFAULT_MAX_RETRIES); ++i) { - if ( - response.status === 408 || - response.status === 409 || - response.status === 429 || - response.status >= 500 - ) { - const delay = Math.min(INITIAL_RETRY_DELAY * Math.pow(i, 2), MAX_RETRY_DELAY); - await new Promise((resolve) => setTimeout(resolve, delay)); - response = await makeRequest(); - } else { - break; - } - } + const response = await requestWithRetries( + async () => + makeRequest( + fetchFn, + url, + args.method, + headers, + requestBody, + args.timeoutMs, + args.abortSignal, + args.withCredentials, + args.duplex + ), + args.maxRetries + ); + let responseBody = await getResponseBody(response, args.responseType); - let body: unknown; - if (response.body != null && args.responseType === "blob") { - body = await response.blob(); - } else if (response.body != null && args.responseType === "streaming") { - body = response.body; - } else { - const text = await response.text(); - if (text.length > 0) { - try { - body = JSON.parse(text); - } catch (err) { - return { - ok: false, - error: { - reason: "non-json", - statusCode: response.status, - rawBody: text, - }, - }; - } + if (response.status >= 200 && response.status < 400) { + if (args.duplex && args.responseType === "streaming") { + responseBody = (await import("stream")).Readable.from(responseBody as any); } - } - if (response.status >= 200 && response.status < 400) { return { ok: true, - body: body as R, + body: responseBody as R, headers: response.headers, }; } else { @@ -160,12 +104,20 @@ async function fetcherImpl(args: Fetcher.Args): Promise +): string { + return Object.keys(queryParameters ?? {}).length > 0 + ? `${baseUrl}?${qs.stringify(queryParameters, { arrayFormat: "repeat" })}` + : baseUrl; +} diff --git a/src/core/fetcher/getFetchFn.ts b/src/core/fetcher/getFetchFn.ts new file mode 100644 index 0000000..9fd9bfc --- /dev/null +++ b/src/core/fetcher/getFetchFn.ts @@ -0,0 +1,25 @@ +import { RUNTIME } from "../runtime"; + +/** + * Returns a fetch function based on the runtime + */ +export async function getFetchFn(): Promise { + // In Node.js 18+ environments, use native fetch + if (RUNTIME.type === "node" && RUNTIME.parsedVersion != null && RUNTIME.parsedVersion >= 18) { + return fetch; + } + + // In Node.js 18 or lower environments, the SDK always uses`node-fetch`. + if (RUNTIME.type === "node") { + return (await import("node-fetch")).default as any; + } + + // Otherwise the SDK uses global fetch if available, + // and falls back to node-fetch. + if (typeof fetch == "function") { + return fetch; + } + + // Defaults to node `node-fetch` if global fetch isn't available + return (await import("node-fetch")).default as any; +} diff --git a/src/core/fetcher/getRequestBody.ts b/src/core/fetcher/getRequestBody.ts new file mode 100644 index 0000000..1138414 --- /dev/null +++ b/src/core/fetcher/getRequestBody.ts @@ -0,0 +1,14 @@ +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; + } +} + +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); + } else { + return body as BodyInit; + } +} diff --git a/src/core/fetcher/getResponseBody.ts b/src/core/fetcher/getResponseBody.ts new file mode 100644 index 0000000..2015356 --- /dev/null +++ b/src/core/fetcher/getResponseBody.ts @@ -0,0 +1,28 @@ +export async function getResponseBody(response: Response, responseType?: string): Promise { + if (response.body != null && responseType === "blob") { + return await response.blob(); + } else if (response.body != null && responseType === "streaming") { + return response.body; + } else if (response.body != null && responseType === "text") { + return await response.text(); + } else { + const text = await response.text(); + if (text.length > 0) { + try { + let responseBody = JSON.parse(text); + return responseBody; + } catch (err) { + return { + ok: false, + error: { + reason: "non-json", + statusCode: response.status, + rawBody: text, + }, + }; + } + } else { + return undefined; + } + } +} diff --git a/src/core/fetcher/makeRequest.ts b/src/core/fetcher/makeRequest.ts new file mode 100644 index 0000000..8fb4bac --- /dev/null +++ b/src/core/fetcher/makeRequest.ts @@ -0,0 +1,44 @@ +import { anySignal, getTimeoutSignal } from "./signals"; + +export const makeRequest = async ( + fetchFn: (url: string, init: RequestInit) => Promise, + url: string, + method: string, + headers: Record, + requestBody: BodyInit | undefined, + timeoutMs?: number, + abortSignal?: AbortSignal, + withCredentials?: boolean, + duplex?: "half" +): Promise => { + const signals: AbortSignal[] = []; + + // Add timeout signal + let timeoutAbortId: NodeJS.Timeout | undefined = undefined; + if (timeoutMs != null) { + const { signal, abortId } = getTimeoutSignal(timeoutMs); + timeoutAbortId = abortId; + signals.push(signal); + } + + // Add arbitrary signal + if (abortSignal != null) { + signals.push(abortSignal); + } + let newSignals = anySignal(signals); + const response = await fetchFn(url, { + method: method, + headers, + body: requestBody, + signal: newSignals, + credentials: withCredentials ? "include" : undefined, + // @ts-ignore + duplex, + }); + + if (timeoutAbortId != null) { + clearTimeout(timeoutAbortId); + } + + return response; +}; diff --git a/src/core/fetcher/requestWithRetries.ts b/src/core/fetcher/requestWithRetries.ts new file mode 100644 index 0000000..ff5dc3b --- /dev/null +++ b/src/core/fetcher/requestWithRetries.ts @@ -0,0 +1,21 @@ +const INITIAL_RETRY_DELAY = 1; +const MAX_RETRY_DELAY = 60; +const DEFAULT_MAX_RETRIES = 2; + +export async function requestWithRetries( + requestFn: () => Promise, + maxRetries: number = DEFAULT_MAX_RETRIES +): Promise { + let response: Response = await requestFn(); + + for (let i = 0; i < maxRetries; ++i) { + if ([408, 409, 429].includes(response.status) || response.status >= 500) { + const delay = Math.min(INITIAL_RETRY_DELAY * Math.pow(2, i), MAX_RETRY_DELAY); + await new Promise((resolve) => setTimeout(resolve, delay)); + response = await requestFn(); + } else { + break; + } + } + return response!; +} diff --git a/src/core/fetcher/signals.ts b/src/core/fetcher/signals.ts new file mode 100644 index 0000000..6c124ff --- /dev/null +++ b/src/core/fetcher/signals.ts @@ -0,0 +1,38 @@ +const TIMEOUT = "timeout"; + +export function getTimeoutSignal(timeoutMs: number): { signal: AbortSignal; abortId: NodeJS.Timeout } { + const controller = new AbortController(); + const abortId = setTimeout(() => controller.abort(TIMEOUT), timeoutMs); + return { signal: controller.signal, abortId }; +} + +/** + * Returns an abort signal that is getting aborted when + * at least one of the specified abort signals is aborted. + * + * Requires at least node.js 18. + */ +export function anySignal(...args: AbortSignal[] | [AbortSignal[]]): AbortSignal { + // Allowing signals to be passed either as array + // of signals or as multiple arguments. + const signals = (args.length === 1 && Array.isArray(args[0]) ? args[0] : args); + + const controller = new AbortController(); + + for (const signal of signals) { + if (signal.aborted) { + // Exiting early if one of the signals + // is already aborted. + controller.abort((signal as any)?.reason); + break; + } + + // Listening for signals and removing the listeners + // when at least one symbol is aborted. + signal.addEventListener("abort", () => controller.abort((signal as any)?.reason), { + signal: controller.signal, + }); + } + + return controller.signal; +} diff --git a/src/core/runtime/runtime.ts b/src/core/runtime/runtime.ts index f0692ab..4d0687e 100644 --- a/src/core/runtime/runtime.ts +++ b/src/core/runtime/runtime.ts @@ -55,14 +55,21 @@ const isNode = */ const isReactNative = typeof navigator !== "undefined" && navigator?.product === "ReactNative"; +/** + * A constant that indicates whether the environment the code is running is Cloudflare. + * https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent + */ +const isCloudflare = typeof globalThis !== "undefined" && globalThis?.navigator?.userAgent === "Cloudflare-Workers"; + /** * A constant that indicates which environment and version the SDK is running in. */ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { - type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown"; + type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -73,6 +80,12 @@ function evaluateRuntime(): Runtime { }; } + if (isCloudflare) { + return { + type: "workerd", + }; + } + if (isWebWorker) { return { type: "web-worker", @@ -97,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/src/core/schemas/Schema.ts b/src/core/schemas/Schema.ts index 870f373..19acc5d 100644 --- a/src/core/schemas/Schema.ts +++ b/src/core/schemas/Schema.ts @@ -1,5 +1,4 @@ import { SchemaUtils } from "./builders"; -import { MaybePromise } from "./utils/MaybePromise"; export type Schema = BaseSchema & SchemaUtils; @@ -7,9 +6,9 @@ export type inferRaw = S extends Schema ? Raw export type inferParsed = S extends Schema ? Parsed : never; export interface BaseSchema { - parse: (raw: unknown, opts?: SchemaOptions) => MaybePromise>; - json: (parsed: unknown, opts?: SchemaOptions) => MaybePromise>; - getType: () => SchemaType | Promise; + parse: (raw: unknown, opts?: SchemaOptions) => MaybeValid; + json: (parsed: unknown, opts?: SchemaOptions) => MaybeValid; + getType: () => SchemaType | SchemaType; } export const SchemaType = { @@ -91,4 +90,9 @@ export interface SchemaOptions { * helpful for zurg's internal debug logging. */ breadcrumbsPrefix?: string[]; + + /** + * whether to send 'null' for optional properties explicitly set to 'undefined'. + */ + omitUndefined?: boolean; } diff --git a/src/core/schemas/builders/lazy/lazy.ts b/src/core/schemas/builders/lazy/lazy.ts index a665472..835c61f 100644 --- a/src/core/schemas/builders/lazy/lazy.ts +++ b/src/core/schemas/builders/lazy/lazy.ts @@ -1,7 +1,7 @@ import { BaseSchema, Schema } from "../../Schema"; import { getSchemaUtils } from "../schema-utils"; -export type SchemaGetter> = () => SchemaType | Promise; +export type SchemaGetter> = () => SchemaType; export function lazy(getter: SchemaGetter>): Schema { const baseSchema = constructLazyBaseSchema(getter); @@ -15,20 +15,18 @@ export function constructLazyBaseSchema( getter: SchemaGetter> ): BaseSchema { return { - parse: async (raw, opts) => (await getMemoizedSchema(getter)).parse(raw, opts), - json: async (parsed, opts) => (await getMemoizedSchema(getter)).json(parsed, opts), - getType: async () => (await getMemoizedSchema(getter)).getType(), + parse: (raw, opts) => getMemoizedSchema(getter).parse(raw, opts), + json: (parsed, opts) => getMemoizedSchema(getter).json(parsed, opts), + getType: () => getMemoizedSchema(getter).getType(), }; } type MemoizedGetter> = SchemaGetter & { __zurg_memoized?: SchemaType }; -export async function getMemoizedSchema>( - getter: SchemaGetter -): Promise { +export function getMemoizedSchema>(getter: SchemaGetter): SchemaType { const castedGetter = getter as MemoizedGetter; if (castedGetter.__zurg_memoized == null) { - castedGetter.__zurg_memoized = await getter(); + castedGetter.__zurg_memoized = getter(); } return castedGetter.__zurg_memoized; } diff --git a/src/core/schemas/builders/lazy/lazyObject.ts b/src/core/schemas/builders/lazy/lazyObject.ts index e48c016..38c9e28 100644 --- a/src/core/schemas/builders/lazy/lazyObject.ts +++ b/src/core/schemas/builders/lazy/lazyObject.ts @@ -7,8 +7,8 @@ import { constructLazyBaseSchema, getMemoizedSchema, SchemaGetter } from "./lazy export function lazyObject(getter: SchemaGetter>): ObjectSchema { const baseSchema: BaseObjectSchema = { ...constructLazyBaseSchema(getter), - _getRawProperties: async () => (await getMemoizedSchema(getter))._getRawProperties(), - _getParsedProperties: async () => (await getMemoizedSchema(getter))._getParsedProperties(), + _getRawProperties: () => getMemoizedSchema(getter)._getRawProperties(), + _getParsedProperties: () => getMemoizedSchema(getter)._getParsedProperties(), }; return { diff --git a/src/core/schemas/builders/list/list.ts b/src/core/schemas/builders/list/list.ts index b333321..e4c5c4a 100644 --- a/src/core/schemas/builders/list/list.ts +++ b/src/core/schemas/builders/list/list.ts @@ -1,12 +1,11 @@ import { BaseSchema, MaybeValid, Schema, SchemaType, ValidationError } from "../../Schema"; import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; -import { MaybePromise } from "../../utils/MaybePromise"; import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; import { getSchemaUtils } from "../schema-utils"; export function list(schema: Schema): Schema { const baseSchema: BaseSchema = { - parse: async (raw, opts) => + parse: (raw, opts) => validateAndTransformArray(raw, (item, index) => schema.parse(item, { ...opts, @@ -29,10 +28,10 @@ export function list(schema: Schema): Schema( +function validateAndTransformArray( value: unknown, - transformItem: (item: Raw, index: number) => MaybePromise> -): Promise> { + transformItem: (item: Raw, index: number) => MaybeValid +): MaybeValid { if (!Array.isArray(value)) { return { ok: false, @@ -45,7 +44,7 @@ async function validateAndTransformArray( }; } - const maybeValidItems = await Promise.all(value.map((item, index) => transformItem(item, index))); + const maybeValidItems = value.map((item, index) => transformItem(item, index)); return maybeValidItems.reduce>( (acc, item) => { diff --git a/src/core/schemas/builders/object-like/getObjectLikeUtils.ts b/src/core/schemas/builders/object-like/getObjectLikeUtils.ts index 270ea17..8331d08 100644 --- a/src/core/schemas/builders/object-like/getObjectLikeUtils.ts +++ b/src/core/schemas/builders/object-like/getObjectLikeUtils.ts @@ -20,8 +20,8 @@ export function withParsedProperties Properties[K]) } ): ObjectLikeSchema { const objectSchema: BaseSchema = { - parse: async (raw, opts) => { - const parsedObject = await objectLike.parse(raw, opts); + parse: (raw, opts) => { + const parsedObject = objectLike.parse(raw, opts); if (!parsedObject.ok) { return parsedObject; } diff --git a/src/core/schemas/builders/object/object.ts b/src/core/schemas/builders/object/object.ts index 6427678..e00136d 100644 --- a/src/core/schemas/builders/object/object.ts +++ b/src/core/schemas/builders/object/object.ts @@ -4,7 +4,6 @@ import { filterObject } from "../../utils/filterObject"; import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; import { isPlainObject } from "../../utils/isPlainObject"; import { keys } from "../../utils/keys"; -import { MaybePromise } from "../../utils/MaybePromise"; import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; import { partition } from "../../utils/partition"; import { getObjectLikeUtils } from "../object-like"; @@ -34,15 +33,12 @@ export function object > = { _getRawProperties: () => - Promise.resolve( - Object.entries(schemas).map(([parsedKey, propertySchema]) => - isProperty(propertySchema) ? propertySchema.rawKey : parsedKey - ) as unknown as (keyof inferRawObjectFromPropertySchemas)[] - ), - _getParsedProperties: () => - Promise.resolve(keys(schemas) as unknown as (keyof inferParsedObjectFromPropertySchemas)[]), + Object.entries(schemas).map(([parsedKey, propertySchema]) => + isProperty(propertySchema) ? propertySchema.rawKey : parsedKey + ) as unknown as (keyof inferRawObjectFromPropertySchemas)[], + _getParsedProperties: () => keys(schemas) as unknown as (keyof inferParsedObjectFromPropertySchemas)[], - parse: async (raw, opts) => { + parse: (raw, opts) => { const rawKeyToProperty: Record = {}; const requiredKeys: string[] = []; @@ -85,10 +81,11 @@ export function object { + json: (parsed, opts) => { const requiredKeys: string[] = []; for (const [parsedKey, schemaOrObjectProperty] of entries(schemas)) { @@ -106,9 +103,7 @@ export function object MaybePromise> } - | undefined => { + ): { transformedKey: string; transform: (propertyValue: unknown) => MaybeValid } | undefined => { const property = schemas[parsedKey as keyof T]; // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition @@ -139,6 +134,7 @@ export function object({ +function validateAndTransformObject({ value, requiredKeys, getProperty, @@ -165,11 +161,12 @@ async function validateAndTransformObject({ requiredKeys: string[]; getProperty: ( preTransformedKey: string - ) => { transformedKey: string; transform: (propertyValue: unknown) => MaybePromise> } | undefined; + ) => { transformedKey: string; transform: (propertyValue: unknown) => MaybeValid } | undefined; unrecognizedObjectKeys: "fail" | "passthrough" | "strip" | undefined; skipValidation: boolean | undefined; breadcrumbsPrefix: string[] | undefined; -}): Promise> { + omitUndefined: boolean | undefined; +}): MaybeValid { if (!isPlainObject(value)) { return { ok: false, @@ -192,7 +189,7 @@ async function validateAndTransformObject({ if (property != null) { missingRequiredKeys.delete(preTransformedKey); - const value = await property.transform(preTransformedItemValue); + const value = property.transform(preTransformedItemValue); if (value.ok) { transformed[property.transformedKey] = value.value; } else { @@ -242,25 +239,19 @@ export function getObjectUtils(schema: BaseObjectSchema(extension: ObjectSchema) => { const baseSchema: BaseObjectSchema = { - _getParsedProperties: async () => [ - ...(await schema._getParsedProperties()), - ...(await extension._getParsedProperties()), - ], - _getRawProperties: async () => [ - ...(await schema._getRawProperties()), - ...(await extension._getRawProperties()), - ], - parse: async (raw, opts) => { + _getParsedProperties: () => [...schema._getParsedProperties(), ...extension._getParsedProperties()], + _getRawProperties: () => [...schema._getRawProperties(), ...extension._getRawProperties()], + parse: (raw, opts) => { return validateAndTransformExtendedObject({ - extensionKeys: await extension._getRawProperties(), + extensionKeys: extension._getRawProperties(), value: raw, transformBase: (rawBase) => schema.parse(rawBase, opts), transformExtension: (rawExtension) => extension.parse(rawExtension, opts), }); }, - json: async (parsed, opts) => { + json: (parsed, opts) => { return validateAndTransformExtendedObject({ - extensionKeys: await extension._getParsedProperties(), + extensionKeys: extension._getParsedProperties(), value: parsed, transformBase: (parsedBase) => schema.json(parsedBase, opts), transformExtension: (parsedExtension) => extension.json(parsedExtension, opts), @@ -279,7 +270,7 @@ export function getObjectUtils(schema: BaseObjectSchema({ +function validateAndTransformExtendedObject({ extensionKeys, value, transformBase, @@ -287,16 +278,16 @@ async function validateAndTransformExtendedObject MaybePromise>; - transformExtension: (value: unknown) => MaybePromise>; -}): Promise> { + transformBase: (value: unknown) => MaybeValid; + transformExtension: (value: unknown) => MaybeValid; +}): MaybeValid { const extensionPropertiesSet = new Set(extensionKeys); const [extensionProperties, baseProperties] = partition(keys(value), (key) => extensionPropertiesSet.has(key as keyof PreTransformedExtension) ); - const transformedBase = await transformBase(filterObject(value, baseProperties)); - const transformedExtension = await transformExtension(filterObject(value, extensionProperties)); + const transformedBase = transformBase(filterObject(value, baseProperties)); + const transformedExtension = transformExtension(filterObject(value, extensionProperties)); if (transformedBase.ok && transformedExtension.ok) { return { diff --git a/src/core/schemas/builders/object/types.ts b/src/core/schemas/builders/object/types.ts index 17cff4f..de9bb40 100644 --- a/src/core/schemas/builders/object/types.ts +++ b/src/core/schemas/builders/object/types.ts @@ -10,8 +10,8 @@ export type ObjectSchema = BaseObjectSchema & SchemaUtils; export interface BaseObjectSchema extends BaseSchema { - _getRawProperties: () => Promise<(keyof Raw)[]>; - _getParsedProperties: () => Promise<(keyof Parsed)[]>; + _getRawProperties: () => (keyof Raw)[]; + _getParsedProperties: () => (keyof Parsed)[]; } export interface ObjectUtils { diff --git a/src/core/schemas/builders/record/record.ts b/src/core/schemas/builders/record/record.ts index ac1cd22..6683ac3 100644 --- a/src/core/schemas/builders/record/record.ts +++ b/src/core/schemas/builders/record/record.ts @@ -2,7 +2,6 @@ import { MaybeValid, Schema, SchemaType, ValidationError } from "../../Schema"; import { entries } from "../../utils/entries"; import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; import { isPlainObject } from "../../utils/isPlainObject"; -import { MaybePromise } from "../../utils/MaybePromise"; import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; import { getSchemaUtils } from "../schema-utils"; import { BaseRecordSchema, RecordSchema } from "./types"; @@ -12,10 +11,10 @@ export function record ): RecordSchema { const baseSchema: BaseRecordSchema = { - parse: async (raw, opts) => { + parse: (raw, opts) => { return validateAndTransformRecord({ value: raw, - isKeyNumeric: (await keySchema.getType()) === SchemaType.NUMBER, + isKeyNumeric: keySchema.getType() === SchemaType.NUMBER, transformKey: (key) => keySchema.parse(key, { ...opts, @@ -29,10 +28,10 @@ export function record { + json: (parsed, opts) => { return validateAndTransformRecord({ value: parsed, - isKeyNumeric: (await keySchema.getType()) === SchemaType.NUMBER, + isKeyNumeric: keySchema.getType() === SchemaType.NUMBER, transformKey: (key) => keySchema.json(key, { ...opts, @@ -55,7 +54,7 @@ export function record({ +function validateAndTransformRecord({ value, isKeyNumeric, transformKey, @@ -64,10 +63,10 @@ async function validateAndTransformRecord MaybePromise>; - transformValue: (value: unknown, key: string | number) => MaybePromise>; + transformKey: (key: string | number) => MaybeValid; + transformValue: (value: unknown, key: string | number) => MaybeValid; breadcrumbsPrefix: string[] | undefined; -}): Promise>> { +}): MaybeValid> { if (!isPlainObject(value)) { return { ok: false, @@ -80,14 +79,14 @@ async function validateAndTransformRecord>>>( - async (accPromise, [stringKey, value]) => { + return entries(value).reduce>>( + (accPromise, [stringKey, value]) => { // skip nullish keys if (value == null) { return accPromise; } - const acc = await accPromise; + const acc = accPromise; let key: string | number = stringKey; if (isKeyNumeric) { @@ -96,9 +95,9 @@ async function validateAndTransformRecord }) + { ok: true, value: {} as Record } ); } diff --git a/src/core/schemas/builders/schema-utils/getSchemaUtils.ts b/src/core/schemas/builders/schema-utils/getSchemaUtils.ts index 0c0d379..79ecad9 100644 --- a/src/core/schemas/builders/schema-utils/getSchemaUtils.ts +++ b/src/core/schemas/builders/schema-utils/getSchemaUtils.ts @@ -5,8 +5,8 @@ import { ParseError } from "./ParseError"; export interface SchemaUtils { optional: () => Schema; transform: (transformer: SchemaTransformer) => Schema; - parseOrThrow: (raw: unknown, opts?: SchemaOptions) => Promise; - jsonOrThrow: (raw: unknown, opts?: SchemaOptions) => Promise; + parseOrThrow: (raw: unknown, opts?: SchemaOptions) => Parsed; + jsonOrThrow: (raw: unknown, opts?: SchemaOptions) => Raw; } export interface SchemaTransformer { @@ -18,15 +18,15 @@ export function getSchemaUtils(schema: BaseSchema): Sc return { optional: () => optional(schema), transform: (transformer) => transform(schema, transformer), - parseOrThrow: async (raw, opts) => { - const parsed = await schema.parse(raw, opts); + parseOrThrow: (raw, opts) => { + const parsed = schema.parse(raw, opts); if (parsed.ok) { return parsed.value; } throw new ParseError(parsed.errors); }, - jsonOrThrow: async (parsed, opts) => { - const raw = await schema.json(parsed, opts); + jsonOrThrow: (parsed, opts) => { + const raw = schema.json(parsed, opts); if (raw.ok) { return raw.value; } @@ -53,6 +53,12 @@ export function optional( return schema.parse(raw, opts); }, json: (parsed, opts) => { + if (opts?.omitUndefined && parsed === undefined) { + return { + ok: true, + value: undefined, + }; + } if (parsed == null) { return { ok: true, @@ -75,8 +81,8 @@ export function transform( transformer: SchemaTransformer ): Schema { const baseSchema: BaseSchema = { - parse: async (raw, opts) => { - const parsed = await schema.parse(raw, opts); + parse: (raw, opts) => { + const parsed = schema.parse(raw, opts); if (!parsed.ok) { return parsed; } @@ -85,8 +91,8 @@ export function transform( value: transformer.transform(parsed.value), }; }, - json: async (transformed, opts) => { - const parsed = await transformer.untransform(transformed); + json: (transformed, opts) => { + const parsed = transformer.untransform(transformed); return schema.json(parsed, opts); }, getType: () => schema.getType(), diff --git a/src/core/schemas/builders/set/set.ts b/src/core/schemas/builders/set/set.ts index 3113bcb..e9e6bb7 100644 --- a/src/core/schemas/builders/set/set.ts +++ b/src/core/schemas/builders/set/set.ts @@ -7,8 +7,8 @@ import { getSchemaUtils } from "../schema-utils"; export function set(schema: Schema): Schema> { const listSchema = list(schema); const baseSchema: BaseSchema> = { - parse: async (raw, opts) => { - const parsedList = await listSchema.parse(raw, opts); + parse: (raw, opts) => { + const parsedList = listSchema.parse(raw, opts); if (parsedList.ok) { return { ok: true, @@ -18,7 +18,7 @@ export function set(schema: Schema): Schema { + json: (parsed, opts) => { if (!(parsed instanceof Set)) { return { ok: false, @@ -30,7 +30,7 @@ export function set(schema: Schema): Schema SchemaType.SET, diff --git a/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts b/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts index 771dc6a..21ed3df 100644 --- a/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts +++ b/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts @@ -1,5 +1,4 @@ import { BaseSchema, MaybeValid, Schema, SchemaOptions, SchemaType, ValidationError } from "../../Schema"; -import { MaybePromise } from "../../utils/MaybePromise"; import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; import { getSchemaUtils } from "../schema-utils"; import { inferParsedUnidiscriminatedUnionSchema, inferRawUnidiscriminatedUnionSchema } from "./types"; @@ -11,14 +10,14 @@ export function undiscriminatedUnion, ...Schem inferRawUnidiscriminatedUnionSchema, inferParsedUnidiscriminatedUnionSchema > = { - parse: async (raw, opts) => { + parse: (raw, opts) => { return validateAndTransformUndiscriminatedUnion>( (schema, opts) => schema.parse(raw, opts), schemas, opts ); }, - json: async (parsed, opts) => { + json: (parsed, opts) => { return validateAndTransformUndiscriminatedUnion>( (schema, opts) => schema.json(parsed, opts), schemas, @@ -34,14 +33,14 @@ export function undiscriminatedUnion, ...Schem }; } -async function validateAndTransformUndiscriminatedUnion( - transform: (schema: Schema, opts: SchemaOptions) => MaybePromise>, +function validateAndTransformUndiscriminatedUnion( + transform: (schema: Schema, opts: SchemaOptions) => MaybeValid, schemas: Schema[], opts: SchemaOptions | undefined -): Promise> { +): MaybeValid { const errors: ValidationError[] = []; for (const [index, schema] of schemas.entries()) { - const transformed = await transform(schema, { ...opts, skipValidation: false }); + const transformed = transform(schema, { ...opts, skipValidation: false }); if (transformed.ok) { return transformed; } else { diff --git a/src/core/schemas/builders/union/union.ts b/src/core/schemas/builders/union/union.ts index ed659be..ab61475 100644 --- a/src/core/schemas/builders/union/union.ts +++ b/src/core/schemas/builders/union/union.ts @@ -2,7 +2,6 @@ import { BaseSchema, MaybeValid, SchemaType } from "../../Schema"; import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; import { isPlainObject } from "../../utils/isPlainObject"; import { keys } from "../../utils/keys"; -import { MaybePromise } from "../../utils/MaybePromise"; import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; import { enum_ } from "../enum"; import { ObjectSchema } from "../object"; @@ -25,7 +24,7 @@ export function union, U extends Union const discriminantValueSchema = enum_(keys(union) as string[]); const baseSchema: BaseSchema, inferParsedUnion> = { - parse: async (raw, opts) => { + parse: (raw, opts) => { return transformAndValidateUnion({ value: raw, discriminant: rawDiscriminant, @@ -42,7 +41,7 @@ export function union, U extends Union breadcrumbsPrefix: opts?.breadcrumbsPrefix, }); }, - json: async (parsed, opts) => { + json: (parsed, opts) => { return transformAndValidateUnion({ value: parsed, discriminant: parsedDiscriminant, @@ -69,7 +68,7 @@ export function union, U extends Union }; } -async function transformAndValidateUnion< +function transformAndValidateUnion< TransformedDiscriminant extends string, TransformedDiscriminantValue extends string, TransformedAdditionalProperties @@ -86,17 +85,15 @@ async function transformAndValidateUnion< value: unknown; discriminant: string; transformedDiscriminant: TransformedDiscriminant; - transformDiscriminantValue: (discriminantValue: unknown) => MaybePromise>; + transformDiscriminantValue: (discriminantValue: unknown) => MaybeValid; getAdditionalPropertiesSchema: (discriminantValue: string) => ObjectSchema | undefined; allowUnrecognizedUnionMembers: boolean | undefined; transformAdditionalProperties: ( additionalProperties: unknown, additionalPropertiesSchema: ObjectSchema - ) => MaybePromise>; + ) => MaybeValid; breadcrumbsPrefix: string[] | undefined; -}): Promise< - MaybeValid & TransformedAdditionalProperties> -> { +}): MaybeValid & TransformedAdditionalProperties> { if (!isPlainObject(value)) { return { ok: false, @@ -123,7 +120,7 @@ async function transformAndValidateUnion< }; } - const transformedDiscriminantValue = await transformDiscriminantValue(discriminantValue); + const transformedDiscriminantValue = transformDiscriminantValue(discriminantValue); if (!transformedDiscriminantValue.ok) { return { ok: false, @@ -155,7 +152,7 @@ async function transformAndValidateUnion< } } - const transformedAdditionalProperties = await transformAdditionalProperties( + const transformedAdditionalProperties = transformAdditionalProperties( additionalProperties, additionalPropertiesSchema ); diff --git a/src/core/schemas/utils/maybeSkipValidation.ts b/src/core/schemas/utils/maybeSkipValidation.ts index 99c02c3..86c07ab 100644 --- a/src/core/schemas/utils/maybeSkipValidation.ts +++ b/src/core/schemas/utils/maybeSkipValidation.ts @@ -1,5 +1,4 @@ import { BaseSchema, MaybeValid, SchemaOptions } from "../Schema"; -import { MaybePromise } from "./MaybePromise"; export function maybeSkipValidation, Raw, Parsed>(schema: S): S { return { @@ -10,10 +9,10 @@ export function maybeSkipValidation, Raw, Pars } function transformAndMaybeSkipValidation( - transform: (value: unknown, opts?: SchemaOptions) => MaybePromise> -): (value: unknown, opts?: SchemaOptions) => MaybePromise> { - return async (value, opts): Promise> => { - const transformed = await transform(value, opts); + transform: (value: unknown, opts?: SchemaOptions) => MaybeValid +): (value: unknown, opts?: SchemaOptions) => MaybeValid { + return (value, opts): MaybeValid => { + const transformed = transform(value, opts); const { skipValidation = false } = opts ?? {}; if (!transformed.ok && skipValidation) { // eslint-disable-next-line no-console diff --git a/src/serialization/resources/automationJourneys/client/requests/AutomationJourneysCreateRequest.ts b/src/serialization/resources/automationJourneys/client/requests/AutomationJourneysCreateRequest.ts index 14e7050..89ad119 100644 --- a/src/serialization/resources/automationJourneys/client/requests/AutomationJourneysCreateRequest.ts +++ b/src/serialization/resources/automationJourneys/client/requests/AutomationJourneysCreateRequest.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../../.."; -import * as Beehiiv from "../../../../../api"; +import * as serializers from "../../../../index"; +import * as Beehiiv from "../../../../../api/index"; import * as core from "../../../../../core"; import { AutomationJourneysCreateRequestDoubleOptOverride } from "../../types/AutomationJourneysCreateRequestDoubleOptOverride"; diff --git a/src/serialization/resources/automationJourneys/types/AutomationJourneysCreateRequestDoubleOptOverride.ts b/src/serialization/resources/automationJourneys/types/AutomationJourneysCreateRequestDoubleOptOverride.ts index 2977d8f..89c79af 100644 --- a/src/serialization/resources/automationJourneys/types/AutomationJourneysCreateRequestDoubleOptOverride.ts +++ b/src/serialization/resources/automationJourneys/types/AutomationJourneysCreateRequestDoubleOptOverride.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const AutomationJourneysCreateRequestDoubleOptOverride: core.serialization.Schema< diff --git a/src/serialization/resources/automationJourneys/types/AutomationJourneysCreateResponse.ts b/src/serialization/resources/automationJourneys/types/AutomationJourneysCreateResponse.ts index 55a54a5..1c915ba 100644 --- a/src/serialization/resources/automationJourneys/types/AutomationJourneysCreateResponse.ts +++ b/src/serialization/resources/automationJourneys/types/AutomationJourneysCreateResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { AutomationJourney } from "../../../types/AutomationJourney"; diff --git a/src/serialization/resources/automationJourneys/types/AutomationJourneysGetRequestStatus.ts b/src/serialization/resources/automationJourneys/types/AutomationJourneysGetRequestStatus.ts index 5db4512..0996692 100644 --- a/src/serialization/resources/automationJourneys/types/AutomationJourneysGetRequestStatus.ts +++ b/src/serialization/resources/automationJourneys/types/AutomationJourneysGetRequestStatus.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const AutomationJourneysGetRequestStatus: core.serialization.Schema< diff --git a/src/serialization/resources/automationJourneys/types/AutomationJourneysGetResponse.ts b/src/serialization/resources/automationJourneys/types/AutomationJourneysGetResponse.ts index 19f4399..615dd29 100644 --- a/src/serialization/resources/automationJourneys/types/AutomationJourneysGetResponse.ts +++ b/src/serialization/resources/automationJourneys/types/AutomationJourneysGetResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { AutomationJourney } from "../../../types/AutomationJourney"; diff --git a/src/serialization/resources/automations/types/AutomationsGetResponse.ts b/src/serialization/resources/automations/types/AutomationsGetResponse.ts index a2f7a08..a8ccdd2 100644 --- a/src/serialization/resources/automations/types/AutomationsGetResponse.ts +++ b/src/serialization/resources/automations/types/AutomationsGetResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { Automation } from "../../../types/Automation"; diff --git a/src/serialization/resources/automations/types/AutomationsListResponse.ts b/src/serialization/resources/automations/types/AutomationsListResponse.ts index 94b9692..1d0f5cf 100644 --- a/src/serialization/resources/automations/types/AutomationsListResponse.ts +++ b/src/serialization/resources/automations/types/AutomationsListResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { Automation } from "../../../types/Automation"; diff --git a/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesGetResponse.ts b/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesGetResponse.ts index 6774671..4b25626 100644 --- a/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesGetResponse.ts +++ b/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesGetResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { BulkSubscriptionUpdatesGetResponseData } from "./BulkSubscriptionUpdatesGetResponseData"; diff --git a/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesGetResponseData.ts b/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesGetResponseData.ts index d3bea6e..ae40a2c 100644 --- a/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesGetResponseData.ts +++ b/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesGetResponseData.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { BulkSubscriptionUpdatesGetResponseDataType } from "./BulkSubscriptionUpdatesGetResponseDataType"; import { BulkSubscriptionUpdatesGetResponseDataStatus } from "./BulkSubscriptionUpdatesGetResponseDataStatus"; diff --git a/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesGetResponseDataStatus.ts b/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesGetResponseDataStatus.ts index 8df0846..cafd17a 100644 --- a/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesGetResponseDataStatus.ts +++ b/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesGetResponseDataStatus.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const BulkSubscriptionUpdatesGetResponseDataStatus: core.serialization.Schema< diff --git a/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesGetResponseDataType.ts b/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesGetResponseDataType.ts index ac327fd..c38ef75 100644 --- a/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesGetResponseDataType.ts +++ b/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesGetResponseDataType.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const BulkSubscriptionUpdatesGetResponseDataType: core.serialization.Schema< diff --git a/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesListResponse.ts b/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesListResponse.ts index 0c388b7..c1f000a 100644 --- a/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesListResponse.ts +++ b/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesListResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { BulkSubscriptionUpdatesListResponseDataItem } from "./BulkSubscriptionUpdatesListResponseDataItem"; diff --git a/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesListResponseDataItem.ts b/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesListResponseDataItem.ts index 2bb1276..a2c405a 100644 --- a/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesListResponseDataItem.ts +++ b/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesListResponseDataItem.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { BulkSubscriptionUpdatesListResponseDataItemType } from "./BulkSubscriptionUpdatesListResponseDataItemType"; import { BulkSubscriptionUpdatesListResponseDataItemStatus } from "./BulkSubscriptionUpdatesListResponseDataItemStatus"; diff --git a/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesListResponseDataItemStatus.ts b/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesListResponseDataItemStatus.ts index 58edafb..7eb380d 100644 --- a/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesListResponseDataItemStatus.ts +++ b/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesListResponseDataItemStatus.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const BulkSubscriptionUpdatesListResponseDataItemStatus: core.serialization.Schema< diff --git a/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesListResponseDataItemType.ts b/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesListResponseDataItemType.ts index 00973ee..a0fda23 100644 --- a/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesListResponseDataItemType.ts +++ b/src/serialization/resources/bulkSubscriptionUpdates/types/BulkSubscriptionUpdatesListResponseDataItemType.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const BulkSubscriptionUpdatesListResponseDataItemType: core.serialization.Schema< diff --git a/src/serialization/resources/customFields/client/requests/CustomFieldsCreateRequest.ts b/src/serialization/resources/customFields/client/requests/CustomFieldsCreateRequest.ts index b68be49..0cfd406 100644 --- a/src/serialization/resources/customFields/client/requests/CustomFieldsCreateRequest.ts +++ b/src/serialization/resources/customFields/client/requests/CustomFieldsCreateRequest.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../../.."; -import * as Beehiiv from "../../../../../api"; +import * as serializers from "../../../../index"; +import * as Beehiiv from "../../../../../api/index"; import * as core from "../../../../../core"; import { CustomFieldsCreateRequestKind } from "../../types/CustomFieldsCreateRequestKind"; diff --git a/src/serialization/resources/customFields/client/requests/CustomFieldsPatchRequest.ts b/src/serialization/resources/customFields/client/requests/CustomFieldsPatchRequest.ts index 552c973..a96713b 100644 --- a/src/serialization/resources/customFields/client/requests/CustomFieldsPatchRequest.ts +++ b/src/serialization/resources/customFields/client/requests/CustomFieldsPatchRequest.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../../.."; -import * as Beehiiv from "../../../../../api"; +import * as serializers from "../../../../index"; +import * as Beehiiv from "../../../../../api/index"; import * as core from "../../../../../core"; export const CustomFieldsPatchRequest: core.serialization.Schema< diff --git a/src/serialization/resources/customFields/client/requests/CustomFieldsPutRequest.ts b/src/serialization/resources/customFields/client/requests/CustomFieldsPutRequest.ts index 9cbdfa2..abdbdb9 100644 --- a/src/serialization/resources/customFields/client/requests/CustomFieldsPutRequest.ts +++ b/src/serialization/resources/customFields/client/requests/CustomFieldsPutRequest.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../../.."; -import * as Beehiiv from "../../../../../api"; +import * as serializers from "../../../../index"; +import * as Beehiiv from "../../../../../api/index"; import * as core from "../../../../../core"; export const CustomFieldsPutRequest: core.serialization.Schema< diff --git a/src/serialization/resources/customFields/types/CustomFieldsCreateRequestKind.ts b/src/serialization/resources/customFields/types/CustomFieldsCreateRequestKind.ts index c428fdd..4a98875 100644 --- a/src/serialization/resources/customFields/types/CustomFieldsCreateRequestKind.ts +++ b/src/serialization/resources/customFields/types/CustomFieldsCreateRequestKind.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const CustomFieldsCreateRequestKind: core.serialization.Schema< diff --git a/src/serialization/resources/customFields/types/CustomFieldsCreateResponse.ts b/src/serialization/resources/customFields/types/CustomFieldsCreateResponse.ts index bc3c7cb..8b9b9c1 100644 --- a/src/serialization/resources/customFields/types/CustomFieldsCreateResponse.ts +++ b/src/serialization/resources/customFields/types/CustomFieldsCreateResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { CustomFieldsCreateResponseData } from "./CustomFieldsCreateResponseData"; diff --git a/src/serialization/resources/customFields/types/CustomFieldsCreateResponseData.ts b/src/serialization/resources/customFields/types/CustomFieldsCreateResponseData.ts index 8d7dcfc..d79908e 100644 --- a/src/serialization/resources/customFields/types/CustomFieldsCreateResponseData.ts +++ b/src/serialization/resources/customFields/types/CustomFieldsCreateResponseData.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { CustomFieldsCreateResponseDataKind } from "./CustomFieldsCreateResponseDataKind"; diff --git a/src/serialization/resources/customFields/types/CustomFieldsCreateResponseDataKind.ts b/src/serialization/resources/customFields/types/CustomFieldsCreateResponseDataKind.ts index 4d369ad..3ad0174 100644 --- a/src/serialization/resources/customFields/types/CustomFieldsCreateResponseDataKind.ts +++ b/src/serialization/resources/customFields/types/CustomFieldsCreateResponseDataKind.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const CustomFieldsCreateResponseDataKind: core.serialization.Schema< diff --git a/src/serialization/resources/customFields/types/CustomFieldsDeleteResponse.ts b/src/serialization/resources/customFields/types/CustomFieldsDeleteResponse.ts index 9729ecd..c0f5cbe 100644 --- a/src/serialization/resources/customFields/types/CustomFieldsDeleteResponse.ts +++ b/src/serialization/resources/customFields/types/CustomFieldsDeleteResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const CustomFieldsDeleteResponse: core.serialization.ObjectSchema< diff --git a/src/serialization/resources/customFields/types/CustomFieldsGetResponse.ts b/src/serialization/resources/customFields/types/CustomFieldsGetResponse.ts index d532be7..7a78541 100644 --- a/src/serialization/resources/customFields/types/CustomFieldsGetResponse.ts +++ b/src/serialization/resources/customFields/types/CustomFieldsGetResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { CustomFieldsGetResponseData } from "./CustomFieldsGetResponseData"; diff --git a/src/serialization/resources/customFields/types/CustomFieldsGetResponseData.ts b/src/serialization/resources/customFields/types/CustomFieldsGetResponseData.ts index f2bbeac..87fa905 100644 --- a/src/serialization/resources/customFields/types/CustomFieldsGetResponseData.ts +++ b/src/serialization/resources/customFields/types/CustomFieldsGetResponseData.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { CustomFieldsGetResponseDataKind } from "./CustomFieldsGetResponseDataKind"; diff --git a/src/serialization/resources/customFields/types/CustomFieldsGetResponseDataItem.ts b/src/serialization/resources/customFields/types/CustomFieldsGetResponseDataItem.ts index cddea1c..8b6351e 100644 --- a/src/serialization/resources/customFields/types/CustomFieldsGetResponseDataItem.ts +++ b/src/serialization/resources/customFields/types/CustomFieldsGetResponseDataItem.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { CustomFieldsGetResponseDataItemKind } from "./CustomFieldsGetResponseDataItemKind"; diff --git a/src/serialization/resources/customFields/types/CustomFieldsGetResponseDataItemKind.ts b/src/serialization/resources/customFields/types/CustomFieldsGetResponseDataItemKind.ts index d05f3c9..401e1e3 100644 --- a/src/serialization/resources/customFields/types/CustomFieldsGetResponseDataItemKind.ts +++ b/src/serialization/resources/customFields/types/CustomFieldsGetResponseDataItemKind.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const CustomFieldsGetResponseDataItemKind: core.serialization.Schema< diff --git a/src/serialization/resources/customFields/types/CustomFieldsGetResponseDataKind.ts b/src/serialization/resources/customFields/types/CustomFieldsGetResponseDataKind.ts index d3ad5e0..6c8ba25 100644 --- a/src/serialization/resources/customFields/types/CustomFieldsGetResponseDataKind.ts +++ b/src/serialization/resources/customFields/types/CustomFieldsGetResponseDataKind.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const CustomFieldsGetResponseDataKind: core.serialization.Schema< diff --git a/src/serialization/resources/customFields/types/CustomFieldsPatchResponse.ts b/src/serialization/resources/customFields/types/CustomFieldsPatchResponse.ts index 2ddd4ad..22a6c2c 100644 --- a/src/serialization/resources/customFields/types/CustomFieldsPatchResponse.ts +++ b/src/serialization/resources/customFields/types/CustomFieldsPatchResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { CustomFieldsPatchResponseData } from "./CustomFieldsPatchResponseData"; diff --git a/src/serialization/resources/customFields/types/CustomFieldsPatchResponseData.ts b/src/serialization/resources/customFields/types/CustomFieldsPatchResponseData.ts index 0c01d22..353a70a 100644 --- a/src/serialization/resources/customFields/types/CustomFieldsPatchResponseData.ts +++ b/src/serialization/resources/customFields/types/CustomFieldsPatchResponseData.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { CustomFieldsPatchResponseDataKind } from "./CustomFieldsPatchResponseDataKind"; diff --git a/src/serialization/resources/customFields/types/CustomFieldsPatchResponseDataKind.ts b/src/serialization/resources/customFields/types/CustomFieldsPatchResponseDataKind.ts index c5f442e..0440a73 100644 --- a/src/serialization/resources/customFields/types/CustomFieldsPatchResponseDataKind.ts +++ b/src/serialization/resources/customFields/types/CustomFieldsPatchResponseDataKind.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const CustomFieldsPatchResponseDataKind: core.serialization.Schema< diff --git a/src/serialization/resources/customFields/types/CustomFieldsPutResponse.ts b/src/serialization/resources/customFields/types/CustomFieldsPutResponse.ts index 5786481..0c4cbea 100644 --- a/src/serialization/resources/customFields/types/CustomFieldsPutResponse.ts +++ b/src/serialization/resources/customFields/types/CustomFieldsPutResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { CustomFieldsPutResponseData } from "./CustomFieldsPutResponseData"; diff --git a/src/serialization/resources/customFields/types/CustomFieldsPutResponseData.ts b/src/serialization/resources/customFields/types/CustomFieldsPutResponseData.ts index a6924ce..cd0d94b 100644 --- a/src/serialization/resources/customFields/types/CustomFieldsPutResponseData.ts +++ b/src/serialization/resources/customFields/types/CustomFieldsPutResponseData.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { CustomFieldsPutResponseDataKind } from "./CustomFieldsPutResponseDataKind"; diff --git a/src/serialization/resources/customFields/types/CustomFieldsPutResponseDataKind.ts b/src/serialization/resources/customFields/types/CustomFieldsPutResponseDataKind.ts index 6ba4b56..fd8c86c 100644 --- a/src/serialization/resources/customFields/types/CustomFieldsPutResponseDataKind.ts +++ b/src/serialization/resources/customFields/types/CustomFieldsPutResponseDataKind.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const CustomFieldsPutResponseDataKind: core.serialization.Schema< diff --git a/src/serialization/resources/emailBlasts/types/EmailBlastsGetRequestExpandItem.ts b/src/serialization/resources/emailBlasts/types/EmailBlastsGetRequestExpandItem.ts index 05720f8..0be0fca 100644 --- a/src/serialization/resources/emailBlasts/types/EmailBlastsGetRequestExpandItem.ts +++ b/src/serialization/resources/emailBlasts/types/EmailBlastsGetRequestExpandItem.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const EmailBlastsGetRequestExpandItem: core.serialization.Schema< diff --git a/src/serialization/resources/emailBlasts/types/EmailBlastsGetResponse.ts b/src/serialization/resources/emailBlasts/types/EmailBlastsGetResponse.ts index 93bd96a..d7f574d 100644 --- a/src/serialization/resources/emailBlasts/types/EmailBlastsGetResponse.ts +++ b/src/serialization/resources/emailBlasts/types/EmailBlastsGetResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { EmailBlast } from "../../../types/EmailBlast"; diff --git a/src/serialization/resources/emailBlasts/types/EmailBlastsListRequestDirection.ts b/src/serialization/resources/emailBlasts/types/EmailBlastsListRequestDirection.ts index 9fdbf58..519f462 100644 --- a/src/serialization/resources/emailBlasts/types/EmailBlastsListRequestDirection.ts +++ b/src/serialization/resources/emailBlasts/types/EmailBlastsListRequestDirection.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const EmailBlastsListRequestDirection: core.serialization.Schema< diff --git a/src/serialization/resources/emailBlasts/types/EmailBlastsListRequestExpandItem.ts b/src/serialization/resources/emailBlasts/types/EmailBlastsListRequestExpandItem.ts index de6ec36..d60d670 100644 --- a/src/serialization/resources/emailBlasts/types/EmailBlastsListRequestExpandItem.ts +++ b/src/serialization/resources/emailBlasts/types/EmailBlastsListRequestExpandItem.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const EmailBlastsListRequestExpandItem: core.serialization.Schema< diff --git a/src/serialization/resources/emailBlasts/types/EmailBlastsListRequestOrderBy.ts b/src/serialization/resources/emailBlasts/types/EmailBlastsListRequestOrderBy.ts index 9e191ac..c2623ad 100644 --- a/src/serialization/resources/emailBlasts/types/EmailBlastsListRequestOrderBy.ts +++ b/src/serialization/resources/emailBlasts/types/EmailBlastsListRequestOrderBy.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const EmailBlastsListRequestOrderBy: core.serialization.Schema< diff --git a/src/serialization/resources/emailBlasts/types/EmailBlastsListResponse.ts b/src/serialization/resources/emailBlasts/types/EmailBlastsListResponse.ts index 0071434..fcd6cfc 100644 --- a/src/serialization/resources/emailBlasts/types/EmailBlastsListResponse.ts +++ b/src/serialization/resources/emailBlasts/types/EmailBlastsListResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { EmailBlast } from "../../../types/EmailBlast"; diff --git a/src/serialization/resources/index.ts b/src/serialization/resources/index.ts index b5e13e3..942f81c 100644 --- a/src/serialization/resources/index.ts +++ b/src/serialization/resources/index.ts @@ -20,7 +20,13 @@ export * as automations from "./automations"; export * from "./automations/types"; export * as subscriptionTags from "./subscriptionTags"; export * from "./subscriptionTags/types"; +export * as tiers from "./tiers"; +export * from "./tiers/types"; +export * as webhooks from "./webhooks"; +export * from "./webhooks/types"; export * from "./subscriptions/client/requests"; export * from "./customFields/client/requests"; export * from "./automationJourneys/client/requests"; export * from "./subscriptionTags/client/requests"; +export * from "./tiers/client/requests"; +export * from "./webhooks/client/requests"; diff --git a/src/serialization/resources/posts/types/PostsDeleteResponse.ts b/src/serialization/resources/posts/types/PostsDeleteResponse.ts index 4389086..f7892b1 100644 --- a/src/serialization/resources/posts/types/PostsDeleteResponse.ts +++ b/src/serialization/resources/posts/types/PostsDeleteResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const PostsDeleteResponse: core.serialization.ObjectSchema< diff --git a/src/serialization/resources/posts/types/PostsGetRequestExpandItem.ts b/src/serialization/resources/posts/types/PostsGetRequestExpandItem.ts index 4808eac..e2574f5 100644 --- a/src/serialization/resources/posts/types/PostsGetRequestExpandItem.ts +++ b/src/serialization/resources/posts/types/PostsGetRequestExpandItem.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const PostsGetRequestExpandItem: core.serialization.Schema< diff --git a/src/serialization/resources/posts/types/PostsGetResponse.ts b/src/serialization/resources/posts/types/PostsGetResponse.ts index 6de5ab0..7c66663 100644 --- a/src/serialization/resources/posts/types/PostsGetResponse.ts +++ b/src/serialization/resources/posts/types/PostsGetResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { Post } from "../../../types/Post"; diff --git a/src/serialization/resources/posts/types/PostsListRequestAudience.ts b/src/serialization/resources/posts/types/PostsListRequestAudience.ts index 59e681e..769a4df 100644 --- a/src/serialization/resources/posts/types/PostsListRequestAudience.ts +++ b/src/serialization/resources/posts/types/PostsListRequestAudience.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const PostsListRequestAudience: core.serialization.Schema< diff --git a/src/serialization/resources/posts/types/PostsListRequestDirection.ts b/src/serialization/resources/posts/types/PostsListRequestDirection.ts index 97162a0..90df15c 100644 --- a/src/serialization/resources/posts/types/PostsListRequestDirection.ts +++ b/src/serialization/resources/posts/types/PostsListRequestDirection.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const PostsListRequestDirection: core.serialization.Schema< diff --git a/src/serialization/resources/posts/types/PostsListRequestExpandItem.ts b/src/serialization/resources/posts/types/PostsListRequestExpandItem.ts index c572e14..f46da5d 100644 --- a/src/serialization/resources/posts/types/PostsListRequestExpandItem.ts +++ b/src/serialization/resources/posts/types/PostsListRequestExpandItem.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const PostsListRequestExpandItem: core.serialization.Schema< diff --git a/src/serialization/resources/posts/types/PostsListRequestHiddenFromFeed.ts b/src/serialization/resources/posts/types/PostsListRequestHiddenFromFeed.ts index 20a89cc..74ca44c 100644 --- a/src/serialization/resources/posts/types/PostsListRequestHiddenFromFeed.ts +++ b/src/serialization/resources/posts/types/PostsListRequestHiddenFromFeed.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const PostsListRequestHiddenFromFeed: core.serialization.Schema< diff --git a/src/serialization/resources/posts/types/PostsListRequestOrderBy.ts b/src/serialization/resources/posts/types/PostsListRequestOrderBy.ts index 453f719..09d9be0 100644 --- a/src/serialization/resources/posts/types/PostsListRequestOrderBy.ts +++ b/src/serialization/resources/posts/types/PostsListRequestOrderBy.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const PostsListRequestOrderBy: core.serialization.Schema< diff --git a/src/serialization/resources/posts/types/PostsListRequestPlatform.ts b/src/serialization/resources/posts/types/PostsListRequestPlatform.ts index e122622..1205a6c 100644 --- a/src/serialization/resources/posts/types/PostsListRequestPlatform.ts +++ b/src/serialization/resources/posts/types/PostsListRequestPlatform.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const PostsListRequestPlatform: core.serialization.Schema< diff --git a/src/serialization/resources/posts/types/PostsListRequestStatus.ts b/src/serialization/resources/posts/types/PostsListRequestStatus.ts index f9775fe..9d6ebe1 100644 --- a/src/serialization/resources/posts/types/PostsListRequestStatus.ts +++ b/src/serialization/resources/posts/types/PostsListRequestStatus.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const PostsListRequestStatus: core.serialization.Schema< diff --git a/src/serialization/resources/posts/types/PostsListResponse.ts b/src/serialization/resources/posts/types/PostsListResponse.ts index 0b9f403..362afd3 100644 --- a/src/serialization/resources/posts/types/PostsListResponse.ts +++ b/src/serialization/resources/posts/types/PostsListResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { Post } from "../../../types/Post"; diff --git a/src/serialization/resources/publications/types/PublicationsGetRequestExpandItem.ts b/src/serialization/resources/publications/types/PublicationsGetRequestExpandItem.ts new file mode 100644 index 0000000..4ce0938 --- /dev/null +++ b/src/serialization/resources/publications/types/PublicationsGetRequestExpandItem.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; +import * as core from "../../../../core"; + +export const PublicationsGetRequestExpandItem: core.serialization.Schema< + serializers.PublicationsGetRequestExpandItem.Raw, + Beehiiv.PublicationsGetRequestExpandItem +> = core.serialization.enum_([ + "stats", + "stat_active_subscriptions", + "stat_active_premium_subscriptions", + "stat_active_free_subscriptions", + "stat_average_open_rate", + "stat_average_click_rate", + "stat_total_sent", + "stat_total_unique_opened", + "stat_total_clicked", +]); + +export declare namespace PublicationsGetRequestExpandItem { + type Raw = + | "stats" + | "stat_active_subscriptions" + | "stat_active_premium_subscriptions" + | "stat_active_free_subscriptions" + | "stat_average_open_rate" + | "stat_average_click_rate" + | "stat_total_sent" + | "stat_total_unique_opened" + | "stat_total_clicked"; +} diff --git a/src/serialization/resources/publications/types/PublicationsGetResponse.ts b/src/serialization/resources/publications/types/PublicationsGetResponse.ts index e5fc13e..491bf62 100644 --- a/src/serialization/resources/publications/types/PublicationsGetResponse.ts +++ b/src/serialization/resources/publications/types/PublicationsGetResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { Publication } from "../../../types/Publication"; diff --git a/src/serialization/resources/publications/types/PublicationsListRequestDirection.ts b/src/serialization/resources/publications/types/PublicationsListRequestDirection.ts index 27f6525..442e787 100644 --- a/src/serialization/resources/publications/types/PublicationsListRequestDirection.ts +++ b/src/serialization/resources/publications/types/PublicationsListRequestDirection.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const PublicationsListRequestDirection: core.serialization.Schema< diff --git a/src/serialization/resources/publications/types/PublicationsListRequestExpandItem.ts b/src/serialization/resources/publications/types/PublicationsListRequestExpandItem.ts new file mode 100644 index 0000000..23b858b --- /dev/null +++ b/src/serialization/resources/publications/types/PublicationsListRequestExpandItem.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; +import * as core from "../../../../core"; + +export const PublicationsListRequestExpandItem: core.serialization.Schema< + serializers.PublicationsListRequestExpandItem.Raw, + Beehiiv.PublicationsListRequestExpandItem +> = core.serialization.enum_([ + "stats", + "stat_active_subscriptions", + "stat_active_premium_subscriptions", + "stat_active_free_subscriptions", + "stat_average_open_rate", + "stat_average_click_rate", + "stat_total_sent", + "stat_total_unique_opened", + "stat_total_clicked", +]); + +export declare namespace PublicationsListRequestExpandItem { + type Raw = + | "stats" + | "stat_active_subscriptions" + | "stat_active_premium_subscriptions" + | "stat_active_free_subscriptions" + | "stat_average_open_rate" + | "stat_average_click_rate" + | "stat_total_sent" + | "stat_total_unique_opened" + | "stat_total_clicked"; +} diff --git a/src/serialization/resources/publications/types/PublicationsListRequestOrderBy.ts b/src/serialization/resources/publications/types/PublicationsListRequestOrderBy.ts index c74b06e..8d0d200 100644 --- a/src/serialization/resources/publications/types/PublicationsListRequestOrderBy.ts +++ b/src/serialization/resources/publications/types/PublicationsListRequestOrderBy.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const PublicationsListRequestOrderBy: core.serialization.Schema< diff --git a/src/serialization/resources/publications/types/PublicationsListResponse.ts b/src/serialization/resources/publications/types/PublicationsListResponse.ts index ffabc46..0c86a89 100644 --- a/src/serialization/resources/publications/types/PublicationsListResponse.ts +++ b/src/serialization/resources/publications/types/PublicationsListResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { Publication } from "../../../types/Publication"; diff --git a/src/serialization/resources/publications/types/index.ts b/src/serialization/resources/publications/types/index.ts index 71ac15a..c96220c 100644 --- a/src/serialization/resources/publications/types/index.ts +++ b/src/serialization/resources/publications/types/index.ts @@ -1,4 +1,6 @@ +export * from "./PublicationsListRequestExpandItem"; export * from "./PublicationsListRequestDirection"; export * from "./PublicationsListRequestOrderBy"; export * from "./PublicationsListResponse"; +export * from "./PublicationsGetRequestExpandItem"; export * from "./PublicationsGetResponse"; diff --git a/src/serialization/resources/referralProgram/types/ReferralProgramGetResponse.ts b/src/serialization/resources/referralProgram/types/ReferralProgramGetResponse.ts index 569665a..c43695c 100644 --- a/src/serialization/resources/referralProgram/types/ReferralProgramGetResponse.ts +++ b/src/serialization/resources/referralProgram/types/ReferralProgramGetResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { Milestone } from "../../../types/Milestone"; diff --git a/src/serialization/resources/segments/client/delete.ts b/src/serialization/resources/segments/client/delete.ts index d62e772..d5144e2 100644 --- a/src/serialization/resources/segments/client/delete.ts +++ b/src/serialization/resources/segments/client/delete.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; +import * as serializers from "../../../index"; import * as core from "../../../../core"; export const Response: core.serialization.Schema< diff --git a/src/serialization/resources/segments/types/SegmentsGetResponse.ts b/src/serialization/resources/segments/types/SegmentsGetResponse.ts index ffa5238..0b7e1be 100644 --- a/src/serialization/resources/segments/types/SegmentsGetResponse.ts +++ b/src/serialization/resources/segments/types/SegmentsGetResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const SegmentsGetResponse: core.serialization.ObjectSchema< diff --git a/src/serialization/resources/segments/types/SegmentsListRequestDirection.ts b/src/serialization/resources/segments/types/SegmentsListRequestDirection.ts index f667c17..4553316 100644 --- a/src/serialization/resources/segments/types/SegmentsListRequestDirection.ts +++ b/src/serialization/resources/segments/types/SegmentsListRequestDirection.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const SegmentsListRequestDirection: core.serialization.Schema< diff --git a/src/serialization/resources/segments/types/SegmentsListRequestOrderBy.ts b/src/serialization/resources/segments/types/SegmentsListRequestOrderBy.ts index 886e09c..45f3197 100644 --- a/src/serialization/resources/segments/types/SegmentsListRequestOrderBy.ts +++ b/src/serialization/resources/segments/types/SegmentsListRequestOrderBy.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const SegmentsListRequestOrderBy: core.serialization.Schema< diff --git a/src/serialization/resources/segments/types/SegmentsListRequestStatus.ts b/src/serialization/resources/segments/types/SegmentsListRequestStatus.ts index 586bb44..848b74f 100644 --- a/src/serialization/resources/segments/types/SegmentsListRequestStatus.ts +++ b/src/serialization/resources/segments/types/SegmentsListRequestStatus.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const SegmentsListRequestStatus: core.serialization.Schema< diff --git a/src/serialization/resources/segments/types/SegmentsListRequestType.ts b/src/serialization/resources/segments/types/SegmentsListRequestType.ts index 3831e76..74025f6 100644 --- a/src/serialization/resources/segments/types/SegmentsListRequestType.ts +++ b/src/serialization/resources/segments/types/SegmentsListRequestType.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const SegmentsListRequestType: core.serialization.Schema< diff --git a/src/serialization/resources/segments/types/SegmentsListResponse.ts b/src/serialization/resources/segments/types/SegmentsListResponse.ts index 3ca21fb..4c5dc11 100644 --- a/src/serialization/resources/segments/types/SegmentsListResponse.ts +++ b/src/serialization/resources/segments/types/SegmentsListResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { Segment } from "../../../types/Segment"; diff --git a/src/serialization/resources/subscriptionTags/client/requests/SubscriptionTagsCreateRequest.ts b/src/serialization/resources/subscriptionTags/client/requests/SubscriptionTagsCreateRequest.ts index fba62d9..c28a72b 100644 --- a/src/serialization/resources/subscriptionTags/client/requests/SubscriptionTagsCreateRequest.ts +++ b/src/serialization/resources/subscriptionTags/client/requests/SubscriptionTagsCreateRequest.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../../.."; -import * as Beehiiv from "../../../../../api"; +import * as serializers from "../../../../index"; +import * as Beehiiv from "../../../../../api/index"; import * as core from "../../../../../core"; export const SubscriptionTagsCreateRequest: core.serialization.Schema< diff --git a/src/serialization/resources/subscriptionTags/types/SubscriptionTagsCreateResponse.ts b/src/serialization/resources/subscriptionTags/types/SubscriptionTagsCreateResponse.ts index 36429e0..b071735 100644 --- a/src/serialization/resources/subscriptionTags/types/SubscriptionTagsCreateResponse.ts +++ b/src/serialization/resources/subscriptionTags/types/SubscriptionTagsCreateResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { Subscription } from "../../../types/Subscription"; diff --git a/src/serialization/resources/subscriptions/client/delete.ts b/src/serialization/resources/subscriptions/client/delete.ts index 0c6ca07..a6d8afa 100644 --- a/src/serialization/resources/subscriptions/client/delete.ts +++ b/src/serialization/resources/subscriptions/client/delete.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; +import * as serializers from "../../../index"; import * as core from "../../../../core"; export const Response: core.serialization.Schema< diff --git a/src/serialization/resources/subscriptions/client/requests/SubscriptionsCreateRequest.ts b/src/serialization/resources/subscriptions/client/requests/SubscriptionsCreateRequest.ts index 83e3ba2..6964732 100644 --- a/src/serialization/resources/subscriptions/client/requests/SubscriptionsCreateRequest.ts +++ b/src/serialization/resources/subscriptions/client/requests/SubscriptionsCreateRequest.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../../.."; -import * as Beehiiv from "../../../../../api"; +import * as serializers from "../../../../index"; +import * as Beehiiv from "../../../../../api/index"; import * as core from "../../../../../core"; import { CustomFieldValue } from "../../../../types/CustomFieldValue"; import { SubscriptionsCreateRequestDoubleOptOverride } from "../../types/SubscriptionsCreateRequestDoubleOptOverride"; @@ -27,6 +27,15 @@ export const SubscriptionsCreateRequest: core.serialization.Schema< SubscriptionsCreateRequestDoubleOptOverride.optional() ), tier: SubscriptionsCreateRequestTier.optional(), + premiumTiers: core.serialization.property( + "premium_tiers", + core.serialization.list(core.serialization.string()).optional() + ), + premiumTierIds: core.serialization.property( + "premium_tier_ids", + core.serialization.list(core.serialization.string()).optional() + ), + stripeCustomerId: core.serialization.property("stripe_customer_id", core.serialization.string().optional()), automationIds: core.serialization.property( "automation_ids", core.serialization.list(core.serialization.string()).optional() @@ -46,6 +55,9 @@ export declare namespace SubscriptionsCreateRequest { custom_fields?: CustomFieldValue.Raw[] | null; double_opt_override?: SubscriptionsCreateRequestDoubleOptOverride.Raw | null; tier?: SubscriptionsCreateRequestTier.Raw | null; + premium_tiers?: string[] | null; + premium_tier_ids?: string[] | null; + stripe_customer_id?: string | null; automation_ids?: string[] | null; } } diff --git a/src/serialization/resources/subscriptions/client/requests/SubscriptionsPatchRequest.ts b/src/serialization/resources/subscriptions/client/requests/SubscriptionsPatchRequest.ts index 4c18d27..6ec3bff 100644 --- a/src/serialization/resources/subscriptions/client/requests/SubscriptionsPatchRequest.ts +++ b/src/serialization/resources/subscriptions/client/requests/SubscriptionsPatchRequest.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../../.."; -import * as Beehiiv from "../../../../../api"; +import * as serializers from "../../../../index"; +import * as Beehiiv from "../../../../../api/index"; import * as core from "../../../../../core"; import { SubscriptionsPatchRequestSubscriptionsItem } from "../../types/SubscriptionsPatchRequestSubscriptionsItem"; diff --git a/src/serialization/resources/subscriptions/client/requests/SubscriptionsPutRequest.ts b/src/serialization/resources/subscriptions/client/requests/SubscriptionsPutRequest.ts index 5495b0b..b06e105 100644 --- a/src/serialization/resources/subscriptions/client/requests/SubscriptionsPutRequest.ts +++ b/src/serialization/resources/subscriptions/client/requests/SubscriptionsPutRequest.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../../.."; -import * as Beehiiv from "../../../../../api"; +import * as serializers from "../../../../index"; +import * as Beehiiv from "../../../../../api/index"; import * as core from "../../../../../core"; import { SubscriptionsPutRequestSubscriptionsItem } from "../../types/SubscriptionsPutRequestSubscriptionsItem"; diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsCreateRequestDoubleOptOverride.ts b/src/serialization/resources/subscriptions/types/SubscriptionsCreateRequestDoubleOptOverride.ts index d383941..157b49b 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsCreateRequestDoubleOptOverride.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsCreateRequestDoubleOptOverride.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const SubscriptionsCreateRequestDoubleOptOverride: core.serialization.Schema< diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsCreateRequestTier.ts b/src/serialization/resources/subscriptions/types/SubscriptionsCreateRequestTier.ts index 7aba374..4465599 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsCreateRequestTier.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsCreateRequestTier.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const SubscriptionsCreateRequestTier: core.serialization.Schema< diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsCreateResponse.ts b/src/serialization/resources/subscriptions/types/SubscriptionsCreateResponse.ts index b07ef96..1467b5b 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsCreateResponse.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsCreateResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { Subscription } from "../../../types/Subscription"; diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsGetRequestExpandItem.ts b/src/serialization/resources/subscriptions/types/SubscriptionsGetRequestExpandItem.ts index 10ec944..cec4edc 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsGetRequestExpandItem.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsGetRequestExpandItem.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const SubscriptionsGetRequestExpandItem: core.serialization.Schema< diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsGetResponse.ts b/src/serialization/resources/subscriptions/types/SubscriptionsGetResponse.ts index 8b525a1..bdfe8c1 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsGetResponse.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsGetResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { Subscription } from "../../../types/Subscription"; diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsListRequestDirection.ts b/src/serialization/resources/subscriptions/types/SubscriptionsListRequestDirection.ts index 3d09c64..39ca816 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsListRequestDirection.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsListRequestDirection.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const SubscriptionsListRequestDirection: core.serialization.Schema< diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsListRequestExpandItem.ts b/src/serialization/resources/subscriptions/types/SubscriptionsListRequestExpandItem.ts index 4affd44..ad2aaaf 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsListRequestExpandItem.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsListRequestExpandItem.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const SubscriptionsListRequestExpandItem: core.serialization.Schema< diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsListRequestOrderBy.ts b/src/serialization/resources/subscriptions/types/SubscriptionsListRequestOrderBy.ts index feb95d8..15a7e49 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsListRequestOrderBy.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsListRequestOrderBy.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const SubscriptionsListRequestOrderBy: core.serialization.Schema< diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsListRequestStatus.ts b/src/serialization/resources/subscriptions/types/SubscriptionsListRequestStatus.ts index 31c63ce..3440161 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsListRequestStatus.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsListRequestStatus.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const SubscriptionsListRequestStatus: core.serialization.Schema< diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsListRequestTier.ts b/src/serialization/resources/subscriptions/types/SubscriptionsListRequestTier.ts index 497d253..0c0a5b5 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsListRequestTier.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsListRequestTier.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const SubscriptionsListRequestTier: core.serialization.Schema< diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsListResponse.ts b/src/serialization/resources/subscriptions/types/SubscriptionsListResponse.ts index 9670172..5814e17 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsListResponse.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsListResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { Subscription } from "../../../types/Subscription"; diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsPatchRequestNewStatus.ts b/src/serialization/resources/subscriptions/types/SubscriptionsPatchRequestNewStatus.ts index fcfcc48..89680da 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsPatchRequestNewStatus.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsPatchRequestNewStatus.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const SubscriptionsPatchRequestNewStatus: core.serialization.Schema< diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsPatchRequestSubscriptionsItem.ts b/src/serialization/resources/subscriptions/types/SubscriptionsPatchRequestSubscriptionsItem.ts index 9231a75..73948df 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsPatchRequestSubscriptionsItem.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsPatchRequestSubscriptionsItem.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { SubscriptionsPatchRequestSubscriptionsItemTier } from "./SubscriptionsPatchRequestSubscriptionsItemTier"; import { SubscriptionsPatchRequestSubscriptionsItemCustomFieldsItem } from "./SubscriptionsPatchRequestSubscriptionsItemCustomFieldsItem"; @@ -14,6 +14,7 @@ export const SubscriptionsPatchRequestSubscriptionsItem: core.serialization.Obje > = core.serialization.object({ subscriptionId: core.serialization.property("subscription_id", core.serialization.string()), tier: SubscriptionsPatchRequestSubscriptionsItemTier.optional(), + stripeCustomerId: core.serialization.property("stripe_customer_id", core.serialization.string().optional()), unsubscribe: core.serialization.boolean().optional(), customFields: core.serialization.property( "custom_fields", @@ -25,6 +26,7 @@ export declare namespace SubscriptionsPatchRequestSubscriptionsItem { interface Raw { subscription_id: string; tier?: SubscriptionsPatchRequestSubscriptionsItemTier.Raw | null; + stripe_customer_id?: string | null; unsubscribe?: boolean | null; custom_fields?: SubscriptionsPatchRequestSubscriptionsItemCustomFieldsItem.Raw[] | null; } diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsPatchRequestSubscriptionsItemCustomFieldsItem.ts b/src/serialization/resources/subscriptions/types/SubscriptionsPatchRequestSubscriptionsItemCustomFieldsItem.ts index 9e6ecbd..17c46a5 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsPatchRequestSubscriptionsItemCustomFieldsItem.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsPatchRequestSubscriptionsItemCustomFieldsItem.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const SubscriptionsPatchRequestSubscriptionsItemCustomFieldsItem: core.serialization.ObjectSchema< diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsPatchRequestSubscriptionsItemTier.ts b/src/serialization/resources/subscriptions/types/SubscriptionsPatchRequestSubscriptionsItemTier.ts index 2ff625b..aa5ba79 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsPatchRequestSubscriptionsItemTier.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsPatchRequestSubscriptionsItemTier.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const SubscriptionsPatchRequestSubscriptionsItemTier: core.serialization.Schema< diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsPatchResponse.ts b/src/serialization/resources/subscriptions/types/SubscriptionsPatchResponse.ts index ee4069b..f062bcf 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsPatchResponse.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsPatchResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { SubscriptionsPatchResponseData } from "./SubscriptionsPatchResponseData"; diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsPatchResponseData.ts b/src/serialization/resources/subscriptions/types/SubscriptionsPatchResponseData.ts index 72a23a4..2fd6b18 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsPatchResponseData.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsPatchResponseData.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const SubscriptionsPatchResponseData: core.serialization.ObjectSchema< diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsPutRequestCustomFieldsItem.ts b/src/serialization/resources/subscriptions/types/SubscriptionsPutRequestCustomFieldsItem.ts index 5ec93be..c8c4461 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsPutRequestCustomFieldsItem.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsPutRequestCustomFieldsItem.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const SubscriptionsPutRequestCustomFieldsItem: core.serialization.ObjectSchema< diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsPutRequestNewStatus.ts b/src/serialization/resources/subscriptions/types/SubscriptionsPutRequestNewStatus.ts index d17ea9c..5c5cb01 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsPutRequestNewStatus.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsPutRequestNewStatus.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const SubscriptionsPutRequestNewStatus: core.serialization.Schema< diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsPutRequestSubscriptionsItem.ts b/src/serialization/resources/subscriptions/types/SubscriptionsPutRequestSubscriptionsItem.ts index 215483e..470056e 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsPutRequestSubscriptionsItem.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsPutRequestSubscriptionsItem.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { SubscriptionsPutRequestSubscriptionsItemTier } from "./SubscriptionsPutRequestSubscriptionsItemTier"; import { SubscriptionsPutRequestSubscriptionsItemCustomFieldsItem } from "./SubscriptionsPutRequestSubscriptionsItemCustomFieldsItem"; @@ -14,6 +14,7 @@ export const SubscriptionsPutRequestSubscriptionsItem: core.serialization.Object > = core.serialization.object({ subscriptionId: core.serialization.property("subscription_id", core.serialization.string()), tier: SubscriptionsPutRequestSubscriptionsItemTier.optional(), + stripeCustomerId: core.serialization.property("stripe_customer_id", core.serialization.string().optional()), unsubscribe: core.serialization.boolean().optional(), customFields: core.serialization.property( "custom_fields", @@ -25,6 +26,7 @@ export declare namespace SubscriptionsPutRequestSubscriptionsItem { interface Raw { subscription_id: string; tier?: SubscriptionsPutRequestSubscriptionsItemTier.Raw | null; + stripe_customer_id?: string | null; unsubscribe?: boolean | null; custom_fields?: SubscriptionsPutRequestSubscriptionsItemCustomFieldsItem.Raw[] | null; } diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsPutRequestSubscriptionsItemCustomFieldsItem.ts b/src/serialization/resources/subscriptions/types/SubscriptionsPutRequestSubscriptionsItemCustomFieldsItem.ts index 532d472..bd810f2 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsPutRequestSubscriptionsItemCustomFieldsItem.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsPutRequestSubscriptionsItemCustomFieldsItem.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const SubscriptionsPutRequestSubscriptionsItemCustomFieldsItem: core.serialization.ObjectSchema< diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsPutRequestSubscriptionsItemTier.ts b/src/serialization/resources/subscriptions/types/SubscriptionsPutRequestSubscriptionsItemTier.ts index e1e0e96..2eedfc6 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsPutRequestSubscriptionsItemTier.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsPutRequestSubscriptionsItemTier.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const SubscriptionsPutRequestSubscriptionsItemTier: core.serialization.Schema< diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsPutRequestTier.ts b/src/serialization/resources/subscriptions/types/SubscriptionsPutRequestTier.ts index f088112..f36a758 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsPutRequestTier.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsPutRequestTier.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const SubscriptionsPutRequestTier: core.serialization.Schema< diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsPutResponse.ts b/src/serialization/resources/subscriptions/types/SubscriptionsPutResponse.ts index 3deac08..8643bb2 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsPutResponse.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsPutResponse.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; import { SubscriptionsPutResponseData } from "./SubscriptionsPutResponseData"; diff --git a/src/serialization/resources/subscriptions/types/SubscriptionsPutResponseData.ts b/src/serialization/resources/subscriptions/types/SubscriptionsPutResponseData.ts index b736d91..f355d7c 100644 --- a/src/serialization/resources/subscriptions/types/SubscriptionsPutResponseData.ts +++ b/src/serialization/resources/subscriptions/types/SubscriptionsPutResponseData.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../.."; -import * as Beehiiv from "../../../../api"; +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; import * as core from "../../../../core"; export const SubscriptionsPutResponseData: core.serialization.ObjectSchema< diff --git a/src/serialization/resources/tiers/client/index.ts b/src/serialization/resources/tiers/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/serialization/resources/tiers/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/tiers/client/requests/PatchPublicationsPublicationIdTiersTierIdRequest.ts b/src/serialization/resources/tiers/client/requests/PatchPublicationsPublicationIdTiersTierIdRequest.ts new file mode 100644 index 0000000..c98d644 --- /dev/null +++ b/src/serialization/resources/tiers/client/requests/PatchPublicationsPublicationIdTiersTierIdRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Beehiiv from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem } from "../../types/PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem"; + +export const PatchPublicationsPublicationIdTiersTierIdRequest: core.serialization.Schema< + serializers.PatchPublicationsPublicationIdTiersTierIdRequest.Raw, + Beehiiv.PatchPublicationsPublicationIdTiersTierIdRequest +> = core.serialization.object({ + name: core.serialization.string().optional(), + description: core.serialization.string().optional(), + pricesAttributes: core.serialization.property( + "prices_attributes", + core.serialization.list(PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem).optional() + ), +}); + +export declare namespace PatchPublicationsPublicationIdTiersTierIdRequest { + interface Raw { + name?: string | null; + description?: string | null; + prices_attributes?: PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem.Raw[] | null; + } +} diff --git a/src/serialization/resources/tiers/client/requests/PostPublicationsPublicationIdTiersRequest.ts b/src/serialization/resources/tiers/client/requests/PostPublicationsPublicationIdTiersRequest.ts new file mode 100644 index 0000000..255be46 --- /dev/null +++ b/src/serialization/resources/tiers/client/requests/PostPublicationsPublicationIdTiersRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Beehiiv from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { PostPublicationsPublicationIdTiersRequestPricesAttributesItem } from "../../types/PostPublicationsPublicationIdTiersRequestPricesAttributesItem"; + +export const PostPublicationsPublicationIdTiersRequest: core.serialization.Schema< + serializers.PostPublicationsPublicationIdTiersRequest.Raw, + Beehiiv.PostPublicationsPublicationIdTiersRequest +> = core.serialization.object({ + name: core.serialization.string(), + description: core.serialization.string().optional(), + pricesAttributes: core.serialization.property( + "prices_attributes", + core.serialization.list(PostPublicationsPublicationIdTiersRequestPricesAttributesItem).optional() + ), +}); + +export declare namespace PostPublicationsPublicationIdTiersRequest { + interface Raw { + name: string; + description?: string | null; + prices_attributes?: PostPublicationsPublicationIdTiersRequestPricesAttributesItem.Raw[] | null; + } +} diff --git a/src/serialization/resources/tiers/client/requests/PutPublicationsPublicationIdTiersTierIdRequest.ts b/src/serialization/resources/tiers/client/requests/PutPublicationsPublicationIdTiersTierIdRequest.ts new file mode 100644 index 0000000..10e010e --- /dev/null +++ b/src/serialization/resources/tiers/client/requests/PutPublicationsPublicationIdTiersTierIdRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Beehiiv from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem } from "../../types/PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem"; + +export const PutPublicationsPublicationIdTiersTierIdRequest: core.serialization.Schema< + serializers.PutPublicationsPublicationIdTiersTierIdRequest.Raw, + Beehiiv.PutPublicationsPublicationIdTiersTierIdRequest +> = core.serialization.object({ + name: core.serialization.string().optional(), + description: core.serialization.string().optional(), + pricesAttributes: core.serialization.property( + "prices_attributes", + core.serialization.list(PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem).optional() + ), +}); + +export declare namespace PutPublicationsPublicationIdTiersTierIdRequest { + interface Raw { + name?: string | null; + description?: string | null; + prices_attributes?: PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem.Raw[] | null; + } +} diff --git a/src/serialization/resources/tiers/client/requests/index.ts b/src/serialization/resources/tiers/client/requests/index.ts new file mode 100644 index 0000000..670e21b --- /dev/null +++ b/src/serialization/resources/tiers/client/requests/index.ts @@ -0,0 +1,3 @@ +export { PostPublicationsPublicationIdTiersRequest } from "./PostPublicationsPublicationIdTiersRequest"; +export { PutPublicationsPublicationIdTiersTierIdRequest } from "./PutPublicationsPublicationIdTiersTierIdRequest"; +export { PatchPublicationsPublicationIdTiersTierIdRequest } from "./PatchPublicationsPublicationIdTiersTierIdRequest"; diff --git a/src/serialization/resources/tiers/index.ts b/src/serialization/resources/tiers/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/serialization/resources/tiers/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/serialization/resources/tiers/types/GetPublicationsPublicationIdTiersRequestDirection.ts b/src/serialization/resources/tiers/types/GetPublicationsPublicationIdTiersRequestDirection.ts new file mode 100644 index 0000000..2ff3813 --- /dev/null +++ b/src/serialization/resources/tiers/types/GetPublicationsPublicationIdTiersRequestDirection.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; +import * as core from "../../../../core"; + +export const GetPublicationsPublicationIdTiersRequestDirection: core.serialization.Schema< + serializers.GetPublicationsPublicationIdTiersRequestDirection.Raw, + Beehiiv.GetPublicationsPublicationIdTiersRequestDirection +> = core.serialization.enum_(["asc", "desc"]); + +export declare namespace GetPublicationsPublicationIdTiersRequestDirection { + type Raw = "asc" | "desc"; +} diff --git a/src/serialization/resources/tiers/types/GetPublicationsPublicationIdTiersResponse.ts b/src/serialization/resources/tiers/types/GetPublicationsPublicationIdTiersResponse.ts new file mode 100644 index 0000000..53a7ef8 --- /dev/null +++ b/src/serialization/resources/tiers/types/GetPublicationsPublicationIdTiersResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; +import * as core from "../../../../core"; +import { Tier } from "../../../types/Tier"; + +export const GetPublicationsPublicationIdTiersResponse: core.serialization.ObjectSchema< + serializers.GetPublicationsPublicationIdTiersResponse.Raw, + Beehiiv.GetPublicationsPublicationIdTiersResponse +> = core.serialization.object({ + data: core.serialization.list(Tier), + limit: core.serialization.number(), + page: core.serialization.number(), + totalResults: core.serialization.property("total_results", core.serialization.number()), + totalPages: core.serialization.property("total_pages", core.serialization.number()), +}); + +export declare namespace GetPublicationsPublicationIdTiersResponse { + interface Raw { + data: Tier.Raw[]; + limit: number; + page: number; + total_results: number; + total_pages: number; + } +} diff --git a/src/serialization/resources/tiers/types/GetPublicationsPublicationIdTiersTierIdResponse.ts b/src/serialization/resources/tiers/types/GetPublicationsPublicationIdTiersTierIdResponse.ts new file mode 100644 index 0000000..8943f5f --- /dev/null +++ b/src/serialization/resources/tiers/types/GetPublicationsPublicationIdTiersTierIdResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; +import * as core from "../../../../core"; +import { Tier } from "../../../types/Tier"; + +export const GetPublicationsPublicationIdTiersTierIdResponse: core.serialization.ObjectSchema< + serializers.GetPublicationsPublicationIdTiersTierIdResponse.Raw, + Beehiiv.GetPublicationsPublicationIdTiersTierIdResponse +> = core.serialization.object({ + data: Tier.optional(), +}); + +export declare namespace GetPublicationsPublicationIdTiersTierIdResponse { + interface Raw { + data?: Tier.Raw | null; + } +} diff --git a/src/serialization/resources/tiers/types/PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem.ts b/src/serialization/resources/tiers/types/PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem.ts new file mode 100644 index 0000000..3d736aa --- /dev/null +++ b/src/serialization/resources/tiers/types/PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; +import * as core from "../../../../core"; +import { PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency } from "./PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency"; +import { PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval } from "./PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval"; + +export const PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem: core.serialization.ObjectSchema< + serializers.PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem.Raw, + Beehiiv.PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem +> = core.serialization.object({ + id: core.serialization.string(), + currency: PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency, + amountCents: core.serialization.property("amount_cents", core.serialization.number()), + interval: PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval, + intervalDisplay: core.serialization.property("interval_display", core.serialization.string().optional()), + cta: core.serialization.string().optional(), + features: core.serialization.list(core.serialization.string()).optional(), + delete: core.serialization.boolean().optional(), +}); + +export declare namespace PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem { + interface Raw { + id: string; + currency: PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency.Raw; + amount_cents: number; + interval: PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval.Raw; + interval_display?: string | null; + cta?: string | null; + features?: string[] | null; + delete?: boolean | null; + } +} diff --git a/src/serialization/resources/tiers/types/PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency.ts b/src/serialization/resources/tiers/types/PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency.ts new file mode 100644 index 0000000..872be6e --- /dev/null +++ b/src/serialization/resources/tiers/types/PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; +import * as core from "../../../../core"; + +export const PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency: core.serialization.Schema< + serializers.PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency.Raw, + Beehiiv.PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency +> = core.serialization.enum_(["usd", "aud", "cad", "eur", "inr", "brl"]); + +export declare namespace PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency { + type Raw = "usd" | "aud" | "cad" | "eur" | "inr" | "brl"; +} diff --git a/src/serialization/resources/tiers/types/PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval.ts b/src/serialization/resources/tiers/types/PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval.ts new file mode 100644 index 0000000..9dbad71 --- /dev/null +++ b/src/serialization/resources/tiers/types/PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; +import * as core from "../../../../core"; + +export const PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval: core.serialization.Schema< + serializers.PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval.Raw, + Beehiiv.PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval +> = core.serialization.enum_(["month", "year"]); + +export declare namespace PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval { + type Raw = "month" | "year"; +} diff --git a/src/serialization/resources/tiers/types/PatchPublicationsPublicationIdTiersTierIdResponse.ts b/src/serialization/resources/tiers/types/PatchPublicationsPublicationIdTiersTierIdResponse.ts new file mode 100644 index 0000000..3b244ba --- /dev/null +++ b/src/serialization/resources/tiers/types/PatchPublicationsPublicationIdTiersTierIdResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; +import * as core from "../../../../core"; +import { Tier } from "../../../types/Tier"; + +export const PatchPublicationsPublicationIdTiersTierIdResponse: core.serialization.ObjectSchema< + serializers.PatchPublicationsPublicationIdTiersTierIdResponse.Raw, + Beehiiv.PatchPublicationsPublicationIdTiersTierIdResponse +> = core.serialization.object({ + data: Tier.optional(), +}); + +export declare namespace PatchPublicationsPublicationIdTiersTierIdResponse { + interface Raw { + data?: Tier.Raw | null; + } +} diff --git a/src/serialization/resources/tiers/types/PostPublicationsPublicationIdTiersRequestPricesAttributesItem.ts b/src/serialization/resources/tiers/types/PostPublicationsPublicationIdTiersRequestPricesAttributesItem.ts new file mode 100644 index 0000000..ad49949 --- /dev/null +++ b/src/serialization/resources/tiers/types/PostPublicationsPublicationIdTiersRequestPricesAttributesItem.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; +import * as core from "../../../../core"; +import { PostPublicationsPublicationIdTiersRequestPricesAttributesItemCurrency } from "./PostPublicationsPublicationIdTiersRequestPricesAttributesItemCurrency"; +import { PostPublicationsPublicationIdTiersRequestPricesAttributesItemInterval } from "./PostPublicationsPublicationIdTiersRequestPricesAttributesItemInterval"; + +export const PostPublicationsPublicationIdTiersRequestPricesAttributesItem: core.serialization.ObjectSchema< + serializers.PostPublicationsPublicationIdTiersRequestPricesAttributesItem.Raw, + Beehiiv.PostPublicationsPublicationIdTiersRequestPricesAttributesItem +> = core.serialization.object({ + currency: PostPublicationsPublicationIdTiersRequestPricesAttributesItemCurrency, + amountCents: core.serialization.property("amount_cents", core.serialization.number()), + enabled: core.serialization.boolean().optional(), + interval: PostPublicationsPublicationIdTiersRequestPricesAttributesItemInterval, + intervalDisplay: core.serialization.property("interval_display", core.serialization.string().optional()), + cta: core.serialization.string().optional(), + features: core.serialization.list(core.serialization.string()).optional(), +}); + +export declare namespace PostPublicationsPublicationIdTiersRequestPricesAttributesItem { + interface Raw { + currency: PostPublicationsPublicationIdTiersRequestPricesAttributesItemCurrency.Raw; + amount_cents: number; + enabled?: boolean | null; + interval: PostPublicationsPublicationIdTiersRequestPricesAttributesItemInterval.Raw; + interval_display?: string | null; + cta?: string | null; + features?: string[] | null; + } +} diff --git a/src/serialization/resources/tiers/types/PostPublicationsPublicationIdTiersRequestPricesAttributesItemCurrency.ts b/src/serialization/resources/tiers/types/PostPublicationsPublicationIdTiersRequestPricesAttributesItemCurrency.ts new file mode 100644 index 0000000..b3979dd --- /dev/null +++ b/src/serialization/resources/tiers/types/PostPublicationsPublicationIdTiersRequestPricesAttributesItemCurrency.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; +import * as core from "../../../../core"; + +export const PostPublicationsPublicationIdTiersRequestPricesAttributesItemCurrency: core.serialization.Schema< + serializers.PostPublicationsPublicationIdTiersRequestPricesAttributesItemCurrency.Raw, + Beehiiv.PostPublicationsPublicationIdTiersRequestPricesAttributesItemCurrency +> = core.serialization.enum_(["usd", "aud", "cad", "eur", "inr", "brl"]); + +export declare namespace PostPublicationsPublicationIdTiersRequestPricesAttributesItemCurrency { + type Raw = "usd" | "aud" | "cad" | "eur" | "inr" | "brl"; +} diff --git a/src/serialization/resources/tiers/types/PostPublicationsPublicationIdTiersRequestPricesAttributesItemInterval.ts b/src/serialization/resources/tiers/types/PostPublicationsPublicationIdTiersRequestPricesAttributesItemInterval.ts new file mode 100644 index 0000000..22d2ae6 --- /dev/null +++ b/src/serialization/resources/tiers/types/PostPublicationsPublicationIdTiersRequestPricesAttributesItemInterval.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; +import * as core from "../../../../core"; + +export const PostPublicationsPublicationIdTiersRequestPricesAttributesItemInterval: core.serialization.Schema< + serializers.PostPublicationsPublicationIdTiersRequestPricesAttributesItemInterval.Raw, + Beehiiv.PostPublicationsPublicationIdTiersRequestPricesAttributesItemInterval +> = core.serialization.enum_(["month", "year"]); + +export declare namespace PostPublicationsPublicationIdTiersRequestPricesAttributesItemInterval { + type Raw = "month" | "year"; +} diff --git a/src/serialization/resources/tiers/types/PostPublicationsPublicationIdTiersResponse.ts b/src/serialization/resources/tiers/types/PostPublicationsPublicationIdTiersResponse.ts new file mode 100644 index 0000000..636d8de --- /dev/null +++ b/src/serialization/resources/tiers/types/PostPublicationsPublicationIdTiersResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; +import * as core from "../../../../core"; +import { Tier } from "../../../types/Tier"; + +export const PostPublicationsPublicationIdTiersResponse: core.serialization.ObjectSchema< + serializers.PostPublicationsPublicationIdTiersResponse.Raw, + Beehiiv.PostPublicationsPublicationIdTiersResponse +> = core.serialization.object({ + data: Tier.optional(), +}); + +export declare namespace PostPublicationsPublicationIdTiersResponse { + interface Raw { + data?: Tier.Raw | null; + } +} diff --git a/src/serialization/resources/tiers/types/PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem.ts b/src/serialization/resources/tiers/types/PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem.ts new file mode 100644 index 0000000..db21898 --- /dev/null +++ b/src/serialization/resources/tiers/types/PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; +import * as core from "../../../../core"; +import { PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency } from "./PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency"; +import { PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval } from "./PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval"; + +export const PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem: core.serialization.ObjectSchema< + serializers.PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem.Raw, + Beehiiv.PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem +> = core.serialization.object({ + id: core.serialization.string(), + currency: PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency, + amountCents: core.serialization.property("amount_cents", core.serialization.number()), + interval: PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval, + intervalDisplay: core.serialization.property("interval_display", core.serialization.string().optional()), + cta: core.serialization.string().optional(), + features: core.serialization.list(core.serialization.string()).optional(), + delete: core.serialization.boolean().optional(), +}); + +export declare namespace PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem { + interface Raw { + id: string; + currency: PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency.Raw; + amount_cents: number; + interval: PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval.Raw; + interval_display?: string | null; + cta?: string | null; + features?: string[] | null; + delete?: boolean | null; + } +} diff --git a/src/serialization/resources/tiers/types/PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency.ts b/src/serialization/resources/tiers/types/PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency.ts new file mode 100644 index 0000000..e92e9f2 --- /dev/null +++ b/src/serialization/resources/tiers/types/PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; +import * as core from "../../../../core"; + +export const PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency: core.serialization.Schema< + serializers.PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency.Raw, + Beehiiv.PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency +> = core.serialization.enum_(["usd", "aud", "cad", "eur", "inr", "brl"]); + +export declare namespace PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency { + type Raw = "usd" | "aud" | "cad" | "eur" | "inr" | "brl"; +} diff --git a/src/serialization/resources/tiers/types/PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval.ts b/src/serialization/resources/tiers/types/PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval.ts new file mode 100644 index 0000000..78ed301 --- /dev/null +++ b/src/serialization/resources/tiers/types/PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; +import * as core from "../../../../core"; + +export const PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval: core.serialization.Schema< + serializers.PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval.Raw, + Beehiiv.PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval +> = core.serialization.enum_(["month", "year"]); + +export declare namespace PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval { + type Raw = "month" | "year"; +} diff --git a/src/serialization/resources/tiers/types/PutPublicationsPublicationIdTiersTierIdResponse.ts b/src/serialization/resources/tiers/types/PutPublicationsPublicationIdTiersTierIdResponse.ts new file mode 100644 index 0000000..ae84e7a --- /dev/null +++ b/src/serialization/resources/tiers/types/PutPublicationsPublicationIdTiersTierIdResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; +import * as core from "../../../../core"; +import { Tier } from "../../../types/Tier"; + +export const PutPublicationsPublicationIdTiersTierIdResponse: core.serialization.ObjectSchema< + serializers.PutPublicationsPublicationIdTiersTierIdResponse.Raw, + Beehiiv.PutPublicationsPublicationIdTiersTierIdResponse +> = core.serialization.object({ + data: Tier.optional(), +}); + +export declare namespace PutPublicationsPublicationIdTiersTierIdResponse { + interface Raw { + data?: Tier.Raw | null; + } +} diff --git a/src/serialization/resources/tiers/types/index.ts b/src/serialization/resources/tiers/types/index.ts new file mode 100644 index 0000000..2414d89 --- /dev/null +++ b/src/serialization/resources/tiers/types/index.ts @@ -0,0 +1,15 @@ +export * from "./GetPublicationsPublicationIdTiersRequestDirection"; +export * from "./GetPublicationsPublicationIdTiersResponse"; +export * from "./PostPublicationsPublicationIdTiersRequestPricesAttributesItemCurrency"; +export * from "./PostPublicationsPublicationIdTiersRequestPricesAttributesItemInterval"; +export * from "./PostPublicationsPublicationIdTiersRequestPricesAttributesItem"; +export * from "./PostPublicationsPublicationIdTiersResponse"; +export * from "./GetPublicationsPublicationIdTiersTierIdResponse"; +export * from "./PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency"; +export * from "./PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval"; +export * from "./PutPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem"; +export * from "./PutPublicationsPublicationIdTiersTierIdResponse"; +export * from "./PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemCurrency"; +export * from "./PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItemInterval"; +export * from "./PatchPublicationsPublicationIdTiersTierIdRequestPricesAttributesItem"; +export * from "./PatchPublicationsPublicationIdTiersTierIdResponse"; diff --git a/src/serialization/resources/webhooks/client/deleteWebhooksWebhookId.ts b/src/serialization/resources/webhooks/client/deleteWebhooksWebhookId.ts new file mode 100644 index 0000000..753cd49 --- /dev/null +++ b/src/serialization/resources/webhooks/client/deleteWebhooksWebhookId.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as core from "../../../../core"; + +export const Response: core.serialization.Schema< + serializers.webhooks.deleteWebhooksWebhookId.Response.Raw, + Record +> = core.serialization.record(core.serialization.string(), core.serialization.unknown()); + +export declare namespace Response { + type Raw = Record; +} diff --git a/src/serialization/resources/webhooks/client/index.ts b/src/serialization/resources/webhooks/client/index.ts new file mode 100644 index 0000000..41383ad --- /dev/null +++ b/src/serialization/resources/webhooks/client/index.ts @@ -0,0 +1,2 @@ +export * as deleteWebhooksWebhookId from "./deleteWebhooksWebhookId"; +export * from "./requests"; diff --git a/src/serialization/resources/webhooks/client/requests/PostWebhooksRequest.ts b/src/serialization/resources/webhooks/client/requests/PostWebhooksRequest.ts new file mode 100644 index 0000000..5309829 --- /dev/null +++ b/src/serialization/resources/webhooks/client/requests/PostWebhooksRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Beehiiv from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { PostWebhooksRequestEventTypesItem } from "../../types/PostWebhooksRequestEventTypesItem"; + +export const PostWebhooksRequest: core.serialization.Schema< + serializers.PostWebhooksRequest.Raw, + Beehiiv.PostWebhooksRequest +> = core.serialization.object({ + url: core.serialization.string(), + eventTypes: core.serialization.property("event_types", core.serialization.list(PostWebhooksRequestEventTypesItem)), + description: core.serialization.string().optional(), +}); + +export declare namespace PostWebhooksRequest { + interface Raw { + url: string; + event_types: PostWebhooksRequestEventTypesItem.Raw[]; + description?: string | null; + } +} diff --git a/src/serialization/resources/webhooks/client/requests/index.ts b/src/serialization/resources/webhooks/client/requests/index.ts new file mode 100644 index 0000000..1373488 --- /dev/null +++ b/src/serialization/resources/webhooks/client/requests/index.ts @@ -0,0 +1 @@ +export { PostWebhooksRequest } from "./PostWebhooksRequest"; diff --git a/src/serialization/resources/webhooks/index.ts b/src/serialization/resources/webhooks/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/serialization/resources/webhooks/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/serialization/resources/webhooks/types/GetPublicationsPublicationIdWebhooksWebhookIdTestsResponse.ts b/src/serialization/resources/webhooks/types/GetPublicationsPublicationIdWebhooksWebhookIdTestsResponse.ts new file mode 100644 index 0000000..de67925 --- /dev/null +++ b/src/serialization/resources/webhooks/types/GetPublicationsPublicationIdWebhooksWebhookIdTestsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; +import * as core from "../../../../core"; + +export const GetPublicationsPublicationIdWebhooksWebhookIdTestsResponse: core.serialization.ObjectSchema< + serializers.GetPublicationsPublicationIdWebhooksWebhookIdTestsResponse.Raw, + Beehiiv.GetPublicationsPublicationIdWebhooksWebhookIdTestsResponse +> = core.serialization.object({ + data: core.serialization.record(core.serialization.string(), core.serialization.unknown()), + eventTimestamp: core.serialization.property("event_timestamp", core.serialization.number()), + eventType: core.serialization.property("event_type", core.serialization.string()), + uid: core.serialization.string(), +}); + +export declare namespace GetPublicationsPublicationIdWebhooksWebhookIdTestsResponse { + interface Raw { + data: Record; + event_timestamp: number; + event_type: string; + uid: string; + } +} diff --git a/src/serialization/resources/webhooks/types/GetWebhooksResponse.ts b/src/serialization/resources/webhooks/types/GetWebhooksResponse.ts new file mode 100644 index 0000000..daa28d8 --- /dev/null +++ b/src/serialization/resources/webhooks/types/GetWebhooksResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; +import * as core from "../../../../core"; +import { Webhook } from "../../../types/Webhook"; + +export const GetWebhooksResponse: core.serialization.ObjectSchema< + serializers.GetWebhooksResponse.Raw, + Beehiiv.GetWebhooksResponse +> = core.serialization.object({ + data: core.serialization.list(Webhook), +}); + +export declare namespace GetWebhooksResponse { + interface Raw { + data: Webhook.Raw[]; + } +} diff --git a/src/serialization/resources/webhooks/types/GetWebhooksWebhookIdResponse.ts b/src/serialization/resources/webhooks/types/GetWebhooksWebhookIdResponse.ts new file mode 100644 index 0000000..27f21ba --- /dev/null +++ b/src/serialization/resources/webhooks/types/GetWebhooksWebhookIdResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; +import * as core from "../../../../core"; +import { Webhook } from "../../../types/Webhook"; + +export const GetWebhooksWebhookIdResponse: core.serialization.ObjectSchema< + serializers.GetWebhooksWebhookIdResponse.Raw, + Beehiiv.GetWebhooksWebhookIdResponse +> = core.serialization.object({ + data: Webhook, +}); + +export declare namespace GetWebhooksWebhookIdResponse { + interface Raw { + data: Webhook.Raw; + } +} diff --git a/src/serialization/resources/webhooks/types/PostWebhooksRequestEventTypesItem.ts b/src/serialization/resources/webhooks/types/PostWebhooksRequestEventTypesItem.ts new file mode 100644 index 0000000..1a885b6 --- /dev/null +++ b/src/serialization/resources/webhooks/types/PostWebhooksRequestEventTypesItem.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; +import * as core from "../../../../core"; + +export const PostWebhooksRequestEventTypesItem: core.serialization.Schema< + serializers.PostWebhooksRequestEventTypesItem.Raw, + Beehiiv.PostWebhooksRequestEventTypesItem +> = core.serialization.enum_([ + "post.sent", + "subscription.confirmed", + "subscription.created", + "subscription.downgraded", + "subscription.upgraded", + "subscription.deleted", + "survey.response_submitted", +]); + +export declare namespace PostWebhooksRequestEventTypesItem { + type Raw = + | "post.sent" + | "subscription.confirmed" + | "subscription.created" + | "subscription.downgraded" + | "subscription.upgraded" + | "subscription.deleted" + | "survey.response_submitted"; +} diff --git a/src/serialization/resources/webhooks/types/PostWebhooksResponse.ts b/src/serialization/resources/webhooks/types/PostWebhooksResponse.ts new file mode 100644 index 0000000..d3a4b5d --- /dev/null +++ b/src/serialization/resources/webhooks/types/PostWebhooksResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Beehiiv from "../../../../api/index"; +import * as core from "../../../../core"; +import { Webhook } from "../../../types/Webhook"; + +export const PostWebhooksResponse: core.serialization.ObjectSchema< + serializers.PostWebhooksResponse.Raw, + Beehiiv.PostWebhooksResponse +> = core.serialization.object({ + data: Webhook, +}); + +export declare namespace PostWebhooksResponse { + interface Raw { + data: Webhook.Raw; + } +} diff --git a/src/serialization/resources/webhooks/types/index.ts b/src/serialization/resources/webhooks/types/index.ts new file mode 100644 index 0000000..412e013 --- /dev/null +++ b/src/serialization/resources/webhooks/types/index.ts @@ -0,0 +1,5 @@ +export * from "./GetWebhooksResponse"; +export * from "./PostWebhooksRequestEventTypesItem"; +export * from "./PostWebhooksResponse"; +export * from "./GetWebhooksWebhookIdResponse"; +export * from "./GetPublicationsPublicationIdWebhooksWebhookIdTestsResponse"; diff --git a/src/serialization/types/Automation.ts b/src/serialization/types/Automation.ts index 08c44b3..ab0336d 100644 --- a/src/serialization/types/Automation.ts +++ b/src/serialization/types/Automation.ts @@ -2,16 +2,21 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; import { AutomationStatus } from "./AutomationStatus"; +import { AutomationTriggerEventsItem } from "./AutomationTriggerEventsItem"; export const Automation: core.serialization.ObjectSchema = core.serialization.object({ id: core.serialization.string(), status: AutomationStatus, name: core.serialization.string(), + triggerEvents: core.serialization.property( + "trigger_events", + core.serialization.list(AutomationTriggerEventsItem) + ), description: core.serialization.string().optional(), }); @@ -20,6 +25,7 @@ export declare namespace Automation { id: string; status: AutomationStatus.Raw; name: string; + trigger_events: AutomationTriggerEventsItem.Raw[]; description?: string | null; } } diff --git a/src/serialization/types/AutomationJourney.ts b/src/serialization/types/AutomationJourney.ts index f3f4d06..d6396d7 100644 --- a/src/serialization/types/AutomationJourney.ts +++ b/src/serialization/types/AutomationJourney.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; import { AutomationJourneyStatus } from "./AutomationJourneyStatus"; diff --git a/src/serialization/types/AutomationJourneyStatus.ts b/src/serialization/types/AutomationJourneyStatus.ts index ac9adc2..df79d7e 100644 --- a/src/serialization/types/AutomationJourneyStatus.ts +++ b/src/serialization/types/AutomationJourneyStatus.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; export const AutomationJourneyStatus: core.serialization.Schema< diff --git a/src/serialization/types/AutomationStatus.ts b/src/serialization/types/AutomationStatus.ts index abe5a2b..69d0aab 100644 --- a/src/serialization/types/AutomationStatus.ts +++ b/src/serialization/types/AutomationStatus.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; export const AutomationStatus: core.serialization.Schema = diff --git a/src/serialization/types/AutomationTriggerEventsItem.ts b/src/serialization/types/AutomationTriggerEventsItem.ts new file mode 100644 index 0000000..b66a2e5 --- /dev/null +++ b/src/serialization/types/AutomationTriggerEventsItem.ts @@ -0,0 +1,39 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; +import * as core from "../../core"; + +export const AutomationTriggerEventsItem: core.serialization.Schema< + serializers.AutomationTriggerEventsItem.Raw, + Beehiiv.AutomationTriggerEventsItem +> = core.serialization.enum_([ + "api", + "downgrade", + "email_submission", + "form_submission", + "manual", + "poll_submission", + "referral_action", + "segment_action", + "signup", + "unengaged", + "upgrade", +]); + +export declare namespace AutomationTriggerEventsItem { + type Raw = + | "api" + | "downgrade" + | "email_submission" + | "form_submission" + | "manual" + | "poll_submission" + | "referral_action" + | "segment_action" + | "signup" + | "unengaged" + | "upgrade"; +} diff --git a/src/serialization/types/ClickStats.ts b/src/serialization/types/ClickStats.ts index 1367196..5fa8940 100644 --- a/src/serialization/types/ClickStats.ts +++ b/src/serialization/types/ClickStats.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; import { PostClickStatsEmail } from "./PostClickStatsEmail"; import { PostClickStatsWeb } from "./PostClickStatsWeb"; diff --git a/src/serialization/types/CustomField.ts b/src/serialization/types/CustomField.ts index a04e00e..07f5bb4 100644 --- a/src/serialization/types/CustomField.ts +++ b/src/serialization/types/CustomField.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; import { CustomFieldKind } from "./CustomFieldKind"; diff --git a/src/serialization/types/CustomFieldKind.ts b/src/serialization/types/CustomFieldKind.ts index 7ac7e70..c3121c6 100644 --- a/src/serialization/types/CustomFieldKind.ts +++ b/src/serialization/types/CustomFieldKind.ts @@ -2,13 +2,13 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; export const CustomFieldKind: core.serialization.Schema = - core.serialization.enum_(["string", "integer", "boolean", "date", "datetime"]); + core.serialization.enum_(["string", "integer", "boolean", "date", "datetime", "list"]); export declare namespace CustomFieldKind { - type Raw = "string" | "integer" | "boolean" | "date" | "datetime"; + type Raw = "string" | "integer" | "boolean" | "date" | "datetime" | "list"; } diff --git a/src/serialization/types/CustomFieldValue.ts b/src/serialization/types/CustomFieldValue.ts index d210548..14861bd 100644 --- a/src/serialization/types/CustomFieldValue.ts +++ b/src/serialization/types/CustomFieldValue.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; export const CustomFieldValue: core.serialization.ObjectSchema< diff --git a/src/serialization/types/EmailBlast.ts b/src/serialization/types/EmailBlast.ts index 7d3c46f..f0fbd6f 100644 --- a/src/serialization/types/EmailBlast.ts +++ b/src/serialization/types/EmailBlast.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; import { EmailBlastStatus } from "./EmailBlastStatus"; import { EmailBlastStats } from "./EmailBlastStats"; diff --git a/src/serialization/types/EmailBlastContent.ts b/src/serialization/types/EmailBlastContent.ts index 38d3f6f..560430b 100644 --- a/src/serialization/types/EmailBlastContent.ts +++ b/src/serialization/types/EmailBlastContent.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; import { EmailBlastContentEmail } from "./EmailBlastContentEmail"; diff --git a/src/serialization/types/EmailBlastContentEmail.ts b/src/serialization/types/EmailBlastContentEmail.ts index 16abcd4..274ed9c 100644 --- a/src/serialization/types/EmailBlastContentEmail.ts +++ b/src/serialization/types/EmailBlastContentEmail.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; export const EmailBlastContentEmail: core.serialization.ObjectSchema< diff --git a/src/serialization/types/EmailBlastStats.ts b/src/serialization/types/EmailBlastStats.ts index 46aec89..e8bf95d 100644 --- a/src/serialization/types/EmailBlastStats.ts +++ b/src/serialization/types/EmailBlastStats.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; import { EmailBlastStatsEmail } from "./EmailBlastStatsEmail"; import { EmailBlastStatsClicksItem } from "./EmailBlastStatsClicksItem"; diff --git a/src/serialization/types/EmailBlastStatsClicksItem.ts b/src/serialization/types/EmailBlastStatsClicksItem.ts index 83dba96..7e874c6 100644 --- a/src/serialization/types/EmailBlastStatsClicksItem.ts +++ b/src/serialization/types/EmailBlastStatsClicksItem.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; export const EmailBlastStatsClicksItem: core.serialization.ObjectSchema< diff --git a/src/serialization/types/EmailBlastStatsEmail.ts b/src/serialization/types/EmailBlastStatsEmail.ts index 8cb2169..5330073 100644 --- a/src/serialization/types/EmailBlastStatsEmail.ts +++ b/src/serialization/types/EmailBlastStatsEmail.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; export const EmailBlastStatsEmail: core.serialization.ObjectSchema< diff --git a/src/serialization/types/EmailBlastStatus.ts b/src/serialization/types/EmailBlastStatus.ts index 6e09357..67bc969 100644 --- a/src/serialization/types/EmailBlastStatus.ts +++ b/src/serialization/types/EmailBlastStatus.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; export const EmailBlastStatus: core.serialization.Schema = diff --git a/src/serialization/types/ErrorErrorsItem.ts b/src/serialization/types/ErrorErrorsItem.ts index e5ecf33..5b71742 100644 --- a/src/serialization/types/ErrorErrorsItem.ts +++ b/src/serialization/types/ErrorErrorsItem.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; export const ErrorErrorsItem: core.serialization.ObjectSchema< diff --git a/src/serialization/types/Error_.ts b/src/serialization/types/Error_.ts index 4efd7ef..353a9e3 100644 --- a/src/serialization/types/Error_.ts +++ b/src/serialization/types/Error_.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; import { ErrorErrorsItem } from "./ErrorErrorsItem"; diff --git a/src/serialization/types/Milestone.ts b/src/serialization/types/Milestone.ts index afd1882..7a04978 100644 --- a/src/serialization/types/Milestone.ts +++ b/src/serialization/types/Milestone.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; import { MilestoneReward } from "./MilestoneReward"; diff --git a/src/serialization/types/MilestoneReward.ts b/src/serialization/types/MilestoneReward.ts index 87a5013..9727c03 100644 --- a/src/serialization/types/MilestoneReward.ts +++ b/src/serialization/types/MilestoneReward.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; import { MilestoneRewardType } from "./MilestoneRewardType"; diff --git a/src/serialization/types/MilestoneRewardType.ts b/src/serialization/types/MilestoneRewardType.ts index e5cd066..87fdd6b 100644 --- a/src/serialization/types/MilestoneRewardType.ts +++ b/src/serialization/types/MilestoneRewardType.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; export const MilestoneRewardType: core.serialization.Schema< diff --git a/src/serialization/types/Post.ts b/src/serialization/types/Post.ts index 867325b..efc215b 100644 --- a/src/serialization/types/Post.ts +++ b/src/serialization/types/Post.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; import { PostStatus } from "./PostStatus"; import { PostAudience } from "./PostAudience"; diff --git a/src/serialization/types/PostAudience.ts b/src/serialization/types/PostAudience.ts index 47ec645..eb56cb1 100644 --- a/src/serialization/types/PostAudience.ts +++ b/src/serialization/types/PostAudience.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; export const PostAudience: core.serialization.Schema = diff --git a/src/serialization/types/PostClickStatsEmail.ts b/src/serialization/types/PostClickStatsEmail.ts index 55d1d44..9614909 100644 --- a/src/serialization/types/PostClickStatsEmail.ts +++ b/src/serialization/types/PostClickStatsEmail.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; export const PostClickStatsEmail: core.serialization.ObjectSchema< diff --git a/src/serialization/types/PostClickStatsWeb.ts b/src/serialization/types/PostClickStatsWeb.ts index 30bf344..0464b71 100644 --- a/src/serialization/types/PostClickStatsWeb.ts +++ b/src/serialization/types/PostClickStatsWeb.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; export const PostClickStatsWeb: core.serialization.ObjectSchema< diff --git a/src/serialization/types/PostContent.ts b/src/serialization/types/PostContent.ts index 510317f..be55d09 100644 --- a/src/serialization/types/PostContent.ts +++ b/src/serialization/types/PostContent.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; import { PostContentFree } from "./PostContentFree"; import { PostContentPremium } from "./PostContentPremium"; diff --git a/src/serialization/types/PostContentFree.ts b/src/serialization/types/PostContentFree.ts index e11d4c9..0d3e419 100644 --- a/src/serialization/types/PostContentFree.ts +++ b/src/serialization/types/PostContentFree.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; export const PostContentFree: core.serialization.ObjectSchema< diff --git a/src/serialization/types/PostContentPremium.ts b/src/serialization/types/PostContentPremium.ts index dd5306f..460dd61 100644 --- a/src/serialization/types/PostContentPremium.ts +++ b/src/serialization/types/PostContentPremium.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; export const PostContentPremium: core.serialization.ObjectSchema< diff --git a/src/serialization/types/PostPlatform.ts b/src/serialization/types/PostPlatform.ts index b90830f..5bc3e6b 100644 --- a/src/serialization/types/PostPlatform.ts +++ b/src/serialization/types/PostPlatform.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; export const PostPlatform: core.serialization.Schema = diff --git a/src/serialization/types/PostStats.ts b/src/serialization/types/PostStats.ts index 9460192..1bf1d42 100644 --- a/src/serialization/types/PostStats.ts +++ b/src/serialization/types/PostStats.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; import { PostStatsEmail } from "./PostStatsEmail"; import { PostStatsWeb } from "./PostStatsWeb"; diff --git a/src/serialization/types/PostStatsEmail.ts b/src/serialization/types/PostStatsEmail.ts index 14dd373..bd00c48 100644 --- a/src/serialization/types/PostStatsEmail.ts +++ b/src/serialization/types/PostStatsEmail.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; export const PostStatsEmail: core.serialization.ObjectSchema = diff --git a/src/serialization/types/PostStatsWeb.ts b/src/serialization/types/PostStatsWeb.ts index 70b485e..330712a 100644 --- a/src/serialization/types/PostStatsWeb.ts +++ b/src/serialization/types/PostStatsWeb.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; export const PostStatsWeb: core.serialization.ObjectSchema = diff --git a/src/serialization/types/PostStatus.ts b/src/serialization/types/PostStatus.ts index 20fbcd9..cda533a 100644 --- a/src/serialization/types/PostStatus.ts +++ b/src/serialization/types/PostStatus.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; export const PostStatus: core.serialization.Schema = diff --git a/src/serialization/types/Publication.ts b/src/serialization/types/Publication.ts index 3128389..575c3dd 100644 --- a/src/serialization/types/Publication.ts +++ b/src/serialization/types/Publication.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; import { PublicationStats } from "./PublicationStats"; @@ -11,6 +11,7 @@ export const Publication: core.serialization.ObjectSchema = diff --git a/src/serialization/types/SegmentType.ts b/src/serialization/types/SegmentType.ts index b303dc4..9a71952 100644 --- a/src/serialization/types/SegmentType.ts +++ b/src/serialization/types/SegmentType.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; export const SegmentType: core.serialization.Schema = diff --git a/src/serialization/types/Subscription.ts b/src/serialization/types/Subscription.ts index 35502b2..5ed90ba 100644 --- a/src/serialization/types/Subscription.ts +++ b/src/serialization/types/Subscription.ts @@ -2,15 +2,17 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; import { SubscriptionExpandedStatus } from "./SubscriptionExpandedStatus"; import { SubscriptionExpandedSubscriptionTier } from "./SubscriptionExpandedSubscriptionTier"; import { SubscriptionExpandedUtmChannel } from "./SubscriptionExpandedUtmChannel"; +import { SubscriptionTiers } from "./SubscriptionTiers"; import { SubscriptionCustomFields } from "./SubscriptionCustomFields"; -import { SubscriptionStats } from "./SubscriptionStats"; import { SubscriptionTags } from "./SubscriptionTags"; +import { SubscriptionStats } from "./SubscriptionStats"; +import { SubscriptionTiersItem } from "./SubscriptionTiersItem"; import { CustomField } from "./CustomField"; export const Subscription: core.serialization.ObjectSchema = @@ -20,15 +22,23 @@ export const Subscription: core.serialization.ObjectSchema = diff --git a/src/serialization/types/SubscriptionTiers.ts b/src/serialization/types/SubscriptionTiers.ts new file mode 100644 index 0000000..ee43836 --- /dev/null +++ b/src/serialization/types/SubscriptionTiers.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; +import * as core from "../../core"; +import { SubscriptionTiersItem } from "./SubscriptionTiersItem"; + +export const SubscriptionTiers: core.serialization.Schema< + serializers.SubscriptionTiers.Raw, + Beehiiv.SubscriptionTiers +> = core.serialization.list(SubscriptionTiersItem); + +export declare namespace SubscriptionTiers { + type Raw = SubscriptionTiersItem.Raw[]; +} diff --git a/src/serialization/types/SubscriptionTiersItem.ts b/src/serialization/types/SubscriptionTiersItem.ts new file mode 100644 index 0000000..ac8e6ee --- /dev/null +++ b/src/serialization/types/SubscriptionTiersItem.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; +import * as core from "../../core"; +import { SubscriptionTiersItemStatus } from "./SubscriptionTiersItemStatus"; + +export const SubscriptionTiersItem: core.serialization.ObjectSchema< + serializers.SubscriptionTiersItem.Raw, + Beehiiv.SubscriptionTiersItem +> = core.serialization.object({ + id: core.serialization.string(), + name: core.serialization.string(), + status: SubscriptionTiersItemStatus, +}); + +export declare namespace SubscriptionTiersItem { + interface Raw { + id: string; + name: string; + status: SubscriptionTiersItemStatus.Raw; + } +} diff --git a/src/serialization/types/SubscriptionTiersItemStatus.ts b/src/serialization/types/SubscriptionTiersItemStatus.ts new file mode 100644 index 0000000..dd4eb87 --- /dev/null +++ b/src/serialization/types/SubscriptionTiersItemStatus.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; +import * as core from "../../core"; + +export const SubscriptionTiersItemStatus: core.serialization.Schema< + serializers.SubscriptionTiersItemStatus.Raw, + Beehiiv.SubscriptionTiersItemStatus +> = core.serialization.enum_(["active", "archived"]); + +export declare namespace SubscriptionTiersItemStatus { + type Raw = "active" | "archived"; +} diff --git a/src/serialization/types/SubscriptionUtmChannel.ts b/src/serialization/types/SubscriptionUtmChannel.ts index 4094fde..6ff04ac 100644 --- a/src/serialization/types/SubscriptionUtmChannel.ts +++ b/src/serialization/types/SubscriptionUtmChannel.ts @@ -2,8 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from ".."; -import * as Beehiiv from "../../api"; +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; import * as core from "../../core"; export const SubscriptionUtmChannel: core.serialization.Schema< diff --git a/src/serialization/types/Tier.ts b/src/serialization/types/Tier.ts new file mode 100644 index 0000000..a199863 --- /dev/null +++ b/src/serialization/types/Tier.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; +import * as core from "../../core"; +import { TierStatus } from "./TierStatus"; +import { TierStats } from "./TierStats"; +import { TierPrice } from "./TierPrice"; + +export const Tier: core.serialization.ObjectSchema = core.serialization.object({ + id: core.serialization.string(), + name: core.serialization.string(), + status: TierStatus, + description: core.serialization.string().optional(), + stats: TierStats.optional(), + prices: core.serialization.list(TierPrice).optional(), +}); + +export declare namespace Tier { + interface Raw { + id: string; + name: string; + status: TierStatus.Raw; + description?: string | null; + stats?: TierStats.Raw | null; + prices?: TierPrice.Raw[] | null; + } +} diff --git a/src/serialization/types/TierPrice.ts b/src/serialization/types/TierPrice.ts new file mode 100644 index 0000000..60f3267 --- /dev/null +++ b/src/serialization/types/TierPrice.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; +import * as core from "../../core"; +import { TierPriceCurrency } from "./TierPriceCurrency"; +import { TierPriceInterval } from "./TierPriceInterval"; + +export const TierPrice: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + currency: TierPriceCurrency.optional(), + amountCents: core.serialization.property("amount_cents", core.serialization.number().optional()), + enabled: core.serialization.boolean().optional(), + interval: TierPriceInterval.optional(), + denominator: core.serialization.string().optional(), + cta: core.serialization.string().optional(), + features: core.serialization.list(core.serialization.string()).optional(), + }); + +export declare namespace TierPrice { + interface Raw { + id?: string | null; + currency?: TierPriceCurrency.Raw | null; + amount_cents?: number | null; + enabled?: boolean | null; + interval?: TierPriceInterval.Raw | null; + denominator?: string | null; + cta?: string | null; + features?: string[] | null; + } +} diff --git a/src/serialization/types/TierPriceCurrency.ts b/src/serialization/types/TierPriceCurrency.ts new file mode 100644 index 0000000..0da4a2b --- /dev/null +++ b/src/serialization/types/TierPriceCurrency.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; +import * as core from "../../core"; + +export const TierPriceCurrency: core.serialization.Schema< + serializers.TierPriceCurrency.Raw, + Beehiiv.TierPriceCurrency +> = core.serialization.enum_(["usd", "aud", "cad", "eur", "inr", "brl"]); + +export declare namespace TierPriceCurrency { + type Raw = "usd" | "aud" | "cad" | "eur" | "inr" | "brl"; +} diff --git a/src/serialization/types/TierPriceInterval.ts b/src/serialization/types/TierPriceInterval.ts new file mode 100644 index 0000000..af7c39a --- /dev/null +++ b/src/serialization/types/TierPriceInterval.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; +import * as core from "../../core"; + +export const TierPriceInterval: core.serialization.Schema< + serializers.TierPriceInterval.Raw, + Beehiiv.TierPriceInterval +> = core.serialization.enum_(["month", "year"]); + +export declare namespace TierPriceInterval { + type Raw = "month" | "year"; +} diff --git a/src/serialization/types/TierStats.ts b/src/serialization/types/TierStats.ts new file mode 100644 index 0000000..a1105f5 --- /dev/null +++ b/src/serialization/types/TierStats.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; +import * as core from "../../core"; + +export const TierStats: core.serialization.ObjectSchema = + core.serialization.object({ + activeSubscriptions: core.serialization.property("active_subscriptions", core.serialization.number()), + }); + +export declare namespace TierStats { + interface Raw { + active_subscriptions: number; + } +} diff --git a/src/serialization/types/TierStatus.ts b/src/serialization/types/TierStatus.ts new file mode 100644 index 0000000..1b67df7 --- /dev/null +++ b/src/serialization/types/TierStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; +import * as core from "../../core"; + +export const TierStatus: core.serialization.Schema = + core.serialization.enum_(["active", "archived"]); + +export declare namespace TierStatus { + type Raw = "active" | "archived"; +} diff --git a/src/serialization/types/Webhook.ts b/src/serialization/types/Webhook.ts new file mode 100644 index 0000000..aca151d --- /dev/null +++ b/src/serialization/types/Webhook.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; +import * as core from "../../core"; +import { WebhookEventTypesItem } from "./WebhookEventTypesItem"; + +export const Webhook: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + url: core.serialization.string(), + created: core.serialization.number(), + updated: core.serialization.number(), + eventTypes: core.serialization.property("event_types", core.serialization.list(WebhookEventTypesItem)), + description: core.serialization.string(), + }); + +export declare namespace Webhook { + interface Raw { + id?: string | null; + url: string; + created: number; + updated: number; + event_types: WebhookEventTypesItem.Raw[]; + description: string; + } +} diff --git a/src/serialization/types/WebhookEventTypesItem.ts b/src/serialization/types/WebhookEventTypesItem.ts new file mode 100644 index 0000000..a81fe8f --- /dev/null +++ b/src/serialization/types/WebhookEventTypesItem.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Beehiiv from "../../api/index"; +import * as core from "../../core"; + +export const WebhookEventTypesItem: core.serialization.Schema< + serializers.WebhookEventTypesItem.Raw, + Beehiiv.WebhookEventTypesItem +> = core.serialization.enum_([ + "post.sent", + "subscription.confirmed", + "subscription.created", + "subscription.deleted", + "subscription.downgraded", + "subscription.upgraded", + "survey.response_submitted", +]); + +export declare namespace WebhookEventTypesItem { + type Raw = + | "post.sent" + | "subscription.confirmed" + | "subscription.created" + | "subscription.deleted" + | "subscription.downgraded" + | "subscription.upgraded" + | "survey.response_submitted"; +} diff --git a/src/serialization/types/index.ts b/src/serialization/types/index.ts index 7c45cac..a1ee19f 100644 --- a/src/serialization/types/index.ts +++ b/src/serialization/types/index.ts @@ -26,6 +26,9 @@ export * from "./SubscriptionExpandedUtmChannel"; export * from "./SubscriptionCustomFields"; export * from "./SubscriptionStats"; export * from "./SubscriptionTags"; +export * from "./SubscriptionTiersItemStatus"; +export * from "./SubscriptionTiersItem"; +export * from "./SubscriptionTiers"; export * from "./PostStatus"; export * from "./PostAudience"; export * from "./PostPlatform"; @@ -53,6 +56,15 @@ export * from "./SegmentType"; export * from "./SegmentStatus"; export * from "./Segment"; export * from "./AutomationStatus"; +export * from "./AutomationTriggerEventsItem"; export * from "./Automation"; export * from "./AutomationJourneyStatus"; export * from "./AutomationJourney"; +export * from "./TierStatus"; +export * from "./Tier"; +export * from "./TierStats"; +export * from "./TierPriceCurrency"; +export * from "./TierPriceInterval"; +export * from "./TierPrice"; +export * from "./WebhookEventTypesItem"; +export * from "./Webhook"; diff --git a/tests/client.test.ts b/tests/client.test.ts deleted file mode 100644 index 62b373b..0000000 --- a/tests/client.test.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** -* This is a test file for the SDK. -* -* Add any tests here and make sure to mark this file -* in `.fernignore`. -*/ -describe("test", () => { - it("default", () => { - expect(true).toBe(true); - }); -}); \ No newline at end of file diff --git a/tests/custom.test.ts b/tests/custom.test.ts new file mode 100644 index 0000000..7f5e031 --- /dev/null +++ b/tests/custom.test.ts @@ -0,0 +1,13 @@ +/** + * This is a custom test file, if you wish to add more tests + * to your SDK. + * Be sure to mark this file in `.fernignore`. + * + * If you include example requests/responses in your fern definition, + * you will have tests automatically generated for you. + */ +describe("test", () => { + it("default", () => { + expect(true).toBe(true); + }); +}); diff --git a/tsconfig.json b/tsconfig.json index 5a306b2..538c94f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,8 +12,6 @@ "rootDir": "src", "baseUrl": "src" }, - "include": [ - "src" - ], + "include": ["src"], "exclude": [] -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index 08a5981..8b29de8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10,156 +10,159 @@ "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.24" -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.23.5", "@babel/code-frame@^7.24.1", "@babel/code-frame@^7.24.2": - version "7.24.2" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.2.tgz#718b4b19841809a58b29b68cde80bc5e1aa6d9ae" - integrity sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ== +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.7.tgz#882fd9e09e8ee324e496bd040401c6f046ef4465" + integrity sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA== dependencies: - "@babel/highlight" "^7.24.2" + "@babel/highlight" "^7.24.7" picocolors "^1.0.0" -"@babel/compat-data@^7.23.5": - version "7.24.4" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.24.4.tgz#6f102372e9094f25d908ca0d34fc74c74606059a" - integrity sha512-vg8Gih2MLK+kOkHJp4gBEIkyaIi00jgWot2D9QOmmfLC8jINSOzmCLta6Bvz/JSBCqnegV0L80jhxkol5GWNfQ== +"@babel/compat-data@^7.24.8": + version "7.24.9" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.24.9.tgz#53eee4e68f1c1d0282aa0eb05ddb02d033fc43a0" + integrity sha512-e701mcfApCJqMMueQI0Fb68Amflj83+dvAvHawoBpAz+GDjCIyGHzNwnefjsWJ3xiYAqqiQFoWbspGYBdb2/ng== "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.9": - version "7.24.4" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.24.4.tgz#1f758428e88e0d8c563874741bc4ffc4f71a4717" - integrity sha512-MBVlMXP+kkl5394RBLSxxk/iLTeVGuXTV3cIDXavPpMMqnSnt6apKgan/U8O3USWZCWZT/TbgfEpKa4uMgN4Dg== + version "7.24.9" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.24.9.tgz#dc07c9d307162c97fa9484ea997ade65841c7c82" + integrity sha512-5e3FI4Q3M3Pbr21+5xJwCv6ZT6KmGkI0vw3Tozy5ODAQFTIWe37iT8Cr7Ice2Ntb+M3iSKCEWMB1MBgKrW3whg== dependencies: "@ampproject/remapping" "^2.2.0" - "@babel/code-frame" "^7.24.2" - "@babel/generator" "^7.24.4" - "@babel/helper-compilation-targets" "^7.23.6" - "@babel/helper-module-transforms" "^7.23.3" - "@babel/helpers" "^7.24.4" - "@babel/parser" "^7.24.4" - "@babel/template" "^7.24.0" - "@babel/traverse" "^7.24.1" - "@babel/types" "^7.24.0" + "@babel/code-frame" "^7.24.7" + "@babel/generator" "^7.24.9" + "@babel/helper-compilation-targets" "^7.24.8" + "@babel/helper-module-transforms" "^7.24.9" + "@babel/helpers" "^7.24.8" + "@babel/parser" "^7.24.8" + "@babel/template" "^7.24.7" + "@babel/traverse" "^7.24.8" + "@babel/types" "^7.24.9" convert-source-map "^2.0.0" debug "^4.1.0" gensync "^1.0.0-beta.2" json5 "^2.2.3" semver "^6.3.1" -"@babel/generator@^7.24.1", "@babel/generator@^7.24.4", "@babel/generator@^7.7.2": - version "7.24.4" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.24.4.tgz#1fc55532b88adf952025d5d2d1e71f946cb1c498" - integrity sha512-Xd6+v6SnjWVx/nus+y0l1sxMOTOMBkyL4+BIdbALyatQnAe/SRVjANeDPSCYaX+i1iJmuGSKf3Z+E+V/va1Hvw== +"@babel/generator@^7.24.8", "@babel/generator@^7.24.9", "@babel/generator@^7.7.2": + version "7.24.10" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.24.10.tgz#a4ab681ec2a78bbb9ba22a3941195e28a81d8e76" + integrity sha512-o9HBZL1G2129luEUlG1hB4N/nlYNWHnpwlND9eOMclRqqu1YDy2sSYVCFUZwl8I1Gxh+QSRrP2vD7EpUmFVXxg== dependencies: - "@babel/types" "^7.24.0" + "@babel/types" "^7.24.9" "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.25" jsesc "^2.5.1" -"@babel/helper-compilation-targets@^7.23.6": - version "7.23.6" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.23.6.tgz#4d79069b16cbcf1461289eccfbbd81501ae39991" - integrity sha512-9JB548GZoQVmzrFgp8o7KxdgkTGm6xs9DW0o/Pim72UDjzr5ObUQ6ZzYPqA+g9OTS2bBQoctLJrky0RDCAWRgQ== +"@babel/helper-compilation-targets@^7.24.8": + version "7.24.8" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.24.8.tgz#b607c3161cd9d1744977d4f97139572fe778c271" + integrity sha512-oU+UoqCHdp+nWVDkpldqIQL/i/bvAv53tRqLG/s+cOXxe66zOYLU7ar/Xs3LdmBihrUMEUhwu6dMZwbNOYDwvw== dependencies: - "@babel/compat-data" "^7.23.5" - "@babel/helper-validator-option" "^7.23.5" - browserslist "^4.22.2" + "@babel/compat-data" "^7.24.8" + "@babel/helper-validator-option" "^7.24.8" + browserslist "^4.23.1" lru-cache "^5.1.1" semver "^6.3.1" -"@babel/helper-environment-visitor@^7.22.20": - version "7.22.20" - resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz#96159db61d34a29dba454c959f5ae4a649ba9167" - integrity sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA== - -"@babel/helper-function-name@^7.23.0": - version "7.23.0" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz#1f9a3cdbd5b2698a670c30d2735f9af95ed52759" - integrity sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw== - dependencies: - "@babel/template" "^7.22.15" - "@babel/types" "^7.23.0" - -"@babel/helper-hoist-variables@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz#c01a007dac05c085914e8fb652b339db50d823bb" - integrity sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw== - dependencies: - "@babel/types" "^7.22.5" - -"@babel/helper-module-imports@^7.22.15": - version "7.24.3" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.24.3.tgz#6ac476e6d168c7c23ff3ba3cf4f7841d46ac8128" - integrity sha512-viKb0F9f2s0BCS22QSF308z/+1YWKV/76mwt61NBzS5izMzDPwdq1pTrzf+Li3npBWX9KdQbkeCt1jSAM7lZqg== - dependencies: - "@babel/types" "^7.24.0" - -"@babel/helper-module-transforms@^7.23.3": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.23.3.tgz#d7d12c3c5d30af5b3c0fcab2a6d5217773e2d0f1" - integrity sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ== - dependencies: - "@babel/helper-environment-visitor" "^7.22.20" - "@babel/helper-module-imports" "^7.22.15" - "@babel/helper-simple-access" "^7.22.5" - "@babel/helper-split-export-declaration" "^7.22.6" - "@babel/helper-validator-identifier" "^7.22.20" - -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.24.0", "@babel/helper-plugin-utils@^7.8.0": - version "7.24.0" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.0.tgz#945681931a52f15ce879fd5b86ce2dae6d3d7f2a" - integrity sha512-9cUznXMG0+FxRuJfvL82QlTqIzhVW9sL0KjMPHhAOOvpQGL8QtdxnBKILjBqxlHyliz0yCa1G903ZXI/FuHy2w== - -"@babel/helper-simple-access@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz#4938357dc7d782b80ed6dbb03a0fba3d22b1d5de" - integrity sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w== - dependencies: - "@babel/types" "^7.22.5" - -"@babel/helper-split-export-declaration@^7.22.6": - version "7.22.6" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz#322c61b7310c0997fe4c323955667f18fcefb91c" - integrity sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g== - dependencies: - "@babel/types" "^7.22.5" - -"@babel/helper-string-parser@^7.23.4": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.24.1.tgz#f99c36d3593db9540705d0739a1f10b5e20c696e" - integrity sha512-2ofRCjnnA9y+wk8b9IAREroeUP02KHp431N2mhKniy2yKIDKpbrHv9eXwm8cBeWQYcJmzv5qKCu65P47eCF7CQ== - -"@babel/helper-validator-identifier@^7.22.20": - version "7.22.20" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" - integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== - -"@babel/helper-validator-option@^7.23.5": - version "7.23.5" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz#907a3fbd4523426285365d1206c423c4c5520307" - integrity sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw== - -"@babel/helpers@^7.24.4": - version "7.24.4" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.24.4.tgz#dc00907fd0d95da74563c142ef4cd21f2cb856b6" - integrity sha512-FewdlZbSiwaVGlgT1DPANDuCHaDMiOo+D/IDYRFYjHOuv66xMSJ7fQwwODwRNAPkADIO/z1EoF/l2BCWlWABDw== - dependencies: - "@babel/template" "^7.24.0" - "@babel/traverse" "^7.24.1" - "@babel/types" "^7.24.0" - -"@babel/highlight@^7.24.2": - version "7.24.2" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.24.2.tgz#3f539503efc83d3c59080a10e6634306e0370d26" - integrity sha512-Yac1ao4flkTxTteCDZLEvdxg2fZfz1v8M4QpaGypq/WPDqg3ijHYbDfs+LG5hvzSoqaSZ9/Z9lKSP3CjZjv+pA== - dependencies: - "@babel/helper-validator-identifier" "^7.22.20" +"@babel/helper-environment-visitor@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.24.7.tgz#4b31ba9551d1f90781ba83491dd59cf9b269f7d9" + integrity sha512-DoiN84+4Gnd0ncbBOM9AZENV4a5ZiL39HYMyZJGZ/AZEykHYdJw0wW3kdcsh9/Kn+BRXHLkkklZ51ecPKmI1CQ== + dependencies: + "@babel/types" "^7.24.7" + +"@babel/helper-function-name@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.24.7.tgz#75f1e1725742f39ac6584ee0b16d94513da38dd2" + integrity sha512-FyoJTsj/PEUWu1/TYRiXTIHc8lbw+TDYkZuoE43opPS5TrI7MyONBE1oNvfguEXAD9yhQRrVBnXdXzSLQl9XnA== + dependencies: + "@babel/template" "^7.24.7" + "@babel/types" "^7.24.7" + +"@babel/helper-hoist-variables@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.24.7.tgz#b4ede1cde2fd89436397f30dc9376ee06b0f25ee" + integrity sha512-MJJwhkoGy5c4ehfoRyrJ/owKeMl19U54h27YYftT0o2teQ3FJ3nQUf/I3LlJsX4l3qlw7WRXUmiyajvHXoTubQ== + dependencies: + "@babel/types" "^7.24.7" + +"@babel/helper-module-imports@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.24.7.tgz#f2f980392de5b84c3328fc71d38bd81bbb83042b" + integrity sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA== + dependencies: + "@babel/traverse" "^7.24.7" + "@babel/types" "^7.24.7" + +"@babel/helper-module-transforms@^7.24.9": + version "7.24.9" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.24.9.tgz#e13d26306b89eea569180868e652e7f514de9d29" + integrity sha512-oYbh+rtFKj/HwBQkFlUzvcybzklmVdVV3UU+mN7n2t/q3yGHbuVdNxyFvSBO1tfvjyArpHNcWMAzsSPdyI46hw== + dependencies: + "@babel/helper-environment-visitor" "^7.24.7" + "@babel/helper-module-imports" "^7.24.7" + "@babel/helper-simple-access" "^7.24.7" + "@babel/helper-split-export-declaration" "^7.24.7" + "@babel/helper-validator-identifier" "^7.24.7" + +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.24.7", "@babel/helper-plugin-utils@^7.8.0": + version "7.24.8" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.8.tgz#94ee67e8ec0e5d44ea7baeb51e571bd26af07878" + integrity sha512-FFWx5142D8h2Mgr/iPVGH5G7w6jDn4jUSpZTyDnQO0Yn7Ks2Kuz6Pci8H6MPCoUJegd/UZQ3tAvfLCxQSnWWwg== + +"@babel/helper-simple-access@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.24.7.tgz#bcade8da3aec8ed16b9c4953b74e506b51b5edb3" + integrity sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg== + dependencies: + "@babel/traverse" "^7.24.7" + "@babel/types" "^7.24.7" + +"@babel/helper-split-export-declaration@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.7.tgz#83949436890e07fa3d6873c61a96e3bbf692d856" + integrity sha512-oy5V7pD+UvfkEATUKvIjvIAH/xCzfsFVw7ygW2SI6NClZzquT+mwdTfgfdbUiceh6iQO0CHtCPsyze/MZ2YbAA== + dependencies: + "@babel/types" "^7.24.7" + +"@babel/helper-string-parser@^7.24.8": + version "7.24.8" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz#5b3329c9a58803d5df425e5785865881a81ca48d" + integrity sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ== + +"@babel/helper-validator-identifier@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz#75b889cfaf9e35c2aaf42cf0d72c8e91719251db" + integrity sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w== + +"@babel/helper-validator-option@^7.24.8": + version "7.24.8" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.24.8.tgz#3725cdeea8b480e86d34df15304806a06975e33d" + integrity sha512-xb8t9tD1MHLungh/AIoWYN+gVHaB9kwlu8gffXGSt3FFEIT7RjS+xWbc2vUD1UTZdIpKj/ab3rdqJ7ufngyi2Q== + +"@babel/helpers@^7.24.8": + version "7.24.8" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.24.8.tgz#2820d64d5d6686cca8789dd15b074cd862795873" + integrity sha512-gV2265Nkcz7weJJfvDoAEVzC1e2OTDpkGbEsebse8koXUJUXPsCMi7sRo/+SPMuMZ9MtUPnGwITTnQnU5YjyaQ== + dependencies: + "@babel/template" "^7.24.7" + "@babel/types" "^7.24.8" + +"@babel/highlight@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.24.7.tgz#a05ab1df134b286558aae0ed41e6c5f731bf409d" + integrity sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw== + dependencies: + "@babel/helper-validator-identifier" "^7.24.7" chalk "^2.4.2" js-tokens "^4.0.0" picocolors "^1.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.24.0", "@babel/parser@^7.24.1", "@babel/parser@^7.24.4": - version "7.24.4" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.4.tgz#234487a110d89ad5a3ed4a8a566c36b9453e8c88" - integrity sha512-zTvEBcghmeBma9QIGunWevvBAp4/Qu9Bdq+2k0Ot4fVMD6v3dsC9WOcRSKk7tRRyBM/53yKMJko9xOatGQAwSg== +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.24.7", "@babel/parser@^7.24.8": + version "7.24.8" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.8.tgz#58a4dbbcad7eb1d48930524a3fd93d93e9084c6f" + integrity sha512-WzfbgXOkGzZiXXCqk43kKwZjzwx4oulxZi3nq2TYL9mOjQv6kYwul9mz6ID36njuL7Xkp6nJEfok848Zj10j/w== "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" @@ -197,11 +200,11 @@ "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-jsx@^7.7.2": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.24.1.tgz#3f6ca04b8c841811dbc3c5c5f837934e0d626c10" - integrity sha512-2eCtxZXf+kbkMIsXS4poTvT4Yu5rXiRa+9xGVT56raghjmBTKMpFNc9R4IDiB4emao9eO22Ox7CxuJG7BgExqA== + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.24.7.tgz#39a1fa4a7e3d3d7f34e2acc6be585b718d30e02d" + integrity sha512-6ddciUPe/mpMnOKv/U+RSd2vvVy+Yw/JfBB0ZHYjEZt9NLHmCUylNYlsbqCCS1Bffjlb0fCwC9Vqz+sBz6PsiQ== dependencies: - "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-plugin-utils" "^7.24.7" "@babel/plugin-syntax-logical-assignment-operators@^7.8.3": version "7.10.4" @@ -253,44 +256,44 @@ "@babel/helper-plugin-utils" "^7.14.5" "@babel/plugin-syntax-typescript@^7.7.2": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.24.1.tgz#b3bcc51f396d15f3591683f90239de143c076844" - integrity sha512-Yhnmvy5HZEnHUty6i++gcfH1/l68AHnItFHnaCv6hn9dNh0hQvvQJsxpi4BMBFN5DLeHBuucT/0DgzXif/OyRw== - dependencies: - "@babel/helper-plugin-utils" "^7.24.0" - -"@babel/template@^7.22.15", "@babel/template@^7.24.0", "@babel/template@^7.3.3": - version "7.24.0" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.24.0.tgz#c6a524aa93a4a05d66aaf31654258fae69d87d50" - integrity sha512-Bkf2q8lMB0AFpX0NFEqSbx1OkTHf0f+0j82mkw+ZpzBnkk7e9Ql0891vlfgi+kHwOk8tQjiQHpqh4LaSa0fKEA== - dependencies: - "@babel/code-frame" "^7.23.5" - "@babel/parser" "^7.24.0" - "@babel/types" "^7.24.0" - -"@babel/traverse@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.24.1.tgz#d65c36ac9dd17282175d1e4a3c49d5b7988f530c" - integrity sha512-xuU6o9m68KeqZbQuDt2TcKSxUw/mrsvavlEqQ1leZ/B+C9tk6E4sRWy97WaXgvq5E+nU3cXMxv3WKOCanVMCmQ== - dependencies: - "@babel/code-frame" "^7.24.1" - "@babel/generator" "^7.24.1" - "@babel/helper-environment-visitor" "^7.22.20" - "@babel/helper-function-name" "^7.23.0" - "@babel/helper-hoist-variables" "^7.22.5" - "@babel/helper-split-export-declaration" "^7.22.6" - "@babel/parser" "^7.24.1" - "@babel/types" "^7.24.0" + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.24.7.tgz#58d458271b4d3b6bb27ee6ac9525acbb259bad1c" + integrity sha512-c/+fVeJBB0FeKsFvwytYiUD+LBvhHjGSI0g446PRGdSVGZLRNArBUno2PETbAly3tpiNAQR5XaZ+JslxkotsbA== + dependencies: + "@babel/helper-plugin-utils" "^7.24.7" + +"@babel/template@^7.24.7", "@babel/template@^7.3.3": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.24.7.tgz#02efcee317d0609d2c07117cb70ef8fb17ab7315" + integrity sha512-jYqfPrU9JTF0PmPy1tLYHW4Mp4KlgxJD9l2nP9fD6yT/ICi554DmrWBAEYpIelzjHf1msDP3PxJIRt/nFNfBig== + dependencies: + "@babel/code-frame" "^7.24.7" + "@babel/parser" "^7.24.7" + "@babel/types" "^7.24.7" + +"@babel/traverse@^7.24.7", "@babel/traverse@^7.24.8": + version "7.24.8" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.24.8.tgz#6c14ed5232b7549df3371d820fbd9abfcd7dfab7" + integrity sha512-t0P1xxAPzEDcEPmjprAQq19NWum4K0EQPjMwZQZbHt+GiZqvjCHjj755Weq1YRPVzBI+3zSfvScfpnuIecVFJQ== + dependencies: + "@babel/code-frame" "^7.24.7" + "@babel/generator" "^7.24.8" + "@babel/helper-environment-visitor" "^7.24.7" + "@babel/helper-function-name" "^7.24.7" + "@babel/helper-hoist-variables" "^7.24.7" + "@babel/helper-split-export-declaration" "^7.24.7" + "@babel/parser" "^7.24.8" + "@babel/types" "^7.24.8" debug "^4.3.1" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.22.5", "@babel/types@^7.23.0", "@babel/types@^7.24.0", "@babel/types@^7.3.3": - version "7.24.0" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.24.0.tgz#3b951f435a92e7333eba05b7566fd297960ea1bf" - integrity sha512-+j7a5c253RfKh8iABBhywc8NSfP5LURe7Uh4qpsh6jc+aLJguvmIUBdjSdEMQv2bENrCR5MfRdjGo7vzS/ob7w== +"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.24.7", "@babel/types@^7.24.8", "@babel/types@^7.24.9", "@babel/types@^7.3.3": + version "7.24.9" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.24.9.tgz#228ce953d7b0d16646e755acf204f4cf3d08cc73" + integrity sha512-xm8XrMKz0IlUdocVbYJe0Z9xEgidU7msskG8BbhnTPK/HZ2z/7FP7ykqPgrUH+C+r414mNfNWam1f2vqOjqjYQ== dependencies: - "@babel/helper-string-parser" "^7.23.4" - "@babel/helper-validator-identifier" "^7.22.20" + "@babel/helper-string-parser" "^7.24.8" + "@babel/helper-validator-identifier" "^7.24.7" to-fast-properties "^2.0.0" "@bcoe/v8-coverage@^0.2.3": @@ -526,9 +529,9 @@ integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A== "@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": - version "1.4.15" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" - integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== + version "1.5.0" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz#3188bcb273a414b0d215fd22a58540b989b9409a" + integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== "@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": version "0.3.25" @@ -557,6 +560,11 @@ dependencies: "@sinonjs/commons" "^3.0.0" +"@tootallnate/once@2": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf" + integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A== + "@types/babel__core@^7.1.14": version "7.20.5" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" @@ -584,9 +592,9 @@ "@babel/types" "^7.0.0" "@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": - version "7.20.5" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.20.5.tgz#7b7502be0aa80cc4ef22978846b983edaafcd4dd" - integrity sha512-WXCyOcRtH37HAUkpXhUduaxdm82b4GSlyTqajXviN4EfiuPgNYR109xMCKvpl6zPIpua0DGlMEDCq+g8EdoheQ== + version "7.20.6" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.20.6.tgz#8dc9f0ae0f202c08d8d4dab648912c8d6038e3f7" + integrity sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg== dependencies: "@babel/types" "^7.20.7" @@ -616,14 +624,23 @@ dependencies: "@types/istanbul-lib-report" "*" -"@types/jest@^29.5.5": - version "29.5.12" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.12.tgz#7f7dc6eb4cf246d2474ed78744b05d06ce025544" - integrity sha512-eDC8bTvT/QhYdxJAulQikueigY5AsdBRH2yDKW3yveW7svY3+DzN84/2NUgkw10RTiJbWqZrTtoGVdYlvFJdLw== +"@types/jest@29.5.5": + version "29.5.5" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.5.tgz#727204e06228fe24373df9bae76b90f3e8236a2a" + integrity sha512-ebylz2hnsWR9mYvmBFbXJXr+33UPc4+ZdxyDXh5w0FlPBTfCVN3wPL+kuOiQt3xvrK419v7XWeAs+AeOksafXg== dependencies: expect "^29.0.0" pretty-format "^29.0.0" +"@types/jsdom@^20.0.0": + version "20.0.1" + resolved "https://registry.yarnpkg.com/@types/jsdom/-/jsdom-20.0.1.tgz#07c14bc19bd2f918c1929541cdaacae894744808" + integrity sha512-d0r18sZPmMQr1eG35u12FZfhIXNrnsPU/g5wvRKCUf/tOGilKKwYMYGqh33BNR6ba+2gkHw1EUiHoN3mn7E5IQ== + dependencies: + "@types/node" "*" + "@types/tough-cookie" "*" + parse5 "^7.0.0" + "@types/node-fetch@2.6.9": version "2.6.9" resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.9.tgz#15f529d247f1ede1824f7e7acdaa192d5f28071e" @@ -633,9 +650,9 @@ form-data "^4.0.0" "@types/node@*": - version "20.12.7" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.7.tgz#04080362fa3dd6c5822061aa3124f5c152cff384" - integrity sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg== + version "20.14.11" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.11.tgz#09b300423343460455043ddd4d0ded6ac579b74b" + integrity sha512-kprQpL8MMeszbz6ojB5/tU8PLN4kesnN8Gjzw349rDlNgsSzg90lAVj3llK99Dh7JON+t9AuscPPFW6mPbTnSA== dependencies: undici-types "~5.26.4" @@ -654,6 +671,11 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== +"@types/tough-cookie@*": + version "4.0.5" + resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.5.tgz#cb6e2a691b70cb177c6e3ae9c1d2e8b2ea8cd304" + integrity sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA== + "@types/url-join@4.0.1": version "4.0.1" resolved "https://registry.yarnpkg.com/@types/url-join/-/url-join-4.0.1.tgz#4989c97f969464647a8586c7252d97b449cdc045" @@ -671,6 +693,38 @@ dependencies: "@types/yargs-parser" "*" +abab@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" + integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA== + +acorn-globals@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-7.0.1.tgz#0dbf05c44fa7c94332914c02066d5beff62c40c3" + integrity sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q== + dependencies: + acorn "^8.1.0" + acorn-walk "^8.0.2" + +acorn-walk@^8.0.2: + version "8.3.3" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.3.tgz#9caeac29eefaa0c41e3d4c65137de4d6f34df43e" + integrity sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw== + dependencies: + acorn "^8.11.0" + +acorn@^8.1.0, acorn@^8.11.0, acorn@^8.8.1: + version "8.12.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.1.tgz#71616bdccbe25e27a54439e0046e89ca76df2248" + integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg== + +agent-base@6: + version "6.0.2" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" + integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== + dependencies: + debug "4" + ansi-escapes@^4.2.1: version "4.3.2" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" @@ -795,22 +849,22 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" -braces@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" - integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== +braces@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" + integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== dependencies: - fill-range "^7.0.1" + fill-range "^7.1.1" -browserslist@^4.22.2: - version "4.23.0" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.23.0.tgz#8f3acc2bbe73af7213399430890f86c63a5674ab" - integrity sha512-QW8HiM1shhT2GuzkvklfjcKDiWFXHOeFCIA/huJPwHsslwcydgk7X+z2zXpEijP98UCY7HbubZt5J2Zgvf0CaQ== +browserslist@^4.23.1: + version "4.23.2" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.23.2.tgz#244fe803641f1c19c28c48c4b6ec9736eb3d32ed" + integrity sha512-qkqSyistMYdxAcw+CzbZwlBy8AGmS/eEWs+sEV5TnLRGDOL+C5M2EnH6tlZyg0YoAxGJAFKh61En9BR941GnHA== dependencies: - caniuse-lite "^1.0.30001587" - electron-to-chromium "^1.4.668" + caniuse-lite "^1.0.30001640" + electron-to-chromium "^1.4.820" node-releases "^2.0.14" - update-browserslist-db "^1.0.13" + update-browserslist-db "^1.1.0" bs-logger@0.x: version "0.2.6" @@ -857,10 +911,10 @@ camelcase@^6.2.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -caniuse-lite@^1.0.30001587: - version "1.0.30001610" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001610.tgz#2f44ed6e21d359e914271ae35b68903632628ccf" - integrity sha512-QFutAY4NgaelojVMjY63o6XlZyORPaLfyMnsl3HgnWdJUcX6K0oaJymHjH8PT5Gk7sTm8rvC/c5COUQKXqmOMA== +caniuse-lite@^1.0.30001640: + version "1.0.30001643" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001643.tgz#9c004caef315de9452ab970c3da71085f8241dbd" + integrity sha512-ERgWGNleEilSrHM6iUz/zJNSQTP8Mr21wDWpdgvRwcTXGAq6jMtOUPP4dqFPTdKqZ2wKTdtB+uucZ3MRpAUSmg== chalk@^2.4.2: version "2.4.2" @@ -890,9 +944,9 @@ ci-info@^3.2.0: integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== cjs-module-lexer@^1.0.0: - version "1.2.3" - resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz#6c370ab19f8a3394e318fe682686ec0ac684d107" - integrity sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ== + version "1.3.1" + resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.3.1.tgz#c485341ae8fd999ca4ee5af2d7a1c9ae01e0099c" + integrity sha512-a3KdPAANPbNE4ZUv9h6LckSl9zLsYOP4MBmhIPkRaeyybt+r4UghLvq+xw/YwUcC1gqylCkL4rdVs3Lwupjm4Q== cliui@^8.0.1: version "8.0.1" @@ -976,13 +1030,44 @@ cross-spawn@^7.0.3: shebang-command "^2.0.0" which "^2.0.1" -debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: - version "4.3.4" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== +cssom@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.5.0.tgz#d254fa92cd8b6fbd83811b9fbaed34663cc17c36" + integrity sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw== + +cssom@~0.3.6: + version "0.3.8" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" + integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== + +cssstyle@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-2.3.0.tgz#ff665a0ddbdc31864b09647f34163443d90b0852" + integrity sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A== + dependencies: + cssom "~0.3.6" + +data-urls@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-3.0.2.tgz#9cf24a477ae22bcef5cd5f6f0bfbc1d2d3be9143" + integrity sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ== + dependencies: + abab "^2.0.6" + whatwg-mimetype "^3.0.0" + whatwg-url "^11.0.0" + +debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: + version "4.3.5" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.5.tgz#e83444eceb9fedd4a1da56d671ae2446a01a6e1e" + integrity sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg== dependencies: ms "2.1.2" +decimal.js@^10.4.2: + version "10.4.3" + resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.4.3.tgz#1044092884d245d1b7f65725fa4ad4c6f781cc23" + integrity sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA== + dedent@^1.0.0: version "1.5.3" resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.5.3.tgz#99aee19eb9bae55a67327717b6e848d0bf777e5a" @@ -1017,10 +1102,17 @@ diff-sequences@^29.6.3: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q== -electron-to-chromium@^1.4.668: - version "1.4.736" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.736.tgz#ecb4348f4d5c70fb1e31c347e5bad6b751066416" - integrity sha512-Rer6wc3ynLelKNM4lOCg7/zPQj8tPOCB2hzD32PX9wd3hgRRi9MxEbmkFCokzcEhRVMiOVLjnL9ig9cefJ+6+Q== +domexception@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/domexception/-/domexception-4.0.0.tgz#4ad1be56ccadc86fc76d033353999a8037d03673" + integrity sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw== + dependencies: + webidl-conversions "^7.0.0" + +electron-to-chromium@^1.4.820: + version "1.4.832" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.832.tgz#d25882ce0a9237577b039bffa124ecef1822003b" + integrity sha512-cTen3SB0H2SGU7x467NRe1eVcQgcuS6jckKfWJHia2eo0cHIGOqHoAxevIYZD4eRHcWjkvFzo93bi3vJ9W+1lA== emittery@^0.13.1: version "0.13.1" @@ -1032,6 +1124,11 @@ emoji-regex@^8.0.0: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== +entities@^4.4.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48" + integrity sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw== + error-ex@^1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" @@ -1051,7 +1148,7 @@ es-errors@^1.3.0: resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== -escalade@^3.1.1: +escalade@^3.1.1, escalade@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.2.tgz#54076e9ab29ea5bf3d8f1ed62acffbb88272df27" integrity sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA== @@ -1066,11 +1163,32 @@ escape-string-regexp@^2.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== -esprima@^4.0.0: +escodegen@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.1.0.tgz#ba93bbb7a43986d29d6041f99f5262da773e2e17" + integrity sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w== + dependencies: + esprima "^4.0.1" + estraverse "^5.2.0" + esutils "^2.0.2" + optionalDependencies: + source-map "~0.6.1" + +esprima@^4.0.0, esprima@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== +estraverse@^5.2.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" + integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== + +esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + execa@^5.0.0: version "5.1.1" resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" @@ -1114,10 +1232,10 @@ fb-watchman@^2.0.0: dependencies: bser "2.1.1" -fill-range@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" - integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== +fill-range@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" + integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== dependencies: to-regex-range "^5.0.1" @@ -1129,7 +1247,7 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" -form-data@4.0.0, form-data@^4.0.0: +form-data@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== @@ -1138,6 +1256,11 @@ form-data@4.0.0, form-data@^4.0.0: combined-stream "^1.0.8" mime-types "^2.1.12" +formdata-node@^6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/formdata-node/-/formdata-node-6.0.3.tgz#48f8e2206ae2befded82af621ef015f08168dc6d" + integrity sha512-8e1++BCiTzUno9v5IZ2J6bv4RU+3UKDmqWUQD0MIMVCd9AdhWkO1gw57oo1mNEX1dMq2EGI+FbWz4B92pscSQg== + fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" @@ -1240,27 +1363,58 @@ has-symbols@^1.0.3: resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== -hasown@^2.0.0: +hasown@^2.0.0, hasown@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== dependencies: function-bind "^1.1.2" +html-encoding-sniffer@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz#2cb1a8cf0db52414776e5b2a7a04d5dd98158de9" + integrity sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA== + dependencies: + whatwg-encoding "^2.0.0" + html-escaper@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== +http-proxy-agent@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz#5129800203520d434f142bc78ff3c170800f2b43" + integrity sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w== + dependencies: + "@tootallnate/once" "2" + agent-base "6" + debug "4" + +https-proxy-agent@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" + integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== + dependencies: + agent-base "6" + debug "4" + human-signals@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== +iconv-lite@0.6.3: + version "0.6.3" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" + integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== + dependencies: + safer-buffer ">= 2.1.2 < 3.0.0" + import-local@^3.0.2: - version "3.1.0" - resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.1.0.tgz#b4479df8a5fd44f6cdce24070675676063c95cb4" - integrity sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg== + version "3.2.0" + resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.2.0.tgz#c3d5c745798c02a6f8b897726aba5100186ee260" + integrity sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA== dependencies: pkg-dir "^4.2.0" resolve-cwd "^3.0.0" @@ -1289,11 +1443,11 @@ is-arrayish@^0.2.1: integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== is-core-module@^2.13.0: - version "2.13.1" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.1.tgz#ad0d7532c6fea9da1ebdc82742d74525c6273384" - integrity sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw== + version "2.15.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.15.0.tgz#71c72ec5442ace7e76b306e9d48db361f22699ea" + integrity sha512-Dd+Lb2/zvk9SKy1TGCt1wFJFo/MWBPMX5x7KcvLajWTGuomczdQX61PvY5yK6SVACwpoexWo81IfFyoKY2QnTA== dependencies: - hasown "^2.0.0" + hasown "^2.0.2" is-fullwidth-code-point@^3.0.0: version "3.0.0" @@ -1310,6 +1464,11 @@ is-number@^7.0.0: resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== +is-potential-custom-element-name@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5" + integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== + is-stream@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" @@ -1337,9 +1496,9 @@ istanbul-lib-instrument@^5.0.4: semver "^6.3.0" istanbul-lib-instrument@^6.0.0: - version "6.0.2" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.2.tgz#91655936cf7380e4e473383081e38478b69993b1" - integrity sha512-1WUsZ9R1lA0HtBSohTkm39WTPlNKSJ5iFk7UwqXkBLoHQT+hfqPsfsTDVuZdKGaBwn7din9bS7SsnoAr943hvw== + version "6.0.3" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz#fa15401df6c15874bcb2105f773325d78c666765" + integrity sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q== dependencies: "@babel/core" "^7.23.9" "@babel/parser" "^7.23.9" @@ -1481,6 +1640,20 @@ jest-each@^29.7.0: jest-util "^29.7.0" pretty-format "^29.7.0" +jest-environment-jsdom@29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-29.7.0.tgz#d206fa3551933c3fd519e5dfdb58a0f5139a837f" + integrity sha512-k9iQbsf9OyOfdzWH8HDmrRT0gSIcX+FLNW7IQq94tFX0gynPwqDTW0Ho6iMVNjGz/nb+l/vW3dWM2bbLLpkbXA== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/fake-timers" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/jsdom" "^20.0.0" + "@types/node" "*" + jest-mock "^29.7.0" + jest-util "^29.7.0" + jsdom "^20.0.0" + jest-environment-node@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.7.0.tgz#0b93e111dda8ec120bc8300e6d1fb9576e164376" @@ -1721,7 +1894,7 @@ jest-worker@^29.7.0: merge-stream "^2.0.0" supports-color "^8.0.0" -jest@^29.7.0: +jest@29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest/-/jest-29.7.0.tgz#994676fc24177f088f1c5e3737f5697204ff2613" integrity sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw== @@ -1749,6 +1922,38 @@ js-yaml@^3.13.1: argparse "^1.0.7" esprima "^4.0.0" +jsdom@^20.0.0: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-20.0.3.tgz#886a41ba1d4726f67a8858028c99489fed6ad4db" + integrity sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ== + dependencies: + abab "^2.0.6" + acorn "^8.8.1" + acorn-globals "^7.0.0" + cssom "^0.5.0" + cssstyle "^2.3.0" + data-urls "^3.0.2" + decimal.js "^10.4.2" + domexception "^4.0.0" + escodegen "^2.0.0" + form-data "^4.0.0" + html-encoding-sniffer "^3.0.0" + http-proxy-agent "^5.0.0" + https-proxy-agent "^5.0.1" + is-potential-custom-element-name "^1.0.1" + nwsapi "^2.2.2" + parse5 "^7.1.1" + saxes "^6.0.0" + symbol-tree "^3.2.4" + tough-cookie "^4.1.2" + w3c-xmlserializer "^4.0.0" + webidl-conversions "^7.0.0" + whatwg-encoding "^2.0.0" + whatwg-mimetype "^3.0.0" + whatwg-url "^11.0.0" + ws "^8.11.0" + xml-name-validator "^4.0.0" + jsesc@^2.5.1: version "2.5.2" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" @@ -1798,13 +2003,6 @@ lru-cache@^5.1.1: dependencies: yallist "^3.0.2" -lru-cache@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" - integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== - dependencies: - yallist "^4.0.0" - make-dir@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-4.0.0.tgz#c3c2307a771277cd9638305f915c29ae741b614e" @@ -1830,11 +2028,11 @@ merge-stream@^2.0.0: integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== micromatch@^4.0.4: - version "4.0.5" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" - integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== + version "4.0.7" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.7.tgz#33e8190d9fe474a9895525f5618eee136d46c2e5" + integrity sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q== dependencies: - braces "^3.0.2" + braces "^3.0.3" picomatch "^2.3.1" mime-db@1.52.0: @@ -1884,9 +2082,9 @@ node-int64@^0.4.0: integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== node-releases@^2.0.14: - version "2.0.14" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.14.tgz#2ffb053bceb8b2be8495ece1ab6ce600c4461b0b" - integrity sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw== + version "2.0.18" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.18.tgz#f010e8d35e2fe8d6b2944f03f70213ecedc4ca3f" + integrity sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g== normalize-path@^3.0.0: version "3.0.0" @@ -1900,10 +2098,15 @@ npm-run-path@^4.0.1: dependencies: path-key "^3.0.0" +nwsapi@^2.2.2: + version "2.2.12" + resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.12.tgz#fb6af5c0ec35b27b4581eb3bbad34ec9e5c696f8" + integrity sha512-qXDmcVlZV4XRtKFzddidpfVP4oMSGhga+xdMc25mv8kaLUHtgzCDhUxkrN8exkGdTlLNaXj7CV3GtON7zuGZ+w== + object-inspect@^1.13.1: - version "1.13.1" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.1.tgz#b96c6109324ccfef6b12216a956ca4dc2ff94bc2" - integrity sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ== + version "1.13.2" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.2.tgz#dea0088467fb991e67af4058147a24824a3043ff" + integrity sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g== once@^1.3.0: version "1.4.0" @@ -1955,6 +2158,13 @@ parse-json@^5.2.0: json-parse-even-better-errors "^2.3.0" lines-and-columns "^1.1.6" +parse5@^7.0.0, parse5@^7.1.1: + version "7.1.2" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-7.1.2.tgz#0736bebbfd77793823240a23b7fc5e010b7f8e32" + integrity sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw== + dependencies: + entities "^4.4.0" + path-exists@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" @@ -1975,10 +2185,10 @@ path-parse@^1.0.7: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== -picocolors@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" - integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== +picocolors@^1.0.0, picocolors@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.1.tgz#a8ad579b571952f0e5d25892de5445bcfe25aaa1" + integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew== picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1: version "2.3.1" @@ -2019,6 +2229,16 @@ prompts@^2.0.1: kleur "^3.0.3" sisteransi "^1.0.5" +psl@^1.1.33: + version "1.9.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7" + integrity sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag== + +punycode@^2.1.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" + integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== + pure-rand@^6.0.0: version "6.1.0" resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.1.0.tgz#d173cf23258231976ccbdb05247c9787957604f2" @@ -2031,16 +2251,26 @@ qs@6.11.2: dependencies: side-channel "^1.0.4" +querystringify@^2.1.1: + version "2.2.0" + resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" + integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== + react-is@^18.0.0: - version "18.2.0" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" - integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== + version "18.3.1" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e" + integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== +requires-port@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" + integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== + resolve-cwd@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" @@ -2067,17 +2297,27 @@ resolve@^1.20.0: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" +"safer-buffer@>= 2.1.2 < 3.0.0": + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +saxes@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/saxes/-/saxes-6.0.0.tgz#fe5b4a4768df4f14a201b1ba6a65c1f3d9988cc5" + integrity sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA== + dependencies: + xmlchars "^2.2.0" + semver@^6.3.0, semver@^6.3.1: version "6.3.1" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== semver@^7.5.3, semver@^7.5.4: - version "7.6.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d" - integrity sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg== - dependencies: - lru-cache "^6.0.0" + version "7.6.3" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" + integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== set-function-length@^1.2.1: version "1.2.2" @@ -2136,7 +2376,7 @@ source-map-support@0.5.13: buffer-from "^1.0.0" source-map "^0.6.0" -source-map@^0.6.0, source-map@^0.6.1: +source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== @@ -2218,6 +2458,11 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== +symbol-tree@^3.2.4: + version "3.2.4" + resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" + integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== + test-exclude@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" @@ -2244,15 +2489,32 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" +tough-cookie@^4.1.2: + version "4.1.4" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.4.tgz#945f1461b45b5a8c76821c33ea49c3ac192c1b36" + integrity sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag== + dependencies: + psl "^1.1.33" + punycode "^2.1.1" + universalify "^0.2.0" + url-parse "^1.5.3" + +tr46@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-3.0.0.tgz#555c4e297a950617e8eeddef633c87d4d9d6cbf9" + integrity sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA== + dependencies: + punycode "^2.1.1" + tr46@~0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== -ts-jest@^29.1.1: - version "29.1.2" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.1.2.tgz#7613d8c81c43c8cb312c6904027257e814c40e09" - integrity sha512-br6GJoH/WUX4pu7FbZXuWGKGNDuU7b8Uj77g/Sp7puZV6EXzuByl6JrECvm0MzVzSTkSHWTihsXt+5XYER5b+g== +ts-jest@29.1.1: + version "29.1.1" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.1.1.tgz#f58fe62c63caf7bfcc5cc6472082f79180f0815b" + integrity sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA== dependencies: bs-logger "0.x" fast-json-stable-stringify "2.x" @@ -2283,28 +2545,48 @@ undici-types@~5.26.4: resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== -update-browserslist-db@^1.0.13: - version "1.0.13" - resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz#3c5e4f5c083661bd38ef64b6328c26ed6c8248c4" - integrity sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg== +universalify@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0" + integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== + +update-browserslist-db@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz#7ca61c0d8650766090728046e416a8cde682859e" + integrity sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ== dependencies: - escalade "^3.1.1" - picocolors "^1.0.0" + escalade "^3.1.2" + picocolors "^1.0.1" url-join@4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/url-join/-/url-join-4.0.1.tgz#b642e21a2646808ffa178c4c5fda39844e12cde7" integrity sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA== +url-parse@^1.5.3: + version "1.5.10" + resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1" + integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ== + dependencies: + querystringify "^2.1.1" + requires-port "^1.0.0" + v8-to-istanbul@^9.0.1: - version "9.2.0" - resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz#2ed7644a245cddd83d4e087b9b33b3e62dfd10ad" - integrity sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA== + version "9.3.0" + resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz#b9572abfa62bd556c16d75fdebc1a411d5ff3175" + integrity sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA== dependencies: "@jridgewell/trace-mapping" "^0.3.12" "@types/istanbul-lib-coverage" "^2.0.1" convert-source-map "^2.0.0" +w3c-xmlserializer@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz#aebdc84920d806222936e3cdce408e32488a3073" + integrity sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw== + dependencies: + xml-name-validator "^4.0.0" + walker@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f" @@ -2317,6 +2599,31 @@ webidl-conversions@^3.0.0: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== +webidl-conversions@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-7.0.0.tgz#256b4e1882be7debbf01d05f0aa2039778ea080a" + integrity sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g== + +whatwg-encoding@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz#e7635f597fd87020858626805a2729fa7698ac53" + integrity sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg== + dependencies: + iconv-lite "0.6.3" + +whatwg-mimetype@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz#5fa1a7623867ff1af6ca3dc72ad6b8a4208beba7" + integrity sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q== + +whatwg-url@^11.0.0: + version "11.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-11.0.0.tgz#0a849eebb5faf2119b901bb76fd795c2848d4018" + integrity sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ== + dependencies: + tr46 "^3.0.0" + webidl-conversions "^7.0.0" + whatwg-url@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" @@ -2354,6 +2661,21 @@ write-file-atomic@^4.0.2: imurmurhash "^0.1.4" signal-exit "^3.0.7" +ws@^8.11.0: + version "8.18.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" + integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== + +xml-name-validator@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-4.0.0.tgz#79a006e2e63149a8600f15430f0a4725d1524835" + integrity sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw== + +xmlchars@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" + integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== + y18n@^5.0.5: version "5.0.8" resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" @@ -2364,11 +2686,6 @@ yallist@^3.0.2: resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== -yallist@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" - integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== - yargs-parser@^21.0.1, yargs-parser@^21.1.1: version "21.1.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35"