Package ai.vectros.resources.documents
Class DocumentsClient
java.lang.Object
ai.vectros.resources.documents.DocumentsClient
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteDocument(String id) Permanently deletes the document and removes it from the search index.voiddeleteDocument(String id, RequestOptions requestOptions) Permanently deletes the document and removes it from the search index.voiddeleteDocument(String id, DeleteDocumentRequest request) Permanently deletes the document and removes it from the search index.voiddeleteDocument(String id, DeleteDocumentRequest request, RequestOptions requestOptions) Permanently deletes the document and removes it from the search index.getDocument(String id) Returns a single document by its ID, including its full structured payload.getDocument(String id, RequestOptions requestOptions) Returns a single document by its ID, including its full structured payload.getDocument(String id, GetDocumentRequest request) Returns a single document by its ID, including its full structured payload.getDocument(String id, GetDocumentRequest request, RequestOptions requestOptions) Returns a single document by its ID, including its full structured payload.Returns a short-lived presigned S3 GET URL for the original uploaded file.getDocumentDownloadUrl(String id, RequestOptions requestOptions) Returns a short-lived presigned S3 GET URL for the original uploaded file.getDocumentDownloadUrl(String id, GetDocumentDownloadUrlRequest request) Returns a short-lived presigned S3 GET URL for the original uploaded file.getDocumentDownloadUrl(String id, GetDocumentDownloadUrlRequest request, RequestOptions requestOptions) Returns a short-lived presigned S3 GET URL for the original uploaded file.Returns the document's full text body when it is retained: always available for text-ingested documents, and for file-uploaded documents unless they were uploaded withstoreText=false(which discards the extracted text once indexing completes — the original file remains available viaGET /{id}/download).getDocumentText(String id, RequestOptions requestOptions) Returns the document's full text body when it is retained: always available for text-ingested documents, and for file-uploaded documents unless they were uploaded withstoreText=false(which discards the extracted text once indexing completes — the original file remains available viaGET /{id}/download).getDocumentText(String id, GetDocumentTextRequest request) Returns the document's full text body when it is retained: always available for text-ingested documents, and for file-uploaded documents unless they were uploaded withstoreText=false(which discards the extracted text once indexing completes — the original file remains available viaGET /{id}/download).getDocumentText(String id, GetDocumentTextRequest request, RequestOptions requestOptions) Returns the document's full text body when it is retained: always available for text-ingested documents, and for file-uploaded documents unless they were uploaded withstoreText=false(which discards the extracted text once indexing completes — the original file remains available viaGET /{id}/download).Returns the audit trail of changes (CREATE, UPDATE, DELETE) for a document.getDocumentVersions(String id, RequestOptions requestOptions) Returns the audit trail of changes (CREATE, UPDATE, DELETE) for a document.getDocumentVersions(String id, GetDocumentVersionsRequest request) Returns the audit trail of changes (CREATE, UPDATE, DELETE) for a document.getDocumentVersions(String id, GetDocumentVersionsRequest request, RequestOptions requestOptions) Returns the audit trail of changes (CREATE, UPDATE, DELETE) for a document.ingestDocument(IngestDocumentRequest request) Creates a document from a raw text string and queues it for asynchronous indexing so it becomes searchable.ingestDocument(IngestDocumentRequest request, RequestOptions requestOptions) Creates a document from a raw text string and queues it for asynchronous indexing so it becomes searchable.Creates a document from a raw text string and queues it for asynchronous indexing so it becomes searchable.ingestDocument(DocumentRequest body, RequestOptions requestOptions) Creates a document from a raw text string and queues it for asynchronous indexing so it becomes searchable.Returns a paginated list of your documents, optionally filtered by folder (folderId) and/or owner (userIdorscope).listDocuments(RequestOptions requestOptions) Returns a paginated list of your documents, optionally filtered by folder (folderId) and/or owner (userIdorscope).listDocuments(ListDocumentsRequest request) Returns a paginated list of your documents, optionally filtered by folder (folderId) and/or owner (userIdorscope).listDocuments(ListDocumentsRequest request, RequestOptions requestOptions) Returns a paginated list of your documents, optionally filtered by folder (folderId) and/or owner (userIdorscope).lookupDocuments(LookupDocumentsRequest request) Finds documents of a given type by field value.lookupDocuments(LookupDocumentsRequest request, RequestOptions requestOptions) Finds documents of a given type by field value.Request-body equivalent of GET /v1/documents/lookup.lookupDocumentsByBody(DocumentLookupRequest request, RequestOptions requestOptions) Request-body equivalent of GET /v1/documents/lookup.patchDocument(String id, PatchDocumentRequest request) Partially updates a document using an RFC 7386 JSON Merge Patch.patchDocument(String id, PatchDocumentRequest request, RequestOptions requestOptions) Partially updates a document using an RFC 7386 JSON Merge Patch.updateDocument(String id, UpdateDocumentRequest request) Replaces the mutable fields of a document.updateDocument(String id, UpdateDocumentRequest request, RequestOptions requestOptions) Replaces the mutable fields of a document.updateDocument(String id, DocumentRequest body) Replaces the mutable fields of a document.updateDocument(String id, DocumentRequest body, RequestOptions requestOptions) Replaces the mutable fields of a document.uploadDocument(FileUploadRequest request) Starts a file-based document by returning a short-lived presigned S3 PUT URL.uploadDocument(FileUploadRequest request, RequestOptions requestOptions) Starts a file-based document by returning a short-lived presigned S3 PUT URL.Get responses with HTTP metadata like headers
-
Field Details
-
clientOptions
-
-
Constructor Details
-
DocumentsClient
-
-
Method Details
-
withRawResponse
Get responses with HTTP metadata like headers -
listDocuments
Returns a paginated list of your documents, optionally filtered by folder (folderId) and/or owner (userIdorscope). The response is a{data, nextCursor}envelope; passnextCursorback asstartFromto fetch the next page. Requires thedocuments:rscope. -
listDocuments
Returns a paginated list of your documents, optionally filtered by folder (folderId) and/or owner (userIdorscope). The response is a{data, nextCursor}envelope; passnextCursorback asstartFromto fetch the next page. Requires thedocuments:rscope. -
listDocuments
Returns a paginated list of your documents, optionally filtered by folder (folderId) and/or owner (userIdorscope). The response is a{data, nextCursor}envelope; passnextCursorback asstartFromto fetch the next page. Requires thedocuments:rscope. -
listDocuments
Returns a paginated list of your documents, optionally filtered by folder (folderId) and/or owner (userIdorscope). The response is a{data, nextCursor}envelope; passnextCursorback asstartFromto fetch the next page. Requires thedocuments:rscope. -
ingestDocument
Creates a document from a raw text string and queues it for asynchronous indexing so it becomes searchable. Optionally supply anexternalIdto make the create idempotent — if a document with the sameexternalIdalready exists in your context, that existing document is returned unchanged instead of a duplicate being created. The response'screatedfield (and the HTTP status — 201 when created, 200 when an existing document was returned) tells the two apart. To overwrite an existing document's content instead of returning it unchanged, set?upsert=true(this also requires thedocuments:uscope). Requires thedocuments:cscope to create. Being returned the existing document on a collision is a read of that document's data and additionally requires thedocuments:rscope — a credential holdingdocuments:calone receives a400("already exists") on collision instead of the document. -
ingestDocument
Creates a document from a raw text string and queues it for asynchronous indexing so it becomes searchable. Optionally supply anexternalIdto make the create idempotent — if a document with the sameexternalIdalready exists in your context, that existing document is returned unchanged instead of a duplicate being created. The response'screatedfield (and the HTTP status — 201 when created, 200 when an existing document was returned) tells the two apart. To overwrite an existing document's content instead of returning it unchanged, set?upsert=true(this also requires thedocuments:uscope). Requires thedocuments:cscope to create. Being returned the existing document on a collision is a read of that document's data and additionally requires thedocuments:rscope — a credential holdingdocuments:calone receives a400("already exists") on collision instead of the document. -
ingestDocument
Creates a document from a raw text string and queues it for asynchronous indexing so it becomes searchable. Optionally supply anexternalIdto make the create idempotent — if a document with the sameexternalIdalready exists in your context, that existing document is returned unchanged instead of a duplicate being created. The response'screatedfield (and the HTTP status — 201 when created, 200 when an existing document was returned) tells the two apart. To overwrite an existing document's content instead of returning it unchanged, set?upsert=true(this also requires thedocuments:uscope). Requires thedocuments:cscope to create. Being returned the existing document on a collision is a read of that document's data and additionally requires thedocuments:rscope — a credential holdingdocuments:calone receives a400("already exists") on collision instead of the document. -
ingestDocument
public DocumentResponse ingestDocument(IngestDocumentRequest request, RequestOptions requestOptions) Creates a document from a raw text string and queues it for asynchronous indexing so it becomes searchable. Optionally supply anexternalIdto make the create idempotent — if a document with the sameexternalIdalready exists in your context, that existing document is returned unchanged instead of a duplicate being created. The response'screatedfield (and the HTTP status — 201 when created, 200 when an existing document was returned) tells the two apart. To overwrite an existing document's content instead of returning it unchanged, set?upsert=true(this also requires thedocuments:uscope). Requires thedocuments:cscope to create. Being returned the existing document on a collision is a read of that document's data and additionally requires thedocuments:rscope — a credential holdingdocuments:calone receives a400("already exists") on collision instead of the document. -
getDocument
Returns a single document by its ID, including its full structured payload. Requires thedocuments:rscope. -
getDocument
Returns a single document by its ID, including its full structured payload. Requires thedocuments:rscope. -
getDocument
Returns a single document by its ID, including its full structured payload. Requires thedocuments:rscope. -
getDocument
public DocumentResponse getDocument(String id, GetDocumentRequest request, RequestOptions requestOptions) Returns a single document by its ID, including its full structured payload. Requires thedocuments:rscope. -
updateDocument
Replaces the mutable fields of a document. This is a full replacement of the payload — to merge fields instead, use PATCH. If you supply newtext, the document body is re-ingested and re-queued for indexing. Requires thedocuments:uscope. -
updateDocument
public DocumentResponse updateDocument(String id, DocumentRequest body, RequestOptions requestOptions) Replaces the mutable fields of a document. This is a full replacement of the payload — to merge fields instead, use PATCH. If you supply newtext, the document body is re-ingested and re-queued for indexing. Requires thedocuments:uscope. -
updateDocument
Replaces the mutable fields of a document. This is a full replacement of the payload — to merge fields instead, use PATCH. If you supply newtext, the document body is re-ingested and re-queued for indexing. Requires thedocuments:uscope. -
updateDocument
public DocumentResponse updateDocument(String id, UpdateDocumentRequest request, RequestOptions requestOptions) Replaces the mutable fields of a document. This is a full replacement of the payload — to merge fields instead, use PATCH. If you supply newtext, the document body is re-ingested and re-queued for indexing. Requires thedocuments:uscope. -
deleteDocument
Permanently deletes the document and removes it from the search index. This cannot be undone. Requires thedocuments:dscope. -
deleteDocument
Permanently deletes the document and removes it from the search index. This cannot be undone. Requires thedocuments:dscope. -
deleteDocument
Permanently deletes the document and removes it from the search index. This cannot be undone. Requires thedocuments:dscope. -
deleteDocument
Permanently deletes the document and removes it from the search index. This cannot be undone. Requires thedocuments:dscope. -
patchDocument
Partially updates a document using an RFC 7386 JSON Merge Patch. Thepayloadobject is deep-merged: keys you send overwrite existing values (recursing into nested objects), a key set tonullis deleted, and keys you omit are preserved — unlike PUT, which replaces the whole payload. Top-level fields (title,folderId,schemaId, ownership) are set when present and left unchanged when omitted; sending a top-level field asnullis rejected. Supplyingtextre-ingests the document body (same as PUT).indexMode,externalId, andstoreText(text retention is fixed at ingest) are immutable and rejected if present. The merged result is validated against the bound schema. PassexpectedVersionfor optimistic concurrency (409 on conflict). Requires thedocuments:uscope. -
patchDocument
public DocumentResponse patchDocument(String id, PatchDocumentRequest request, RequestOptions requestOptions) Partially updates a document using an RFC 7386 JSON Merge Patch. Thepayloadobject is deep-merged: keys you send overwrite existing values (recursing into nested objects), a key set tonullis deleted, and keys you omit are preserved — unlike PUT, which replaces the whole payload. Top-level fields (title,folderId,schemaId, ownership) are set when present and left unchanged when omitted; sending a top-level field asnullis rejected. Supplyingtextre-ingests the document body (same as PUT).indexMode,externalId, andstoreText(text retention is fixed at ingest) are immutable and rejected if present. The merged result is validated against the bound schema. PassexpectedVersionfor optimistic concurrency (409 on conflict). Requires thedocuments:uscope. -
lookupDocuments
Finds documents of a given type by field value. Supported fields:externalId(the document's first-class external identifier — no schema declaration required) and any field declared as a lookup field on the bound schema. A lookup on a sensitive field is rejected here because the value would appear in the URL query string; use POST /v1/documents/lookup (the request-body variant) for a sensitive field instead.type's schema resolves with basedOn-aware shadowing: your ownuserId- orscope-owned variant if you have one, otherwise the shared base — for a scoped credential the owner is always your own token identity;userId/scopehere only apply as an explicit owner selector for a root API key. Results are paginated: setlimitfor the page size and feed the returnednextCursorback asstartFromto fetch the next page. The response is a{data, nextCursor}envelope. Requires thedocuments:rscope. -
lookupDocuments
public DocumentLookupPage lookupDocuments(LookupDocumentsRequest request, RequestOptions requestOptions) Finds documents of a given type by field value. Supported fields:externalId(the document's first-class external identifier — no schema declaration required) and any field declared as a lookup field on the bound schema. A lookup on a sensitive field is rejected here because the value would appear in the URL query string; use POST /v1/documents/lookup (the request-body variant) for a sensitive field instead.type's schema resolves with basedOn-aware shadowing: your ownuserId- orscope-owned variant if you have one, otherwise the shared base — for a scoped credential the owner is always your own token identity;userId/scopehere only apply as an explicit owner selector for a root API key. Results are paginated: setlimitfor the page size and feed the returnednextCursorback asstartFromto fetch the next page. The response is a{data, nextCursor}envelope. Requires thedocuments:rscope. -
lookupDocumentsByBody
Request-body equivalent of GET /v1/documents/lookup. Use this when looking up by a sensitive field: the value travels in the request body (and is blind-indexed server-side) instead of the URL query string, so it never lands in access, CDN, or proxy logs. The GET variant rejectsvaluefor a sensitive field and directs you here. Requires thedocuments:rscope. -
lookupDocumentsByBody
public DocumentLookupPage lookupDocumentsByBody(DocumentLookupRequest request, RequestOptions requestOptions) Request-body equivalent of GET /v1/documents/lookup. Use this when looking up by a sensitive field: the value travels in the request body (and is blind-indexed server-side) instead of the URL query string, so it never lands in access, CDN, or proxy logs. The GET variant rejectsvaluefor a sensitive field and directs you here. Requires thedocuments:rscope. -
getDocumentDownloadUrl
Returns a short-lived presigned S3 GET URL for the original uploaded file. Only available for file-backed documents (created via POST /v1/documents/upload); text-only documents return 400. Requires thedocuments:rscope. -
getDocumentDownloadUrl
Returns a short-lived presigned S3 GET URL for the original uploaded file. Only available for file-backed documents (created via POST /v1/documents/upload); text-only documents return 400. Requires thedocuments:rscope. -
getDocumentDownloadUrl
public DocumentDownloadResponse getDocumentDownloadUrl(String id, GetDocumentDownloadUrlRequest request) Returns a short-lived presigned S3 GET URL for the original uploaded file. Only available for file-backed documents (created via POST /v1/documents/upload); text-only documents return 400. Requires thedocuments:rscope. -
getDocumentDownloadUrl
public DocumentDownloadResponse getDocumentDownloadUrl(String id, GetDocumentDownloadUrlRequest request, RequestOptions requestOptions) Returns a short-lived presigned S3 GET URL for the original uploaded file. Only available for file-backed documents (created via POST /v1/documents/upload); text-only documents return 400. Requires thedocuments:rscope. -
getDocumentText
Returns the document's full text body when it is retained: always available for text-ingested documents, and for file-uploaded documents unless they were uploaded withstoreText=false(which discards the extracted text once indexing completes — the original file remains available viaGET /{id}/download). Returns 404 when the document does not exist, its text was not retained, or extraction has not yet completed. Requires thedocuments:rscope. -
getDocumentText
Returns the document's full text body when it is retained: always available for text-ingested documents, and for file-uploaded documents unless they were uploaded withstoreText=false(which discards the extracted text once indexing completes — the original file remains available viaGET /{id}/download). Returns 404 when the document does not exist, its text was not retained, or extraction has not yet completed. Requires thedocuments:rscope. -
getDocumentText
Returns the document's full text body when it is retained: always available for text-ingested documents, and for file-uploaded documents unless they were uploaded withstoreText=false(which discards the extracted text once indexing completes — the original file remains available viaGET /{id}/download). Returns 404 when the document does not exist, its text was not retained, or extraction has not yet completed. Requires thedocuments:rscope. -
getDocumentText
public DocumentTextResponse getDocumentText(String id, GetDocumentTextRequest request, RequestOptions requestOptions) Returns the document's full text body when it is retained: always available for text-ingested documents, and for file-uploaded documents unless they were uploaded withstoreText=false(which discards the extracted text once indexing completes — the original file remains available viaGET /{id}/download). Returns 404 when the document does not exist, its text was not retained, or extraction has not yet completed. Requires thedocuments:rscope. -
getDocumentVersions
Returns the audit trail of changes (CREATE, UPDATE, DELETE) for a document. History is recorded only for documents bound to a schema that has audit history enabled (the default for typed documents); untyped documents have no version history. The response is a{data, nextCursor}envelope. Requires thedocuments:rscope. -
getDocumentVersions
Returns the audit trail of changes (CREATE, UPDATE, DELETE) for a document. History is recorded only for documents bound to a schema that has audit history enabled (the default for typed documents); untyped documents have no version history. The response is a{data, nextCursor}envelope. Requires thedocuments:rscope. -
getDocumentVersions
Returns the audit trail of changes (CREATE, UPDATE, DELETE) for a document. History is recorded only for documents bound to a schema that has audit history enabled (the default for typed documents); untyped documents have no version history. The response is a{data, nextCursor}envelope. Requires thedocuments:rscope. -
getDocumentVersions
public ModelDataVersionPage getDocumentVersions(String id, GetDocumentVersionsRequest request, RequestOptions requestOptions) Returns the audit trail of changes (CREATE, UPDATE, DELETE) for a document. History is recorded only for documents bound to a schema that has audit history enabled (the default for typed documents); untyped documents have no version history. The response is a{data, nextCursor}envelope. Requires thedocuments:rscope. -
uploadDocument
Starts a file-based document by returning a short-lived presigned S3 PUT URL. Upload the file bytes directly touploadUrl; the document is then automatically queued for text extraction and asynchronous indexing. Supplying anexternalIdmakes this idempotent — re-initiating an upload with the sameexternalIdre-issues a fresh presigned URL to the SAME existing document/object (so a re-upload inherently replaces the file body) rather than creating a duplicate. The response'screatedfield (and the HTTP status — 201 when a new document was minted, 200 when an existing one was matched) tells the two apart. With?upsert=true, the submittedpayload/titleare also applied to the matched document (file-body divergence cannot be diffed at upload-init — the bytes have not arrived yet — so the re-upload itself replaces the body). Creating a NEW document requires thedocuments:cscope. Re-uploading over an EXISTING document overwrites (and re-indexes) its body, so it is an update: it requires thedocuments:uscope (as does?upsert=truefor the metadata). -
uploadDocument
Starts a file-based document by returning a short-lived presigned S3 PUT URL. Upload the file bytes directly touploadUrl; the document is then automatically queued for text extraction and asynchronous indexing. Supplying anexternalIdmakes this idempotent — re-initiating an upload with the sameexternalIdre-issues a fresh presigned URL to the SAME existing document/object (so a re-upload inherently replaces the file body) rather than creating a duplicate. The response'screatedfield (and the HTTP status — 201 when a new document was minted, 200 when an existing one was matched) tells the two apart. With?upsert=true, the submittedpayload/titleare also applied to the matched document (file-body divergence cannot be diffed at upload-init — the bytes have not arrived yet — so the re-upload itself replaces the body). Creating a NEW document requires thedocuments:cscope. Re-uploading over an EXISTING document overwrites (and re-indexes) its body, so it is an update: it requires thedocuments:uscope (as does?upsert=truefor the metadata).
-