PerspectPerspectDocs
Go to Admin
View as Markdown

client/base-v2-client

Classes

  • BaseV2Client
  • PerspectV2Error

index

Classes

  • ApiKeysV2Client
  • CategoriesV2Client
  • CollectionsV2Client
  • ContactsV2Client
  • ContentV2Client
  • CreditsV2Client
  • NewsletterV2Client
  • OrdersV2Client
  • OrganizationsV2Client
  • PerspectApiV2Client
  • ProductsV2Client
  • SitesV2Client
  • SiteUsersV2Client
  • SubscriptionsV2Client
  • WebhooksV2Client

Interfaces

  • PerspectApiV2Config

Functions

  • createPerspectApiV2Client

References

BaseV2Client

Re-exports BaseV2Client

PerspectV2Error

Re-exports PerspectV2Error

V2ApiKey

Re-exports V2ApiKey

V2CancelSubscriptionResult

Re-exports V2CancelSubscriptionResult

V2Category

Re-exports V2Category

V2CategoryCreateParams

Re-exports V2CategoryCreateParams

V2CategoryUpdateParams

Re-exports V2CategoryUpdateParams

V2Collection

Re-exports V2Collection

V2CollectionCreateParams

Re-exports V2CollectionCreateParams

V2CollectionItem

Re-exports V2CollectionItem

V2CollectionUpdateParams

Re-exports V2CollectionUpdateParams

V2ContactSubmission

Re-exports V2ContactSubmission

V2Content

Re-exports V2Content

V2ContentCreateParams

Re-exports V2ContentCreateParams

V2ContentListParams

Re-exports V2ContentListParams

V2ContentUpdateParams

Re-exports V2ContentUpdateParams

V2CreditBalance

Re-exports V2CreditBalance

V2CreditTransaction

Re-exports V2CreditTransaction

V2Deleted

Re-exports V2Deleted

V2Error

Re-exports V2Error

V2ErrorType

Re-exports V2ErrorType

V2GrantCreditParams

Re-exports V2GrantCreditParams

V2GrantCreditResult

Re-exports V2GrantCreditResult

V2List

Re-exports V2List

V2Media

Re-exports V2Media

V2NewsletterCampaign

Re-exports V2NewsletterCampaign

V2NewsletterImportRequest

Re-exports V2NewsletterImportRequest

V2NewsletterImportResult

Re-exports V2NewsletterImportResult

V2NewsletterList

Re-exports V2NewsletterList

V2NewsletterListCreateParams

Re-exports V2NewsletterListCreateParams

V2NewsletterListUpdateParams

Re-exports V2NewsletterListUpdateParams

V2NewsletterSubscription

Re-exports V2NewsletterSubscription

V2NewsletterSubscriptionListMembershipUpdate

Re-exports V2NewsletterSubscriptionListMembershipUpdate

V2NewsletterSyncInput

Re-exports V2NewsletterSyncInput

V2NewsletterSyncResult

Re-exports V2NewsletterSyncResult

V2NewsletterTrackingResponse

Re-exports V2NewsletterTrackingResponse

V2Object

Re-exports V2Object

V2Order

Re-exports V2Order

V2OrderAddress

Re-exports V2OrderAddress

V2OrderCreateParams

Re-exports V2OrderCreateParams

V2OrderCreateResult

Re-exports V2OrderCreateResult

V2OrderFulfillmentUpdate

Re-exports V2OrderFulfillmentUpdate

V2OrderLineItem

Re-exports V2OrderLineItem

V2OrderLineItemPriceData

Re-exports V2OrderLineItemPriceData

V2OrderListParams

Re-exports V2OrderListParams

V2OrderTaxRequest

Re-exports V2OrderTaxRequest

V2Organization

Re-exports V2Organization

V2PaginationParams

Re-exports V2PaginationParams

V2Product

Re-exports V2Product

V2ProductCreateParams

Re-exports V2ProductCreateParams

V2ProductListParams

Re-exports V2ProductListParams

V2ProductUpdateParams

Re-exports V2ProductUpdateParams

V2Site

Re-exports V2Site

V2SiteUser

Re-exports V2SiteUser

V2SiteUserListParams

Re-exports V2SiteUserListParams

V2SiteUserMeUpdateParams

Re-exports V2SiteUserMeUpdateParams

V2SiteUserProfile

Re-exports V2SiteUserProfile

V2SiteUserSubscription

Re-exports V2SiteUserSubscription

V2SiteUserUpdateParams

Re-exports V2SiteUserUpdateParams

V2SiteUserWithProfile

Re-exports V2SiteUserWithProfile

V2SubscriptionCancelParams

Re-exports V2SubscriptionCancelParams

V2SubscriptionChangePlanParams

Re-exports V2SubscriptionChangePlanParams

V2SubscriptionPauseParams

Re-exports V2SubscriptionPauseParams

V2Webhook

Re-exports V2Webhook

V2WebhookCreateParams

Re-exports V2WebhookCreateParams

V2WebhookUpdateParams

Re-exports V2WebhookUpdateParams


perspectapi-ts-sdk

Modules

  • client/base-v2-client
  • index
  • types

types

Interfaces

  • V2ApiKey
  • V2CancelSubscriptionResult
  • V2Category
  • V2CategoryCreateParams
  • V2CategoryUpdateParams
  • V2Collection
  • V2CollectionCreateParams
  • V2CollectionItem
  • V2CollectionUpdateParams
  • V2ContactSubmission
  • V2Content
  • V2ContentCreateParams
  • V2ContentListParams
  • V2ContentUpdateParams
  • V2CreditBalance
  • V2CreditTransaction
  • V2Deleted
  • V2Error
  • V2GrantCreditParams
  • V2GrantCreditResult
  • V2List
  • V2Media
  • V2NewsletterCampaign
  • V2NewsletterImportRequest
  • V2NewsletterImportResult
  • V2NewsletterList
  • V2NewsletterListCreateParams
  • V2NewsletterListUpdateParams
  • V2NewsletterSubscription
  • V2NewsletterSubscriptionListMembershipUpdate
  • V2NewsletterSyncInput
  • V2NewsletterSyncResult
  • V2NewsletterTrackingResponse
  • V2Object
  • V2Order
  • V2OrderAddress
  • V2OrderCreateParams
  • V2OrderCreateResult
  • V2OrderFulfillmentUpdate
  • V2OrderLineItem
  • V2OrderLineItemPriceData
  • V2OrderListParams
  • V2OrderTaxRequest
  • V2Organization
  • V2PaginationParams
  • V2Product
  • V2ProductCreateParams
  • V2ProductListParams
  • V2ProductUpdateParams
  • V2Site
  • V2SiteUser
  • V2SiteUserListParams
  • V2SiteUserMeUpdateParams
  • V2SiteUserProfile
  • V2SiteUserSubscription
  • V2SiteUserUpdateParams
  • V2SiteUserWithProfile
  • V2SubscriptionCancelParams
  • V2SubscriptionChangePlanParams
  • V2SubscriptionPauseParams
  • V2Webhook
  • V2WebhookCreateParams
  • V2WebhookUpdateParams

Type Aliases

  • V2ErrorType

Interface: PerspectApiV2Config

Extends

  • PerspectApiConfig

Properties

apiKey?

optional apiKey?: string

Inherited from

PerspectApiConfig.apiKey

baseUrl

baseUrl: string

Inherited from

PerspectApiConfig.baseUrl

cache?

optional cache?: CacheConfig

Overrides

PerspectApiConfig.cache

headers?

optional headers?: Record<string, string>

Inherited from

PerspectApiConfig.headers

jwt?

optional jwt?: string

Inherited from

PerspectApiConfig.jwt

retries?

optional retries?: number

Inherited from

PerspectApiConfig.retries

timeout?

optional timeout?: number

Inherited from

PerspectApiConfig.timeout


Interface: V2ApiKey

v2 SDK Types — matches the API wire format exactly (snake_case).

These types reflect the actual JSON returned by /api/v2/ endpoints. No transformation layer is needed in the SDK.

Extends

  • V2Object

Properties

created_at

created_at: string | null

description

description: string | null

expires_at

expires_at: string | null

id

id: string

Inherited from

V2Object.id

is_active

is_active: boolean

last_used_at

last_used_at: string | null

name

name: string

object

object: "api_key"

Overrides

V2Object.object

organization_id

organization_id: string | null

permissions

permissions: string[] | null

site_name

site_name: string | null

updated_at

updated_at: string | null


Interface: V2CancelSubscriptionResult

Properties

cancel_at_period_end

cancel_at_period_end: boolean

effective_at

effective_at: string | null

message

message: string

mode

mode: string

object

object: "subscription_cancel_result"

scheduled_cancel_at

scheduled_cancel_at: string | null

status

status: string


Interface: V2Category

v2 SDK Types — matches the API wire format exactly (snake_case).

These types reflect the actual JSON returned by /api/v2/ endpoints. No transformation layer is needed in the SDK.

Extends

  • V2Object

Properties

created_at

created_at: string | null

description

description: string | null

id

id: string

Inherited from

V2Object.id

name

name: string

object

object: "category"

Overrides

V2Object.object

parent_id

parent_id: string | null

slug

slug: string | null

slug_prefix

slug_prefix: string | null

type

type: "post" | "product" | null

updated_at

updated_at: string | null


Interface: V2CategoryCreateParams

Properties

description?

optional description?: string

name

name: string

parent_id?

optional parent_id?: string

slug?

optional slug?: string

slug_prefix?

optional slug_prefix?: string

type?

optional type?: "post" | "product"


Interface: V2CategoryUpdateParams

Extends

  • Partial<V2CategoryCreateParams>

Properties

description?

optional description?: string

Inherited from

V2CategoryCreateParams.description

name?

optional name?: string

Inherited from

V2CategoryCreateParams.name

parent_id?

optional parent_id?: string

Inherited from

V2CategoryCreateParams.parent_id

slug?

optional slug?: string

Inherited from

V2CategoryCreateParams.slug

slug_prefix?

optional slug_prefix?: string

Inherited from

V2CategoryCreateParams.slug_prefix

type?

optional type?: "post" | "product"

Inherited from

V2CategoryCreateParams.type


Interface: V2Collection

v2 SDK Types — matches the API wire format exactly (snake_case).

These types reflect the actual JSON returned by /api/v2/ endpoints. No transformation layer is needed in the SDK.

Extends

  • V2Object

Properties

available_from

available_from: string | null

available_until

available_until: string | null

created_at

created_at: string | null

description

description: string | null

id

id: string

Inherited from

V2Object.id

name

name: string

object

object: "collection"

Overrides

V2Object.object

published

published: boolean

updated_at

updated_at: string | null


Interface: V2CollectionCreateParams

Properties

available_from?

optional available_from?: string | null

available_until?

optional available_until?: string | null

description?

optional description?: string | null

name

name: string

published?

optional published?: boolean


Interface: V2CollectionItem

v2 SDK Types — matches the API wire format exactly (snake_case).

These types reflect the actual JSON returned by /api/v2/ endpoints. No transformation layer is needed in the SDK.

Extends

  • V2Object

Properties

collection_id

collection_id: string

id

id: string

Inherited from

V2Object.id

max_quantity

max_quantity: number | null

object

object: "collection_item"

Overrides

V2Object.object

position

position: number

product_id

product_id: string


Interface: V2CollectionUpdateParams

Extends

  • Partial<V2CollectionCreateParams>

Properties

available_from?

optional available_from?: string | null

Inherited from

V2CollectionCreateParams.available_from

available_until?

optional available_until?: string | null

Inherited from

V2CollectionCreateParams.available_until

description?

optional description?: string | null

Inherited from

V2CollectionCreateParams.description

name?

optional name?: string

Inherited from

V2CollectionCreateParams.name

published?

optional published?: boolean

Inherited from

V2CollectionCreateParams.published


Interface: V2ContactSubmission

v2 SDK Types — matches the API wire format exactly (snake_case).

