client/base-v2-client
Classes
BaseV2ClientPerspectV2Error
index
Classes
ApiKeysV2ClientCategoriesV2ClientCollectionsV2ClientContactsV2ClientContentV2ClientCreditsV2ClientNewsletterV2ClientOrdersV2ClientOrganizationsV2ClientPerspectApiV2ClientProductsV2ClientSitesV2ClientSiteUsersV2ClientSubscriptionsV2ClientWebhooksV2Client
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-clientindextypes
types
Interfaces
V2ApiKeyV2CancelSubscriptionResultV2CategoryV2CategoryCreateParamsV2CategoryUpdateParamsV2CollectionV2CollectionCreateParamsV2CollectionItemV2CollectionUpdateParamsV2ContactSubmissionV2ContentV2ContentCreateParamsV2ContentListParamsV2ContentUpdateParamsV2CreditBalanceV2CreditTransactionV2DeletedV2ErrorV2GrantCreditParamsV2GrantCreditResultV2ListV2MediaV2NewsletterCampaignV2NewsletterImportRequestV2NewsletterImportResultV2NewsletterListV2NewsletterListCreateParamsV2NewsletterListUpdateParamsV2NewsletterSubscriptionV2NewsletterSubscriptionListMembershipUpdateV2NewsletterSyncInputV2NewsletterSyncResultV2NewsletterTrackingResponseV2ObjectV2OrderV2OrderAddressV2OrderCreateParamsV2OrderCreateResultV2OrderFulfillmentUpdateV2OrderLineItemV2OrderLineItemPriceDataV2OrderListParamsV2OrderTaxRequestV2OrganizationV2PaginationParamsV2ProductV2ProductCreateParamsV2ProductListParamsV2ProductUpdateParamsV2SiteV2SiteUserV2SiteUserListParamsV2SiteUserMeUpdateParamsV2SiteUserProfileV2SiteUserSubscriptionV2SiteUserUpdateParamsV2SiteUserWithProfileV2SubscriptionCancelParamsV2SubscriptionChangePlanParamsV2SubscriptionPauseParamsV2WebhookV2WebhookCreateParamsV2WebhookUpdateParams
Type Aliases
V2ErrorType
Interface: PerspectApiV2Config
Extends
PerspectApiConfig
Properties
apiKey?
optionalapiKey?:string
Inherited from
PerspectApiConfig.apiKey
baseUrl
baseUrl:
string
Inherited from
PerspectApiConfig.baseUrl
cache?
optionalcache?:CacheConfig
Overrides
PerspectApiConfig.cache
headers?
optionalheaders?:Record<string,string>
Inherited from
PerspectApiConfig.headers
jwt?
optionaljwt?:string
Inherited from
PerspectApiConfig.jwt
retries?
optionalretries?:number
Inherited from
PerspectApiConfig.retries
timeout?
optionaltimeout?: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?
optionaldescription?:string
name
name:
string
parent_id?
optionalparent_id?:string
slug?
optionalslug?:string
slug_prefix?
optionalslug_prefix?:string
type?
optionaltype?:"post"|"product"
Interface: V2CategoryUpdateParams
Extends
Partial<V2CategoryCreateParams>
Properties
description?
optionaldescription?:string
Inherited from
V2CategoryCreateParams.description
name?
optionalname?:string
Inherited from
V2CategoryCreateParams.name
parent_id?
optionalparent_id?:string
Inherited from
V2CategoryCreateParams.parent_id
slug?
optionalslug?:string
Inherited from
V2CategoryCreateParams.slug
slug_prefix?
optionalslug_prefix?:string
Inherited from
V2CategoryCreateParams.slug_prefix
type?
optionaltype?:"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?
optionalavailable_from?:string|null
available_until?
optionalavailable_until?:string|null
description?
optionaldescription?:string|null
name
name:
string
published?
optionalpublished?: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?
optionalavailable_from?:string|null
Inherited from
V2CollectionCreateParams.available_from
available_until?
optionalavailable_until?:string|null
Inherited from
V2CollectionCreateParams.available_until
description?
optionaldescription?:string|null
Inherited from
V2CollectionCreateParams.description
name?
optionalname?:string
Inherited from
V2CollectionCreateParams.name
published?
optionalpublished?: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:
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?
optionalcustom?:Record<string,unknown>
excerpt?
optionalexcerpt?:string
markdown?
optionalmarkdown?:string
published_at?
optionalpublished_at?:string
scheduled_at?
optionalscheduled_at?:string|null
slug?
optionalslug?:string
slug_prefix?
optionalslug_prefix?:string
status?
optionalstatus?:"draft"|"publish"|"private"|"trash"|"scheduled"
title
title:
string
type?
optionaltype?:"post"|"page"|"block"
Interface: V2ContentListParams
Extends
V2PaginationParams
Properties
category?
optionalcategory?:string
ending_before?
optionalending_before?:string
Inherited from
V2PaginationParams.ending_before
limit?
optionallimit?:number
Inherited from
V2PaginationParams.limit
search?
optionalsearch?:string
slug_prefix?
optionalslug_prefix?:string
starting_after?
optionalstarting_after?:string
Inherited from
V2PaginationParams.starting_after
status?
optionalstatus?:"draft"|"publish"|"private"|"trash"|"scheduled"
type?
optionaltype?:"post"|"page"|"block"
Interface: V2ContentUpdateParams
Extends
Partial<V2ContentCreateParams>
Properties
content?
optionalcontent?:string
Inherited from
V2ContentCreateParams.content
custom?
optionalcustom?:Record<string,unknown>
Inherited from
V2ContentCreateParams.custom
excerpt?
optionalexcerpt?:string
Inherited from
V2ContentCreateParams.excerpt
markdown?
optionalmarkdown?:string
Inherited from
V2ContentCreateParams.markdown
published_at?
optionalpublished_at?:string
Inherited from
V2ContentCreateParams.published_at
scheduled_at?
optionalscheduled_at?:string|null
Inherited from
V2ContentCreateParams.scheduled_at
slug?
optionalslug?:string
Inherited from
V2ContentCreateParams.slug
slug_prefix?
optionalslug_prefix?:string
Inherited from
V2ContentCreateParams.slug_prefix
status?
optionalstatus?:"draft"|"publish"|"private"|"trash"|"scheduled"
Inherited from
V2ContentCreateParams.status
title?
optionaltitle?:string
Inherited from
V2ContentCreateParams.title
type?
optionaltype?:"post"|"page"|"block"
Inherited from
V2ContentCreateParams.type
Interface: V2CreditBalance
Properties
balance_cents
balance_cents:
number
object
object:
"credit_balance"
transactions?
optionaltransactions?: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?
optionalparam?: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?
optionalresubscribe_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:
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?
optionaldescription?:string|null
is_default?
optionalis_default?:boolean
is_public?
optionalis_public?:boolean
list_name
list_name:
string
slug
slug:
string
welcome_email_enabled?
optionalwelcome_email_enabled?:boolean
Interface: V2NewsletterListUpdateParams
Properties
description?
optionaldescription?:string|null
is_default?
optionalis_default?:boolean
is_public?
optionalis_public?:boolean
list_name?
optionallist_name?:string
slug?
optionalslug?:string
status?
optionalstatus?:"active"|"archived"
welcome_email_enabled?
optionalwelcome_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:
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:
string
frequency?
optionalfrequency?:"instant"|"daily"|"weekly"|"monthly"
language?
optionallanguage?:string|null
list_ids?
optionallist_ids?:string[]
metadata?
optionalmetadata?:Record<string,unknown>
name?
optionalname?:string|null
notes?
optionalnotes?:string|null
resubscribe_override?
optionalresubscribe_override?:boolean
source?
optionalsource?:string|null
source_url?
optionalsource_url?:string|null
status?
optionalstatus?:"pending"|"confirmed"|"unsubscribed"|"bounced"|"complained"
tags?
optionaltags?:string[]
topics?
optionaltopics?: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
V2MediaV2ContentV2ProductV2CategoryV2CollectionV2CollectionItemV2OrderV2OrderCreateResultV2SiteUserV2NewsletterSubscriptionV2NewsletterListV2NewsletterCampaignV2ContactSubmissionV2OrganizationV2SiteV2ApiKeyV2WebhookV2SiteUserSubscriptionV2CreditTransaction
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?
optionalcity?:string
country?
optionalcountry?:string
line1?
optionalline1?:string
line2?
optionalline2?:string
postal_code?
optionalpostal_code?:string
state?
optionalstate?:string
Interface: V2OrderCreateParams
Properties
billing_address?
optionalbilling_address?:V2OrderAddress
cancel_url
cancel_url:
string
currency?
optionalcurrency?:string
customer_email?
optionalcustomer_email?:string
line_items
line_items:
V2OrderLineItem[]
metadata?
optionalmetadata?:Record<string,string|number|boolean>
mode?
optionalmode?:"payment"|"subscription"
referral_code?
optionalreferral_code?:string
referrer_site_user_id?
optionalreferrer_site_user_id?:string
shipping_address?
optionalshipping_address?:V2OrderAddress
shipping_amount?
optionalshipping_amount?:number
site_user_id?
optionalsite_user_id?:string
success_url
success_url:
string
tax?
optionaltax?: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?
optionalnotes?:string
tracking_number?
optionaltracking_number?:string
Interface: V2OrderLineItem
Properties
price?
optionalprice?:string
price_data?
optionalprice_data?:V2OrderLineItemPriceData
product_id?
optionalproduct_id?:number
quantity
quantity:
number
sku_id?
optionalsku_id?:number
Interface: V2OrderLineItemPriceData
Properties
currency
currency:
string
product_data
product_data:
object
description?
optionaldescription?:string
images?
optionalimages?:string[]
name
name:
string
unit_amount
unit_amount:
number
Interface: V2OrderListParams
Extends
V2PaginationParams
Properties
customer_email?
optionalcustomer_email?:string
date_from?
optionaldate_from?:string
date_to?
optionaldate_to?:string
ending_before?
optionalending_before?:string
Inherited from
V2PaginationParams.ending_before
limit?
optionallimit?:number
Inherited from
V2PaginationParams.limit
starting_after?
optionalstarting_after?:string
Inherited from
V2PaginationParams.starting_after
status?
optionalstatus?:string
Interface: V2OrderTaxRequest
Properties
allow_exemption?
optionalallow_exemption?:boolean
customer_display_name?
optionalcustomer_display_name?:string
customer_exemption?
optionalcustomer_exemption?:object
certificate_url?
optionalcertificate_url?:string
expires_at?
optionalexpires_at?:string
metadata?
optionalmetadata?:Record<string,unknown>
reason?
optionalreason?:string
status?
optionalstatus?:"none"|"exempt"|"reverse_charge"
tax_id?
optionaltax_id?:string
tax_id_type?
optionaltax_id_type?:string
customer_identifier?
optionalcustomer_identifier?:string
customer_profile_id?
optionalcustomer_profile_id?:string
save_profile?
optionalsave_profile?:boolean
strategy?
optionalstrategy?: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
V2ContentListParamsV2ProductListParamsV2OrderListParamsV2SiteUserListParams
Properties
ending_before?
optionalending_before?:string
limit?
optionallimit?:number
starting_after?
optionalstarting_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?
optionalattachment_ids?:number[]
category_id?
optionalcategory_id?:string
currency?
optionalcurrency?:string
custom?
optionalcustom?:Record<string,unknown>
description?
optionaldescription?:string
excerpt?
optionalexcerpt?:string
meta_description?
optionalmeta_description?:string
name
name:
string
price
price:
number
published?
optionalpublished?:boolean
recurring?
optionalrecurring?:object
interval
interval:
"day"|"week"|"month"|"year"
interval_count?
optionalinterval_count?:number
sku?
optionalsku?:string
slug?
optionalslug?:string
slug_prefix?
optionalslug_prefix?:string
stock_quantity?
optionalstock_quantity?:number|null
tax_behavior?
optionaltax_behavior?:"inclusive"|"exclusive"|"unspecified"
unit_amount
unit_amount:
number
Interface: V2ProductListParams
Extends
V2PaginationParams
Properties
category_id?
optionalcategory_id?:string
ending_before?
optionalending_before?:string
Inherited from
V2PaginationParams.ending_before
limit?
optionallimit?:number
Inherited from
V2PaginationParams.limit
published?
optionalpublished?:boolean
search?
optionalsearch?:string
slug_prefix?
optionalslug_prefix?:string
starting_after?
optionalstarting_after?:string
Inherited from
V2PaginationParams.starting_after
Interface: V2ProductUpdateParams
Extends
Partial<V2ProductCreateParams>
Properties
attachment_ids?
optionalattachment_ids?:number[]
Inherited from
V2ProductCreateParams.attachment_ids
category_id?
optionalcategory_id?:string
Inherited from
V2ProductCreateParams.category_id
currency?
optionalcurrency?:string
Inherited from
V2ProductCreateParams.currency
custom?
optionalcustom?:Record<string,unknown>
Inherited from
V2ProductCreateParams.custom
description?
optionaldescription?:string
Inherited from
V2ProductCreateParams.description
excerpt?
optionalexcerpt?:string
Inherited from
V2ProductCreateParams.excerpt
meta_description?
optionalmeta_description?:string
Inherited from
V2ProductCreateParams.meta_description
name?
optionalname?:string
Inherited from
V2ProductCreateParams.name
price?
optionalprice?:number
Inherited from
V2ProductCreateParams.price
published?
optionalpublished?:boolean
Inherited from
V2ProductCreateParams.published
recurring?
optionalrecurring?:object
interval
interval:
"day"|"week"|"month"|"year"
interval_count?
optionalinterval_count?:number
Inherited from
V2ProductCreateParams.recurring
sku?
optionalsku?:string
Inherited from
V2ProductCreateParams.sku
slug?
optionalslug?:string
Inherited from
V2ProductCreateParams.slug
slug_prefix?
optionalslug_prefix?:string
Inherited from
V2ProductCreateParams.slug_prefix
stock_quantity?
optionalstock_quantity?:number|null
Inherited from
V2ProductCreateParams.stock_quantity
tax_behavior?
optionaltax_behavior?:"inclusive"|"exclusive"|"unspecified"
Inherited from
V2ProductCreateParams.tax_behavior
unit_amount?
optionalunit_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:
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?
optionalemail?:string
ending_before?
optionalending_before?:string
Inherited from
V2PaginationParams.ending_before
limit?
optionallimit?:number
Inherited from
V2PaginationParams.limit
starting_after?
optionalstarting_after?:string
Inherited from
V2PaginationParams.starting_after
status?
optionalstatus?:"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?
optionalavatar_url?:string
first_name?
optionalfirst_name?:string
last_name?
optionallast_name?:string
metadata?
optionalmetadata?: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?
optionalavatar_url?:string
first_name?
optionalfirst_name?:string
last_name?
optionallast_name?:string
metadata?
optionalmetadata?:Record<string,unknown>
status?
optionalstatus?:"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:
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?
optionalcancel_at?:string
mode?
optionalmode?:"scheduled"|"immediate"|"period_end"
Interface: V2SubscriptionChangePlanParams
Properties
product_id
product_id:
string
Interface: V2SubscriptionPauseParams
Properties
resumes_at?
optionalresumes_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?
optionaldescription?:string
events?
optionalevents?:string[]
is_active?
optionalis_active?:boolean
url
url:
string
Interface: V2WebhookUpdateParams
Extends
Partial<V2WebhookCreateParams>
Properties
description?
optionaldescription?:string
Inherited from
V2WebhookCreateParams.description
events?
optionalevents?:string[]
Inherited from
V2WebhookCreateParams.events
is_active?
optionalis_active?:boolean
Inherited from
V2WebhookCreateParams.is_active
url?
optionalurl?: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
ContentV2ClientProductsV2ClientCategoriesV2ClientCollectionsV2ClientOrdersV2ClientSiteUsersV2ClientNewsletterV2ClientContactsV2ClientOrganizationsV2ClientSitesV2ClientApiKeysV2ClientWebhooksV2ClientSubscriptionsV2ClientCreditsV2Client
Constructors
Constructor
new BaseV2Client(
http,basePath,cache?):BaseV2Client
Parameters
http
HttpClient
basePath
string
cache?
CacheManager
Returns
BaseV2Client
Properties
basePath
protectedbasePath:string
cache?
protectedoptionalcache?:CacheManager
http
protectedhttp:HttpClient
Methods
buildPath()
protectedbuildPath(endpoint):string
Parameters
endpoint
string
Returns
string
deleteOne()
protecteddeleteOne(path):Promise<V2Deleted>
DELETE a resource.
Parameters
path
string
Returns
Promise<V2Deleted>
getList()
protectedgetList<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()
protectedgetOne<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()
protectedinvalidateCache(options):Promise<void>
Invalidate cache entries by keys or tags.
Parameters
options
CacheInvalidateOptions
Returns
Promise<void>
listAutoPaginate()
protectedlistAutoPaginate<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()
protectedpatchOne<T>(path,body?):Promise<T>
PATCH to update a resource.
Type Parameters
T
T
Parameters
path
string
body?
unknown
Returns
Promise<T>
post()
protectedpost<T>(path,body?):Promise<T>
POST to create a resource.
Type Parameters
T
T
Parameters
path
string
body?
unknown
Returns
Promise<T>
putOne()
protectedputOne<T>(path,body?):Promise<T>
PUT to upsert a resource.
Type Parameters
T
T
Parameters
path
string
body?
unknown
Returns
Promise<T>
sitePath()
protectedsitePath(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?
optionalcause?:unknown
Inherited from
Error.cause
code
readonlycode:string
message
message:
string
Inherited from
Error.message
name
name:
string
Inherited from
Error.name
param?
readonlyoptionalparam?:string
stack?
optionalstack?:string
Inherited from
Error.stack
status
readonlystatus:number
type
readonlytype:string
stackTraceLimit
staticstackTraceLimit: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()
staticcaptureStackTrace(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()
staticprepareStackTrace(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
protectedbasePath:string
Inherited from
BaseV2Client.basePath
cache?
protectedoptionalcache?:CacheManager
Inherited from
BaseV2Client.cache
http
protectedhttp:HttpClient
Inherited from
BaseV2Client.http
Methods
buildPath()
protectedbuildPath(endpoint):string
Parameters
endpoint
string
Returns
string
Inherited from
BaseV2Client.buildPath
del()
del(
id):Promise<V2Deleted>
Parameters
id
string
Returns
Promise<V2Deleted>
deleteOne()
protecteddeleteOne(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()
protectedgetList<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()
protectedgetOne<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()
protectedinvalidateCache(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()
protectedlistAutoPaginate<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()
protectedpatchOne<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()
protectedpost<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()
protectedputOne<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()
protectedsitePath(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
protectedbasePath:string
Inherited from
BaseV2Client.basePath
cache?
protectedoptionalcache?:CacheManager
Inherited from
BaseV2Client.cache
http
protectedhttp:HttpClient
Inherited from
BaseV2Client.http
Methods
buildPath()
protectedbuildPath(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()
protecteddeleteOne(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()
protectedgetList<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()
protectedgetOne<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()
protectedinvalidateCache(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()
protectedlistAutoPaginate<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()
protectedpatchOne<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()
protectedpost<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()
protectedputOne<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()
protectedsitePath(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
protectedbasePath:string
Inherited from
BaseV2Client.basePath
cache?
protectedoptionalcache?:CacheManager
Inherited from
BaseV2Client.cache
http
protectedhttp: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()
protectedbuildPath(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()
protecteddeleteOne(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()
protectedgetList<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()
protectedgetOne<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()
protectedinvalidateCache(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()
protectedlistAutoPaginate<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()
protectedpatchOne<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()
protectedpost<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()
protectedputOne<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()
protectedsitePath(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
protectedbasePath:string
Inherited from
BaseV2Client.basePath
cache?
protectedoptionalcache?:CacheManager
Inherited from
BaseV2Client.cache
http
protectedhttp:HttpClient
Inherited from
BaseV2Client.http
Methods
buildPath()
protectedbuildPath(endpoint):string
Parameters
endpoint
string
Returns
string
Inherited from
BaseV2Client.buildPath
deleteOne()
protecteddeleteOne(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()
protectedgetList<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()
protectedgetOne<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()
protectedinvalidateCache(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()
protectedlistAutoPaginate<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()
protectedpatchOne<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()
protectedpost<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()
protectedputOne<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()
protectedsitePath(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
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
protectedbasePath:string
Inherited from
BaseV2Client.basePath
cache?
protectedoptionalcache?:CacheManager
Inherited from
BaseV2Client.cache
http
protectedhttp:HttpClient
Inherited from
BaseV2Client.http
Methods
buildPath()
protectedbuildPath(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()
protecteddeleteOne(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()
protectedgetList<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()
protectedgetOne<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()
protectedinvalidateCache(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()
protectedlistAutoPaginate<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()
protectedpatchOne<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()
protectedpost<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()
protectedputOne<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()
protectedsitePath(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
protectedbasePath:string
Inherited from
BaseV2Client.basePath
cache?
protectedoptionalcache?:CacheManager
Inherited from
BaseV2Client.cache
http
protectedhttp:HttpClient
Inherited from
BaseV2Client.http
Methods
buildPath()
protectedbuildPath(endpoint):string
Parameters
endpoint
string
Returns
string
Inherited from
BaseV2Client.buildPath
deleteOne()
protecteddeleteOne(path):Promise<V2Deleted>
DELETE a resource.
Parameters
path
string
Returns
Promise<V2Deleted>
Inherited from
BaseV2Client.deleteOne
getList()
protectedgetList<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()
protectedgetOne<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()
protectedinvalidateCache(options):Promise<void>
Invalidate cache entries by keys or tags.
Parameters
options
CacheInvalidateOptions
Returns
Promise<void>
Inherited from
BaseV2Client.invalidateCache
listAutoPaginate()
protectedlistAutoPaginate<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()
protectedpatchOne<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()
protectedpost<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()
protectedputOne<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()
protectedsitePath(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
protectedbasePath:string
Inherited from
BaseV2Client.basePath
cache?
protectedoptionalcache?:CacheManager
Inherited from
BaseV2Client.cache
http
protectedhttp:HttpClient
Inherited from
BaseV2Client.http
Methods
buildPath()
protectedbuildPath(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()
protecteddeleteOne(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()
protectedgetList<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()
protectedgetOne<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()
protectedinvalidateCache(options):Promise<void>
Invalidate cache entries by keys or tags.
Parameters
options
CacheInvalidateOptions
Returns
Promise<void>
Inherited from
BaseV2Client.invalidateCache
listAutoPaginate()
protectedlistAutoPaginate<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()
protectedpatchOne<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()
protectedpost<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()
protectedputOne<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()
protectedsitePath(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
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
protectedbasePath:string
Inherited from
BaseV2Client.basePath
cache?
protectedoptionalcache?:CacheManager
Inherited from
BaseV2Client.cache
http
protectedhttp:HttpClient
Inherited from
BaseV2Client.http
Methods
buildPath()
protectedbuildPath(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()
protecteddeleteOne(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()
protectedgetList<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()
protectedgetOne<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()
protectedinvalidateCache(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()
protectedlistAutoPaginate<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()
protectedpatchOne<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()
protectedpost<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()
protectedputOne<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()
protectedsitePath(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
protectedbasePath:string
Inherited from
BaseV2Client.basePath
cache?
protectedoptionalcache?:CacheManager
Inherited from
BaseV2Client.cache
http
protectedhttp:HttpClient
Inherited from
BaseV2Client.http
Methods
buildPath()
protectedbuildPath(endpoint):string
Parameters
endpoint
string
Returns
string
Inherited from
BaseV2Client.buildPath
deleteOne()
protecteddeleteOne(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()
protectedgetList<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()
protectedgetOne<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()
protectedinvalidateCache(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()
protectedlistAutoPaginate<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()
protectedpatchOne<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()
protectedpost<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()
protectedputOne<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()
protectedsitePath(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
readonlyapiKeys:ApiKeysV2Client
cache
readonlycache:CacheManager
categories
readonlycategories:CategoriesV2Client
collections
readonlycollections:CollectionsV2Client
contacts
readonlycontacts:ContactsV2Client
content
readonlycontent:ContentV2Client
credits
readonlycredits:CreditsV2Client
newsletter
readonlynewsletter:NewsletterV2Client
orders
readonlyorders:OrdersV2Client
organizations
readonlyorganizations:OrganizationsV2Client
products
readonlyproducts:ProductsV2Client
sites
readonlysites:SitesV2Client
siteUsers
readonlysiteUsers:SiteUsersV2Client
subscriptions
readonlysubscriptions:SubscriptionsV2Client
webhooks
readonlywebhooks: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
protectedbasePath:string
Inherited from
BaseV2Client.basePath
cache?
protectedoptionalcache?:CacheManager
Inherited from
BaseV2Client.cache
http
protectedhttp:HttpClient
Inherited from
BaseV2Client.http
Methods
buildPath()
protectedbuildPath(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()
protecteddeleteOne(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()
protectedgetList<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()
protectedgetOne<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()
protectedinvalidateCache(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()
protectedlistAutoPaginate<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()
protectedpatchOne<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()
protectedpost<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()
protectedputOne<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()
protectedsitePath(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
protectedbasePath:string
Inherited from
BaseV2Client.basePath
cache?
protectedoptionalcache?:CacheManager
Inherited from
BaseV2Client.cache
http
protectedhttp:HttpClient
Inherited from
BaseV2Client.http
Methods
buildPath()
protectedbuildPath(endpoint):string
Parameters
endpoint
string
Returns
string
Inherited from
BaseV2Client.buildPath
deleteOne()
protecteddeleteOne(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()
protectedgetList<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()
protectedgetOne<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()
protectedinvalidateCache(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()
protectedlistAutoPaginate<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()
protectedpatchOne<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()
protectedpost<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()
protectedputOne<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()
protectedsitePath(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
protectedbasePath:string
Inherited from
BaseV2Client.basePath
cache?
protectedoptionalcache?:CacheManager
Inherited from
BaseV2Client.cache
http
protectedhttp:HttpClient
Inherited from
BaseV2Client.http
Methods
buildPath()
protectedbuildPath(endpoint):string
Parameters
endpoint
string
Returns
string
Inherited from
BaseV2Client.buildPath
deleteOne()
protecteddeleteOne(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()
protectedgetList<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()
protectedgetOne<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()
protectedinvalidateCache(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()
protectedlistAutoPaginate<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()
protectedpatchOne<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()
protectedpost<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()
protectedputOne<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
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()
protectedsitePath(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
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
protectedbasePath:string
Inherited from
BaseV2Client.basePath
cache?
protectedoptionalcache?:CacheManager
Inherited from
BaseV2Client.cache
http
protectedhttp:HttpClient
Inherited from
BaseV2Client.http
Methods
buildPath()
protectedbuildPath(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()
protecteddeleteOne(path):Promise<V2Deleted>
DELETE a resource.
Parameters
path
string
Returns
Promise<V2Deleted>
Inherited from
BaseV2Client.deleteOne
getList()
protectedgetList<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()
protectedgetOne<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()
protectedinvalidateCache(options):Promise<void>
Invalidate cache entries by keys or tags.
Parameters
options
CacheInvalidateOptions
Returns
Promise<void>
Inherited from
BaseV2Client.invalidateCache
listAutoPaginate()
protectedlistAutoPaginate<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()
protectedpatchOne<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()
protectedpost<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()
protectedputOne<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()
protectedsitePath(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
protectedbasePath:string
Inherited from
BaseV2Client.basePath
cache?
protectedoptionalcache?:CacheManager
Inherited from
BaseV2Client.cache
http
protectedhttp:HttpClient
Inherited from
BaseV2Client.http
Methods
buildPath()
protectedbuildPath(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()
protecteddeleteOne(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()
protectedgetList<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()
protectedgetOne<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()
protectedinvalidateCache(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()
protectedlistAutoPaginate<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()
protectedpatchOne<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()
protectedpost<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()
protectedputOne<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()
protectedsitePath(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>