/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { partnersAnalytics } from "../funcs/partnersAnalytics.js"; import { partnersBan } from "../funcs/partnersBan.js"; import { partnersCreate } from "../funcs/partnersCreate.js"; import { partnersCreateLink } from "../funcs/partnersCreateLink.js"; import { partnersDeactivate } from "../funcs/partnersDeactivate.js"; import { partnersList } from "../funcs/partnersList.js"; import { partnersRetrieveLinks } from "../funcs/partnersRetrieveLinks.js"; import { partnersUpsertLink } from "../funcs/partnersUpsertLink.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as components from "../models/components/index.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; export class Partners extends ClientSDK { /** * List all partners * * @remarks * List all partners for a partner program. */ async list( request?: operations.ListPartnersRequest | undefined, options?: RequestOptions, ): Promise> { return unwrapAsync(partnersList( this, request, options, )); } /** * Create or update a partner * * @remarks * Creates or updates a partner record (upsert behavior). If a partner with the same email already exists, their program enrollment will be updated with the provided tenantId. If no existing partner is found, a new partner will be created using the supplied information. */ async create( request?: operations.CreatePartnerRequestBody | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(partnersCreate( this, request, options, )); } /** * Retrieve a partner's links. * * @remarks * Retrieve a partner's links by their partner ID or tenant ID. */ async retrieveLinks( request?: operations.RetrieveLinksRequest | undefined, options?: RequestOptions, ): Promise> { return unwrapAsync(partnersRetrieveLinks( this, request, options, )); } /** * Create a link for a partner * * @remarks * Create a link for a partner that is enrolled in your program. */ async createLink( request?: operations.CreatePartnerLinkRequestBody | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(partnersCreateLink( this, request, options, )); } /** * Upsert a link for a partner * * @remarks * Upsert a link for a partner that is enrolled in your program. If a link with the same URL already exists, return it (or update it if there are any changes). Otherwise, a new link will be created. */ async upsertLink( request?: operations.UpsertPartnerLinkRequestBody | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(partnersUpsertLink( this, request, options, )); } /** * Retrieve analytics for a partner * * @remarks * Retrieve analytics for a partner within a program. The response type vary based on the `groupBy` query parameter. */ async analytics( request?: operations.RetrievePartnerAnalyticsRequest | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(partnersAnalytics( this, request, options, )); } /** * Ban a partner * * @remarks * Ban a partner from your program. This will disable all links and mark all commissions as canceled. */ async ban( request?: operations.BanPartnerRequestBody | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(partnersBan( this, request, options, )); } /** * Deactivate a partner * * @remarks * This will deactivate the partner from your program and disable all their active links. Their commissions and payouts will remain intact. You can reactivate them later if needed. */ async deactivate( request?: operations.DeactivatePartnerRequestBody | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(partnersDeactivate( this, request, options, )); } }