These types reflect the actual JSON returned by /api/v2/ endpoints. No transformation layer is needed in the SDK.

Extends

  • V2Object

Properties

company

company: string | null

created_at

created_at: string | null

email

email: string

first_name

first_name: string | null

id

id: string

Inherited from

V2Object.id

last_name

last_name: string | null

message

message: string

metadata

metadata: Record<string, unknown> | null

name

name: string | null

object

object: "contact_submission"

Overrides

V2Object.object

phone

phone: string | null

processed_at

processed_at: string | null

status

status: string

subject

subject: string | null


Interface: V2Content

v2 SDK Types — matches the API wire format exactly (snake_case).

These types reflect the actual JSON returned by /api/v2/ endpoints. No transformation layer is needed in the SDK.

Extends

  • V2Object

Properties

author

author: string | null

content

content: string

custom

custom: Record<string, unknown> | null

excerpt

excerpt: string | null

featured_image

featured_image: string | null

id

id: string

Inherited from

V2Object.id

markdown

markdown: string | null

media

media: V2Media[]

object

object: "content"

Overrides

V2Object.object

published_at

published_at: string

scheduled_at

scheduled_at: string | null

slug

slug: string

slug_prefix

slug_prefix: string | null

status

status: "draft" | "publish" | "private" | "trash" | "scheduled"

title

title: string

type

type: "post" | "page" | "block"

updated_at

updated_at: string


Interface: V2ContentCreateParams

Properties

content

content: string

custom?

optional custom?: Record<string, unknown>

excerpt?

optional excerpt?: string

markdown?

optional markdown?: string

published_at?

optional published_at?: string

scheduled_at?

optional scheduled_at?: string | null

slug?

optional slug?: string

slug_prefix?

optional slug_prefix?: string

status?

optional status?: "draft" | "publish" | "private" | "trash" | "scheduled"

title

title: string

type?

optional type?: "post" | "page" | "block"


Interface: V2ContentListParams

Extends

  • V2PaginationParams

Properties

category?

optional category?: string

ending_before?

optional ending_before?: string

Inherited from

V2PaginationParams.ending_before

limit?

optional limit?: number

Inherited from

V2PaginationParams.limit

optional search?: string

slug_prefix?

optional slug_prefix?: string

starting_after?

optional starting_after?: string

Inherited from

V2PaginationParams.starting_after

status?

optional status?: "draft" | "publish" | "private" | "trash" | "scheduled"

type?

optional type?: "post" | "page" | "block"


Interface: V2ContentUpdateParams

Extends

  • Partial<V2ContentCreateParams>

Properties

content?

optional content?: string

Inherited from

V2ContentCreateParams.content

custom?

optional custom?: Record<string, unknown>

Inherited from

V2ContentCreateParams.custom

excerpt?

optional excerpt?: string

Inherited from

V2ContentCreateParams.excerpt

markdown?

optional markdown?: string

Inherited from

V2ContentCreateParams.markdown

published_at?

optional published_at?: string

Inherited from

V2ContentCreateParams.published_at

scheduled_at?

optional scheduled_at?: string | null

Inherited from

V2ContentCreateParams.scheduled_at

slug?

optional slug?: string

Inherited from

V2ContentCreateParams.slug

slug_prefix?

optional slug_prefix?: string

Inherited from

V2ContentCreateParams.slug_prefix

status?

optional status?: "draft" | "publish" | "private" | "trash" | "scheduled"

Inherited from

V2ContentCreateParams.status

title?

optional title?: string

Inherited from

V2ContentCreateParams.title

type?

optional type?: "post" | "page" | "block"

Inherited from

V2ContentCreateParams.type


Interface: V2CreditBalance

Properties

balance_cents

balance_cents: number

object

object: "credit_balance"

transactions?

optional transactions?: V2CreditTransaction[]


Interface: V2CreditTransaction

v2 SDK Types — matches the API wire format exactly (snake_case).

These types reflect the actual JSON returned by /api/v2/ endpoints. No transformation layer is needed in the SDK.

Extends

  • V2Object

Properties

amount_cents

amount_cents: number

balance_after_cents

balance_after_cents: number

created_at

created_at: string | null

description

description: string | null

id

id: string

Inherited from

V2Object.id

object

object: "credit_transaction"

Overrides

V2Object.object

reference_id

reference_id: string | null

reference_type

reference_type: string | null

site_user_id

site_user_id: string

type

type: string


Interface: V2Deleted

Properties

deleted

deleted: true

id

id: string

object

object: string


Interface: V2Error

Properties

error

error: object

code

code: string

message

message: string

param?

optional param?: string

type

type: V2ErrorType


Interface: V2GrantCreditParams

Properties

amount_cents

amount_cents: number

description

description: string


Interface: V2GrantCreditResult

Properties

new_balance_cents

new_balance_cents: number

object

object: "grant_credit_result"


Interface: V2List<T>

Type Parameters

T

T

Properties

data

data: T[]

has_more

has_more: boolean

object

object: "list"

url

url: string


Interface: V2Media

v2 SDK Types — matches the API wire format exactly (snake_case).

These types reflect the actual JSON returned by /api/v2/ endpoints. No transformation layer is needed in the SDK.

Extends

  • V2Object

Properties

alt_text

alt_text: string | null

caption

caption: string | null

content_type

content_type: string | null

file_name

file_name: string

filesize

filesize: number | null

height

height: number | null

id

id: string

Inherited from

V2Object.id

object

object: "media"

Overrides

V2Object.object

url

url: string

width

width: number | null


Interface: V2NewsletterCampaign

v2 SDK Types — matches the API wire format exactly (snake_case).

These types reflect the actual JSON returned by /api/v2/ endpoints. No transformation layer is needed in the SDK.

Extends

  • V2Object

Properties

clicked_count

clicked_count: number

completed_at

completed_at: string | null

created_at

created_at: string | null

id

id: string

Inherited from

V2Object.id

name

name: string

object

object: "newsletter_campaign"

Overrides

V2Object.object

opened_count

opened_count: number

preview_text

preview_text: string | null

sent_at

sent_at: string | null

sent_count

sent_count: number

slug

slug: string | null

status

status: string

subject

subject: string

total_recipients

total_recipients: number

updated_at

updated_at: string | null


Interface: V2NewsletterImportRequest

Properties

resubscribe_override?

optional resubscribe_override?: boolean

rows

rows: V2NewsletterSyncInput[]


Interface: V2NewsletterImportResult

Properties

applied

applied: number

created

created: number

object

object: "newsletter_import_result"

processed

processed: number

resubscribed

resubscribed: number

rows

rows: object[]

applied

applied: boolean

code

code: "CREATED" | "UPDATED" | "RESUBSCRIBED" | "ALREADY_UNSUBSCRIBED"

email

email: string

index

index: number

resubscribed

resubscribed: boolean

skipped_unsubscribed

skipped_unsubscribed: boolean

subscription_id

subscription_id: string

skipped_unsubscribed

skipped_unsubscribed: number

total

total: number

updated

updated: number


Interface: V2NewsletterList

v2 SDK Types — matches the API wire format exactly (snake_case).

These types reflect the actual JSON returned by /api/v2/ endpoints. No transformation layer is needed in the SDK.

Extends

  • V2Object

Properties

created_at

created_at: string | null

description

description: string | null

id

id: string

Inherited from

V2Object.id

is_default

is_default: boolean

name

name: string

object

object: "newsletter_list"

Overrides

V2Object.object

slug

slug: string

subscriber_count

subscriber_count: number

updated_at

updated_at: string | null


Interface: V2NewsletterListCreateParams

Properties

description?

optional description?: string | null

is_default?

optional is_default?: boolean

is_public?

optional is_public?: boolean

list_name

list_name: string

slug

slug: string

welcome_email_enabled?

optional welcome_email_enabled?: boolean


Interface: V2NewsletterListUpdateParams

Properties

description?

optional description?: string | null

is_default?

optional is_default?: boolean

is_public?

optional is_public?: boolean

list_name?

optional list_name?: string

slug?

optional slug?: string

status?

optional status?: "active" | "archived"

welcome_email_enabled?

optional welcome_email_enabled?: boolean


Interface: V2NewsletterSubscription

v2 SDK Types — matches the API wire format exactly (snake_case).

These types reflect the actual JSON returned by /api/v2/ endpoints. No transformation layer is needed in the SDK.

Extends

  • V2Object

Properties

confirmed_at

confirmed_at: string | null

created_at

created_at: string | null

custom_fields

custom_fields: Record<string, unknown> | null

double_opt_in

double_opt_in: boolean

email

email: string

frequency

frequency: string | null

id

id: string

Inherited from

V2Object.id

language

language: string | null

name

name: string | null

object

object: "newsletter_subscription"

Overrides

V2Object.object

source

source: string | null

status

status: string

tags

tags: string[] | null

topics

topics: string[] | null

unsubscribed_at

unsubscribed_at: string | null

updated_at

updated_at: string | null


Interface: V2NewsletterSubscriptionListMembershipUpdate

Properties

list_ids

list_ids: string[]

mode

mode: "add" | "remove" | "replace"


Interface: V2NewsletterSyncInput

Properties

email

email: string

frequency?

optional frequency?: "instant" | "daily" | "weekly" | "monthly"

language?

optional language?: string | null

list_ids?

optional list_ids?: string[]

metadata?

optional metadata?: Record<string, unknown>

name?

optional name?: string | null

notes?

optional notes?: string | null

resubscribe_override?

optional resubscribe_override?: boolean

source?

optional source?: string | null

source_url?

optional source_url?: string | null

status?

optional status?: "pending" | "confirmed" | "unsubscribed" | "bounced" | "complained"

tags?

optional tags?: string[]

topics?

optional topics?: string[]


Interface: V2NewsletterSyncResult

Properties

applied

applied: boolean

code

code: "CREATED" | "UPDATED" | "RESUBSCRIBED" | "ALREADY_UNSUBSCRIBED"

created

created: boolean

object

object: "newsletter_sync_result"

resubscribed

resubscribed: boolean

skipped_unsubscribed

skipped_unsubscribed: boolean

subscription

subscription: Record<string, unknown>

updated

updated: boolean


Interface: V2NewsletterTrackingResponse

Properties

success

success: boolean


Interface: V2Object

v2 SDK Types — matches the API wire format exactly (snake_case).

These types reflect the actual JSON returned by /api/v2/ endpoints. No transformation layer is needed in the SDK.

Extended by

  • V2Media
  • V2Content
  • V2Product
  • V2Category
  • V2Collection
  • V2CollectionItem
  • V2Order
  • V2OrderCreateResult
  • V2SiteUser
  • V2NewsletterSubscription
  • V2NewsletterList
  • V2NewsletterCampaign
  • V2ContactSubmission
  • V2Organization
  • V2Site
  • V2ApiKey
  • V2Webhook
  • V2SiteUserSubscription
  • V2CreditTransaction

Properties

id

id: string

object

object: string


Interface: V2Order

v2 SDK Types — matches the API wire format exactly (snake_case).

These types reflect the actual JSON returned by /api/v2/ endpoints. No transformation layer is needed in the SDK.

Extends

  • V2Object

Properties

amount_total

amount_total: number

completed_at

completed_at: string | null

created_at

created_at: string

currency

currency: string

customer_details

customer_details: Record<string, unknown> | null

customer_email

customer_email: string

customer_name

customer_name: string | null

customer_phone

customer_phone: string | null

expires_at

expires_at: string | null

fulfillment_status

fulfillment_status: string | null

id

id: string

Inherited from

V2Object.id

line_items

line_items: unknown[] | null

live_mode

live_mode: boolean

metadata

metadata: Record<string, unknown> | null

notes

notes: string | null

object

object: "checkout_session"

Overrides

V2Object.object

order_id

order_id: string | null

payment_status

payment_status: string | null

shipping_details

shipping_details: Record<string, unknown> | null

status

status: string

tax_summary

tax_summary: Record<string, unknown> | null

tracking_number

tracking_number: string | null


