@bitbitpress/client 2.0.0-beta.6 → 2.0.0-beta.7

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/README.md CHANGED
@@ -764,7 +764,7 @@ Data methods require authentication. Call `client.user.authenticate()` before us
764
764
 
765
765
  #### assets
766
766
 
767
- Fetch assets by internal IDs or external IDs, and return requested fields.
767
+ Fetch assets by internal IDs, external IDs, or source URLs, and return requested fields.
768
768
 
769
769
  ```typescript
770
770
  client.data.assets(options: AssetsRequest): Promise<AssetsResponse>
@@ -772,8 +772,11 @@ client.data.assets(options: AssetsRequest): Promise<AssetsResponse>
772
772
 
773
773
  ##### Parameters
774
774
 
775
- - `options.assetIds` (required unless `externalIds` is provided): List of BitBitPress asset IDs to fetch
776
- - `options.externalIds` (required unless `assetIds` is provided): List of source-system external IDs to fetch
775
+ Provide exactly one of `assetIds`, `externalIds`, or `sourceUrls`.
776
+
777
+ - `options.assetIds`: List of BitBitPress asset IDs to fetch
778
+ - `options.externalIds`: List of source-system external IDs to fetch
779
+ - `options.sourceUrls`: List of canonical source URLs (article permalinks) to resolve to assets
777
780
  - `options.assetFields` (required): Asset fields to return (dot or bracket notation, e.g. `tags[0]`, `images[1].src`). Allowed: `assetId`, `title`, `tags`, `images`, `videos`, `audios`, `publishedAt`, `externalId`, `externalData`, `assetType`, `sourceUrl`, `dataSource.name`, and subfields. Empty array returns objects with only `assetId`.
778
781
 
779
782
  ##### Returns
@@ -791,6 +794,12 @@ const { assets } = await client.data.assets({
791
794
  });
792
795
 
793
796
  console.log('Assets:', assets);
797
+
798
+ // Resolve assets by their public URL (e.g. a link in article content)
799
+ const { assets: linked } = await client.data.assets({
800
+ sourceUrls: ['https://example.com/some-article/'],
801
+ assetFields: ['assetId', 'title'],
802
+ });
794
803
  ```
795
804
 
796
805
  ---
@@ -995,10 +1004,12 @@ Request body for POST `/v1/data/assets`.
995
1004
  type AssetsRequest = {
996
1005
  assetIds?: string[];
997
1006
  externalIds?: string[];
1007
+ sourceUrls?: string[];
998
1008
  assetFields: string[];
999
1009
  } & (
1000
- | { assetIds: string[]; externalIds?: string[] }
1001
- | { assetIds?: string[]; externalIds: string[] }
1010
+ | { assetIds: string[]; externalIds?: string[]; sourceUrls?: string[] }
1011
+ | { assetIds?: string[]; externalIds: string[]; sourceUrls?: string[] }
1012
+ | { assetIds?: string[]; externalIds?: string[]; sourceUrls: string[] }
1002
1013
  );
1003
1014
  ```
1004
1015
 
@@ -4,9 +4,15 @@ type OpenApiAssetsRequest = paths['/v1/data/assets']['post']['requestBody']['con
4
4
  export type AssetsRequest = OpenApiAssetsRequest & ({
5
5
  assetIds: string[];
6
6
  externalIds?: string[];
7
+ sourceUrls?: string[];
7
8
  } | {
8
9
  assetIds?: string[];
9
10
  externalIds: string[];
11
+ sourceUrls?: string[];
12
+ } | {
13
+ assetIds?: string[];
14
+ externalIds?: string[];
15
+ sourceUrls: string[];
10
16
  });
11
17
  export type AssetsResponse = paths['/v1/data/assets']['post']['responses'][200]['content']['application/json']['data'];
12
18
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../src/data/assets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,KAAK,oBAAoB,GACvB,KAAK,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAEjF,MAAM,MAAM,aAAa,GAAG,oBAAoB,GAC9C,CAAC;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAA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AC,MAAM,CAAC,CAAC;AAE5F;;;;;;GAMG;AACH,wBAAsB,MAAM,CAC1B,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,cAAc,CAAC,CAYzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"assets.js","sourceRoot":"","sources":["../../src/data/assets.ts"],"names":[],"mappings":";;AAoBA,wBAeC;AAjCD,8CAA4C;AAW5C;;;;;;GAMG;AACI,KAAK,UAAU,MAAM,CAC1B,MAAqB,EACrB,OAAsB;IAEtB,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAW,EAAiB,MAAM,EAAE;QACzD,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,OAAO;KACd,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
1
+ {"version":3,"file":"assets.js","sourceRoot":"","sources":["../../src/data/assets.ts"],"names":[],"mappings":";;AAwBA,wBAeC;AArCD,8CAA4C;AAe5C;;;;;;GAMG;AACI,KAAK,UAAU,MAAM,CAC1B,MAAqB,EACrB,OAAsB;IAEtB,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAW,EAAiB,MAAM,EAAE;QACzD,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,OAAO;KACd,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -2393,6 +2393,8 @@ export interface paths {
2393
2393
  assetIds?: string[];
2394
2394
  /** @description List of external IDs to fetch */
2395
2395
  externalIds?: string[];
2396
+ /** @description List of source URLs (article permalinks) to resolve to assets */
2397
+ sourceUrls?: string[];
2396
2398
  /** @description Asset fields to return (dot or bracket notation). Allowed: assetId, title, tags, images, videos, publishedAt, externalId, externalData, assetType, sourceUrl, dataSource.name, and subfields. Empty array returns objects with only assetId. */
2397
2399
  assetFields: string[];
2398
2400
  } & (unknown | unknown);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitbitpress/client",
3
- "version": "2.0.0-beta.6",
3
+ "version": "2.0.0-beta.7",
4
4
  "description": "BitBitPress TypeScript client library",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",