soundlink 2.2.0 → 2.4.0
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/CHANGELOG.md +16 -0
- package/README.md +26 -3
- package/dist/cjs/index.cjs +112 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.d.ts +169 -14
- package/dist/esm/index.js +112 -1
- package/dist/esm/index.js.map +1 -1
- package/openapi/soundlink-public-api-v1.yaml +854 -308
- package/package.json +2 -2
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
/** Stable snake_case error codes returned by the Soundlink Public API. */
|
|
2
2
|
type PublicApiErrorCode = 'invalid_api_key' | 'api_key_revoked' | 'api_key_expired' | 'invalid_token' | 'insufficient_scope' | 'access_denied' | 'not_found' | 'campaign_not_found' | 'invalid_query_parameter' | 'invalid_date_range' | 'page_size_exceeded' | 'invalid_request' | 'invalid_genre' | 'invalid_duration_or_budget' | 'invalid_daily_budget' | 'invalid_duration_days' | 'invalid_spotify_url' | 'invalid_tier_budget_allocation' | 'invalid_tier_status' | 'tier_update_cooldown' | 'wallet_not_enabled' | 'insufficient_credit' | 'idempotency_key_conflict' | 'rate_limit_exceeded' | 'invalid_video_url' | 'video_import_limit_exceeded' | 'video_import_session_not_found' | 'internal_error';
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
* Includes OpenAPI values plus `inactive` (observed on wallet campaigns in
|
|
7
|
-
* production; may be aligned in a later OpenAPI revision).
|
|
8
|
-
*/
|
|
9
|
-
type CampaignStatus = 'creating' | 'active' | 'paused' | 'stopped' | 'completed' | 'failed' | 'ended' | 'inactive';
|
|
3
|
+
/** Campaign lifecycle status returned by the Public API. */
|
|
4
|
+
type CampaignStatus = 'creating' | 'active' | 'inactive' | 'ended' | 'renewing' | 'restarting' | 'restart_failed' | 'renew_awaiting_charge' | 'renew_failed' | 'stopped';
|
|
10
5
|
/** Ad platform used by the campaign. */
|
|
11
6
|
type SocialPlatform = 'meta';
|
|
12
7
|
/**
|
|
@@ -116,6 +111,18 @@ interface CampaignSummary {
|
|
|
116
111
|
campaignDuration: number;
|
|
117
112
|
/** Resource generation — writable Public API methods require `3`. */
|
|
118
113
|
generation: CampaignGeneration;
|
|
114
|
+
/** Follow-attribution Spotify artist ID. `null` when unset. */
|
|
115
|
+
artistId: string | null;
|
|
116
|
+
/** Display name for `artistId`. `null` when unknown or unset. */
|
|
117
|
+
artistName: string | null;
|
|
118
|
+
/** Promoted Spotify track ID. `null` for playlist campaigns. */
|
|
119
|
+
trackId: string | null;
|
|
120
|
+
/** Promoted Spotify playlist ID. `null` for track campaigns. */
|
|
121
|
+
playlistId: string | null;
|
|
122
|
+
/** Promoted track title. `null` for playlist campaigns or when unknown. */
|
|
123
|
+
trackName: string | null;
|
|
124
|
+
/** Logged-in campaign insights URL. Not a public share link. */
|
|
125
|
+
campaignUrl: string;
|
|
119
126
|
/** ISO 8601 creation timestamp. */
|
|
120
127
|
createdAt: string;
|
|
121
128
|
/** ISO 8601 last update timestamp. */
|
|
@@ -125,6 +132,11 @@ interface CampaignSummary {
|
|
|
125
132
|
interface CampaignDetail extends CampaignSummary {
|
|
126
133
|
/** Growth strategy set at creation (e.g. `custom`, `maximum_growth`). */
|
|
127
134
|
strategyType?: StrategyType;
|
|
135
|
+
/**
|
|
136
|
+
* Whether this wallet campaign renews at the end of each cycle.
|
|
137
|
+
* `false` when auto-renew is off or the campaign has no stored value.
|
|
138
|
+
*/
|
|
139
|
+
autoRenew: boolean;
|
|
128
140
|
}
|
|
129
141
|
/** Paginated campaign list payload. */
|
|
130
142
|
interface CampaignListData {
|
|
@@ -162,6 +174,11 @@ interface CreateCampaignRequestBase {
|
|
|
162
174
|
};
|
|
163
175
|
/** Lineage only — does not copy settings from the source campaign. */
|
|
164
176
|
clonedFromCampaignId?: string;
|
|
177
|
+
/**
|
|
178
|
+
* When true, the wallet campaign renews at the end of each cycle if credit
|
|
179
|
+
* remains. When false or omitted, auto-renew stays off.
|
|
180
|
+
*/
|
|
181
|
+
autoRenew?: boolean;
|
|
165
182
|
}
|
|
166
183
|
interface DoItForMeCreativeDirection {
|
|
167
184
|
type: 'do_it_for_me';
|
|
@@ -199,6 +216,53 @@ type CreateCampaignRequest = CreateCampaignRequestBuiltIn | CreateCampaignReques
|
|
|
199
216
|
interface CampaignCreateData {
|
|
200
217
|
campaignId: string;
|
|
201
218
|
status: CampaignStatus;
|
|
219
|
+
/** Stored auto-renew flag for this wallet campaign. */
|
|
220
|
+
autoRenew: boolean;
|
|
221
|
+
}
|
|
222
|
+
interface UpdateCampaignAutoRenewRequest {
|
|
223
|
+
autoRenew: boolean;
|
|
224
|
+
}
|
|
225
|
+
interface CampaignAutoRenewData {
|
|
226
|
+
campaignId: string;
|
|
227
|
+
autoRenew: boolean;
|
|
228
|
+
}
|
|
229
|
+
/** Payload from `GET /v1/wallet`. */
|
|
230
|
+
interface WalletData {
|
|
231
|
+
balance: number;
|
|
232
|
+
available: number;
|
|
233
|
+
reserved: number;
|
|
234
|
+
currency: 'USD';
|
|
235
|
+
/** ISO 8601. `null` when the organization has no credits row. */
|
|
236
|
+
updatedAt: string | null;
|
|
237
|
+
}
|
|
238
|
+
/** One variant under a creative group (`GET .../metrics/creatives`). */
|
|
239
|
+
interface CreativeMetricsChild {
|
|
240
|
+
caption: string | null;
|
|
241
|
+
language: string | null;
|
|
242
|
+
spotify_track_id: string;
|
|
243
|
+
listeners: number | null;
|
|
244
|
+
followers: number | null;
|
|
245
|
+
link_clicks: number | null;
|
|
246
|
+
cpl: number | null;
|
|
247
|
+
cpf: number | null;
|
|
248
|
+
cpc_linkclick: number | null;
|
|
249
|
+
frequency: number | null;
|
|
250
|
+
}
|
|
251
|
+
/** Background-video group from `GET .../metrics/creatives`. */
|
|
252
|
+
interface CreativeMetricsGroup {
|
|
253
|
+
video_id: string;
|
|
254
|
+
caption: string | null;
|
|
255
|
+
listeners: number | null;
|
|
256
|
+
followers: number | null;
|
|
257
|
+
link_clicks: number | null;
|
|
258
|
+
cpl: number | null;
|
|
259
|
+
cpf: number | null;
|
|
260
|
+
cpc_linkclick: number | null;
|
|
261
|
+
frequency: number | null;
|
|
262
|
+
children: CreativeMetricsChild[];
|
|
263
|
+
}
|
|
264
|
+
interface CreativeMetrics {
|
|
265
|
+
creatives: CreativeMetricsGroup[];
|
|
202
266
|
}
|
|
203
267
|
/** Success payload from campaign stop. */
|
|
204
268
|
interface CampaignStopData {
|
|
@@ -413,8 +477,39 @@ interface SoundlinkSummary {
|
|
|
413
477
|
/** Full soundlink detail from {@link SoundlinksResource.get}. */
|
|
414
478
|
interface SoundlinkDetail extends SoundlinkSummary {
|
|
415
479
|
autoFollow: boolean;
|
|
480
|
+
artistIdFollow: string | null;
|
|
416
481
|
metaPixelId: string | null;
|
|
417
482
|
tiktokPixelId: string | null;
|
|
483
|
+
/** Stored Apple Music URL, or `null` when unset. */
|
|
484
|
+
appleMusicUrl: string | null;
|
|
485
|
+
/** Stored YouTube Music URL, or `null` when unset. */
|
|
486
|
+
youtubeMusicUrl: string | null;
|
|
487
|
+
}
|
|
488
|
+
/** Body for `POST /v1/soundlinks`. */
|
|
489
|
+
interface CreateSoundlinkRequest {
|
|
490
|
+
name: string;
|
|
491
|
+
/** HTTPS Spotify track or playlist URL. */
|
|
492
|
+
spotifyUrl: string;
|
|
493
|
+
autoFollow?: boolean;
|
|
494
|
+
/** Spotify artist ID for auto-follow on track links. Ignored for playlists. */
|
|
495
|
+
artistIdFollow?: string;
|
|
496
|
+
/** Must be sent together with `metaConversionAccessToken`. */
|
|
497
|
+
metaPixelId?: string;
|
|
498
|
+
/**
|
|
499
|
+
* Meta Conversions API token. Write-only: accepted on create, never returned.
|
|
500
|
+
* Must be sent together with `metaPixelId`.
|
|
501
|
+
*/
|
|
502
|
+
metaConversionAccessToken?: string;
|
|
503
|
+
/**
|
|
504
|
+
* Optional HTTPS Apple Music song or playlist URL. The API checks URL shape
|
|
505
|
+
* only and stores an album share-sheet link (`?i=`) as the canonical song URL.
|
|
506
|
+
*/
|
|
507
|
+
appleMusicUrl?: string;
|
|
508
|
+
/**
|
|
509
|
+
* Optional HTTPS YouTube Music song or playlist URL. A missing video or
|
|
510
|
+
* playlist returns `400 invalid_request`.
|
|
511
|
+
*/
|
|
512
|
+
youtubeMusicUrl?: string;
|
|
418
513
|
}
|
|
419
514
|
/** Paginated soundlink list payload. */
|
|
420
515
|
interface SoundlinkListData {
|
|
@@ -581,6 +676,8 @@ declare class HttpClient {
|
|
|
581
676
|
get<T>({ path, query }: HttpGetOptions): Promise<ApiResponse<T>>;
|
|
582
677
|
post<T>({ path, body, query, headers, idempotencyKey, }: HttpMutationOptions): Promise<ApiResponse<T>>;
|
|
583
678
|
patch<T>({ path, body, query, headers, idempotencyKey, }: HttpMutationOptions): Promise<ApiResponse<T>>;
|
|
679
|
+
put<T>({ path, body, query, headers, idempotencyKey, }: HttpMutationOptions): Promise<ApiResponse<T>>;
|
|
680
|
+
delete<T>({ path, body, query, headers, idempotencyKey, }: HttpMutationOptions): Promise<ApiResponse<T>>;
|
|
584
681
|
getJsonl<T>({ path, query, accept, }: HttpJsonlOptions): Promise<ApiResponse<JsonlStream<T>>>;
|
|
585
682
|
private mutateJson;
|
|
586
683
|
private buildHeaders;
|
|
@@ -639,6 +736,22 @@ declare class PingResource {
|
|
|
639
736
|
*/
|
|
640
737
|
ping(): Promise<ApiResponse<PingData>>;
|
|
641
738
|
}
|
|
739
|
+
/** Organization wallet (`GET /v1/wallet`). Requires `wallet:read`. */
|
|
740
|
+
declare class WalletResource {
|
|
741
|
+
private readonly http;
|
|
742
|
+
constructor(http: HttpClient);
|
|
743
|
+
/**
|
|
744
|
+
* Wallet snapshot for the organization on the API key.
|
|
745
|
+
*
|
|
746
|
+
* Maps to `GET /v1/wallet`. `available` is balance minus active reservations.
|
|
747
|
+
*
|
|
748
|
+
* @example
|
|
749
|
+
* ```ts
|
|
750
|
+
* const { data } = await soundlink.wallet.get();
|
|
751
|
+
* ```
|
|
752
|
+
*/
|
|
753
|
+
get(): Promise<ApiResponse<WalletData>>;
|
|
754
|
+
}
|
|
642
755
|
/** Strategy catalog (`GET /v1/strategies`). Requires `campaigns:read`. */
|
|
643
756
|
declare class StrategiesResource {
|
|
644
757
|
private readonly http;
|
|
@@ -743,6 +856,13 @@ declare class CampaignsResource {
|
|
|
743
856
|
* Requires `campaigns:write` and `Idempotency-Key`. Wallet only (`generation: 3`).
|
|
744
857
|
*/
|
|
745
858
|
decreaseBudget(campaignId: string, body: DecreaseCampaignBudgetRequest, options: IdempotencyOptions): Promise<ApiResponse<DecreaseCampaignBudgetData>>;
|
|
859
|
+
/**
|
|
860
|
+
* Set auto-renew for a wallet campaign.
|
|
861
|
+
*
|
|
862
|
+
* Maps to `PUT /v1/campaigns/{campaignId}/auto-renew`. Requires `campaigns:write`
|
|
863
|
+
* and `Idempotency-Key`. Wallet campaigns only (`generation: 3`).
|
|
864
|
+
*/
|
|
865
|
+
updateAutoRenew(campaignId: string, body: UpdateCampaignAutoRenewRequest, options: IdempotencyOptions): Promise<ApiResponse<CampaignAutoRenewData>>;
|
|
746
866
|
/**
|
|
747
867
|
* Async iterator over every campaign across all pages.
|
|
748
868
|
*
|
|
@@ -760,18 +880,19 @@ declare class CampaignsResource {
|
|
|
760
880
|
listAll(params?: Omit<CampaignListParams, 'page'>): AsyncGenerator<CampaignListData['items'][number], void, void>;
|
|
761
881
|
}
|
|
762
882
|
/**
|
|
763
|
-
* Self-serve soundlinks (`/v1/soundlinks/*`).
|
|
883
|
+
* Self-serve soundlinks (`/v1/soundlinks/*`).
|
|
764
884
|
*
|
|
765
|
-
*
|
|
766
|
-
* soundlinks are
|
|
885
|
+
* List, get, and metrics require `soundlinks:read`. Create and delete require
|
|
886
|
+
* `soundlinks:write`. Only soundlinks that are **not** linked to a campaign.
|
|
887
|
+
* Campaign-backed soundlinks are served by the Campaigns API.
|
|
767
888
|
*
|
|
768
889
|
* @example
|
|
769
890
|
* ```ts
|
|
770
891
|
* await soundlink.soundlinks.list();
|
|
771
892
|
* await soundlink.soundlinks.get(soundlinkId);
|
|
893
|
+
* await soundlink.soundlinks.create({ name, spotifyUrl }, { idempotencyKey });
|
|
894
|
+
* await soundlink.soundlinks.delete(soundlinkId);
|
|
772
895
|
* await soundlink.soundlinks.metricsOverview(soundlinkId);
|
|
773
|
-
* await soundlink.soundlinks.breakdown.list(soundlinkId);
|
|
774
|
-
* await soundlink.soundlinks.engagement.export(soundlinkId);
|
|
775
896
|
* ```
|
|
776
897
|
*/
|
|
777
898
|
declare class SoundlinksResource {
|
|
@@ -803,6 +924,31 @@ declare class SoundlinksResource {
|
|
|
803
924
|
* @param soundlinkId - Identifier returned by {@link SoundlinksResource.list}.
|
|
804
925
|
*/
|
|
805
926
|
get(soundlinkId: string): Promise<ApiResponse<SoundlinkDetail>>;
|
|
927
|
+
/**
|
|
928
|
+
* Create a self-serve soundlink.
|
|
929
|
+
*
|
|
930
|
+
* Maps to `POST /v1/soundlinks`. Requires `soundlinks:write` and
|
|
931
|
+
* `Idempotency-Key`. Does not create a campaign.
|
|
932
|
+
*
|
|
933
|
+
* @example
|
|
934
|
+
* ```ts
|
|
935
|
+
* const { data, error } = await soundlink.soundlinks.create(
|
|
936
|
+
* {
|
|
937
|
+
* name: 'Midnight Drive',
|
|
938
|
+
* spotifyUrl: 'https://open.spotify.com/track/...',
|
|
939
|
+
* },
|
|
940
|
+
* { idempotencyKey: 'create-midnight-drive-01' },
|
|
941
|
+
* );
|
|
942
|
+
* ```
|
|
943
|
+
*/
|
|
944
|
+
create(body: CreateSoundlinkRequest, options: IdempotencyOptions): Promise<ApiResponse<SoundlinkDetail>>;
|
|
945
|
+
/**
|
|
946
|
+
* Archive a self-serve soundlink (`status: archived`). Same as Archive in the app.
|
|
947
|
+
*
|
|
948
|
+
* Maps to `DELETE /v1/soundlinks/{soundlinkId}`. Requires `soundlinks:write`.
|
|
949
|
+
* Does not send `Idempotency-Key`. List and detail still return the row.
|
|
950
|
+
*/
|
|
951
|
+
delete(soundlinkId: string): Promise<ApiResponse<SoundlinkDetail>>;
|
|
806
952
|
/**
|
|
807
953
|
* Soundlink-level metric totals for a date range.
|
|
808
954
|
*
|
|
@@ -900,6 +1046,13 @@ declare class MetricsResource {
|
|
|
900
1046
|
* ```
|
|
901
1047
|
*/
|
|
902
1048
|
overview(campaignId: string, params?: DateRangeParams): Promise<ApiResponse<MetricsOverview>>;
|
|
1049
|
+
/**
|
|
1050
|
+
* Lifetime creative performance, grouped by background video.
|
|
1051
|
+
*
|
|
1052
|
+
* Maps to `GET /v1/campaigns/{campaignId}/metrics/creatives`.
|
|
1053
|
+
* Snapshot only — do not send a date range.
|
|
1054
|
+
*/
|
|
1055
|
+
creatives(campaignId: string): Promise<ApiResponse<CreativeMetrics>>;
|
|
903
1056
|
}
|
|
904
1057
|
/**
|
|
905
1058
|
* Country-level daily metrics (`campaign_country_daily` schema).
|
|
@@ -967,11 +1120,13 @@ declare class EngagementMetricsResource {
|
|
|
967
1120
|
declare class Soundlink {
|
|
968
1121
|
/** Verify connectivity and authentication. Maps to `GET /v1/ping`. */
|
|
969
1122
|
readonly ping: PingResource['ping'];
|
|
1123
|
+
/** Organization wallet snapshot. Requires `wallet:read` scope. */
|
|
1124
|
+
readonly wallet: WalletResource;
|
|
970
1125
|
/** Growth strategy catalog. Requires `campaigns:read` scope. */
|
|
971
1126
|
readonly strategies: StrategiesResource;
|
|
972
1127
|
/** List, fetch, and manage campaigns. Read needs `campaigns:read`; writes need `campaigns:write`. */
|
|
973
1128
|
readonly campaigns: CampaignsResource;
|
|
974
|
-
/** Self-serve soundlinks
|
|
1129
|
+
/** Self-serve soundlinks. Read needs `soundlinks:read`; create/delete need `soundlinks:write`. */
|
|
975
1130
|
readonly soundlinks: SoundlinksResource;
|
|
976
1131
|
/** Campaign metrics, breakdowns, and JSONL exports. Requires `metrics:read` scope. */
|
|
977
1132
|
readonly metrics: MetricsResource;
|
|
@@ -1008,4 +1163,4 @@ declare const CAMPAIGNS_MAX_PAGE_SIZE = 100;
|
|
|
1008
1163
|
declare const SOUNDLINKS_MAX_PAGE_SIZE = 100;
|
|
1009
1164
|
declare const METRICS_MAX_PAGE_SIZE = 500;
|
|
1010
1165
|
|
|
1011
|
-
export { API_KEY_PREFIX, type ApiError, type ApiMeta, type ApiResponse, type BreakdownExportParams, type BreakdownListData, type BreakdownListParams, type BreakdownRow, type BudgetDecreaseMode, type BudgetIncreaseMode, type BuiltInStrategyType, CAMPAIGNS_MAX_PAGE_SIZE, type CampaignCreateData, type CampaignDetail, type CampaignGeneration, type CampaignListData, type CampaignListParams, type CampaignSortBy, type CampaignStatus, type CampaignStopData, type CampaignSummary, type CampaignTier, type CampaignTiersData, type CreateCampaignRequest, type CreateCampaignRequestBase, type CreateCampaignRequestBuiltIn, type CreateCampaignRequestCustom, type CreativeDirection, type CustomTier, DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT_MS, type DateRangeParams, type DecreaseCampaignBudgetData, type DecreaseCampaignBudgetRequest, type DoItForMeCreativeDirection, type EngagementContext, type EngagementExportParams, type EngagementRow, type ExportCollection, type ExportResource, type FullControlCreativeDirection, type Genre, HttpClient, type IdempotencyOptions, type IncreaseCampaignBudgetData, type IncreaseCampaignBudgetRequest, type JsonlStream, METRICS_MAX_PAGE_SIZE, type MetricsOverview, type Pagination, type PingData, type PublicApiErrorCode, SOUNDLINKS_MAX_PAGE_SIZE, type SocialPlatform, type SortOrder, Soundlink, type SoundlinkBreakdownListData, type SoundlinkBreakdownListParams, type SoundlinkBreakdownRow, type SoundlinkBreakdownSortBy, type SoundlinkClientOptions, SoundlinkConfigError, type SoundlinkDetail, type SoundlinkEngagementListData, type SoundlinkEngagementListParams, type SoundlinkEngagementRow, type SoundlinkEngagementSortBy, type SoundlinkListData, type SoundlinkListParams, type SoundlinkMetricsOverview, type SoundlinkOptions, SoundlinkParseError, SoundlinkSdkError, type SoundlinkSortBy, type SoundlinkStatus, type SoundlinkSummary, type SoundlinkTargetType, type StrategiesCatalogData, type StrategyCatalogItem, type StrategyType, type TierStatusUpdateItem, type TierTargeting, type UpdateCampaignTiersRequest, getStreamRowCount, resolveClientOptions };
|
|
1166
|
+
export { API_KEY_PREFIX, type ApiError, type ApiMeta, type ApiResponse, type BreakdownExportParams, type BreakdownListData, type BreakdownListParams, type BreakdownRow, type BudgetDecreaseMode, type BudgetIncreaseMode, type BuiltInStrategyType, CAMPAIGNS_MAX_PAGE_SIZE, type CampaignAutoRenewData, type CampaignCreateData, type CampaignDetail, type CampaignGeneration, type CampaignListData, type CampaignListParams, type CampaignSortBy, type CampaignStatus, type CampaignStopData, type CampaignSummary, type CampaignTier, type CampaignTiersData, type CreateCampaignRequest, type CreateCampaignRequestBase, type CreateCampaignRequestBuiltIn, type CreateCampaignRequestCustom, type CreateSoundlinkRequest, type CreativeDirection, type CreativeMetrics, type CreativeMetricsChild, type CreativeMetricsGroup, type CustomTier, DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT_MS, type DateRangeParams, type DecreaseCampaignBudgetData, type DecreaseCampaignBudgetRequest, type DoItForMeCreativeDirection, type EngagementContext, type EngagementExportParams, type EngagementRow, type ExportCollection, type ExportResource, type FullControlCreativeDirection, type Genre, HttpClient, type IdempotencyOptions, type IncreaseCampaignBudgetData, type IncreaseCampaignBudgetRequest, type JsonlStream, METRICS_MAX_PAGE_SIZE, type MetricsOverview, type Pagination, type PingData, type PublicApiErrorCode, SOUNDLINKS_MAX_PAGE_SIZE, type SocialPlatform, type SortOrder, Soundlink, type SoundlinkBreakdownListData, type SoundlinkBreakdownListParams, type SoundlinkBreakdownRow, type SoundlinkBreakdownSortBy, type SoundlinkClientOptions, SoundlinkConfigError, type SoundlinkDetail, type SoundlinkEngagementListData, type SoundlinkEngagementListParams, type SoundlinkEngagementRow, type SoundlinkEngagementSortBy, type SoundlinkListData, type SoundlinkListParams, type SoundlinkMetricsOverview, type SoundlinkOptions, SoundlinkParseError, SoundlinkSdkError, type SoundlinkSortBy, type SoundlinkStatus, type SoundlinkSummary, type SoundlinkTargetType, type StrategiesCatalogData, type StrategyCatalogItem, type StrategyType, type TierStatusUpdateItem, type TierTargeting, type UpdateCampaignAutoRenewRequest, type UpdateCampaignTiersRequest, type WalletData, getStreamRowCount, resolveClientOptions };
|
package/dist/esm/index.js
CHANGED
|
@@ -237,6 +237,36 @@ var HttpClient = class {
|
|
|
237
237
|
idempotencyKey
|
|
238
238
|
});
|
|
239
239
|
}
|
|
240
|
+
async put({
|
|
241
|
+
path,
|
|
242
|
+
body,
|
|
243
|
+
query,
|
|
244
|
+
headers,
|
|
245
|
+
idempotencyKey
|
|
246
|
+
}) {
|
|
247
|
+
return this.mutateJson("PUT", {
|
|
248
|
+
path,
|
|
249
|
+
body,
|
|
250
|
+
query,
|
|
251
|
+
headers,
|
|
252
|
+
idempotencyKey
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
async delete({
|
|
256
|
+
path,
|
|
257
|
+
body,
|
|
258
|
+
query,
|
|
259
|
+
headers,
|
|
260
|
+
idempotencyKey
|
|
261
|
+
}) {
|
|
262
|
+
return this.mutateJson("DELETE", {
|
|
263
|
+
path,
|
|
264
|
+
body,
|
|
265
|
+
query,
|
|
266
|
+
headers,
|
|
267
|
+
idempotencyKey
|
|
268
|
+
});
|
|
269
|
+
}
|
|
240
270
|
async getJsonl({
|
|
241
271
|
path,
|
|
242
272
|
query,
|
|
@@ -441,6 +471,25 @@ var PingResource = class {
|
|
|
441
471
|
return this.http.get({ path: "/ping" });
|
|
442
472
|
}
|
|
443
473
|
};
|
|
474
|
+
var WalletResource = class {
|
|
475
|
+
constructor(http) {
|
|
476
|
+
this.http = http;
|
|
477
|
+
}
|
|
478
|
+
http;
|
|
479
|
+
/**
|
|
480
|
+
* Wallet snapshot for the organization on the API key.
|
|
481
|
+
*
|
|
482
|
+
* Maps to `GET /v1/wallet`. `available` is balance minus active reservations.
|
|
483
|
+
*
|
|
484
|
+
* @example
|
|
485
|
+
* ```ts
|
|
486
|
+
* const { data } = await soundlink.wallet.get();
|
|
487
|
+
* ```
|
|
488
|
+
*/
|
|
489
|
+
get() {
|
|
490
|
+
return this.http.get({ path: "/wallet" });
|
|
491
|
+
}
|
|
492
|
+
};
|
|
444
493
|
var StrategiesResource = class {
|
|
445
494
|
constructor(http) {
|
|
446
495
|
this.http = http;
|
|
@@ -597,6 +646,19 @@ var CampaignsResource = class {
|
|
|
597
646
|
idempotencyKey: options.idempotencyKey
|
|
598
647
|
});
|
|
599
648
|
}
|
|
649
|
+
/**
|
|
650
|
+
* Set auto-renew for a wallet campaign.
|
|
651
|
+
*
|
|
652
|
+
* Maps to `PUT /v1/campaigns/{campaignId}/auto-renew`. Requires `campaigns:write`
|
|
653
|
+
* and `Idempotency-Key`. Wallet campaigns only (`generation: 3`).
|
|
654
|
+
*/
|
|
655
|
+
updateAutoRenew(campaignId, body, options) {
|
|
656
|
+
return this.http.put({
|
|
657
|
+
path: `/campaigns/${encodeURIComponent(campaignId)}/auto-renew`,
|
|
658
|
+
body,
|
|
659
|
+
idempotencyKey: options.idempotencyKey
|
|
660
|
+
});
|
|
661
|
+
}
|
|
600
662
|
/**
|
|
601
663
|
* Async iterator over every campaign across all pages.
|
|
602
664
|
*
|
|
@@ -674,6 +736,41 @@ var SoundlinksResource = class {
|
|
|
674
736
|
path: `/soundlinks/${encodeURIComponent(soundlinkId)}`
|
|
675
737
|
});
|
|
676
738
|
}
|
|
739
|
+
/**
|
|
740
|
+
* Create a self-serve soundlink.
|
|
741
|
+
*
|
|
742
|
+
* Maps to `POST /v1/soundlinks`. Requires `soundlinks:write` and
|
|
743
|
+
* `Idempotency-Key`. Does not create a campaign.
|
|
744
|
+
*
|
|
745
|
+
* @example
|
|
746
|
+
* ```ts
|
|
747
|
+
* const { data, error } = await soundlink.soundlinks.create(
|
|
748
|
+
* {
|
|
749
|
+
* name: 'Midnight Drive',
|
|
750
|
+
* spotifyUrl: 'https://open.spotify.com/track/...',
|
|
751
|
+
* },
|
|
752
|
+
* { idempotencyKey: 'create-midnight-drive-01' },
|
|
753
|
+
* );
|
|
754
|
+
* ```
|
|
755
|
+
*/
|
|
756
|
+
create(body, options) {
|
|
757
|
+
return this.http.post({
|
|
758
|
+
path: "/soundlinks",
|
|
759
|
+
body,
|
|
760
|
+
idempotencyKey: options.idempotencyKey
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Archive a self-serve soundlink (`status: archived`). Same as Archive in the app.
|
|
765
|
+
*
|
|
766
|
+
* Maps to `DELETE /v1/soundlinks/{soundlinkId}`. Requires `soundlinks:write`.
|
|
767
|
+
* Does not send `Idempotency-Key`. List and detail still return the row.
|
|
768
|
+
*/
|
|
769
|
+
delete(soundlinkId) {
|
|
770
|
+
return this.http.delete({
|
|
771
|
+
path: `/soundlinks/${encodeURIComponent(soundlinkId)}`
|
|
772
|
+
});
|
|
773
|
+
}
|
|
677
774
|
/**
|
|
678
775
|
* Soundlink-level metric totals for a date range.
|
|
679
776
|
*
|
|
@@ -817,6 +914,17 @@ var MetricsResource = class {
|
|
|
817
914
|
}
|
|
818
915
|
});
|
|
819
916
|
}
|
|
917
|
+
/**
|
|
918
|
+
* Lifetime creative performance, grouped by background video.
|
|
919
|
+
*
|
|
920
|
+
* Maps to `GET /v1/campaigns/{campaignId}/metrics/creatives`.
|
|
921
|
+
* Snapshot only — do not send a date range.
|
|
922
|
+
*/
|
|
923
|
+
creatives(campaignId) {
|
|
924
|
+
return this.http.get({
|
|
925
|
+
path: `/campaigns/${encodeURIComponent(campaignId)}/metrics/creatives`
|
|
926
|
+
});
|
|
927
|
+
}
|
|
820
928
|
};
|
|
821
929
|
var BreakdownMetricsResource = class {
|
|
822
930
|
constructor(http) {
|
|
@@ -886,11 +994,13 @@ var EngagementMetricsResource = class {
|
|
|
886
994
|
var Soundlink = class {
|
|
887
995
|
/** Verify connectivity and authentication. Maps to `GET /v1/ping`. */
|
|
888
996
|
ping;
|
|
997
|
+
/** Organization wallet snapshot. Requires `wallet:read` scope. */
|
|
998
|
+
wallet;
|
|
889
999
|
/** Growth strategy catalog. Requires `campaigns:read` scope. */
|
|
890
1000
|
strategies;
|
|
891
1001
|
/** List, fetch, and manage campaigns. Read needs `campaigns:read`; writes need `campaigns:write`. */
|
|
892
1002
|
campaigns;
|
|
893
|
-
/** Self-serve soundlinks
|
|
1003
|
+
/** Self-serve soundlinks. Read needs `soundlinks:read`; create/delete need `soundlinks:write`. */
|
|
894
1004
|
soundlinks;
|
|
895
1005
|
/** Campaign metrics, breakdowns, and JSONL exports. Requires `metrics:read` scope. */
|
|
896
1006
|
metrics;
|
|
@@ -903,6 +1013,7 @@ var Soundlink = class {
|
|
|
903
1013
|
const http = new HttpClient(options);
|
|
904
1014
|
const pingResource = new PingResource(http);
|
|
905
1015
|
this.ping = pingResource.ping.bind(pingResource);
|
|
1016
|
+
this.wallet = new WalletResource(http);
|
|
906
1017
|
this.strategies = new StrategiesResource(http);
|
|
907
1018
|
this.campaigns = new CampaignsResource(http);
|
|
908
1019
|
this.soundlinks = new SoundlinksResource(http);
|