Interface: V2OrderAddress

Properties

city?

optional city?: string

country?

optional country?: string

line1?

optional line1?: string

line2?

optional line2?: string

postal_code?

optional postal_code?: string

state?

optional state?: string


Interface: V2OrderCreateParams

Properties

billing_address?

optional billing_address?: V2OrderAddress

cancel_url

cancel_url: string

currency?

optional currency?: string

customer_email?

optional customer_email?: string

line_items

line_items: V2OrderLineItem[]

metadata?

optional metadata?: Record<string, string | number | boolean>

mode?

optional mode?: "payment" | "subscription"

referral_code?

optional referral_code?: string

referrer_site_user_id?

optional referrer_site_user_id?: string

shipping_address?

optional shipping_address?: V2OrderAddress

shipping_amount?

optional shipping_amount?: number

site_user_id?

optional site_user_id?: string

success_url

success_url: string

tax?

optional tax?: V2OrderTaxRequest


Interface: V2OrderCreateResult

v2 SDK Types — matches the API wire format exactly (snake_case).

These types reflect the actual JSON returned by /api/v2/ endpoints. No transformation layer is needed in the SDK.

Extends

  • V2Object

Properties

checkout_url

checkout_url: string | null

id

id: string

Inherited from

V2Object.id

object

object: "checkout_session"

Overrides

V2Object.object

payment_status

payment_status: string | null

tax

tax: object

amount

amount: number

breakdown

breakdown: object[]

currency

currency: string

exemption_applied

exemption_applied: boolean

exemption_status

exemption_status: string

strategy

strategy: string


Interface: V2OrderFulfillmentUpdate

Properties

fulfillment_status

fulfillment_status: string

notes?

optional notes?: string

tracking_number?

optional tracking_number?: string


Interface: V2OrderLineItem

Properties

price?

optional price?: string

price_data?

optional price_data?: V2OrderLineItemPriceData

product_id?

optional product_id?: number

quantity

quantity: number

sku_id?

optional sku_id?: number


Interface: V2OrderLineItemPriceData

Properties

currency

currency: string

product_data

product_data: object

description?

optional description?: string

images?

optional images?: string[]

name

name: string

unit_amount

unit_amount: number


Interface: V2OrderListParams

Extends

  • V2PaginationParams

Properties

customer_email?

optional customer_email?: string

date_from?

optional date_from?: string

date_to?

optional date_to?: string

ending_before?

optional ending_before?: string

Inherited from

V2PaginationParams.ending_before

limit?

optional limit?: number

Inherited from

V2PaginationParams.limit

starting_after?

optional starting_after?: string

Inherited from

V2PaginationParams.starting_after

status?

optional status?: string


Interface: V2OrderTaxRequest

Properties

allow_exemption?

optional allow_exemption?: boolean

customer_display_name?

optional customer_display_name?: string

customer_exemption?

optional customer_exemption?: object

certificate_url?

optional certificate_url?: string

expires_at?

optional expires_at?: string

metadata?

optional metadata?: Record<string, unknown>

reason?

optional reason?: string

status?

optional status?: "none" | "exempt" | "reverse_charge"

tax_id?

optional tax_id?: string

tax_id_type?

optional tax_id_type?: string

customer_identifier?

optional customer_identifier?: string

customer_profile_id?

optional customer_profile_id?: string

save_profile?

optional save_profile?: boolean

strategy?

optional strategy?: string


Interface: V2Organization

v2 SDK Types — matches the API wire format exactly (snake_case).

These types reflect the actual JSON returned by /api/v2/ endpoints. No transformation layer is needed in the SDK.

Extends

  • V2Object

Properties

created_at

created_at: string | null

endpoint_status

endpoint_status: string | null

endpoint_url

endpoint_url: string | null

id

id: string

Inherited from

V2Object.id

name

name: string

object

object: "organization"

Overrides

V2Object.object

slug

slug: string | null

updated_at

updated_at: string | null


Interface: V2PaginationParams

Extended by

  • V2ContentListParams
  • V2ProductListParams
  • V2OrderListParams
  • V2SiteUserListParams

Properties

ending_before?

optional ending_before?: string

limit?

optional limit?: number

starting_after?

optional starting_after?: string


Interface: V2Product

v2 SDK Types — matches the API wire format exactly (snake_case).

These types reflect the actual JSON returned by /api/v2/ endpoints. No transformation layer is needed in the SDK.

Extends

  • V2Object

Properties

category_id

category_id: string | null

created_at

created_at: string | null

currency

currency: string

custom

custom: Record<string, unknown> | null

description

description: string | null

excerpt

excerpt: string | null

id

id: string

Inherited from

V2Object.id

media

media: V2Media[]

meta_description

meta_description: string | null

name

name: string

object

object: "product"

Overrides

V2Object.object

price

price: number

published

published: boolean

recurring

recurring: { interval: string; interval_count?: number; } | null

sku

sku: string | null

slug

slug: string | null

slug_prefix

slug_prefix: string | null

stock_quantity

stock_quantity: number | null

tax_behavior

tax_behavior: "inclusive" | "exclusive" | "unspecified" | null

unit_amount

unit_amount: number

updated_at

updated_at: string | null


Interface: V2ProductCreateParams

Properties

attachment_ids?

optional attachment_ids?: number[]

category_id?

optional category_id?: string

currency?

optional currency?: string

custom?

optional custom?: Record<string, unknown>

description?

optional description?: string

excerpt?

optional excerpt?: string

meta_description?

optional meta_description?: string

name

name: string

price

price: number

published?

optional published?: boolean

recurring?

optional recurring?: object

interval

interval: "day" | "week" | "month" | "year"

interval_count?

optional interval_count?: number

sku?

optional sku?: string

slug?

optional slug?: string

slug_prefix?

optional slug_prefix?: string

stock_quantity?

optional stock_quantity?: number | null

tax_behavior?

optional tax_behavior?: "inclusive" | "exclusive" | "unspecified"

unit_amount

unit_amount: number


Interface: V2ProductListParams

Extends

  • V2PaginationParams

Properties

category_id?

optional category_id?: string

ending_before?

optional ending_before?: string

Inherited from

V2PaginationParams.ending_before

limit?

optional limit?: number

Inherited from

V2PaginationParams.limit

published?

optional published?: boolean

optional search?: string

slug_prefix?

optional slug_prefix?: string

starting_after?

optional starting_after?: string

Inherited from

V2PaginationParams.starting_after


Interface: V2ProductUpdateParams

Extends

  • Partial<V2ProductCreateParams>

Properties

attachment_ids?

optional attachment_ids?: number[]

Inherited from

V2ProductCreateParams.attachment_ids

category_id?

optional category_id?: string

Inherited from

V2ProductCreateParams.category_id

currency?

optional currency?: string

Inherited from

V2ProductCreateParams.currency

custom?

optional custom?: Record<string, unknown>

Inherited from

V2ProductCreateParams.custom

description?

optional description?: string

Inherited from

V2ProductCreateParams.description

excerpt?

optional excerpt?: string

Inherited from

V2ProductCreateParams.excerpt

meta_description?

optional meta_description?: string

Inherited from

V2ProductCreateParams.meta_description

name?

optional name?: string

Inherited from

V2ProductCreateParams.name

price?

optional price?: number

Inherited from

V2ProductCreateParams.price

published?

optional published?: boolean

Inherited from

V2ProductCreateParams.published

recurring?

optional recurring?: object

interval

interval: "day" | "week" | "month" | "year"

interval_count?

optional interval_count?: number

Inherited from

V2ProductCreateParams.recurring

sku?

optional sku?: string

Inherited from

V2ProductCreateParams.sku

slug?

optional slug?: string

Inherited from

V2ProductCreateParams.slug

slug_prefix?

optional slug_prefix?: string

Inherited from

V2ProductCreateParams.slug_prefix

stock_quantity?

optional stock_quantity?: number | null

Inherited from

V2ProductCreateParams.stock_quantity

tax_behavior?

optional tax_behavior?: "inclusive" | "exclusive" | "unspecified"

Inherited from

V2ProductCreateParams.tax_behavior

unit_amount?

optional unit_amount?: number

Inherited from

V2ProductCreateParams.unit_amount


Interface: V2Site

v2 SDK Types — matches the API wire format exactly (snake_case).

These types reflect the actual JSON returned by /api/v2/ endpoints. No transformation layer is needed in the SDK.

Extends

  • V2Object

Properties

created_at

created_at: string | null

custom_domain

custom_domain: string | null

description

description: string | null

domain

domain: string | null

id

id: string

Inherited from

V2Object.id

lifecycle_status

lifecycle_status: string | null

name

name: string

object

object: "site"

Overrides

V2Object.object

organization_id

organization_id: string | null

tax_enabled

tax_enabled: boolean

title

title: string | null

updated_at

updated_at: string | null


Interface: V2SiteUser

v2 SDK Types — matches the API wire format exactly (snake_case).

These types reflect the actual JSON returned by /api/v2/ endpoints. No transformation layer is needed in the SDK.

Extends

  • V2Object

Extended by

  • V2SiteUserWithProfile

Properties

avatar_url

avatar_url: string | null

created_at

created_at: string | null

email

email: string

email_verified

email_verified: boolean

first_name

first_name: string | null

id

id: string

Inherited from

V2Object.id

last_login_at

last_login_at: string | null

last_name

last_name: string | null

metadata

metadata: Record<string, unknown> | null

object

object: "site_user"

Overrides

V2Object.object

status

status: string

updated_at

updated_at: string | null

waitlist

waitlist: boolean


Interface: V2SiteUserListParams

Extends

  • V2PaginationParams

Properties

email?

optional email?: string

ending_before?

optional ending_before?: string

Inherited from

V2PaginationParams.ending_before

limit?

optional limit?: number

Inherited from

V2PaginationParams.limit

starting_after?

optional starting_after?: string

Inherited from

V2PaginationParams.starting_after

status?

optional status?: "active" | "suspended" | "pending_verification"


Interface: V2SiteUserMeUpdateParams

Patch shape for the authenticated /me endpoint. Unlike the admin update, end users cannot change their own status.

Properties

avatar_url?

optional avatar_url?: string

first_name?

optional first_name?: string

last_name?

optional last_name?: string

metadata?

optional metadata?: Record<string, unknown>


Interface: V2SiteUserProfile

Standalone profile envelope returned by GET|PUT /sites/{siteName}/users/me/profile[/:key]. Each data entry is a parsed value (arbitrary JSON).

Properties

data

data: Record<string, unknown>

object

object: "site_user_profile"

site_user_id

site_user_id: string


Interface: V2SiteUserSubscription

v2 SDK Types — matches the API wire format exactly (snake_case).

These types reflect the actual JSON returned by /api/v2/ endpoints. No transformation layer is needed in the SDK.

Extends

  • V2Object

Properties

amount

amount: number | null

billing_interval

billing_interval: string | null

billing_interval_count

billing_interval_count: number | null

cancel_at_period_end

cancel_at_period_end: boolean

canceled_at

canceled_at: string | null

created_at

created_at: string | null

currency

currency: string | null

current_period_end

current_period_end: string | null

current_period_start

current_period_start: string | null

id

id: string

Inherited from

V2Object.id

metadata

metadata: Record<string, unknown> | null

object

object: "site_user_subscription"

Overrides

V2Object.object

plan_id

plan_id: string | null

plan_name

plan_name: string | null

provider

provider: string | null

provider_subscription_id

provider_subscription_id: string | null

site_user_id

site_user_id: string

status

status: string

trial_end

trial_end: string | null

trial_start

trial_start: string | null

updated_at

updated_at: string | null


Interface: V2SiteUserUpdateParams

Properties

avatar_url?

optional avatar_url?: string

first_name?

optional first_name?: string

last_name?

optional last_name?: string

metadata?

optional metadata?: Record<string, unknown>

status?

optional status?: "active" | "suspended" | "pending_verification"


Interface: V2SiteUserWithProfile

