@spyglasshq/sdk 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.
Files changed (60) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/Client.d.ts +8 -8
  3. package/dist/cjs/Client.js +8 -8
  4. package/dist/cjs/api/client/requests/SearchBrandsRequest.d.ts +4 -4
  5. package/dist/cjs/api/client/requests/SearchCreatorsRequest.d.ts +4 -4
  6. package/dist/cjs/api/client/requests/SearchMediaRequest.d.ts +2 -2
  7. package/dist/cjs/api/resources/account/client/Client.d.ts +63 -3
  8. package/dist/cjs/api/resources/account/client/Client.js +191 -4
  9. package/dist/cjs/api/resources/account/client/requests/CampaignsAccountRequest.d.ts +18 -0
  10. package/dist/cjs/api/resources/account/client/requests/CampaignsAccountRequest.js +3 -0
  11. package/dist/cjs/api/resources/account/client/requests/CollabsAccountRequest.d.ts +12 -0
  12. package/dist/cjs/api/resources/account/client/requests/CollabsAccountRequest.js +3 -0
  13. package/dist/cjs/api/resources/account/client/requests/LandingPagesAccountRequest.d.ts +1 -0
  14. package/dist/cjs/api/resources/account/client/requests/index.d.ts +2 -0
  15. package/dist/cjs/api/resources/account/types/CampaignsAccountRequestDatePreset.d.ts +17 -0
  16. package/dist/cjs/api/resources/account/types/CampaignsAccountRequestDatePreset.js +20 -0
  17. package/dist/cjs/api/resources/account/types/CampaignsAccountRequestSortBy.d.ts +5 -0
  18. package/dist/cjs/api/resources/account/types/CampaignsAccountRequestSortBy.js +8 -0
  19. package/dist/cjs/api/resources/account/types/CampaignsAccountRequestType.d.ts +5 -0
  20. package/dist/cjs/api/resources/account/types/CampaignsAccountRequestType.js +8 -0
  21. package/dist/cjs/api/resources/account/types/CampaignsAccountResponse.d.ts +20 -0
  22. package/dist/cjs/api/resources/account/types/CampaignsAccountResponse.js +3 -0
  23. package/dist/cjs/api/resources/account/types/CollabsAccountResponse.d.ts +14 -0
  24. package/dist/cjs/api/resources/account/types/CollabsAccountResponse.js +3 -0
  25. package/dist/cjs/api/resources/account/types/InsightsAccountResponse.d.ts +0 -10
  26. package/dist/cjs/api/resources/account/types/index.d.ts +5 -0
  27. package/dist/cjs/api/resources/account/types/index.js +5 -0
  28. package/dist/cjs/version.d.ts +1 -1
  29. package/dist/cjs/version.js +1 -1
  30. package/dist/esm/BaseClient.mjs +2 -2
  31. package/dist/esm/Client.d.mts +8 -8
  32. package/dist/esm/Client.mjs +8 -8
  33. package/dist/esm/api/client/requests/SearchBrandsRequest.d.mts +4 -4
  34. package/dist/esm/api/client/requests/SearchCreatorsRequest.d.mts +4 -4
  35. package/dist/esm/api/client/requests/SearchMediaRequest.d.mts +2 -2
  36. package/dist/esm/api/resources/account/client/Client.d.mts +63 -3
  37. package/dist/esm/api/resources/account/client/Client.mjs +191 -4
  38. package/dist/esm/api/resources/account/client/requests/CampaignsAccountRequest.d.mts +18 -0
  39. package/dist/esm/api/resources/account/client/requests/CampaignsAccountRequest.mjs +2 -0
  40. package/dist/esm/api/resources/account/client/requests/CollabsAccountRequest.d.mts +12 -0
  41. package/dist/esm/api/resources/account/client/requests/CollabsAccountRequest.mjs +2 -0
  42. package/dist/esm/api/resources/account/client/requests/LandingPagesAccountRequest.d.mts +1 -0
  43. package/dist/esm/api/resources/account/client/requests/index.d.mts +2 -0
  44. package/dist/esm/api/resources/account/types/CampaignsAccountRequestDatePreset.d.mts +17 -0
  45. package/dist/esm/api/resources/account/types/CampaignsAccountRequestDatePreset.mjs +17 -0
  46. package/dist/esm/api/resources/account/types/CampaignsAccountRequestSortBy.d.mts +5 -0
  47. package/dist/esm/api/resources/account/types/CampaignsAccountRequestSortBy.mjs +5 -0
  48. package/dist/esm/api/resources/account/types/CampaignsAccountRequestType.d.mts +5 -0
  49. package/dist/esm/api/resources/account/types/CampaignsAccountRequestType.mjs +5 -0
  50. package/dist/esm/api/resources/account/types/CampaignsAccountResponse.d.mts +20 -0
  51. package/dist/esm/api/resources/account/types/CampaignsAccountResponse.mjs +2 -0
  52. package/dist/esm/api/resources/account/types/CollabsAccountResponse.d.mts +14 -0
  53. package/dist/esm/api/resources/account/types/CollabsAccountResponse.mjs +2 -0
  54. package/dist/esm/api/resources/account/types/InsightsAccountResponse.d.mts +0 -10
  55. package/dist/esm/api/resources/account/types/index.d.mts +5 -0
  56. package/dist/esm/api/resources/account/types/index.mjs +5 -0
  57. package/dist/esm/version.d.mts +1 -1
  58. package/dist/esm/version.mjs +1 -1
  59. package/package.json +1 -1
  60. package/reference.md +153 -11
