@heymantle/core-api-client 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +98 -1
- package/dist/index.d.ts +98 -1
- package/dist/index.js +75 -0
- package/dist/index.mjs +74 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1798,6 +1798,19 @@ interface Agent {
|
|
|
1798
1798
|
interface AgentListResponse {
|
|
1799
1799
|
agents: Agent[];
|
|
1800
1800
|
}
|
|
1801
|
+
/**
|
|
1802
|
+
* Parameters for creating an agent
|
|
1803
|
+
*/
|
|
1804
|
+
interface AgentCreateParams {
|
|
1805
|
+
email: string;
|
|
1806
|
+
name?: string;
|
|
1807
|
+
}
|
|
1808
|
+
/**
|
|
1809
|
+
* Response from creating/retrieving an agent
|
|
1810
|
+
*/
|
|
1811
|
+
interface AgentResponse {
|
|
1812
|
+
agent: Agent;
|
|
1813
|
+
}
|
|
1801
1814
|
|
|
1802
1815
|
/**
|
|
1803
1816
|
* Task status
|
|
@@ -2063,6 +2076,45 @@ interface EntitiesSearchResponse {
|
|
|
2063
2076
|
entities: Entity[];
|
|
2064
2077
|
}
|
|
2065
2078
|
|
|
2079
|
+
/**
|
|
2080
|
+
* Resource type for custom data
|
|
2081
|
+
*/
|
|
2082
|
+
type CustomDataResourceType = 'ticket' | 'customer' | 'contact';
|
|
2083
|
+
/**
|
|
2084
|
+
* Parameters for setting custom data
|
|
2085
|
+
*/
|
|
2086
|
+
interface CustomDataSetParams {
|
|
2087
|
+
resourceId: string;
|
|
2088
|
+
resourceType: CustomDataResourceType;
|
|
2089
|
+
key: string;
|
|
2090
|
+
value: string;
|
|
2091
|
+
}
|
|
2092
|
+
/**
|
|
2093
|
+
* Parameters for getting custom data
|
|
2094
|
+
*/
|
|
2095
|
+
interface CustomDataGetParams {
|
|
2096
|
+
resourceId: string;
|
|
2097
|
+
resourceType: CustomDataResourceType;
|
|
2098
|
+
key: string;
|
|
2099
|
+
}
|
|
2100
|
+
/**
|
|
2101
|
+
* Response from getting custom data
|
|
2102
|
+
*/
|
|
2103
|
+
interface CustomDataResponse {
|
|
2104
|
+
resourceId: string;
|
|
2105
|
+
resourceType: CustomDataResourceType;
|
|
2106
|
+
key: string;
|
|
2107
|
+
value: string;
|
|
2108
|
+
}
|
|
2109
|
+
/**
|
|
2110
|
+
* Parameters for deleting custom data
|
|
2111
|
+
*/
|
|
2112
|
+
interface CustomDataDeleteParams {
|
|
2113
|
+
resourceId: string;
|
|
2114
|
+
resourceType: CustomDataResourceType;
|
|
2115
|
+
key: string;
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2066
2118
|
/**
|
|
2067
2119
|
* Resource for managing customers
|
|
2068
2120
|
*/
|
|
@@ -3098,6 +3150,23 @@ declare class AgentsResource extends BaseResource {
|
|
|
3098
3150
|
* List support agents
|
|
3099
3151
|
*/
|
|
3100
3152
|
list(): Promise<AgentListResponse>;
|
|
3153
|
+
/**
|
|
3154
|
+
* Retrieve a specific agent by ID
|
|
3155
|
+
*/
|
|
3156
|
+
retrieve(agentId: string): Promise<AgentResponse>;
|
|
3157
|
+
/**
|
|
3158
|
+
* Create a new agent
|
|
3159
|
+
*/
|
|
3160
|
+
create(params: AgentCreateParams): Promise<AgentResponse>;
|
|
3161
|
+
/**
|
|
3162
|
+
* Find an existing agent by email, or create one if not found.
|
|
3163
|
+
* This is useful for sync operations where you want to ensure
|
|
3164
|
+
* an agent exists without duplicating.
|
|
3165
|
+
*
|
|
3166
|
+
* @param params - Agent data (email required, name optional)
|
|
3167
|
+
* @returns The existing or newly created agent
|
|
3168
|
+
*/
|
|
3169
|
+
findOrCreate(params: AgentCreateParams): Promise<AgentResponse>;
|
|
3101
3170
|
}
|
|
3102
3171
|
|
|
3103
3172
|
/**
|
|
@@ -3215,6 +3284,33 @@ declare class EntitiesResource extends BaseResource {
|
|
|
3215
3284
|
search(params?: EntitiesSearchParams): Promise<EntitiesSearchResponse>;
|
|
3216
3285
|
}
|
|
3217
3286
|
|
|
3287
|
+
/**
|
|
3288
|
+
* Resource for managing custom data on entities.
|
|
3289
|
+
* Custom data allows storing arbitrary key-value pairs on tickets, customers, and contacts.
|
|
3290
|
+
*/
|
|
3291
|
+
declare class CustomDataResource extends BaseResource {
|
|
3292
|
+
/**
|
|
3293
|
+
* Set custom data on a resource.
|
|
3294
|
+
* This will create or update the value for the given key.
|
|
3295
|
+
*
|
|
3296
|
+
* @param params - The custom data parameters
|
|
3297
|
+
*/
|
|
3298
|
+
set(params: CustomDataSetParams): Promise<void>;
|
|
3299
|
+
/**
|
|
3300
|
+
* Get custom data from a resource.
|
|
3301
|
+
*
|
|
3302
|
+
* @param params - Parameters identifying the custom data to retrieve
|
|
3303
|
+
* @returns The custom data value
|
|
3304
|
+
*/
|
|
3305
|
+
getValue(params: CustomDataGetParams): Promise<CustomDataResponse>;
|
|
3306
|
+
/**
|
|
3307
|
+
* Delete custom data from a resource.
|
|
3308
|
+
*
|
|
3309
|
+
* @param params - Parameters identifying the custom data to delete
|
|
3310
|
+
*/
|
|
3311
|
+
del(params: CustomDataDeleteParams): Promise<void>;
|
|
3312
|
+
}
|
|
3313
|
+
|
|
3218
3314
|
/**
|
|
3219
3315
|
* Mantle Core API Client
|
|
3220
3316
|
*
|
|
@@ -3269,6 +3365,7 @@ declare class MantleCoreClient {
|
|
|
3269
3365
|
readonly agents: AgentsResource;
|
|
3270
3366
|
readonly docs: DocsResource;
|
|
3271
3367
|
readonly entities: EntitiesResource;
|
|
3368
|
+
readonly customData: CustomDataResource;
|
|
3272
3369
|
constructor(config: MantleCoreClientConfig);
|
|
3273
3370
|
/**
|
|
3274
3371
|
* Register a middleware function
|
|
@@ -3474,4 +3571,4 @@ interface AuthRefreshOptions {
|
|
|
3474
3571
|
*/
|
|
3475
3572
|
declare function createAuthRefreshMiddleware(options: AuthRefreshOptions): Middleware;
|
|
3476
3573
|
|
|
3477
|
-
export { type AccountOwner, type AccountOwnersListResponse, type Affiliate, type AffiliateCommission, type AffiliateCommissionListParams, type AffiliateCommissionListResponse, AffiliateCommissionsResource, type AffiliateListParams, type AffiliateListResponse, type AffiliatePayout, type AffiliatePayoutListParams, type AffiliatePayoutListResponse, AffiliatePayoutsResource, type AffiliateProgram, type AffiliateProgramCreateParams, type AffiliateProgramUpdateParams, AffiliateProgramsResource, type AffiliateReferral, type AffiliateReferralListParams, type AffiliateReferralListResponse, AffiliateReferralsResource, type AffiliateUpdateParams, AffiliatesResource, type Agent, type AgentListResponse, AgentsResource, type App, type AppEvent, type AppEventListParams, type AppEventListResponse, type AppInstallation, type AppInstallationParams, type AppListParams, AppsResource, type AuthRefreshOptions, BaseResource, type Channel, type ChannelCreateParams, type ChannelListParams, ChannelsResource, type Charge, type ChargeListParams, type ChargeListResponse, ChargesResource, CompaniesResource, type Company, type CompanyCreateParams, type CompanyListParams, type CompanyListResponse, type CompanyUpdateParams, type Contact, type ContactCreateParams, type ContactEntity, type ContactListParams, type ContactListResponse, type ContactUpdateParams, ContactsResource, type CustomField, type CustomFieldCreateParams, type CustomFieldUpdateParams, type Customer, type CustomerCreateParams, type CustomerEntity, type CustomerListParams, type CustomerListResponse, type CustomerRetrieveParams, type CustomerSegment, type CustomerSegmentListParams, type CustomerSegmentListResponse, CustomerSegmentsResource, type CustomerUpdateParams, CustomersResource, type DateRangeType, type Deal, DealActivitiesResource, type DealActivity, type DealActivityCreateParams, type DealActivityUpdateParams, type DealContactInput, type DealCreateParams, type DealCustomerInput, type DealEvent, type DealEventCreateParams, type DealEventCreateResponse, type DealEventListResponse, type DealFlow, type DealFlowCreateParams, type DealFlowUpdateParams, DealFlowsResource, type DealListParams, type DealListResponse, type DealStage, type DealUpdateParams, DealsResource, type DeleteResponse, type DocCollection, type DocCollectionCreateParams, type DocCollectionUpdateParams, type DocGroup, type DocGroupCreateParams, type DocGroupUpdateParams, type DocPage, type DocPageCreateParams, type DocPageListParams, type DocPageListResponse, type DocPageStatus, type DocPageUpdateParams, type DocTreeNode, type DocTreeResponse, DocsResource, EntitiesResource, type EntitiesSearchParams, type EntitiesSearchResponse, type Entity, type EntityType, type Feature, type FeatureCreateParams, type FeatureUpdateParams, type Flow, type FlowCreateParams, type FlowListParams, type FlowListResponse, type FlowStatus, type FlowUpdateParams, FlowsResource, type HttpMethod, type ListParams, MantleAPIError, MantleAuthenticationError, MantleCoreClient, type MantleCoreClientConfig, MantleNotFoundError, MantlePermissionError, MantleRateLimitError, MantleValidationError, MeResource, type MeResponse, type MessageAttachment, type MetricDataPoint, type MetricType, type MetricsBaseParams, type MetricsGetParams, MetricsResource, type MetricsResponse, type Middleware, type MiddlewareContext, MiddlewareManager, type MiddlewareOptions, type MiddlewareRequest, type MiddlewareResponse, type NextFunction, type Organization, OrganizationResource, type PaginatedResponse, type Plan, type PlanCreateParams, type PlanFeature, type PlanListParams, type PlanListResponse, type PlanUpdateParams, type PlanUsageCharge, type RequestOptions, type Review, type ReviewCreateParams, type ReviewUpdateParams, type SocialProfile, type SocialProfileType, type Subscription, type SubscriptionListParams, type SubscriptionListResponse, SubscriptionsResource, type Task, type TaskCreateParams, type TaskListParams, type TaskListResponse, type TaskPriority, type TaskStatus, type TaskUpdateParams, TasksResource, type Ticket, type TicketContactData, type TicketCreateParams, type TicketListParams, type TicketListResponse, type TicketMessage, type TicketMessageCreateParams, type TicketMessageUpdateParams, type TicketUpdateParams, TicketsResource, type TimelineEvent, type TimelineListParams, type TimelineListResponse, type Transaction, type TransactionListParams, type TransactionListResponse, TransactionsResource, type UsageEvent, type UsageEventCreateData, type UsageEventCreateParams, type UsageEventCreateResponse, type UsageEventListParams, type UsageEventListResponse, type UsageEventMetricsParams, UsageEventsResource, type UsageMetric, type UsageMetricCreateParams, type UsageMetricParams, type UsageMetricUpdateParams, type User, type UserListParams, type UserListResponse, UsersResource, type Webhook, type WebhookCreateParams, type WebhookFilter, type WebhookListResponse, type WebhookTopic, type WebhookUpdateParams, WebhooksResource, createAuthRefreshMiddleware };
|
|
3574
|
+
export { type AccountOwner, type AccountOwnersListResponse, type Affiliate, type AffiliateCommission, type AffiliateCommissionListParams, type AffiliateCommissionListResponse, AffiliateCommissionsResource, type AffiliateListParams, type AffiliateListResponse, type AffiliatePayout, type AffiliatePayoutListParams, type AffiliatePayoutListResponse, AffiliatePayoutsResource, type AffiliateProgram, type AffiliateProgramCreateParams, type AffiliateProgramUpdateParams, AffiliateProgramsResource, type AffiliateReferral, type AffiliateReferralListParams, type AffiliateReferralListResponse, AffiliateReferralsResource, type AffiliateUpdateParams, AffiliatesResource, type Agent, type AgentCreateParams, type AgentListResponse, type AgentResponse, AgentsResource, type App, type AppEvent, type AppEventListParams, type AppEventListResponse, type AppInstallation, type AppInstallationParams, type AppListParams, AppsResource, type AuthRefreshOptions, BaseResource, type Channel, type ChannelCreateParams, type ChannelListParams, ChannelsResource, type Charge, type ChargeListParams, type ChargeListResponse, ChargesResource, CompaniesResource, type Company, type CompanyCreateParams, type CompanyListParams, type CompanyListResponse, type CompanyUpdateParams, type Contact, type ContactCreateParams, type ContactEntity, type ContactListParams, type ContactListResponse, type ContactUpdateParams, ContactsResource, type CustomDataDeleteParams, type CustomDataGetParams, CustomDataResource, type CustomDataResourceType, type CustomDataResponse, type CustomDataSetParams, type CustomField, type CustomFieldCreateParams, type CustomFieldUpdateParams, type Customer, type CustomerCreateParams, type CustomerEntity, type CustomerListParams, type CustomerListResponse, type CustomerRetrieveParams, type CustomerSegment, type CustomerSegmentListParams, type CustomerSegmentListResponse, CustomerSegmentsResource, type CustomerUpdateParams, CustomersResource, type DateRangeType, type Deal, DealActivitiesResource, type DealActivity, type DealActivityCreateParams, type DealActivityUpdateParams, type DealContactInput, type DealCreateParams, type DealCustomerInput, type DealEvent, type DealEventCreateParams, type DealEventCreateResponse, type DealEventListResponse, type DealFlow, type DealFlowCreateParams, type DealFlowUpdateParams, DealFlowsResource, type DealListParams, type DealListResponse, type DealStage, type DealUpdateParams, DealsResource, type DeleteResponse, type DocCollection, type DocCollectionCreateParams, type DocCollectionUpdateParams, type DocGroup, type DocGroupCreateParams, type DocGroupUpdateParams, type DocPage, type DocPageCreateParams, type DocPageListParams, type DocPageListResponse, type DocPageStatus, type DocPageUpdateParams, type DocTreeNode, type DocTreeResponse, DocsResource, EntitiesResource, type EntitiesSearchParams, type EntitiesSearchResponse, type Entity, type EntityType, type Feature, type FeatureCreateParams, type FeatureUpdateParams, type Flow, type FlowCreateParams, type FlowListParams, type FlowListResponse, type FlowStatus, type FlowUpdateParams, FlowsResource, type HttpMethod, type ListParams, MantleAPIError, MantleAuthenticationError, MantleCoreClient, type MantleCoreClientConfig, MantleNotFoundError, MantlePermissionError, MantleRateLimitError, MantleValidationError, MeResource, type MeResponse, type MessageAttachment, type MetricDataPoint, type MetricType, type MetricsBaseParams, type MetricsGetParams, MetricsResource, type MetricsResponse, type Middleware, type MiddlewareContext, MiddlewareManager, type MiddlewareOptions, type MiddlewareRequest, type MiddlewareResponse, type NextFunction, type Organization, OrganizationResource, type PaginatedResponse, type Plan, type PlanCreateParams, type PlanFeature, type PlanListParams, type PlanListResponse, type PlanUpdateParams, type PlanUsageCharge, type RequestOptions, type Review, type ReviewCreateParams, type ReviewUpdateParams, type SocialProfile, type SocialProfileType, type Subscription, type SubscriptionListParams, type SubscriptionListResponse, SubscriptionsResource, type Task, type TaskCreateParams, type TaskListParams, type TaskListResponse, type TaskPriority, type TaskStatus, type TaskUpdateParams, TasksResource, type Ticket, type TicketContactData, type TicketCreateParams, type TicketListParams, type TicketListResponse, type TicketMessage, type TicketMessageCreateParams, type TicketMessageUpdateParams, type TicketUpdateParams, TicketsResource, type TimelineEvent, type TimelineListParams, type TimelineListResponse, type Transaction, type TransactionListParams, type TransactionListResponse, TransactionsResource, type UsageEvent, type UsageEventCreateData, type UsageEventCreateParams, type UsageEventCreateResponse, type UsageEventListParams, type UsageEventListResponse, type UsageEventMetricsParams, UsageEventsResource, type UsageMetric, type UsageMetricCreateParams, type UsageMetricParams, type UsageMetricUpdateParams, type User, type UserListParams, type UserListResponse, UsersResource, type Webhook, type WebhookCreateParams, type WebhookFilter, type WebhookListResponse, type WebhookTopic, type WebhookUpdateParams, WebhooksResource, createAuthRefreshMiddleware };
|
package/dist/index.d.ts
CHANGED
|
@@ -1798,6 +1798,19 @@ interface Agent {
|
|
|
1798
1798
|
interface AgentListResponse {
|
|
1799
1799
|
agents: Agent[];
|
|
1800
1800
|
}
|
|
1801
|
+
/**
|
|
1802
|
+
* Parameters for creating an agent
|
|
1803
|
+
*/
|
|
1804
|
+
interface AgentCreateParams {
|
|
1805
|
+
email: string;
|
|
1806
|
+
name?: string;
|
|
1807
|
+
}
|
|
1808
|
+
/**
|
|
1809
|
+
* Response from creating/retrieving an agent
|
|
1810
|
+
*/
|
|
1811
|
+
interface AgentResponse {
|
|
1812
|
+
agent: Agent;
|
|
1813
|
+
}
|
|
1801
1814
|
|
|
1802
1815
|
/**
|
|
1803
1816
|
* Task status
|
|
@@ -2063,6 +2076,45 @@ interface EntitiesSearchResponse {
|
|
|
2063
2076
|
entities: Entity[];
|
|
2064
2077
|
}
|
|
2065
2078
|
|
|
2079
|
+
/**
|
|
2080
|
+
* Resource type for custom data
|
|
2081
|
+
*/
|
|
2082
|
+
type CustomDataResourceType = 'ticket' | 'customer' | 'contact';
|
|
2083
|
+
/**
|
|
2084
|
+
* Parameters for setting custom data
|
|
2085
|
+
*/
|
|
2086
|
+
interface CustomDataSetParams {
|
|
2087
|
+
resourceId: string;
|
|
2088
|
+
resourceType: CustomDataResourceType;
|
|
2089
|
+
key: string;
|
|
2090
|
+
value: string;
|
|
2091
|
+
}
|
|
2092
|
+
/**
|
|
2093
|
+
* Parameters for getting custom data
|
|
2094
|
+
*/
|
|
2095
|
+
interface CustomDataGetParams {
|
|
2096
|
+
resourceId: string;
|
|
2097
|
+
resourceType: CustomDataResourceType;
|
|
2098
|
+
key: string;
|
|
2099
|
+
}
|
|
2100
|
+
/**
|
|
2101
|
+
* Response from getting custom data
|
|
2102
|
+
*/
|
|
2103
|
+
interface CustomDataResponse {
|
|
2104
|
+
resourceId: string;
|
|
2105
|
+
resourceType: CustomDataResourceType;
|
|
2106
|
+
key: string;
|
|
2107
|
+
value: string;
|
|
2108
|
+
}
|
|
2109
|
+
/**
|
|
2110
|
+
* Parameters for deleting custom data
|
|
2111
|
+
*/
|
|
2112
|
+
interface CustomDataDeleteParams {
|
|
2113
|
+
resourceId: string;
|
|
2114
|
+
resourceType: CustomDataResourceType;
|
|
2115
|
+
key: string;
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2066
2118
|
/**
|
|
2067
2119
|
* Resource for managing customers
|
|
2068
2120
|
*/
|
|
@@ -3098,6 +3150,23 @@ declare class AgentsResource extends BaseResource {
|
|
|
3098
3150
|
* List support agents
|
|
3099
3151
|
*/
|
|
3100
3152
|
list(): Promise<AgentListResponse>;
|
|
3153
|
+
/**
|
|
3154
|
+
* Retrieve a specific agent by ID
|
|
3155
|
+
*/
|
|
3156
|
+
retrieve(agentId: string): Promise<AgentResponse>;
|
|
3157
|
+
/**
|
|
3158
|
+
* Create a new agent
|
|
3159
|
+
*/
|
|
3160
|
+
create(params: AgentCreateParams): Promise<AgentResponse>;
|
|
3161
|
+
/**
|
|
3162
|
+
* Find an existing agent by email, or create one if not found.
|
|
3163
|
+
* This is useful for sync operations where you want to ensure
|
|
3164
|
+
* an agent exists without duplicating.
|
|
3165
|
+
*
|
|
3166
|
+
* @param params - Agent data (email required, name optional)
|
|
3167
|
+
* @returns The existing or newly created agent
|
|
3168
|
+
*/
|
|
3169
|
+
findOrCreate(params: AgentCreateParams): Promise<AgentResponse>;
|
|
3101
3170
|
}
|
|
3102
3171
|
|
|
3103
3172
|
/**
|
|
@@ -3215,6 +3284,33 @@ declare class EntitiesResource extends BaseResource {
|
|
|
3215
3284
|
search(params?: EntitiesSearchParams): Promise<EntitiesSearchResponse>;
|
|
3216
3285
|
}
|
|
3217
3286
|
|
|
3287
|
+
/**
|
|
3288
|
+
* Resource for managing custom data on entities.
|
|
3289
|
+
* Custom data allows storing arbitrary key-value pairs on tickets, customers, and contacts.
|
|
3290
|
+
*/
|
|
3291
|
+
declare class CustomDataResource extends BaseResource {
|
|
3292
|
+
/**
|
|
3293
|
+
* Set custom data on a resource.
|
|
3294
|
+
* This will create or update the value for the given key.
|
|
3295
|
+
*
|
|
3296
|
+
* @param params - The custom data parameters
|
|
3297
|
+
*/
|
|
3298
|
+
set(params: CustomDataSetParams): Promise<void>;
|
|
3299
|
+
/**
|
|
3300
|
+
* Get custom data from a resource.
|
|
3301
|
+
*
|
|
3302
|
+
* @param params - Parameters identifying the custom data to retrieve
|
|
3303
|
+
* @returns The custom data value
|
|
3304
|
+
*/
|
|
3305
|
+
getValue(params: CustomDataGetParams): Promise<CustomDataResponse>;
|
|
3306
|
+
/**
|
|
3307
|
+
* Delete custom data from a resource.
|
|
3308
|
+
*
|
|
3309
|
+
* @param params - Parameters identifying the custom data to delete
|
|
3310
|
+
*/
|
|
3311
|
+
del(params: CustomDataDeleteParams): Promise<void>;
|
|
3312
|
+
}
|
|
3313
|
+
|
|
3218
3314
|
/**
|
|
3219
3315
|
* Mantle Core API Client
|
|
3220
3316
|
*
|
|
@@ -3269,6 +3365,7 @@ declare class MantleCoreClient {
|
|
|
3269
3365
|
readonly agents: AgentsResource;
|
|
3270
3366
|
readonly docs: DocsResource;
|
|
3271
3367
|
readonly entities: EntitiesResource;
|
|
3368
|
+
readonly customData: CustomDataResource;
|
|
3272
3369
|
constructor(config: MantleCoreClientConfig);
|
|
3273
3370
|
/**
|
|
3274
3371
|
* Register a middleware function
|
|
@@ -3474,4 +3571,4 @@ interface AuthRefreshOptions {
|
|
|
3474
3571
|
*/
|
|
3475
3572
|
declare function createAuthRefreshMiddleware(options: AuthRefreshOptions): Middleware;
|
|
3476
3573
|
|
|
3477
|
-
export { type AccountOwner, type AccountOwnersListResponse, type Affiliate, type AffiliateCommission, type AffiliateCommissionListParams, type AffiliateCommissionListResponse, AffiliateCommissionsResource, type AffiliateListParams, type AffiliateListResponse, type AffiliatePayout, type AffiliatePayoutListParams, type AffiliatePayoutListResponse, AffiliatePayoutsResource, type AffiliateProgram, type AffiliateProgramCreateParams, type AffiliateProgramUpdateParams, AffiliateProgramsResource, type AffiliateReferral, type AffiliateReferralListParams, type AffiliateReferralListResponse, AffiliateReferralsResource, type AffiliateUpdateParams, AffiliatesResource, type Agent, type AgentListResponse, AgentsResource, type App, type AppEvent, type AppEventListParams, type AppEventListResponse, type AppInstallation, type AppInstallationParams, type AppListParams, AppsResource, type AuthRefreshOptions, BaseResource, type Channel, type ChannelCreateParams, type ChannelListParams, ChannelsResource, type Charge, type ChargeListParams, type ChargeListResponse, ChargesResource, CompaniesResource, type Company, type CompanyCreateParams, type CompanyListParams, type CompanyListResponse, type CompanyUpdateParams, type Contact, type ContactCreateParams, type ContactEntity, type ContactListParams, type ContactListResponse, type ContactUpdateParams, ContactsResource, type CustomField, type CustomFieldCreateParams, type CustomFieldUpdateParams, type Customer, type CustomerCreateParams, type CustomerEntity, type CustomerListParams, type CustomerListResponse, type CustomerRetrieveParams, type CustomerSegment, type CustomerSegmentListParams, type CustomerSegmentListResponse, CustomerSegmentsResource, type CustomerUpdateParams, CustomersResource, type DateRangeType, type Deal, DealActivitiesResource, type DealActivity, type DealActivityCreateParams, type DealActivityUpdateParams, type DealContactInput, type DealCreateParams, type DealCustomerInput, type DealEvent, type DealEventCreateParams, type DealEventCreateResponse, type DealEventListResponse, type DealFlow, type DealFlowCreateParams, type DealFlowUpdateParams, DealFlowsResource, type DealListParams, type DealListResponse, type DealStage, type DealUpdateParams, DealsResource, type DeleteResponse, type DocCollection, type DocCollectionCreateParams, type DocCollectionUpdateParams, type DocGroup, type DocGroupCreateParams, type DocGroupUpdateParams, type DocPage, type DocPageCreateParams, type DocPageListParams, type DocPageListResponse, type DocPageStatus, type DocPageUpdateParams, type DocTreeNode, type DocTreeResponse, DocsResource, EntitiesResource, type EntitiesSearchParams, type EntitiesSearchResponse, type Entity, type EntityType, type Feature, type FeatureCreateParams, type FeatureUpdateParams, type Flow, type FlowCreateParams, type FlowListParams, type FlowListResponse, type FlowStatus, type FlowUpdateParams, FlowsResource, type HttpMethod, type ListParams, MantleAPIError, MantleAuthenticationError, MantleCoreClient, type MantleCoreClientConfig, MantleNotFoundError, MantlePermissionError, MantleRateLimitError, MantleValidationError, MeResource, type MeResponse, type MessageAttachment, type MetricDataPoint, type MetricType, type MetricsBaseParams, type MetricsGetParams, MetricsResource, type MetricsResponse, type Middleware, type MiddlewareContext, MiddlewareManager, type MiddlewareOptions, type MiddlewareRequest, type MiddlewareResponse, type NextFunction, type Organization, OrganizationResource, type PaginatedResponse, type Plan, type PlanCreateParams, type PlanFeature, type PlanListParams, type PlanListResponse, type PlanUpdateParams, type PlanUsageCharge, type RequestOptions, type Review, type ReviewCreateParams, type ReviewUpdateParams, type SocialProfile, type SocialProfileType, type Subscription, type SubscriptionListParams, type SubscriptionListResponse, SubscriptionsResource, type Task, type TaskCreateParams, type TaskListParams, type TaskListResponse, type TaskPriority, type TaskStatus, type TaskUpdateParams, TasksResource, type Ticket, type TicketContactData, type TicketCreateParams, type TicketListParams, type TicketListResponse, type TicketMessage, type TicketMessageCreateParams, type TicketMessageUpdateParams, type TicketUpdateParams, TicketsResource, type TimelineEvent, type TimelineListParams, type TimelineListResponse, type Transaction, type TransactionListParams, type TransactionListResponse, TransactionsResource, type UsageEvent, type UsageEventCreateData, type UsageEventCreateParams, type UsageEventCreateResponse, type UsageEventListParams, type UsageEventListResponse, type UsageEventMetricsParams, UsageEventsResource, type UsageMetric, type UsageMetricCreateParams, type UsageMetricParams, type UsageMetricUpdateParams, type User, type UserListParams, type UserListResponse, UsersResource, type Webhook, type WebhookCreateParams, type WebhookFilter, type WebhookListResponse, type WebhookTopic, type WebhookUpdateParams, WebhooksResource, createAuthRefreshMiddleware };
|
|
3574
|
+
export { type AccountOwner, type AccountOwnersListResponse, type Affiliate, type AffiliateCommission, type AffiliateCommissionListParams, type AffiliateCommissionListResponse, AffiliateCommissionsResource, type AffiliateListParams, type AffiliateListResponse, type AffiliatePayout, type AffiliatePayoutListParams, type AffiliatePayoutListResponse, AffiliatePayoutsResource, type AffiliateProgram, type AffiliateProgramCreateParams, type AffiliateProgramUpdateParams, AffiliateProgramsResource, type AffiliateReferral, type AffiliateReferralListParams, type AffiliateReferralListResponse, AffiliateReferralsResource, type AffiliateUpdateParams, AffiliatesResource, type Agent, type AgentCreateParams, type AgentListResponse, type AgentResponse, AgentsResource, type App, type AppEvent, type AppEventListParams, type AppEventListResponse, type AppInstallation, type AppInstallationParams, type AppListParams, AppsResource, type AuthRefreshOptions, BaseResource, type Channel, type ChannelCreateParams, type ChannelListParams, ChannelsResource, type Charge, type ChargeListParams, type ChargeListResponse, ChargesResource, CompaniesResource, type Company, type CompanyCreateParams, type CompanyListParams, type CompanyListResponse, type CompanyUpdateParams, type Contact, type ContactCreateParams, type ContactEntity, type ContactListParams, type ContactListResponse, type ContactUpdateParams, ContactsResource, type CustomDataDeleteParams, type CustomDataGetParams, CustomDataResource, type CustomDataResourceType, type CustomDataResponse, type CustomDataSetParams, type CustomField, type CustomFieldCreateParams, type CustomFieldUpdateParams, type Customer, type CustomerCreateParams, type CustomerEntity, type CustomerListParams, type CustomerListResponse, type CustomerRetrieveParams, type CustomerSegment, type CustomerSegmentListParams, type CustomerSegmentListResponse, CustomerSegmentsResource, type CustomerUpdateParams, CustomersResource, type DateRangeType, type Deal, DealActivitiesResource, type DealActivity, type DealActivityCreateParams, type DealActivityUpdateParams, type DealContactInput, type DealCreateParams, type DealCustomerInput, type DealEvent, type DealEventCreateParams, type DealEventCreateResponse, type DealEventListResponse, type DealFlow, type DealFlowCreateParams, type DealFlowUpdateParams, DealFlowsResource, type DealListParams, type DealListResponse, type DealStage, type DealUpdateParams, DealsResource, type DeleteResponse, type DocCollection, type DocCollectionCreateParams, type DocCollectionUpdateParams, type DocGroup, type DocGroupCreateParams, type DocGroupUpdateParams, type DocPage, type DocPageCreateParams, type DocPageListParams, type DocPageListResponse, type DocPageStatus, type DocPageUpdateParams, type DocTreeNode, type DocTreeResponse, DocsResource, EntitiesResource, type EntitiesSearchParams, type EntitiesSearchResponse, type Entity, type EntityType, type Feature, type FeatureCreateParams, type FeatureUpdateParams, type Flow, type FlowCreateParams, type FlowListParams, type FlowListResponse, type FlowStatus, type FlowUpdateParams, FlowsResource, type HttpMethod, type ListParams, MantleAPIError, MantleAuthenticationError, MantleCoreClient, type MantleCoreClientConfig, MantleNotFoundError, MantlePermissionError, MantleRateLimitError, MantleValidationError, MeResource, type MeResponse, type MessageAttachment, type MetricDataPoint, type MetricType, type MetricsBaseParams, type MetricsGetParams, MetricsResource, type MetricsResponse, type Middleware, type MiddlewareContext, MiddlewareManager, type MiddlewareOptions, type MiddlewareRequest, type MiddlewareResponse, type NextFunction, type Organization, OrganizationResource, type PaginatedResponse, type Plan, type PlanCreateParams, type PlanFeature, type PlanListParams, type PlanListResponse, type PlanUpdateParams, type PlanUsageCharge, type RequestOptions, type Review, type ReviewCreateParams, type ReviewUpdateParams, type SocialProfile, type SocialProfileType, type Subscription, type SubscriptionListParams, type SubscriptionListResponse, SubscriptionsResource, type Task, type TaskCreateParams, type TaskListParams, type TaskListResponse, type TaskPriority, type TaskStatus, type TaskUpdateParams, TasksResource, type Ticket, type TicketContactData, type TicketCreateParams, type TicketListParams, type TicketListResponse, type TicketMessage, type TicketMessageCreateParams, type TicketMessageUpdateParams, type TicketUpdateParams, TicketsResource, type TimelineEvent, type TimelineListParams, type TimelineListResponse, type Transaction, type TransactionListParams, type TransactionListResponse, TransactionsResource, type UsageEvent, type UsageEventCreateData, type UsageEventCreateParams, type UsageEventCreateResponse, type UsageEventListParams, type UsageEventListResponse, type UsageEventMetricsParams, UsageEventsResource, type UsageMetric, type UsageMetricCreateParams, type UsageMetricParams, type UsageMetricUpdateParams, type User, type UserListParams, type UserListResponse, UsersResource, type Webhook, type WebhookCreateParams, type WebhookFilter, type WebhookListResponse, type WebhookTopic, type WebhookUpdateParams, WebhooksResource, createAuthRefreshMiddleware };
|
package/dist/index.js
CHANGED
|
@@ -32,6 +32,7 @@ __export(index_exports, {
|
|
|
32
32
|
ChargesResource: () => ChargesResource,
|
|
33
33
|
CompaniesResource: () => CompaniesResource,
|
|
34
34
|
ContactsResource: () => ContactsResource,
|
|
35
|
+
CustomDataResource: () => CustomDataResource,
|
|
35
36
|
CustomerSegmentsResource: () => CustomerSegmentsResource,
|
|
36
37
|
CustomersResource: () => CustomersResource,
|
|
37
38
|
DealActivitiesResource: () => DealActivitiesResource,
|
|
@@ -1711,6 +1712,42 @@ var AgentsResource = class extends BaseResource {
|
|
|
1711
1712
|
async list() {
|
|
1712
1713
|
return this.get("/agents");
|
|
1713
1714
|
}
|
|
1715
|
+
/**
|
|
1716
|
+
* Retrieve a specific agent by ID
|
|
1717
|
+
*/
|
|
1718
|
+
async retrieve(agentId) {
|
|
1719
|
+
return this.get(`/agents/${agentId}`);
|
|
1720
|
+
}
|
|
1721
|
+
/**
|
|
1722
|
+
* Create a new agent
|
|
1723
|
+
*/
|
|
1724
|
+
async create(params) {
|
|
1725
|
+
return this.post("/agents", params);
|
|
1726
|
+
}
|
|
1727
|
+
/**
|
|
1728
|
+
* Find an existing agent by email, or create one if not found.
|
|
1729
|
+
* This is useful for sync operations where you want to ensure
|
|
1730
|
+
* an agent exists without duplicating.
|
|
1731
|
+
*
|
|
1732
|
+
* @param params - Agent data (email required, name optional)
|
|
1733
|
+
* @returns The existing or newly created agent
|
|
1734
|
+
*/
|
|
1735
|
+
async findOrCreate(params) {
|
|
1736
|
+
try {
|
|
1737
|
+
return await this.create(params);
|
|
1738
|
+
} catch (error) {
|
|
1739
|
+
if (error instanceof MantleAPIError && error.statusCode === 409) {
|
|
1740
|
+
const { agents } = await this.list();
|
|
1741
|
+
const existingAgent = agents.find(
|
|
1742
|
+
(agent) => agent.email.toLowerCase() === params.email.toLowerCase()
|
|
1743
|
+
);
|
|
1744
|
+
if (existingAgent) {
|
|
1745
|
+
return { agent: existingAgent };
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
throw error;
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1714
1751
|
};
|
|
1715
1752
|
|
|
1716
1753
|
// src/resources/docs.ts
|
|
@@ -1853,6 +1890,42 @@ var EntitiesResource = class extends BaseResource {
|
|
|
1853
1890
|
}
|
|
1854
1891
|
};
|
|
1855
1892
|
|
|
1893
|
+
// src/resources/custom-data.ts
|
|
1894
|
+
var CustomDataResource = class extends BaseResource {
|
|
1895
|
+
/**
|
|
1896
|
+
* Set custom data on a resource.
|
|
1897
|
+
* This will create or update the value for the given key.
|
|
1898
|
+
*
|
|
1899
|
+
* @param params - The custom data parameters
|
|
1900
|
+
*/
|
|
1901
|
+
async set(params) {
|
|
1902
|
+
await this.put("/custom_data", params);
|
|
1903
|
+
}
|
|
1904
|
+
/**
|
|
1905
|
+
* Get custom data from a resource.
|
|
1906
|
+
*
|
|
1907
|
+
* @param params - Parameters identifying the custom data to retrieve
|
|
1908
|
+
* @returns The custom data value
|
|
1909
|
+
*/
|
|
1910
|
+
async getValue(params) {
|
|
1911
|
+
const { resourceType, resourceId, key } = params;
|
|
1912
|
+
return this.get(
|
|
1913
|
+
`/custom_data/${resourceType}/${resourceId}/${encodeURIComponent(key)}`
|
|
1914
|
+
);
|
|
1915
|
+
}
|
|
1916
|
+
/**
|
|
1917
|
+
* Delete custom data from a resource.
|
|
1918
|
+
*
|
|
1919
|
+
* @param params - Parameters identifying the custom data to delete
|
|
1920
|
+
*/
|
|
1921
|
+
async del(params) {
|
|
1922
|
+
const { resourceType, resourceId, key } = params;
|
|
1923
|
+
await this._delete(
|
|
1924
|
+
`/custom_data/${resourceType}/${resourceId}/${encodeURIComponent(key)}`
|
|
1925
|
+
);
|
|
1926
|
+
}
|
|
1927
|
+
};
|
|
1928
|
+
|
|
1856
1929
|
// src/client.ts
|
|
1857
1930
|
var MantleCoreClient = class {
|
|
1858
1931
|
constructor(config) {
|
|
@@ -1904,6 +1977,7 @@ var MantleCoreClient = class {
|
|
|
1904
1977
|
this.agents = new AgentsResource(this);
|
|
1905
1978
|
this.docs = new DocsResource(this);
|
|
1906
1979
|
this.entities = new EntitiesResource(this);
|
|
1980
|
+
this.customData = new CustomDataResource(this);
|
|
1907
1981
|
}
|
|
1908
1982
|
/**
|
|
1909
1983
|
* Register a middleware function
|
|
@@ -2194,6 +2268,7 @@ function createAuthRefreshMiddleware(options) {
|
|
|
2194
2268
|
ChargesResource,
|
|
2195
2269
|
CompaniesResource,
|
|
2196
2270
|
ContactsResource,
|
|
2271
|
+
CustomDataResource,
|
|
2197
2272
|
CustomerSegmentsResource,
|
|
2198
2273
|
CustomersResource,
|
|
2199
2274
|
DealActivitiesResource,
|
package/dist/index.mjs
CHANGED
|
@@ -1647,6 +1647,42 @@ var AgentsResource = class extends BaseResource {
|
|
|
1647
1647
|
async list() {
|
|
1648
1648
|
return this.get("/agents");
|
|
1649
1649
|
}
|
|
1650
|
+
/**
|
|
1651
|
+
* Retrieve a specific agent by ID
|
|
1652
|
+
*/
|
|
1653
|
+
async retrieve(agentId) {
|
|
1654
|
+
return this.get(`/agents/${agentId}`);
|
|
1655
|
+
}
|
|
1656
|
+
/**
|
|
1657
|
+
* Create a new agent
|
|
1658
|
+
*/
|
|
1659
|
+
async create(params) {
|
|
1660
|
+
return this.post("/agents", params);
|
|
1661
|
+
}
|
|
1662
|
+
/**
|
|
1663
|
+
* Find an existing agent by email, or create one if not found.
|
|
1664
|
+
* This is useful for sync operations where you want to ensure
|
|
1665
|
+
* an agent exists without duplicating.
|
|
1666
|
+
*
|
|
1667
|
+
* @param params - Agent data (email required, name optional)
|
|
1668
|
+
* @returns The existing or newly created agent
|
|
1669
|
+
*/
|
|
1670
|
+
async findOrCreate(params) {
|
|
1671
|
+
try {
|
|
1672
|
+
return await this.create(params);
|
|
1673
|
+
} catch (error) {
|
|
1674
|
+
if (error instanceof MantleAPIError && error.statusCode === 409) {
|
|
1675
|
+
const { agents } = await this.list();
|
|
1676
|
+
const existingAgent = agents.find(
|
|
1677
|
+
(agent) => agent.email.toLowerCase() === params.email.toLowerCase()
|
|
1678
|
+
);
|
|
1679
|
+
if (existingAgent) {
|
|
1680
|
+
return { agent: existingAgent };
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
throw error;
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1650
1686
|
};
|
|
1651
1687
|
|
|
1652
1688
|
// src/resources/docs.ts
|
|
@@ -1789,6 +1825,42 @@ var EntitiesResource = class extends BaseResource {
|
|
|
1789
1825
|
}
|
|
1790
1826
|
};
|
|
1791
1827
|
|
|
1828
|
+
// src/resources/custom-data.ts
|
|
1829
|
+
var CustomDataResource = class extends BaseResource {
|
|
1830
|
+
/**
|
|
1831
|
+
* Set custom data on a resource.
|
|
1832
|
+
* This will create or update the value for the given key.
|
|
1833
|
+
*
|
|
1834
|
+
* @param params - The custom data parameters
|
|
1835
|
+
*/
|
|
1836
|
+
async set(params) {
|
|
1837
|
+
await this.put("/custom_data", params);
|
|
1838
|
+
}
|
|
1839
|
+
/**
|
|
1840
|
+
* Get custom data from a resource.
|
|
1841
|
+
*
|
|
1842
|
+
* @param params - Parameters identifying the custom data to retrieve
|
|
1843
|
+
* @returns The custom data value
|
|
1844
|
+
*/
|
|
1845
|
+
async getValue(params) {
|
|
1846
|
+
const { resourceType, resourceId, key } = params;
|
|
1847
|
+
return this.get(
|
|
1848
|
+
`/custom_data/${resourceType}/${resourceId}/${encodeURIComponent(key)}`
|
|
1849
|
+
);
|
|
1850
|
+
}
|
|
1851
|
+
/**
|
|
1852
|
+
* Delete custom data from a resource.
|
|
1853
|
+
*
|
|
1854
|
+
* @param params - Parameters identifying the custom data to delete
|
|
1855
|
+
*/
|
|
1856
|
+
async del(params) {
|
|
1857
|
+
const { resourceType, resourceId, key } = params;
|
|
1858
|
+
await this._delete(
|
|
1859
|
+
`/custom_data/${resourceType}/${resourceId}/${encodeURIComponent(key)}`
|
|
1860
|
+
);
|
|
1861
|
+
}
|
|
1862
|
+
};
|
|
1863
|
+
|
|
1792
1864
|
// src/client.ts
|
|
1793
1865
|
var MantleCoreClient = class {
|
|
1794
1866
|
constructor(config) {
|
|
@@ -1840,6 +1912,7 @@ var MantleCoreClient = class {
|
|
|
1840
1912
|
this.agents = new AgentsResource(this);
|
|
1841
1913
|
this.docs = new DocsResource(this);
|
|
1842
1914
|
this.entities = new EntitiesResource(this);
|
|
1915
|
+
this.customData = new CustomDataResource(this);
|
|
1843
1916
|
}
|
|
1844
1917
|
/**
|
|
1845
1918
|
* Register a middleware function
|
|
@@ -2129,6 +2202,7 @@ export {
|
|
|
2129
2202
|
ChargesResource,
|
|
2130
2203
|
CompaniesResource,
|
|
2131
2204
|
ContactsResource,
|
|
2205
|
+
CustomDataResource,
|
|
2132
2206
|
CustomerSegmentsResource,
|
|
2133
2207
|
CustomersResource,
|
|
2134
2208
|
DealActivitiesResource,
|