Response shape of GET /sites/{siteName}/users/me. Extends V2SiteUser with a profile side-channel populated from the site_user_profiles KV table.

Extends

  • V2SiteUser

Properties

avatar_url

avatar_url: string | null

Inherited from

V2SiteUser.avatar_url

created_at

created_at: string | null

Inherited from

V2SiteUser.created_at

email

email: string

Inherited from

V2SiteUser.email

email_verified

email_verified: boolean

Inherited from

V2SiteUser.email_verified

first_name

first_name: string | null

Inherited from

V2SiteUser.first_name

id

id: string

Inherited from

V2SiteUser.id

last_login_at

last_login_at: string | null

Inherited from

V2SiteUser.last_login_at

last_name

last_name: string | null

Inherited from

V2SiteUser.last_name

metadata

metadata: Record<string, unknown> | null

Inherited from

V2SiteUser.metadata

object

object: "site_user"

Inherited from

V2SiteUser.object

profile

profile: Record<string, unknown>

status

status: string

Inherited from

V2SiteUser.status

updated_at

updated_at: string | null

Inherited from

V2SiteUser.updated_at

waitlist

waitlist: boolean

Inherited from

V2SiteUser.waitlist


Interface: V2SubscriptionCancelParams

Properties

cancel_at?

optional cancel_at?: string

mode?

optional mode?: "scheduled" | "immediate" | "period_end"


Interface: V2SubscriptionChangePlanParams

Properties

product_id

product_id: string


Interface: V2SubscriptionPauseParams

Properties

resumes_at?

optional resumes_at?: number


Interface: V2Webhook

v2 SDK Types — matches the API wire format exactly (snake_case).

These types reflect the actual JSON returned by /api/v2/ endpoints. No transformation layer is needed in the SDK.

Extends

  • V2Object

Properties

created_at

created_at: string | null

description

description: string | null

events

events: string[] | null

id

id: string

Inherited from

V2Object.id

is_active

is_active: boolean

object

object: "webhook"

Overrides

V2Object.object

updated_at

updated_at: string | null

url

url: string


Interface: V2WebhookCreateParams

Properties

description?

optional description?: string

events?

optional events?: string[]

is_active?

optional is_active?: boolean

url

url: string


Interface: V2WebhookUpdateParams

Extends

  • Partial<V2WebhookCreateParams>

Properties

description?

optional description?: string

Inherited from

V2WebhookCreateParams.description

events?

optional events?: string[]

Inherited from

V2WebhookCreateParams.events

is_active?

optional is_active?: boolean

Inherited from

V2WebhookCreateParams.is_active

url?

optional url?: string

Inherited from

V2WebhookCreateParams.url


Function: createPerspectApiV2Client()

createPerspectApiV2Client(config): PerspectApiV2Client

Parameters

config

PerspectApiConfig

Returns

PerspectApiV2Client


Type Alias: V2ErrorType

V2ErrorType = "invalid_request_error" | "authentication_error" | "permission_error" | "not_found_error" | "rate_limit_error" | "api_error"


Abstract Class: BaseV2Client

Extended by

  • ContentV2Client
  • ProductsV2Client
  • CategoriesV2Client
  • CollectionsV2Client
  • OrdersV2Client
  • SiteUsersV2Client
  • NewsletterV2Client
  • ContactsV2Client
  • OrganizationsV2Client
  • SitesV2Client
  • ApiKeysV2Client
  • WebhooksV2Client
  • SubscriptionsV2Client
  • CreditsV2Client

Constructors

Constructor

new BaseV2Client(http, basePath, cache?): BaseV2Client

Parameters

http

HttpClient

basePath

string

cache?

CacheManager

Returns

BaseV2Client

Properties

basePath

protected basePath: string

cache?

protected optional cache?: CacheManager

http

protected http: HttpClient

Methods

buildPath()

protected buildPath(endpoint): string

Parameters

endpoint

string

Returns

string

deleteOne()

protected deleteOne(path): Promise<V2Deleted>

DELETE a resource.

Parameters

path

string

Returns

Promise<V2Deleted>

getList()

protected getList<T>(path, params?, cachePolicy?): Promise<V2List<T>>

GET a list of resources with cursor pagination, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<V2List<T>>

getOne()

protected getOne<T>(path, params?, cachePolicy?): Promise<T>

GET a single resource, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<T>

invalidateCache()

protected invalidateCache(options): Promise<void>

Invalidate cache entries by keys or tags.

Parameters

options

CacheInvalidateOptions

Returns

Promise<void>

listAutoPaginate()

protected listAutoPaginate<T>(path, params?): AsyncGenerator<T, void, unknown>

Auto-paginating async generator. Yields every item across all pages.

Usage: for await (const item of client.listAutoPaginate(path, params)) { ... }

Type Parameters

T

T extends object

Parameters

path

string

params?

object

Returns

AsyncGenerator<T, void, unknown>

patchOne()

protected patchOne<T>(path, body?): Promise<T>

PATCH to update a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

post()

protected post<T>(path, body?): Promise<T>

POST to create a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

putOne()

protected putOne<T>(path, body?): Promise<T>

PUT to upsert a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

sitePath()

protected sitePath(siteName, resource, suffix?): string

Parameters

siteName

string

resource

string

suffix?

string = ''

Returns

string


Class: PerspectV2Error

Extends

  • Error

Constructors

Constructor

new PerspectV2Error(error, status): PerspectV2Error

Parameters

error
code

string

message

string

param?

string

type

V2ErrorType

status

number

Returns

PerspectV2Error

Overrides

Error.constructor

Properties

cause?

optional cause?: unknown

Inherited from

Error.cause

code

readonly code: string

message

message: string

Inherited from

Error.message

name

name: string

Inherited from

Error.name

param?

readonly optional param?: string

stack?

optional stack?: string

Inherited from

Error.stack

status

readonly status: number

type

readonly type: string

stackTraceLimit

static stackTraceLimit: number

The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

Inherited from

Error.stackTraceLimit

Methods

captureStackTrace()

static captureStackTrace(targetObject, constructorOpt?): void

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();

Parameters

targetObject

object

constructorOpt?

Function

Returns

void

Inherited from

Error.captureStackTrace

prepareStackTrace()

static prepareStackTrace(err, stackTraces): any

Parameters

err

Error

stackTraces

CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

Error.prepareStackTrace


Class: ApiKeysV2Client

Extends

  • BaseV2Client

Constructors

Constructor

new ApiKeysV2Client(http, basePath, cache?): ApiKeysV2Client

Parameters

http

HttpClient

basePath

string

cache?

CacheManager

Returns

ApiKeysV2Client

Inherited from

BaseV2Client.constructor

Properties

basePath

protected basePath: string

Inherited from

BaseV2Client.basePath

cache?

protected optional cache?: CacheManager

Inherited from

BaseV2Client.cache

http

protected http: HttpClient

Inherited from

BaseV2Client.http

Methods

buildPath()

protected buildPath(endpoint): string

Parameters

endpoint

string

Returns

string

Inherited from

BaseV2Client.buildPath

del()

del(id): Promise<V2Deleted>

Parameters

id

string

Returns

Promise<V2Deleted>

deleteOne()

protected deleteOne(path): Promise<V2Deleted>

DELETE a resource.

Parameters

path

string

Returns

Promise<V2Deleted>

Inherited from

BaseV2Client.deleteOne

get()

get(id): Promise<V2ApiKey>

Parameters

id

string

Returns

Promise<V2ApiKey>

getList()

protected getList<T>(path, params?, cachePolicy?): Promise<V2List<T>>

GET a list of resources with cursor pagination, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<V2List<T>>

Inherited from

BaseV2Client.getList

getOne()

protected getOne<T>(path, params?, cachePolicy?): Promise<T>

GET a single resource, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<T>

Inherited from

BaseV2Client.getOne

invalidateCache()

protected invalidateCache(options): Promise<void>

Invalidate cache entries by keys or tags.

Parameters

options

CacheInvalidateOptions

Returns

Promise<void>

Inherited from

BaseV2Client.invalidateCache

list()

list(params?): Promise<V2List<V2ApiKey>>

Parameters

params?

V2PaginationParams

Returns

Promise<V2List<V2ApiKey>>

listAutoPaginate()

protected listAutoPaginate<T>(path, params?): AsyncGenerator<T, void, unknown>

Auto-paginating async generator. Yields every item across all pages.

Usage: for await (const item of client.listAutoPaginate(path, params)) { ... }

Type Parameters

T

T extends object

Parameters

path

string

params?

object

Returns

AsyncGenerator<T, void, unknown>

Inherited from

BaseV2Client.listAutoPaginate

patchOne()

protected patchOne<T>(path, body?): Promise<T>

PATCH to update a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.patchOne

post()

protected post<T>(path, body?): Promise<T>

POST to create a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.post

putOne()

protected putOne<T>(path, body?): Promise<T>

PUT to upsert a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.putOne

sitePath()

protected sitePath(siteName, resource, suffix?): string

Parameters

siteName

string

resource

string

suffix?

string = ''

Returns

string

Inherited from

BaseV2Client.sitePath


Class: CategoriesV2Client

Extends

  • BaseV2Client

Constructors

Constructor

new CategoriesV2Client(http, basePath, cache?): CategoriesV2Client

Parameters

http

HttpClient

basePath

string

cache?

CacheManager

Returns

CategoriesV2Client

Inherited from

BaseV2Client.constructor

Properties

basePath

protected basePath: string

Inherited from

BaseV2Client.basePath

cache?

protected optional cache?: CacheManager

Inherited from

BaseV2Client.cache

http

protected http: HttpClient

Inherited from

BaseV2Client.http

Methods

buildPath()

protected buildPath(endpoint): string

Parameters

endpoint

string

Returns

string

Inherited from

BaseV2Client.buildPath

create()

create(siteName, data): Promise<V2Category>

Parameters

siteName

string

data

V2CategoryCreateParams

Returns

Promise<V2Category>

del()

del(siteName, id): Promise<V2Deleted>

Parameters

siteName

string

id

string

Returns

Promise<V2Deleted>

deleteOne()

protected deleteOne(path): Promise<V2Deleted>

DELETE a resource.

Parameters

path

string

Returns

Promise<V2Deleted>

Inherited from

BaseV2Client.deleteOne

get()

get(siteName, id, cachePolicy?): Promise<V2Category>

Parameters

siteName

string

id

string

cachePolicy?

CachePolicy

Returns

Promise<V2Category>

getList()

protected getList<T>(path, params?, cachePolicy?): Promise<V2List<T>>

GET a list of resources with cursor pagination, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<V2List<T>>

Inherited from

BaseV2Client.getList

getOne()

protected getOne<T>(path, params?, cachePolicy?): Promise<T>

GET a single resource, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<T>

Inherited from

BaseV2Client.getOne

invalidateCache()

protected invalidateCache(options): Promise<void>

Invalidate cache entries by keys or tags.

Parameters

options

CacheInvalidateOptions

Returns

Promise<void>

Inherited from

BaseV2Client.invalidateCache

list()

list(siteName, params?, cachePolicy?): Promise<V2List<V2Category>>

Parameters

siteName

string

params?

V2PaginationParams & object

cachePolicy?

CachePolicy

Returns

Promise<V2List<V2Category>>

listAutoPaginate()

protected listAutoPaginate<T>(path, params?): AsyncGenerator<T, void, unknown>

Auto-paginating async generator. Yields every item across all pages.

Usage: for await (const item of client.listAutoPaginate(path, params)) { ... }

Type Parameters

T

T extends object

Parameters

path

string

params?

object

Returns

AsyncGenerator<T, void, unknown>

Inherited from

BaseV2Client.listAutoPaginate

patchOne()

protected patchOne<T>(path, body?): Promise<T>

PATCH to update a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.patchOne

post()

protected post<T>(path, body?): Promise<T>

POST to create a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.post

putOne()

protected putOne<T>(path, body?): Promise<T>

PUT to upsert a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.putOne

sitePath()

protected sitePath(siteName, resource, suffix?): string