@@ -0,0 +1,18 @@
1
+ import type * as spyglass from '../../../../index.mjs';
2
+ /**
3
+ * @example
4
+ * {
5
+ * id: "id",
6
+ * type: "CAMPAIGN"
7
+ * }
8
+ */
9
+ export interface CampaignsAccountRequest {
10
+ /** Brand id returned by POST /brands/search. */
11
+ id: string;
12
+ type: spyglass.CampaignsAccountRequestType;
13
+ sortBy?: spyglass.CampaignsAccountRequestSortBy;
14
+ limit?: number;
15
+ datePreset?: spyglass.CampaignsAccountRequestDatePreset;
16
+ startDate?: string;
17
+ endDate?: string;
18
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "id"
5
+ * }
6
+ */
7
+ export interface CollabsAccountRequest {
8
+ /** Brand id returned by POST /brands/search. */
9
+ id: string;
10
+ limit?: number;
11
+ offset?: number;
12
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -10,4 +10,5 @@ export interface LandingPagesAccountRequest {
10
10
  id: string;
11
11
  showInactive?: spyglass.LandingPagesAccountRequestShowInactive;
12
12
  limit?: number;
13
+ offset?: number;
13
14
  }
@@ -1,3 +1,5 @@
1
+ export type { CampaignsAccountRequest } from './CampaignsAccountRequest.mjs';
2
+ export type { CollabsAccountRequest } from './CollabsAccountRequest.mjs';
1
3
  export type { GetAccountRequest } from './GetAccountRequest.mjs';
2
4
  export type { IndexAccountRequest } from './IndexAccountRequest.mjs';
3
5
  export type { IndexStatusAccountRequest } from './IndexStatusAccountRequest.mjs';
@@ -0,0 +1,17 @@
1
+ export declare const CampaignsAccountRequestDatePreset: {
2
+ readonly Today: "today";
3
+ readonly Yesterday: "yesterday";
4
+ readonly Last3Days: "last-3-days";
5
+ readonly Last7Days: "last-7-days";
6
+ readonly ThisWeek: "this-week";
7
+ readonly LastWeek: "last-week";
8
+ readonly Last14Days: "last-14-days";
9
+ readonly Last30Days: "last-30-days";
10
+ readonly ThisMonth: "this-month";
11
+ readonly LastMonth: "last-month";
12
+ readonly Last3Months: "last-3-months";
13
+ readonly Last6Months: "last-6-months";
14
+ readonly YearToDate: "year-to-date";
15
+ readonly LastYear: "last-year";
16
+ };
17
+ export type CampaignsAccountRequestDatePreset = (typeof CampaignsAccountRequestDatePreset)[keyof typeof CampaignsAccountRequestDatePreset];
@@ -0,0 +1,17 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export const CampaignsAccountRequestDatePreset = {
3
+ Today: 'today',
4
+ Yesterday: 'yesterday',
5
+ Last3Days: 'last-3-days',
6
+ Last7Days: 'last-7-days',
7
+ ThisWeek: 'this-week',
8
+ LastWeek: 'last-week',
9
+ Last14Days: 'last-14-days',
10
+ Last30Days: 'last-30-days',
11
+ ThisMonth: 'this-month',
12
+ LastMonth: 'last-month',
13
+ Last3Months: 'last-3-months',
14
+ Last6Months: 'last-6-months',
15
+ YearToDate: 'year-to-date',
16
+ LastYear: 'last-year',
17
+ };
@@ -0,0 +1,5 @@
1
+ export declare const CampaignsAccountRequestSortBy: {
2
+ readonly MostRecent: "MOST_RECENT";
3
+ readonly HighestVelocity: "HIGHEST_VELOCITY";
4
+ };
5
+ export type CampaignsAccountRequestSortBy = (typeof CampaignsAccountRequestSortBy)[keyof typeof CampaignsAccountRequestSortBy];
@@ -0,0 +1,5 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export const CampaignsAccountRequestSortBy = {
3
+ MostRecent: 'MOST_RECENT',
4
+ HighestVelocity: 'HIGHEST_VELOCITY',
5
+ };
@@ -0,0 +1,5 @@
1
+ export declare const CampaignsAccountRequestType: {
2
+ readonly Campaign: "CAMPAIGN";
3
+ readonly Offer: "OFFER";
4
+ };
5
+ export type CampaignsAccountRequestType = (typeof CampaignsAccountRequestType)[keyof typeof CampaignsAccountRequestType];
@@ -0,0 +1,5 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export const CampaignsAccountRequestType = {
3
+ Campaign: 'CAMPAIGN',
4
+ Offer: 'OFFER',
5
+ };
@@ -0,0 +1,20 @@
1
+ export interface CampaignsAccountResponse {
2
+ count: number;
3
+ campaigns: CampaignsAccountResponse.Campaigns.Item[];
4
+ }
5
+ export declare namespace CampaignsAccountResponse {
6
+ type Campaigns = Campaigns.Item[];
7
+ namespace Campaigns {
8
+ interface Item {
9
+ id: string;
10
+ type: string;
11
+ category: string | null;
12
+ title: string;
13
+ summary: string | null;
14
+ velocityScore: number | null;
15
+ startAt: string;
16
+ mediaCount?: number | undefined;
17
+ launches7d: number;
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,14 @@
1
+ export interface CollabsAccountResponse {
2
+ count: number;
3
+ collabs: CollabsAccountResponse.Collabs.Item[];
4
+ }
5
+ export declare namespace CollabsAccountResponse {
6
+ type Collabs = Collabs.Item[];
7
+ namespace Collabs {
8
+ interface Item {
9
+ name: string;
10
+ profileUrl: string;
11
+ mediaCount: number;
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -8,16 +8,6 @@ export type InsightsAccountResponse = {
8
8
  } | {
9
9
  type: 'HOOK' | 'TARGET_PERSONA' | 'AD_ANGLE';
10
10
  count: number;
11
- buckets: {
12
- year: number;
13
- week: number;
14
- clusters: {
15
- id: string;
16
- label: string;
17
- rawDelta: number;
18
- percentDelta: number | null;
19
- }[];
20
- }[];
21
11
  totals: {
22
12
  id: string;
23
13
  label: string;
@@ -1,3 +1,8 @@
1
+ export * from './CampaignsAccountRequestDatePreset.mjs';
2
+ export * from './CampaignsAccountRequestSortBy.mjs';
3
+ export * from './CampaignsAccountRequestType.mjs';
4
+ export * from './CampaignsAccountResponse.mjs';
5
+ export * from './CollabsAccountResponse.mjs';
1
6
  export * from './GetAccountResponse.mjs';
2
7
  export * from './IndexAccountResponse.mjs';
3
8
  export * from './IndexStatusAccountResponse.mjs';
@@ -1,3 +1,8 @@
1
+ export * from './CampaignsAccountRequestDatePreset.mjs';
2
+ export * from './CampaignsAccountRequestSortBy.mjs';
3
+ export * from './CampaignsAccountRequestType.mjs';
4
+ export * from './CampaignsAccountResponse.mjs';
5
+ export * from './CollabsAccountResponse.mjs';
1
6
  export * from './GetAccountResponse.mjs';
2
7
  export * from './IndexAccountResponse.mjs';
3
8
  export * from './IndexStatusAccountResponse.mjs';
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.1.9";
1
+ export declare const SDK_VERSION = "0.1.10";
@@ -1 +1 @@
1
- export const SDK_VERSION = '0.1.9';
1
+ export const SDK_VERSION = '0.1.10';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spyglasshq/sdk",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
package/reference.md CHANGED
@@ -24,7 +24,7 @@ Send one search field. Each field is its own mode:
24
24
  when nothing matches.
25
25
  - **Name** (`names`). Fuzzy-matches account names (a case-insensitive contains
26
26
  match). Pass every name in one array.
27
- - **ID** (`brandIds`). Looks up known ids. Missing ids are omitted and listed
27
+ - **ID** (`ids`). Looks up known ids. Missing ids are omitted and listed
28
28
  in `unmatchedIds`. `limit` and `offset` are ignored.
29
29
  - **Instagram** (`igUsername`). Case-insensitive contains match on the
30
30
  handle. A leading `@` is ignored.
@@ -33,7 +33,7 @@ Send one search field. Each field is its own mode:
33
33
  If a request includes more than one of these fields, only the highest
34
34
  priority field is used. The rest are ignored:
35
35
 
36
- 1. `brandIds`
36
+ 1. `ids`
37
37
  2. `igUsername` or `tiktokUsername` (if both are set, either handle can match)
38
38
  3. `names`
39
39
  4. `query`
@@ -45,7 +45,7 @@ set, and `query` ranks inside it.
45
45
  every mode except ID.
46
46
 
47
47
  Limited to 120 requests per minute per user.
48
- Costs 2,000 microdollars ($0.0020) per brand returned, charged against your plan's monthly credits. The count field is what you were charged for.
48
+ Costs $0.0010 per brand returned, charged against your plan's monthly credits. The count field is what you were charged for.
49
49
  A `query` search runs a language model, so it bills a minimum of one
50
50
  row even when nothing matches.
51
51
 
@@ -125,7 +125,7 @@ Send one search field. Each field is its own mode:
125
125
  when nothing matches.
126
126
  - **Name** (`names`). Fuzzy-matches account names (a case-insensitive contains
127
127
  match). Pass every name in one array.
128
- - **ID** (`brandIds`). Looks up known ids. Missing ids are omitted and listed
128
+ - **ID** (`ids`). Looks up known ids. Missing ids are omitted and listed
129
129
  in `unmatchedIds`. `limit` and `offset` are ignored.
130
130
  - **Instagram** (`igUsername`). Case-insensitive contains match on the
131
131
  handle. A leading `@` is ignored.
@@ -134,7 +134,7 @@ Send one search field. Each field is its own mode:
134
134
  If a request includes more than one of these fields, only the highest
135
135
  priority field is used. The rest are ignored:
136
136
 
137
- 1. `brandIds`
137
+ 1. `ids`
138
138
  2. `igUsername` or `tiktokUsername` (if both are set, either handle can match)
139
139
  3. `names`
140
140
  4. `query`
@@ -146,7 +146,7 @@ set, and `query` ranks inside it.
146
146
  every mode except ID.
147
147
 
148
148
  Limited to 120 requests per minute per user.
149
- Costs 2,000 microdollars ($0.0020) per creator returned, charged against your plan's monthly credits. The count field is what you were charged for.
149
+ Costs $0.0010 per creator returned, charged against your plan's monthly credits. The count field is what you were charged for.
150
150
  A `query` search runs a language model, so it bills a minimum of one
151
151
  row even when nothing matches.
152
152
 
@@ -290,7 +290,7 @@ or omit it to search the whole corpus. Without `accountId`,
290
290
  `query` is required.
291
291
 
292
292
  Limited to 120 requests per minute per user.
293
- Costs 1,000 microdollars ($0.0010) per creative returned, charged against your plan's monthly credits. The count field is what you were charged for.
293
+ Costs $0.0005 per creative returned, charged against your plan's monthly credits. The count field is what you were charged for.
294
294
  The call bills a minimum of one row even when nothing matches. In that
295
295
  case `count` is 0 but you are charged for one row.
296
296
 
@@ -439,7 +439,7 @@ Recent posts may be scraped live; older posts with stored comments
439
439
  are served from cache.
440
440
 
441
441
  Limited to 20 requests per minute per user.
442
- Costs 10,000 microdollars ($0.0100) per successful page of comments returned, charged against your plan's monthly credits.
442
+ Costs $0.0050 per successful page of comments returned, charged against your plan's monthly credits.
443
443
  Each comment page fetched live (`limit`, default 1) is one billed
444
444
  unit. Cached posts do not scrape and are not billed.
445
445
 
@@ -515,7 +515,7 @@ which one you got: `BRAND` or `CREATOR`, and the creator-only fields
515
515
  (`gender`, `ageRange`, ...) are present only on `CREATOR`.
516
516
 
517
517
  Limited to 120 requests per minute per user.
518
- Costs 2,000 microdollars ($0.0020) per account returned, charged against your plan's monthly credits.
518
+ Costs $0.0010 per account returned, charged against your plan's monthly credits.
519
519
  An id that matches nothing returns 404 and is free.
520
520
 
521
521
  </dd>
@@ -589,7 +589,7 @@ ranked totals, highest first.
589
589
  `totals` to creatives that started within the requested window.
590
590
 
591
591
  Limited to 120 requests per minute per user.
592
- Costs 1,000 microdollars ($0.0010) per cluster returned, charged against your plan's monthly credits. The count field is what you were charged for.
592
+ Costs $0.0005 per cluster returned, charged against your plan's monthly credits. The count field is what you were charged for.
593
593
 
594
594
  </dd>
595
595
  </dl>
@@ -643,6 +643,148 @@ await client.account.insights({
643
643
  </dl>
644
644
  </details>
645
645
 
646
+ <details><summary><code>client.account.<a href="/src/api/resources/account/client/Client.ts">campaigns</a>({ ...params }) -> spyglass.CampaignsAccountResponse</code></summary>
647
+ <dl>
648
+ <dd>
649
+
650
+ #### 📝 Description
651
+
652
+ <dl>
653
+ <dd>
654
+
655
+ <dl>
656
+ <dd>
657
+
658
+ Return an account’s campaigns or offers, newest start date first.
659
+ `datePreset`, or `startDate` and `endDate`, filter by campaign
660
+ start date. Omit both for all time.
661
+
662
+ Limited to 120 requests per minute per user.
663
+ Costs $0.0005 per campaign returned, charged against your plan's monthly credits. The count field is what you were charged for.
664
+
665
+ </dd>
666
+ </dl>
667
+ </dd>
668
+ </dl>
669
+
670
+ #### 🔌 Usage
671
+
672
+ <dl>
673
+ <dd>
674
+
675
+ <dl>
676
+ <dd>
677
+
678
+ ```typescript
679
+ await client.account.campaigns({
680
+ id: 'id',
681
+ type: 'CAMPAIGN',
682
+ });
683
+ ```
684
+
685
+ </dd>
686
+ </dl>
687
+ </dd>
688
+ </dl>
689
+
690
+ #### ⚙️ Parameters
691
+
692
+ <dl>
693
+ <dd>
694
+
695
+ <dl>
696
+ <dd>
697
+
698
+ **request:** `spyglass.CampaignsAccountRequest`
699
+
700
+ </dd>
701
+ </dl>
702
+
703
+ <dl>
704
+ <dd>
705
+
706
+ **requestOptions:** `AccountClient.RequestOptions`
707
+
708
+ </dd>
709
+ </dl>
710
+ </dd>
711
+ </dl>
712
+
713
+ </dd>
714
+ </dl>
715
+ </details>
716
+
717
+ <details><summary><code>client.account.<a href="/src/api/resources/account/client/Client.ts">collabs</a>({ ...params }) -> spyglass.CollabsAccountResponse</code></summary>
718
+ <dl>
719
+ <dd>
720
+
721
+ #### 📝 Description
722
+
723
+ <dl>
724
+ <dd>
725
+
726
+ <dl>
727
+ <dd>
728
+
729
+ Return the creators an account has collaborated with, ordered from
730
+ most media to least. Works for both brands and creators.
731
+ mediaCount is how many of that account’s media items tag the
732
+ creator.
733
+
734
+ Limited to 120 requests per minute per user.
735
+ Costs $0.0005 per collab returned, charged against your plan's monthly credits. The count field is what you were charged for.
736
+
737
+ </dd>
738
+ </dl>
739
+ </dd>
740
+ </dl>
741
+
742
+ #### 🔌 Usage
743
+
744
+ <dl>
745
+ <dd>
746
+
747
+ <dl>
748
+ <dd>
749
+
750
+ ```typescript
751
+ await client.account.collabs({
752
+ id: 'id',
753
+ });
754
+ ```
755
+
756
+ </dd>
757
+ </dl>
758
+ </dd>
759
+ </dl>
760
+
761
+ #### ⚙️ Parameters
762
+
763
+ <dl>
764
+ <dd>
765
+
766
+ <dl>
767
+ <dd>
768
+
769
+ **request:** `spyglass.CollabsAccountRequest`
770
+
771
+ </dd>
772
+ </dl>
773
+
774
+ <dl>
775
+ <dd>
776
+
777
+ **requestOptions:** `AccountClient.RequestOptions`
778
+
779
+ </dd>
780
+ </dl>
781
+ </dd>
782
+ </dl>
783
+
784
+ </dd>
785
+ </dl>
786
+ </details>
787
+
646
788
  <details><summary><code>client.account.<a href="/src/api/resources/account/client/Client.ts">landingPages</a>({ ...params }) -> spyglass.LandingPagesAccountResponse</code></summary>
647
789
  <dl>
648
790
  <dd>
@@ -659,7 +801,7 @@ Return the landing-page URLs an account sends ad traffic to, ranked by
659
801
  how often they appear across its ads.
660
802
 
661
803
  Limited to 120 requests per minute per user.
662
- Costs 5,000 microdollars ($0.0050) per landing page returned, charged against your plan's monthly credits. The count field is what you were charged for.
804
+ Costs $0.0025 per landing page returned, charged against your plan's monthly credits. The count field is what you were charged for.
663
805
 
664
806
  </dd>
665
807
  </dl>