Skip to content

Commit e876ee5

Browse files
release: 0.10.0 (#59)
Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent e03a063 commit e876ee5

File tree

12 files changed

+425
-5
lines changed

12 files changed

+425
-5
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.9.0"
2+
".": "0.10.0"
33
}

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 34
1+
configured_endpoints: 36
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/contextual-ai%2Fsunrise-c8152db455001be3f09a3bc60d63711699d2c2a4ea5f7bbc1d71726efda0fd9b.yml
33
openapi_spec_hash: 97719df292ca220de5d35d36f9756b95
4-
config_hash: ae81af9b7eb88a788a80bcf3480e0b6b
4+
config_hash: fdaf751580ba8a60e222e560847af1ac

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 0.10.0 (2025-11-11)
4+
5+
Full Changelog: [v0.9.0...v0.10.0](https://github.com/ContextualAI/contextual-client-node/compare/v0.9.0...v0.10.0)
6+
7+
### Features
8+
9+
* **api:** update via SDK Studio ([314253f](https://github.com/ContextualAI/contextual-client-node/commit/314253f03cbf07ecc2f6a0f4e856d4d0000f544e))
10+
311
## 0.9.0 (2025-10-28)
412

513
Full Changelog: [v0.8.0...v0.9.0](https://github.com/ContextualAI/contextual-client-node/compare/v0.8.0...v0.9.0)

api.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@ Methods:
4040
- <code title="get /datastores/{datastore_id}/documents/{document_id}/metadata">client.datastores.documents.<a href="./src/resources/datastores/documents.ts">metadata</a>(datastoreId, documentId) -> DocumentMetadata</code>
4141
- <code title="put /datastores/{datastore_id}/documents/{document_id}/metadata">client.datastores.documents.<a href="./src/resources/datastores/documents.ts">setMetadata</a>(datastoreId, documentId, { ...params }) -> DocumentMetadata</code>
4242

43+
## Contents
44+
45+
Types:
46+
47+
- <code><a href="./src/resources/datastores/contents.ts">ContentListResponse</a></code>
48+
- <code><a href="./src/resources/datastores/contents.ts">ContentMetadataResponse</a></code>
49+
50+
Methods:
51+
52+
- <code title="get /datastores/{datastore_id}/contents">client.datastores.contents.<a href="./src/resources/datastores/contents.ts">list</a>(datastoreId, { ...params }) -> ContentListResponsesContentsPage</code>
53+
- <code title="get /datastores/{datastore_id}/contents/{content_id}/metadata">client.datastores.contents.<a href="./src/resources/datastores/contents.ts">metadata</a>(datastoreId, contentId, { ...params }) -> ContentMetadataResponse</code>
54+
4355
# Agents
4456

4557
Types:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "contextual-client",
3-
"version": "0.9.0",
3+
"version": "0.10.0",
44
"description": "The official TypeScript library for the Contextual AI API",
55
"author": "Contextual AI <[email protected]>",
66
"types": "dist/index.d.ts",

src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import * as Core from './core';
66
import * as Errors from './error';
77
import * as Pagination from './pagination';
88
import {
9+
type ContentsPageParams,
10+
ContentsPageResponse,
911
type DatastoresPageParams,
1012
DatastoresPageResponse,
1113
type DocumentsPageParams,
@@ -281,6 +283,9 @@ export declare namespace ContextualAI {
281283
export import Page = Pagination.Page;
282284
export { type PageParams as PageParams, type PageResponse as PageResponse };
283285

286+
export import ContentsPage = Pagination.ContentsPage;
287+
export { type ContentsPageParams as ContentsPageParams, type ContentsPageResponse as ContentsPageResponse };
288+
284289
export {
285290
Datastores as Datastores,
286291
type CreateDatastoreResponse as CreateDatastoreResponse,

src/pagination.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,50 @@ export class Page<Item> extends AbstractPage<Item> implements PageResponse<Item>
224224
};
225225
}
226226
}
227+
228+
export interface ContentsPageResponse<Item> {
229+
data: Array<Item>;
230+
}
231+
232+
export interface ContentsPageParams {
233+
limit?: number;
234+
235+
offset?: number;
236+
}
237+
238+
export class ContentsPage<Item> extends AbstractPage<Item> implements ContentsPageResponse<Item> {
239+
data: Array<Item>;
240+
241+
constructor(
242+
client: APIClient,
243+
response: Response,
244+
body: ContentsPageResponse<Item>,
245+
options: FinalRequestOptions,
246+
) {
247+
super(client, response, body, options);
248+
249+
this.data = body.data || [];
250+
}
251+
252+
getPaginatedItems(): Item[] {
253+
return this.data ?? [];
254+
}
255+
256+
// @deprecated Please use `nextPageInfo()` instead
257+
nextPageParams(): Partial<ContentsPageParams> | null {
258+
const info = this.nextPageInfo();
259+
if (!info) return null;
260+
if ('params' in info) return info.params;
261+
const params = Object.fromEntries(info.url.searchParams);
262+
if (!Object.keys(params).length) return null;
263+
return params;
264+
}
265+
266+
nextPageInfo(): PageInfo | null {
267+
const offset = (this.options.query as ContentsPageParams).offset ?? 0;
268+
const length = this.getPaginatedItems().length;
269+
const currentCount = offset + length;
270+
271+
return { params: { offset: currentCount } };
272+
}
273+
}
Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
import { APIResource } from '../../resource';
4+
import { isRequestOptions } from '../../core';
5+
import * as Core from '../../core';
6+
import { ContentsPage, type ContentsPageParams } from '../../pagination';
7+
8+
export class Contents extends APIResource {
9+
/**
10+
* Get Document Contents
11+
*/
12+
list(
13+
datastoreId: string,
14+
query?: ContentListParams,
15+
options?: Core.RequestOptions,
16+
): Core.PagePromise<ContentListResponsesContentsPage, ContentListResponse>;
17+
list(
18+
datastoreId: string,
19+
options?: Core.RequestOptions,
20+
): Core.PagePromise<ContentListResponsesContentsPage, ContentListResponse>;
21+
list(
22+
datastoreId: string,
23+
query: ContentListParams | Core.RequestOptions = {},
24+
options?: Core.RequestOptions,
25+
): Core.PagePromise<ContentListResponsesContentsPage, ContentListResponse> {
26+
if (isRequestOptions(query)) {
27+
return this.list(datastoreId, {}, query);
28+
}
29+
return this._client.getAPIList(`/datastores/${datastoreId}/contents`, ContentListResponsesContentsPage, {
30+
query,
31+
...options,
32+
});
33+
}
34+
35+
/**
36+
* Get Content Metadata
37+
*/
38+
metadata(
39+
datastoreId: string,
40+
contentId: string,
41+
query?: ContentMetadataParams,
42+
options?: Core.RequestOptions,
43+
): Core.APIPromise<ContentMetadataResponse>;
44+
metadata(
45+
datastoreId: string,
46+
contentId: string,
47+
options?: Core.RequestOptions,
48+
): Core.APIPromise<ContentMetadataResponse>;
49+
metadata(
50+
datastoreId: string,
51+
contentId: string,
52+
query: ContentMetadataParams | Core.RequestOptions = {},
53+
options?: Core.RequestOptions,
54+
): Core.APIPromise<ContentMetadataResponse> {
55+
if (isRequestOptions(query)) {
56+
return this.metadata(datastoreId, contentId, {}, query);
57+
}
58+
return this._client.get(`/datastores/${datastoreId}/contents/${contentId}/metadata`, {
59+
query,
60+
...options,
61+
});
62+
}
63+
}
64+
65+
export class ContentListResponsesContentsPage extends ContentsPage<ContentListResponse> {}
66+
67+
/**
68+
* Content entry type
69+
*/
70+
export type ContentListResponse =
71+
| ContentListResponse.DocumentContentEntry
72+
| ContentListResponse.StructuredContentEntry;
73+
74+
export namespace ContentListResponse {
75+
export interface DocumentContentEntry {
76+
/**
77+
* ID of the content
78+
*/
79+
content_id: string;
80+
81+
/**
82+
* Page number of the content
83+
*/
84+
page_number: number;
85+
86+
content_type?: 'unstructured';
87+
}
88+
89+
/**
90+
* Tabular content entry used in query retrieval.
91+
*/
92+
export interface StructuredContentEntry {
93+
/**
94+
* ID of the content
95+
*/
96+
content_id: string;
97+
98+
/**
99+
* Name of the table
100+
*/
101+
table_name: string;
102+
103+
content_type?: 'structured';
104+
105+
/**
106+
* Name of the schema of the table
107+
*/
108+
schema?: string | null;
109+
}
110+
}
111+
112+
/**
113+
* Content type
114+
*/
115+
export type ContentMetadataResponse =
116+
| ContentMetadataResponse.UnstructuredContentMetadata
117+
| ContentMetadataResponse.StructuredContentMetadata
118+
| ContentMetadataResponse.FileAnalysisContentMetadata;
119+
120+
export namespace ContentMetadataResponse {
121+
export interface UnstructuredContentMetadata {
122+
/**
123+
* Id of the content.
124+
*/
125+
content_id: string;
126+
127+
/**
128+
* Text of the content.
129+
*/
130+
content_text: string;
131+
132+
/**
133+
* Id of the document which the content belongs to.
134+
*/
135+
document_id: string;
136+
137+
/**
138+
* Height of the image.
139+
*/
140+
height: number;
141+
142+
/**
143+
* Page number of the content.
144+
*/
145+
page: number;
146+
147+
/**
148+
* Image of the page on which the content occurs.
149+
*/
150+
page_img: string;
151+
152+
/**
153+
* Width of the image.
154+
*/
155+
width: number;
156+
157+
/**
158+
* X coordinate of the top left corner on the bounding box.
159+
*/
160+
x0: number;
161+
162+
/**
163+
* X coordinate of the bottom right corner on the bounding box.
164+
*/
165+
x1: number;
166+
167+
/**
168+
* Y coordinate of the top left corner on the bounding box.
169+
*/
170+
y0: number;
171+
172+
/**
173+
* Y coordinate of the bottom right corner on the bounding box.
174+
*/
175+
y1: number;
176+
177+
content_type?: 'unstructured';
178+
}
179+
180+
export interface StructuredContentMetadata {
181+
/**
182+
* Id of the content.
183+
*/
184+
content_id: string;
185+
186+
/**
187+
* Text of the content.
188+
*/
189+
content_text: unknown;
190+
191+
content_type?: 'structured';
192+
}
193+
194+
export interface FileAnalysisContentMetadata {
195+
/**
196+
* Id of the content.
197+
*/
198+
content_id: string;
199+
200+
/**
201+
* Format of the file.
202+
*/
203+
file_format: string;
204+
205+
/**
206+
* GCP location of the file.
207+
*/
208+
gcp_location: string;
209+
210+
content_type?: 'file_analysis';
211+
}
212+
}
213+
214+
export interface ContentListParams extends ContentsPageParams {
215+
/**
216+
* Document ID of the document to retrieve details for
217+
*/
218+
document_id?: string;
219+
220+
/**
221+
* The query to search keywords for
222+
*/
223+
search?: string;
224+
}
225+
226+
export interface ContentMetadataParams {
227+
cursor?: string;
228+
}
229+
230+
Contents.ContentListResponsesContentsPage = ContentListResponsesContentsPage;
231+
232+
export declare namespace Contents {
233+
export {
234+
type ContentListResponse as ContentListResponse,
235+
type ContentMetadataResponse as ContentMetadataResponse,
236+
ContentListResponsesContentsPage as ContentListResponsesContentsPage,
237+
type ContentListParams as ContentListParams,
238+
type ContentMetadataParams as ContentMetadataParams,
239+
};
240+
}

0 commit comments

Comments
 (0)