Parameters

siteName

string

resource

string

suffix?

string = ''

Returns

string

Inherited from

BaseV2Client.sitePath

update()

update(siteName, id, data): Promise<V2Category>

Parameters

siteName

string

id

string

data

V2CategoryUpdateParams

Returns

Promise<V2Category>


Class: CollectionsV2Client

Extends

  • BaseV2Client

Constructors

Constructor

new CollectionsV2Client(http, basePath, cache?): CollectionsV2Client

Parameters

http

HttpClient

basePath

string

cache?

CacheManager

Returns

CollectionsV2Client

Inherited from

BaseV2Client.constructor

Properties

basePath

protected basePath: string

Inherited from

BaseV2Client.basePath

cache?

protected optional cache?: CacheManager

Inherited from

BaseV2Client.cache

http

protected http: HttpClient

Inherited from

BaseV2Client.http

Methods

addItem()

addItem(siteName, collectionId, data): Promise<V2CollectionItem>

Parameters

siteName

string

collectionId

string

data
max_quantity?

number | null

position?

number

product_id

string

Returns

Promise<V2CollectionItem>

buildPath()

protected buildPath(endpoint): string

Parameters

endpoint

string

Returns

string

Inherited from

BaseV2Client.buildPath

create()

create(siteName, data): Promise<V2Collection>

Parameters

siteName

string

data

V2CollectionCreateParams

Returns

Promise<V2Collection>

del()

del(siteName, id): Promise<V2Deleted>

Parameters

siteName

string

id

string

Returns

Promise<V2Deleted>

deleteOne()

protected deleteOne(path): Promise<V2Deleted>

DELETE a resource.

Parameters

path

string

Returns

Promise<V2Deleted>

Inherited from

BaseV2Client.deleteOne

get()

get(siteName, id): Promise<V2Collection>

Parameters

siteName

string

id

string

Returns

Promise<V2Collection>

getCurrent()

getCurrent(siteName): Promise<V2Collection | null>

Parameters

siteName

string

Returns

Promise<V2Collection | null>

getList()

protected getList<T>(path, params?, cachePolicy?): Promise<V2List<T>>

GET a list of resources with cursor pagination, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<V2List<T>>

Inherited from

BaseV2Client.getList

getOne()

protected getOne<T>(path, params?, cachePolicy?): Promise<T>

GET a single resource, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<T>

Inherited from

BaseV2Client.getOne

invalidateCache()

protected invalidateCache(options): Promise<void>

Invalidate cache entries by keys or tags.

Parameters

options

CacheInvalidateOptions

Returns

Promise<void>

Inherited from

BaseV2Client.invalidateCache

list()

list(siteName, params?): Promise<V2List<V2Collection>>

Parameters

siteName

string

params?

V2PaginationParams

Returns

Promise<V2List<V2Collection>>

listAutoPaginate()

protected listAutoPaginate<T>(path, params?): AsyncGenerator<T, void, unknown>

Auto-paginating async generator. Yields every item across all pages.

Usage: for await (const item of client.listAutoPaginate(path, params)) { ... }

Type Parameters

T

T extends object

Parameters

path

string

params?

object

Returns

AsyncGenerator<T, void, unknown>

Inherited from

BaseV2Client.listAutoPaginate

listItems()

listItems(siteName, collectionId): Promise<V2List<V2CollectionItem>>

Parameters

siteName

string

collectionId

string

Returns

Promise<V2List<V2CollectionItem>>

patchOne()

protected patchOne<T>(path, body?): Promise<T>

PATCH to update a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.patchOne

post()

protected post<T>(path, body?): Promise<T>

POST to create a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.post

putOne()

protected putOne<T>(path, body?): Promise<T>

PUT to upsert a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.putOne

removeItem()

removeItem(siteName, collectionId, itemId): Promise<V2Deleted>

Parameters

siteName

string

collectionId

string

itemId

string

Returns

Promise<V2Deleted>

sitePath()

protected sitePath(siteName, resource, suffix?): string

Parameters

siteName

string

resource

string

suffix?

string = ''

Returns

string

Inherited from

BaseV2Client.sitePath

update()

update(siteName, id, data): Promise<V2Collection>

Parameters

siteName

string

id

string

data

V2CollectionUpdateParams

Returns

Promise<V2Collection>


Class: ContactsV2Client

Extends

  • BaseV2Client

Constructors

Constructor

new ContactsV2Client(http, basePath, cache?): ContactsV2Client

Parameters

http

HttpClient

basePath

string

cache?

CacheManager

Returns

ContactsV2Client

Inherited from

BaseV2Client.constructor

Properties

basePath

protected basePath: string

Inherited from

BaseV2Client.basePath

cache?

protected optional cache?: CacheManager

Inherited from

BaseV2Client.cache

http

protected http: HttpClient

Inherited from

BaseV2Client.http

Methods

buildPath()

protected buildPath(endpoint): string

Parameters

endpoint

string

Returns

string

Inherited from

BaseV2Client.buildPath

deleteOne()

protected deleteOne(path): Promise<V2Deleted>

DELETE a resource.

Parameters

path

string

Returns

Promise<V2Deleted>

Inherited from

BaseV2Client.deleteOne

get()

get(siteName, id): Promise<V2ContactSubmission>

Parameters

siteName

string

id

string

Returns

Promise<V2ContactSubmission>

getList()

protected getList<T>(path, params?, cachePolicy?): Promise<V2List<T>>

GET a list of resources with cursor pagination, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<V2List<T>>

Inherited from

BaseV2Client.getList

getOne()

protected getOne<T>(path, params?, cachePolicy?): Promise<T>

GET a single resource, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<T>

Inherited from

BaseV2Client.getOne

invalidateCache()

protected invalidateCache(options): Promise<void>

Invalidate cache entries by keys or tags.

Parameters

options

CacheInvalidateOptions

Returns

Promise<void>

Inherited from

BaseV2Client.invalidateCache

list()

list(siteName, params?): Promise<V2List<V2ContactSubmission>>

Parameters

siteName

string

params?

V2PaginationParams & object

Returns

Promise<V2List<V2ContactSubmission>>

listAutoPaginate()

protected listAutoPaginate<T>(path, params?): AsyncGenerator<T, void, unknown>

Auto-paginating async generator. Yields every item across all pages.

Usage: for await (const item of client.listAutoPaginate(path, params)) { ... }

Type Parameters

T

T extends object

Parameters

path

string

params?

object

Returns

AsyncGenerator<T, void, unknown>

Inherited from

BaseV2Client.listAutoPaginate

patchOne()

protected patchOne<T>(path, body?): Promise<T>

PATCH to update a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.patchOne

post()

protected post<T>(path, body?): Promise<T>

POST to create a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.post

putOne()

protected putOne<T>(path, body?): Promise<T>

PUT to upsert a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.putOne

sitePath()

protected sitePath(siteName, resource, suffix?): string

Parameters

siteName

string

resource

string

suffix?

string = ''

Returns

string

Inherited from

BaseV2Client.sitePath

submit()

submit(siteName, data): Promise<V2ContactSubmission>

Parameters

siteName

string

data
company?

string

email

string

first_name?

string

last_name?

string

message

string

metadata?

Record<string, unknown>

name?

string

phone?

string

subject?

string

Returns

Promise<V2ContactSubmission>


Class: ContentV2Client

Extends

  • BaseV2Client

Constructors

Constructor

new ContentV2Client(http, basePath, cache?): ContentV2Client

Parameters

http

HttpClient

basePath

string

cache?

CacheManager

Returns

ContentV2Client

Inherited from

BaseV2Client.constructor

Properties

basePath

protected basePath: string

Inherited from

BaseV2Client.basePath

cache?

protected optional cache?: CacheManager

Inherited from

BaseV2Client.cache

http

protected http: HttpClient

Inherited from

BaseV2Client.http

Methods

buildPath()

protected buildPath(endpoint): string

Parameters

endpoint

string

Returns

string

Inherited from

BaseV2Client.buildPath

create()

create(siteName, data): Promise<V2Content>

Parameters

siteName

string

data

V2ContentCreateParams

Returns

Promise<V2Content>

del()

del(siteName, id): Promise<V2Deleted>

Parameters

siteName

string

id

string

Returns

Promise<V2Deleted>

deleteOne()

protected deleteOne(path): Promise<V2Deleted>

DELETE a resource.

Parameters

path

string

Returns

Promise<V2Deleted>

Inherited from

BaseV2Client.deleteOne

get()

get(siteName, idOrSlug, cachePolicy?): Promise<V2Content>

Parameters

siteName

string

idOrSlug

string

cachePolicy?

CachePolicy

Returns

Promise<V2Content>

getList()

protected getList<T>(path, params?, cachePolicy?): Promise<V2List<T>>

GET a list of resources with cursor pagination, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<V2List<T>>

Inherited from

BaseV2Client.getList

getOne()

protected getOne<T>(path, params?, cachePolicy?): Promise<T>

GET a single resource, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<T>

Inherited from

BaseV2Client.getOne

invalidateCache()

protected invalidateCache(options): Promise<void>

Invalidate cache entries by keys or tags.

Parameters

options

CacheInvalidateOptions

Returns

Promise<void>

Inherited from

BaseV2Client.invalidateCache

list()

list(siteName, params?, cachePolicy?): Promise<V2List<V2Content>>

Parameters

siteName

string

params?

V2ContentListParams

cachePolicy?

CachePolicy

Returns

Promise<V2List<V2Content>>

listAutoPaginate()

protected listAutoPaginate<T>(path, params?): AsyncGenerator<T, void, unknown>

Auto-paginating async generator. Yields every item across all pages.

Usage: for await (const item of client.listAutoPaginate(path, params)) { ... }

Type Parameters

T

T extends object

Parameters

path

string

params?

object

Returns

AsyncGenerator<T, void, unknown>

Inherited from

BaseV2Client.listAutoPaginate

listAutoPaginated()

listAutoPaginated(siteName, params?, cachePolicy?): AsyncGenerator<V2Content, void, unknown>

Parameters

siteName

string

params?

Omit<V2ContentListParams, "starting_after" | "ending_before">

cachePolicy?

CachePolicy

Returns

AsyncGenerator<V2Content, void, unknown>

patchOne()

protected patchOne<T>(path, body?): Promise<T>

PATCH to update a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.patchOne

post()

protected post<T>(path, body?): Promise<T>

POST to create a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.post

publish()

publish(siteName, id): Promise<V2Content>

Parameters

siteName

string

id

string

Returns

Promise<V2Content>

putOne()

protected putOne<T>(path, body?): Promise<T>

PUT to upsert a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.putOne

sitePath()

protected sitePath(siteName, resource, suffix?): string

Parameters

siteName

string

resource

string

suffix?

string = ''

Returns

string

Inherited from

BaseV2Client.sitePath

unpublish()

unpublish(siteName, id): Promise<V2Content>

Parameters

siteName

string

id

string

Returns

Promise<V2Content>

update()

update(siteName, id, data): Promise<V2Content>

Parameters

siteName

string

id

string

data

V2ContentUpdateParams

Returns

Promise<V2Content>


Class: CreditsV2Client

Extends

  • BaseV2Client

Constructors

Constructor

new CreditsV2Client(http, basePath, cache?): CreditsV2Client

Parameters

http

HttpClient

basePath

string

cache?

CacheManager

Returns

CreditsV2Client

Inherited from

BaseV2Client.constructor

Properties

basePath

protected basePath: string

Inherited from

BaseV2Client.basePath

cache?

protected optional cache?: CacheManager

Inherited from

BaseV2Client.cache

http

protected http: HttpClient

Inherited from

BaseV2Client.http

Methods

buildPath()

protected buildPath(endpoint): string

Parameters

endpoint

string

Returns

string

Inherited from

BaseV2Client.buildPath

deleteOne()

protected deleteOne(path): Promise<V2Deleted>

DELETE a resource.

Parameters

path

string

Returns

Promise<V2Deleted>

Inherited from

BaseV2Client.deleteOne

getList()

protected getList<T>(path, params?, cachePolicy?): Promise<V2List<T>>

GET a list of resources with cursor pagination, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<V2List<T>>

Inherited from

BaseV2Client.getList

getMyBalance()

getMyBalance(siteName): Promise<V2CreditBalance>

Get the current credit balance for the authenticated user.

Parameters

siteName

string

Returns

Promise<V2CreditBalance>

getMyCredits()

getMyCredits(siteName): Promise<V2CreditBalance>

Get credit balance and transaction history for the authenticated user.

Parameters

siteName

string

Returns

Promise<V2CreditBalance>

getOne()

protected getOne<T>(path, params?, cachePolicy?): Promise<T>

GET a single resource, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<T>

Inherited from

BaseV2Client.getOne

getUserBalance()

getUserBalance(siteName, userId): Promise<V2CreditBalance>

Get the credit balance for a specific user (admin).

Parameters

siteName

string

userId

string

Returns

Promise<V2CreditBalance>

grantCredit()

grantCredit(siteName, userId, data): Promise<V2GrantCreditResult>

Grant credit to a specific user (admin).

Parameters

siteName

string

userId

string

data

V2GrantCreditParams

Returns

Promise<V2GrantCreditResult>

invalidateCache()

protected invalidateCache(options): Promise<void>

Invalidate cache entries by keys or tags.

Parameters

options

CacheInvalidateOptions

Returns

Promise<void>

Inherited from

BaseV2Client.invalidateCache

listAutoPaginate()

protected listAutoPaginate<T>(path, params?): AsyncGenerator<T, void, unknown>

Auto-paginating async generator. Yields every item across all pages.

Usage: for await (const item of client.listAutoPaginate(path, params)) { ... }

Type Parameters

T

T extends object

Parameters

path

string

params?

object

Returns

AsyncGenerator<T, void, unknown>

Inherited from

BaseV2Client.listAutoPaginate

patchOne()

protected patchOne<T>(path, body?): Promise<T>

PATCH to update a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.patchOne

post()

protected post<T>(path, body?): Promise<T>

POST to create a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.post

putOne()

protected putOne<T>(path, body?): Promise<T>

PUT to upsert a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.putOne

sitePath()

protected sitePath(siteName, resource, suffix?): string

Parameters

siteName

string

resource

string

suffix?

string = ''

Returns

string

Inherited from

BaseV2Client.sitePath


Class: NewsletterV2Client

Extends

  • BaseV2Client

Constructors

Constructor

new NewsletterV2Client(http, basePath, cache?): NewsletterV2Client

Parameters

http

HttpClient

basePath

string

cache?

CacheManager

Returns

NewsletterV2Client

Inherited from

BaseV2Client.constructor

Properties

basePath

protected basePath: string

Inherited from

BaseV2Client.basePath

cache?

protected optional cache?: CacheManager

Inherited from

BaseV2Client.cache

http

protected http: HttpClient

Inherited from

BaseV2Client.http

Methods

buildPath()

protected buildPath(endpoint): string

Parameters

endpoint

string

Returns

string

Inherited from

BaseV2Client.buildPath

confirm()

confirm(siteName, token): Promise<V2NewsletterSubscription>

Parameters

siteName

string

token

string

Returns

Promise<V2NewsletterSubscription>

createList()

createList(siteName, data): Promise<V2NewsletterList>

Parameters

siteName

string

data

V2NewsletterListCreateParams

Returns

Promise<V2NewsletterList>

deleteList()

deleteList(siteName, id): Promise<V2Deleted>

Parameters

siteName

string

id

string

Returns

Promise<V2Deleted>

deleteOne()

protected deleteOne(path): Promise<V2Deleted>

DELETE a resource.

Parameters

path

string

Returns

Promise<V2Deleted>

Inherited from

BaseV2Client.deleteOne

getCampaign()

getCampaign(siteName, idOrSlug, cachePolicy?): Promise<V2NewsletterCampaign>

Parameters

siteName

string

idOrSlug

string

cachePolicy?

CachePolicy

Returns

Promise<V2NewsletterCampaign>

getList()

protected getList<T>(path, params?, cachePolicy?): Promise<V2List<T>>

GET a list of resources with cursor pagination, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<V2List<T>>

Inherited from

BaseV2Client.getList

getOne()

protected getOne<T>(path, params?, cachePolicy?): Promise<T>

GET a single resource, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<T>

Inherited from

BaseV2Client.getOne

getSubscription()

getSubscription(siteName, id, cachePolicy?): Promise<V2NewsletterSubscription>

Parameters

siteName

string

id

string

cachePolicy?

CachePolicy

Returns

Promise<V2NewsletterSubscription>

importSubscriptions()

importSubscriptions(siteName, data): Promise<V2NewsletterImportResult>

Bulk import subscriptions. Each row is upserted via the same sync path; refreshListCounts is deferred until after all rows are processed on the server.

Parameters

siteName

string

data

V2NewsletterImportRequest

Returns

Promise<V2NewsletterImportResult>

invalidateCache()

protected invalidateCache(options): Promise<void>

Invalidate cache entries by keys or tags.

Parameters

options

CacheInvalidateOptions

Returns

Promise<void>

Inherited from

BaseV2Client.invalidateCache

listAutoPaginate()

protected listAutoPaginate<T>(path, params?): AsyncGenerator<T, void, unknown>

Auto-paginating async generator. Yields every item across all pages.

Usage: for await (const item of client.listAutoPaginate(path, params)) { ... }

Type Parameters

T

T extends object

Parameters

path

string

params?

object

Returns

AsyncGenerator<T, void, unknown>

Inherited from

BaseV2Client.listAutoPaginate

listCampaigns()

listCampaigns(siteName, params?, cachePolicy?): Promise<V2List<V2NewsletterCampaign>>

Parameters

siteName

string

params?

V2PaginationParams & object

cachePolicy?

CachePolicy

Returns

Promise<V2List<V2NewsletterCampaign>>

listLists()

listLists(siteName, cachePolicy?): Promise<V2List<V2NewsletterList>>

Parameters

siteName

string

cachePolicy?

CachePolicy

Returns

Promise<V2List<V2NewsletterList>>

listSubscriptions()

listSubscriptions(siteName, params?, cachePolicy?): Promise<V2List<V2NewsletterSubscription>>

Parameters

siteName

string

params?

V2PaginationParams & object

cachePolicy?

CachePolicy

Returns

Promise<V2List<V2NewsletterSubscription>>

patchOne()

protected patchOne<T>(path, body?): Promise<T>

PATCH to update a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.patchOne

post()

protected post<T>(path, body?): Promise<T>

POST to create a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.post

putOne()

protected putOne<T>(path, body?): Promise<T>

PUT to upsert a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.putOne

sitePath()

protected sitePath(siteName, resource, suffix?): string

Parameters

siteName

string

resource

string

suffix?

string = ''

Returns

string

Inherited from

BaseV2Client.sitePath

subscribe()

subscribe(siteName, data): Promise<V2NewsletterSubscription>

Parameters

siteName

string

data
email

string

frequency?

"instant" | "daily" | "weekly" | "monthly"

language?

string

list_ids?

string[]

metadata?

Record<string, unknown>

name?

string

source?

string

source_url?

string

topics?

string[]

Returns

Promise<V2NewsletterSubscription>

syncSubscription()

syncSubscription(siteName, data): Promise<V2NewsletterSyncResult>

Upsert a subscription by email and (optionally) replace its list memberships. Returns a newsletter_sync_result envelope with the outcome (created / updated / resubscribed / already-unsubscribed).

Parameters

siteName

string

data

V2NewsletterSyncInput

Returns

Promise<V2NewsletterSyncResult>

trackClick()

trackClick(siteName, token, url): Promise<V2NewsletterTrackingResponse>

Parameters

siteName

string

token

string

url

string

Returns

Promise<V2NewsletterTrackingResponse>

trackOpen()

trackOpen(siteName, token): Promise<V2NewsletterTrackingResponse>

Parameters

siteName

string

token

string

Returns

Promise<V2NewsletterTrackingResponse>

unsubscribe()

unsubscribe(siteName, data): Promise<V2NewsletterSubscription>

Parameters

siteName

string

data
email?

string

reason?

string

token?

string

Returns

Promise<V2NewsletterSubscription>

updateList()

updateList(siteName, id, data): Promise<V2NewsletterList>

Parameters

siteName

string

id

string

data

V2NewsletterListUpdateParams

Returns

Promise<V2NewsletterList>

updateSubscriptionListMembership()

updateSubscriptionListMembership(siteName, subscriptionId, data): Promise<V2NewsletterSubscription>

Add/remove/replace the list memberships for an existing subscription. Returns the refreshed subscription record.

Parameters

siteName

string

subscriptionId

string

data

V2NewsletterSubscriptionListMembershipUpdate

Returns

Promise<V2NewsletterSubscription>


Class: OrdersV2Client

Extends

  • BaseV2Client

Constructors

Constructor

new OrdersV2Client(http, basePath, cache?): OrdersV2Client

Parameters

http

HttpClient

basePath

string

cache?

CacheManager

Returns

OrdersV2Client

Inherited from

BaseV2Client.constructor

Properties

basePath

protected basePath: string

Inherited from

BaseV2Client.basePath

cache?

protected optional cache?: CacheManager

Inherited from

BaseV2Client.cache

http

protected http: HttpClient

Inherited from

BaseV2Client.http

Methods

buildPath()

protected buildPath(endpoint): string

Parameters

endpoint

string

Returns

string

Inherited from

BaseV2Client.buildPath

create()

create(siteName, data): Promise<V2OrderCreateResult>

Create a checkout session via Stripe. Returns the session ID and a checkout_url that the client should redirect to (or open in a new tab).

This replaces the v1 checkout.createCheckoutSession() + getCsrfToken() dance — v2 is API-key-only and requires no CSRF token.

Parameters

siteName

string

data

V2OrderCreateParams

Returns

Promise<V2OrderCreateResult>

deleteOne()

protected deleteOne(path): Promise<V2Deleted>

DELETE a resource.

Parameters

path

string

Returns

Promise<V2Deleted>

Inherited from

BaseV2Client.deleteOne

get()

get(siteName, id, cachePolicy?): Promise<V2Order>

Parameters

siteName

string

id

string

cachePolicy?

CachePolicy

Returns

Promise<V2Order>

getList()

protected getList<T>(path, params?, cachePolicy?): Promise<V2List<T>>

GET a list of resources with cursor pagination, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<V2List<T>>

Inherited from

BaseV2Client.getList

getOne()

protected getOne<T>(path, params?, cachePolicy?): Promise<T>

GET a single resource, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<T>

Inherited from

BaseV2Client.getOne

invalidateCache()

protected invalidateCache(options): Promise<void>

Invalidate cache entries by keys or tags.

Parameters

options

CacheInvalidateOptions

Returns

Promise<void>

Inherited from

BaseV2Client.invalidateCache

list()

list(siteName, params?, cachePolicy?): Promise<V2List<V2Order>>

Parameters

siteName

string

params?

V2OrderListParams

cachePolicy?

CachePolicy

Returns

Promise<V2List<V2Order>>

listAutoPaginate()

protected listAutoPaginate<T>(path, params?): AsyncGenerator<T, void, unknown>

Auto-paginating async generator. Yields every item across all pages.

Usage: for await (const item of client.listAutoPaginate(path, params)) { ... }

Type Parameters

T

T extends object

Parameters

path

string

params?

object

Returns

AsyncGenerator<T, void, unknown>

Inherited from

BaseV2Client.listAutoPaginate

listAutoPaginated()

listAutoPaginated(siteName, params?): AsyncGenerator<V2Order, void, unknown>

Parameters

siteName

string

params?

Omit<V2OrderListParams, "starting_after" | "ending_before">

Returns

AsyncGenerator<V2Order, void, unknown>

patchOne()

protected patchOne<T>(path, body?): Promise<T>

PATCH to update a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.patchOne

post()

protected post<T>(path, body?): Promise<T>

POST to create a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.post

putOne()

protected putOne<T>(path, body?): Promise<T>

PUT to upsert a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.putOne

sitePath()

protected sitePath(siteName, resource, suffix?): string

Parameters

siteName

string

resource

string

suffix?

string = ''

Returns

string

Inherited from

BaseV2Client.sitePath

updateFulfillment()

updateFulfillment(siteName, id, data): Promise<V2Order>

Update fulfillment status, tracking number, and/or notes on an order.

Parameters

siteName

string

id

string

data

V2OrderFulfillmentUpdate

Returns

Promise<V2Order>


Class: OrganizationsV2Client

Extends

  • BaseV2Client

Constructors

Constructor

new OrganizationsV2Client(http, basePath, cache?): OrganizationsV2Client

Parameters

http

HttpClient

basePath

string

cache?

CacheManager

Returns

OrganizationsV2Client

Inherited from

BaseV2Client.constructor

Properties

basePath

protected basePath: string

Inherited from

BaseV2Client.basePath

cache?

protected optional cache?: CacheManager

Inherited from

BaseV2Client.cache

http

protected http: HttpClient

Inherited from

BaseV2Client.http

Methods

buildPath()

protected buildPath(endpoint): string

Parameters

endpoint

string

Returns

string

Inherited from

BaseV2Client.buildPath

deleteOne()

protected deleteOne(path): Promise<V2Deleted>

DELETE a resource.

Parameters

path

string

Returns

Promise<V2Deleted>

Inherited from

BaseV2Client.deleteOne

get()

get(id): Promise<V2Organization>

Parameters

id

string

Returns

Promise<V2Organization>

getList()

protected getList<T>(path, params?, cachePolicy?): Promise<V2List<T>>

GET a list of resources with cursor pagination, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<V2List<T>>

Inherited from

BaseV2Client.getList

getOne()

protected getOne<T>(path, params?, cachePolicy?): Promise<T>

GET a single resource, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<T>

Inherited from

BaseV2Client.getOne

invalidateCache()

protected invalidateCache(options): Promise<void>

Invalidate cache entries by keys or tags.

Parameters

options

CacheInvalidateOptions

Returns

Promise<void>

Inherited from

BaseV2Client.invalidateCache

list()

list(): Promise<V2List<V2Organization>>

Returns

Promise<V2List<V2Organization>>

listAutoPaginate()

protected listAutoPaginate<T>(path, params?): AsyncGenerator<T, void, unknown>

Auto-paginating async generator. Yields every item across all pages.

Usage: for await (const item of client.listAutoPaginate(path, params)) { ... }

Type Parameters

T

T extends object

Parameters

path

string

params?

object

Returns

AsyncGenerator<T, void, unknown>

Inherited from

BaseV2Client.listAutoPaginate

patchOne()

protected patchOne<T>(path, body?): Promise<T>

PATCH to update a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.patchOne

post()

protected post<T>(path, body?): Promise<T>

POST to create a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.post

putOne()

protected putOne<T>(path, body?): Promise<T>

PUT to upsert a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.putOne

sitePath()

protected sitePath(siteName, resource, suffix?): string

Parameters

siteName

string

resource

string

suffix?

string = ''

Returns

string

Inherited from

BaseV2Client.sitePath


Class: PerspectApiV2Client

Constructors

Constructor

new PerspectApiV2Client(config): PerspectApiV2Client

Parameters

config

PerspectApiV2Config

Returns

PerspectApiV2Client

Properties

apiKeys

readonly apiKeys: ApiKeysV2Client

cache

readonly cache: CacheManager

categories

readonly categories: CategoriesV2Client

collections

readonly collections: CollectionsV2Client

contacts

readonly contacts: ContactsV2Client

content

readonly content: ContentV2Client

credits

readonly credits: CreditsV2Client

newsletter

readonly newsletter: NewsletterV2Client

orders

readonly orders: OrdersV2Client

organizations

readonly organizations: OrganizationsV2Client

products

readonly products: ProductsV2Client

sites

readonly sites: SitesV2Client

siteUsers

readonly siteUsers: SiteUsersV2Client

subscriptions

readonly subscriptions: SubscriptionsV2Client

webhooks

readonly webhooks: WebhooksV2Client

Methods

clearAuth()

clearAuth(): void

Clear authentication.

Returns

void

setApiKey()

setApiKey(apiKey): void

Update the API key.

Parameters

apiKey

string

Returns

void

setAuth()

setAuth(jwt): void

Update the JWT token for authenticated requests.

Parameters

jwt

string

Returns

void


Class: ProductsV2Client

Extends

  • BaseV2Client

Constructors

Constructor

new ProductsV2Client(http, basePath, cache?): ProductsV2Client

Parameters

http

HttpClient

basePath

string

cache?

CacheManager

Returns

ProductsV2Client

Inherited from

BaseV2Client.constructor

Properties

basePath

protected basePath: string

Inherited from

BaseV2Client.basePath

cache?

protected optional cache?: CacheManager

Inherited from

BaseV2Client.cache

http

protected http: HttpClient

Inherited from

BaseV2Client.http

Methods

buildPath()

protected buildPath(endpoint): string

Parameters

endpoint

string

Returns

string

Inherited from

BaseV2Client.buildPath

create()

create(siteName, data): Promise<V2Product>

Parameters

siteName

string

data

V2ProductCreateParams

Returns

Promise<V2Product>

del()

del(siteName, id): Promise<V2Deleted>

Parameters

siteName

string

id

string

Returns

Promise<V2Deleted>

deleteOne()

protected deleteOne(path): Promise<V2Deleted>

DELETE a resource.

Parameters

path

string

Returns

Promise<V2Deleted>

Inherited from

BaseV2Client.deleteOne

get()

get(siteName, idOrSlug, cachePolicy?): Promise<V2Product>

Parameters

siteName

string

idOrSlug

string

cachePolicy?

CachePolicy

Returns

Promise<V2Product>

getList()

protected getList<T>(path, params?, cachePolicy?): Promise<V2List<T>>

GET a list of resources with cursor pagination, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<V2List<T>>

Inherited from

BaseV2Client.getList

getOne()

protected getOne<T>(path, params?, cachePolicy?): Promise<T>

GET a single resource, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<T>

Inherited from

BaseV2Client.getOne

invalidateCache()

protected invalidateCache(options): Promise<void>

Invalidate cache entries by keys or tags.

Parameters

options

CacheInvalidateOptions

Returns

Promise<void>

Inherited from

BaseV2Client.invalidateCache

list()

list(siteName, params?, cachePolicy?): Promise<V2List<V2Product>>

Parameters

siteName

string

params?

V2ProductListParams

cachePolicy?

CachePolicy

Returns

Promise<V2List<V2Product>>

listAutoPaginate()

protected listAutoPaginate<T>(path, params?): AsyncGenerator<T, void, unknown>

Auto-paginating async generator. Yields every item across all pages.

Usage: for await (const item of client.listAutoPaginate(path, params)) { ... }

Type Parameters

T

T extends object

Parameters

path

string

params?

object

Returns

AsyncGenerator<T, void, unknown>

Inherited from

BaseV2Client.listAutoPaginate

listAutoPaginated()

listAutoPaginated(siteName, params?): AsyncGenerator<V2Product, void, unknown>

Parameters

siteName

string

params?

Omit<V2ProductListParams, "starting_after" | "ending_before">

Returns

AsyncGenerator<V2Product, void, unknown>

patchOne()

protected patchOne<T>(path, body?): Promise<T>

PATCH to update a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.patchOne

post()

protected post<T>(path, body?): Promise<T>

POST to create a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.post

putOne()

protected putOne<T>(path, body?): Promise<T>

PUT to upsert a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.putOne

sitePath()

protected sitePath(siteName, resource, suffix?): string

Parameters

siteName

string

resource

string

suffix?

string = ''

Returns

string

Inherited from

BaseV2Client.sitePath

update()

update(siteName, id, data): Promise<V2Product>

Parameters

siteName

string

id

string

data

V2ProductUpdateParams

Returns

Promise<V2Product>


Class: SitesV2Client

Extends

  • BaseV2Client

Constructors

Constructor

new SitesV2Client(http, basePath, cache?): SitesV2Client

Parameters

http

HttpClient

basePath

string

cache?

CacheManager

Returns

SitesV2Client

Inherited from

BaseV2Client.constructor

Properties

basePath

protected basePath: string

Inherited from

BaseV2Client.basePath

cache?

protected optional cache?: CacheManager

Inherited from

BaseV2Client.cache

http

protected http: HttpClient

Inherited from

BaseV2Client.http

Methods

buildPath()

protected buildPath(endpoint): string

Parameters

endpoint

string

Returns

string

Inherited from

BaseV2Client.buildPath

deleteOne()

protected deleteOne(path): Promise<V2Deleted>

DELETE a resource.

Parameters

path

string

Returns

Promise<V2Deleted>

Inherited from

BaseV2Client.deleteOne

get()

get(name): Promise<V2Site>

Parameters

name

string

Returns

Promise<V2Site>

getList()

protected getList<T>(path, params?, cachePolicy?): Promise<V2List<T>>

GET a list of resources with cursor pagination, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<V2List<T>>

Inherited from

BaseV2Client.getList

getOne()

protected getOne<T>(path, params?, cachePolicy?): Promise<T>

GET a single resource, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<T>

Inherited from

BaseV2Client.getOne

invalidateCache()

protected invalidateCache(options): Promise<void>

Invalidate cache entries by keys or tags.

Parameters

options

CacheInvalidateOptions

Returns

Promise<void>

Inherited from

BaseV2Client.invalidateCache

list()

list(params?): Promise<V2List<V2Site>>

Parameters

params?

V2PaginationParams

Returns

Promise<V2List<V2Site>>

listAutoPaginate()

protected listAutoPaginate<T>(path, params?): AsyncGenerator<T, void, unknown>

Auto-paginating async generator. Yields every item across all pages.

Usage: for await (const item of client.listAutoPaginate(path, params)) { ... }

Type Parameters

T

T extends object

Parameters

path

string

params?

object

Returns

AsyncGenerator<T, void, unknown>

Inherited from

BaseV2Client.listAutoPaginate

patchOne()

protected patchOne<T>(path, body?): Promise<T>

PATCH to update a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.patchOne

post()

protected post<T>(path, body?): Promise<T>

POST to create a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.post

putOne()

protected putOne<T>(path, body?): Promise<T>

PUT to upsert a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.putOne

sitePath()

protected sitePath(siteName, resource, suffix?): string

Parameters

siteName

string

resource

string

suffix?

string = ''

Returns

string

Inherited from

BaseV2Client.sitePath


Class: SiteUsersV2Client

Extends

  • BaseV2Client

Constructors

Constructor

new SiteUsersV2Client(http, basePath, cache?): SiteUsersV2Client

Parameters

http

HttpClient

basePath

string

cache?

CacheManager

Returns

SiteUsersV2Client

Inherited from

BaseV2Client.constructor

Properties

basePath

protected basePath: string

Inherited from

BaseV2Client.basePath

cache?

protected optional cache?: CacheManager

Inherited from

BaseV2Client.cache

http

protected http: HttpClient

Inherited from

BaseV2Client.http

Methods

buildPath()

protected buildPath(endpoint): string

Parameters

endpoint

string

Returns

string

Inherited from

BaseV2Client.buildPath

deleteOne()

protected deleteOne(path): Promise<V2Deleted>

DELETE a resource.

Parameters

path

string

Returns

Promise<V2Deleted>

Inherited from

BaseV2Client.deleteOne

deleteProfileValue()

deleteProfileValue(siteName, key): Promise<V2Deleted>

Delete a single profile key.

Parameters

siteName

string

key

string

Returns

Promise<V2Deleted>

get()

get(siteName, id): Promise<V2SiteUser>

Parameters

siteName

string

id

string

Returns

Promise<V2SiteUser>

getList()

protected getList<T>(path, params?, cachePolicy?): Promise<V2List<T>>

GET a list of resources with cursor pagination, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<V2List<T>>

Inherited from

BaseV2Client.getList

getMe()

getMe(siteName): Promise<V2SiteUserWithProfile>

Load the currently-authenticated site user's canonical record plus their profile KV map. Requires client.setAuth(jwt) to have been called with the token returned from verifyOtp.

Parameters

siteName

string

Returns

Promise<V2SiteUserWithProfile>

getOne()

protected getOne<T>(path, params?, cachePolicy?): Promise<T>

GET a single resource, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<T>

Inherited from

BaseV2Client.getOne

getProfile()

getProfile(siteName): Promise<V2SiteUserProfile>

Fetch the profile KV map as a dedicated site_user_profile envelope.

Parameters

siteName

string

Returns

Promise<V2SiteUserProfile>

invalidateCache()

protected invalidateCache(options): Promise<void>

Invalidate cache entries by keys or tags.

Parameters

options

CacheInvalidateOptions

Returns

Promise<void>

Inherited from

BaseV2Client.invalidateCache

list()

list(siteName, params?): Promise<V2List<V2SiteUser>>

Parameters

siteName

string

params?

V2SiteUserListParams

Returns

Promise<V2List<V2SiteUser>>

listAutoPaginate()

protected listAutoPaginate<T>(path, params?): AsyncGenerator<T, void, unknown>

Auto-paginating async generator. Yields every item across all pages.

Usage: for await (const item of client.listAutoPaginate(path, params)) { ... }

Type Parameters

T

T extends object

Parameters

path

string

params?

object

Returns

AsyncGenerator<T, void, unknown>

Inherited from

BaseV2Client.listAutoPaginate

listAutoPaginated()

listAutoPaginated(siteName, params?): AsyncGenerator<V2SiteUser, void, unknown>

Parameters

siteName

string

params?

Omit<V2SiteUserListParams, "starting_after" | "ending_before">

Returns

AsyncGenerator<V2SiteUser, void, unknown>

patchOne()

protected patchOne<T>(path, body?): Promise<T>

PATCH to update a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.patchOne

post()

protected post<T>(path, body?): Promise<T>

POST to create a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.post

putOne()

protected putOne<T>(path, body?): Promise<T>

PUT to upsert a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.putOne

requestOtp()

requestOtp(siteName, data): Promise<V2OtpRequestResponse>

Parameters

siteName

string

data
email

string

metadata?

Record<string, unknown>

waitlist?

boolean

Returns

Promise<V2OtpRequestResponse>

setProfileValue()

setProfileValue(siteName, key, value): Promise<V2SiteUserProfile>

Set a single profile key. The value is persisted verbatim — callers wanting structured data should JSON-stringify their value first.

Parameters

siteName

string

key

string

value

string

Returns

Promise<V2SiteUserProfile>

sitePath()

protected sitePath(siteName, resource, suffix?): string

Parameters

siteName

string

resource

string

suffix?

string = ''

Returns

string

Inherited from

BaseV2Client.sitePath

update()

update(siteName, id, data): Promise<V2SiteUser>

Parameters

siteName

string

id

string

data

V2SiteUserUpdateParams

Returns

Promise<V2SiteUser>

updateMe()

updateMe(siteName, data): Promise<V2SiteUser>

Update the authenticated user's own fields.

Parameters

siteName

string

data

V2SiteUserMeUpdateParams

Returns

Promise<V2SiteUser>

verifyOtp()

verifyOtp(siteName, data): Promise<V2OtpVerifyResponse>

Parameters

siteName

string

data
code

string

email

string

Returns

Promise<V2OtpVerifyResponse>


Class: SubscriptionsV2Client

Extends

  • BaseV2Client

Constructors

Constructor

new SubscriptionsV2Client(http, basePath, cache?): SubscriptionsV2Client

Parameters

http

HttpClient

basePath

string

cache?

CacheManager

Returns

SubscriptionsV2Client

Inherited from

BaseV2Client.constructor

Properties

basePath

protected basePath: string

Inherited from

BaseV2Client.basePath

cache?

protected optional cache?: CacheManager

Inherited from

BaseV2Client.cache

http

protected http: HttpClient

Inherited from

BaseV2Client.http

Methods

buildPath()

protected buildPath(endpoint): string

Parameters

endpoint

string

Returns

string

Inherited from

BaseV2Client.buildPath

cancelSubscription()

cancelSubscription(siteName, subId, params?): Promise<V2CancelSubscriptionResult>

Cancel a subscription.

Parameters

siteName

string

subId

string

params?

V2SubscriptionCancelParams

Returns

Promise<V2CancelSubscriptionResult>

cancelUserSubscription()

cancelUserSubscription(siteName, userId, subId, params?): Promise<V2CancelSubscriptionResult>

Cancel a user's subscription (admin).

Parameters

siteName

string

userId

string

subId

string

params?

V2SubscriptionCancelParams

Returns

Promise<V2CancelSubscriptionResult>

changeSubscriptionPlan()

changeSubscriptionPlan(siteName, subId, params): Promise<V2SiteUserSubscription>

Change the plan (price) of a subscription.

Parameters

siteName

string

subId

string

params

V2SubscriptionChangePlanParams

Returns

Promise<V2SiteUserSubscription>

deleteOne()

protected deleteOne(path): Promise<V2Deleted>

DELETE a resource.

Parameters

path

string

Returns

Promise<V2Deleted>

Inherited from

BaseV2Client.deleteOne

getList()

protected getList<T>(path, params?, cachePolicy?): Promise<V2List<T>>

GET a list of resources with cursor pagination, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<V2List<T>>

Inherited from

BaseV2Client.getList

getOne()

protected getOne<T>(path, params?, cachePolicy?): Promise<T>

GET a single resource, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<T>

Inherited from

BaseV2Client.getOne

invalidateCache()

protected invalidateCache(options): Promise<void>

Invalidate cache entries by keys or tags.

Parameters

options

CacheInvalidateOptions

Returns

Promise<void>

Inherited from

BaseV2Client.invalidateCache

listAutoPaginate()

protected listAutoPaginate<T>(path, params?): AsyncGenerator<T, void, unknown>

Auto-paginating async generator. Yields every item across all pages.

Usage: for await (const item of client.listAutoPaginate(path, params)) { ... }

Type Parameters

T

T extends object

Parameters

path

string

params?

object

Returns

AsyncGenerator<T, void, unknown>

Inherited from

BaseV2Client.listAutoPaginate

listMySubscriptions()

listMySubscriptions(siteName): Promise<V2List<V2SiteUserSubscription>>

List all subscriptions for the authenticated user.

Parameters

siteName

string

Returns

Promise<V2List<V2SiteUserSubscription>>

listUserSubscriptions()

listUserSubscriptions(siteName, userId): Promise<V2List<V2SiteUserSubscription>>

List subscriptions for a specific user (admin).

Parameters

siteName

string

userId

string

Returns

Promise<V2List<V2SiteUserSubscription>>

patchOne()

protected patchOne<T>(path, body?): Promise<T>

PATCH to update a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.patchOne

pauseSubscription()

pauseSubscription(siteName, subId, params?): Promise<V2SiteUserSubscription>

Pause a subscription.

Parameters

siteName

string

subId

string

params?

V2SubscriptionPauseParams

Returns

Promise<V2SiteUserSubscription>

pauseUserSubscription()

pauseUserSubscription(siteName, userId, subId, params?): Promise<V2SiteUserSubscription>

Pause a user's subscription (admin).

Parameters

siteName

string

userId

string

subId

string

params?

V2SubscriptionPauseParams

Returns

Promise<V2SiteUserSubscription>

post()

protected post<T>(path, body?): Promise<T>

POST to create a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.post

putOne()

protected putOne<T>(path, body?): Promise<T>

PUT to upsert a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.putOne

resumeSubscription()

resumeSubscription(siteName, subId): Promise<V2SiteUserSubscription>

Resume a paused subscription.

Parameters

siteName

string

subId

string

Returns

Promise<V2SiteUserSubscription>

resumeUserSubscription()

resumeUserSubscription(siteName, userId, subId): Promise<V2SiteUserSubscription>

Resume a user's paused subscription (admin).

Parameters

siteName

string

userId

string

subId

string

Returns

Promise<V2SiteUserSubscription>

sitePath()

protected sitePath(siteName, resource, suffix?): string

Parameters

siteName

string

resource

string

suffix?

string = ''

Returns

string

Inherited from

BaseV2Client.sitePath


Class: WebhooksV2Client

Extends

  • BaseV2Client

Constructors

Constructor

new WebhooksV2Client(http, basePath, cache?): WebhooksV2Client

Parameters

http

HttpClient

basePath

string

cache?

CacheManager

Returns

WebhooksV2Client

Inherited from

BaseV2Client.constructor

Properties

basePath

protected basePath: string

Inherited from

BaseV2Client.basePath

cache?

protected optional cache?: CacheManager

Inherited from

BaseV2Client.cache

http

protected http: HttpClient

Inherited from

BaseV2Client.http

Methods

buildPath()

protected buildPath(endpoint): string

Parameters

endpoint

string

Returns

string

Inherited from

BaseV2Client.buildPath

create()

create(siteName, data): Promise<V2Webhook>

Parameters

siteName

string

data

V2WebhookCreateParams

Returns

Promise<V2Webhook>

del()

del(siteName, id): Promise<V2Deleted>

Parameters

siteName

string

id

string

Returns

Promise<V2Deleted>

deleteOne()

protected deleteOne(path): Promise<V2Deleted>

DELETE a resource.

Parameters

path

string

Returns

Promise<V2Deleted>

Inherited from

BaseV2Client.deleteOne

get()

get(siteName, id): Promise<V2Webhook>

Parameters

siteName

string

id

string

Returns

Promise<V2Webhook>

getList()

protected getList<T>(path, params?, cachePolicy?): Promise<V2List<T>>

GET a list of resources with cursor pagination, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<V2List<T>>

Inherited from

BaseV2Client.getList

getOne()

protected getOne<T>(path, params?, cachePolicy?): Promise<T>

GET a single resource, with optional caching.

Type Parameters

T

T

Parameters

path

string

params?

object

cachePolicy?

CachePolicy

Returns

Promise<T>

Inherited from

BaseV2Client.getOne

invalidateCache()

protected invalidateCache(options): Promise<void>

Invalidate cache entries by keys or tags.

Parameters

options

CacheInvalidateOptions

Returns

Promise<void>

Inherited from

BaseV2Client.invalidateCache

list()

list(siteName, params?): Promise<V2List<V2Webhook>>

Parameters

siteName

string

params?

V2PaginationParams

Returns

Promise<V2List<V2Webhook>>

listAutoPaginate()

protected listAutoPaginate<T>(path, params?): AsyncGenerator<T, void, unknown>

Auto-paginating async generator. Yields every item across all pages.

Usage: for await (const item of client.listAutoPaginate(path, params)) { ... }

Type Parameters

T

T extends object

Parameters

path

string

params?

object

Returns

AsyncGenerator<T, void, unknown>

Inherited from

BaseV2Client.listAutoPaginate

patchOne()

protected patchOne<T>(path, body?): Promise<T>

PATCH to update a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.patchOne

post()

protected post<T>(path, body?): Promise<T>

POST to create a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.post

putOne()

protected putOne<T>(path, body?): Promise<T>

PUT to upsert a resource.

Type Parameters

T

T

Parameters

path

string

body?

unknown

Returns

Promise<T>

Inherited from

BaseV2Client.putOne

sitePath()

protected sitePath(siteName, resource, suffix?): string

Parameters

siteName

string

resource

string

suffix?

string = ''

Returns

string

Inherited from

BaseV2Client.sitePath

update()

update(siteName, id, data): Promise<V2Webhook>

Parameters

siteName

string

id

string

data

V2WebhookUpdateParams

Returns

Promise<V2Webhook>