diff --git a/.codegen.json b/.codegen.json index adb99165..793bb74b 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "d55532c", "specHash": "c5a35a6", "version": "10.17.1" } +{ "engineHash": "d55532c", "specHash": "e21eebc", "version": "10.17.1" } diff --git a/box_sdk_gen/managers/chunked_uploads.py b/box_sdk_gen/managers/chunked_uploads.py index 8cedb017..5c91b861 100644 --- a/box_sdk_gen/managers/chunked_uploads.py +++ b/box_sdk_gen/managers/chunked_uploads.py @@ -304,15 +304,18 @@ def upload_file_part_by_url( :type request_body: ByteStream :param digest: The [RFC3230][1] message digest of the chunk uploaded. - Only SHA1 is supported. The SHA1 digest must be base64 + `SHA-1` and `SHA-512` ([RFC5843][2]) are supported. The digest must be base64 encoded. The format of this header is as - `sha=BASE64_ENCODED_DIGEST`. + `sha=BASE64_ENCODED_DIGEST` for `SHA-1`, or + `sha-512=BASE64_ENCODED_DIGEST` for `SHA-512`. - To get the value for the `SHA` digest, use the + To get the value for the digest, use the openSSL command to encode the file part: - `openssl sha1 -binary | base64`. + `openssl sha1 -binary | base64` for `SHA-1`, or + `openssl sha512 -binary | base64` for `SHA-512`. [1]: https://tools.ietf.org/html/rfc3230 + [2]: https://tools.ietf.org/html/rfc5843 :type digest: str :param content_range: The byte range of the chunk. @@ -378,15 +381,18 @@ def upload_file_part( :type request_body: ByteStream :param digest: The [RFC3230][1] message digest of the chunk uploaded. - Only SHA1 is supported. The SHA1 digest must be base64 + `SHA-1` and `SHA-512` ([RFC5843][2]) are supported. The digest must be base64 encoded. The format of this header is as - `sha=BASE64_ENCODED_DIGEST`. + `sha=BASE64_ENCODED_DIGEST` for `SHA-1`, or + `sha-512=BASE64_ENCODED_DIGEST` for `SHA-512`. - To get the value for the `SHA` digest, use the + To get the value for the digest, use the openSSL command to encode the file part: - `openssl sha1 -binary | base64`. + `openssl sha1 -binary | base64` for `SHA-1`, or + `openssl sha512 -binary | base64` for `SHA-512`. [1]: https://tools.ietf.org/html/rfc3230 + [2]: https://tools.ietf.org/html/rfc5843 :type digest: str :param content_range: The byte range of the chunk. @@ -650,10 +656,10 @@ def create_file_upload_session_plan_by_url( have already been uploaded (cache hits) and only uploading missing parts. - The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions) + The actual endpoint URL is returned by the [`Create upload session`](https://developer.box.com/reference/post-files-upload-sessions) - and [`Get upload session`](e://get-files-upload-sessions-id) endpoints. + and [`Get upload session`](https://developer.box.com/reference/get-files-upload-sessions-id) endpoints. :param url: URL of createFileUploadSessionPlan method :type url: str @@ -696,10 +702,10 @@ def create_file_upload_session_plan( have already been uploaded (cache hits) and only uploading missing parts. - The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions) + The actual endpoint URL is returned by the [`Create upload session`](https://developer.box.com/reference/post-files-upload-sessions) - and [`Get upload session`](e://get-files-upload-sessions-id) endpoints. + and [`Get upload session`](https://developer.box.com/reference/get-files-upload-sessions-id) endpoints. :param upload_session_id: The ID of the upload session. Example: "D5E3F7A" @@ -761,6 +767,17 @@ def create_file_upload_session_commit_by_url( :param url: URL of createFileUploadSessionCommit method :type url: str :param parts: The list details for the uploaded parts. + + Each entry can include `sha1` or `sha512`. Include `sha512` + on every entry or on none of them. A request where only + some entries include `sha512` is rejected. + + Include parts that the server already has, returned as + `hits` by the [`Plan upload session`](https://developer.box.com/reference/post-files-upload-sessions-id-plan) + endpoint. Use the `part_id`, `offset`, and `size` from the + plan response. If the other entries include `sha512`, + include the `sha512` value from the plan response. + Otherwise, leave the hash out of these entries. :type parts: List[UploadPart] :param digest: The [RFC3230][1] message digest of the whole file. @@ -768,6 +785,9 @@ def create_file_upload_session_commit_by_url( encoded. The format of this header is as `sha=BASE64_ENCODED_DIGEST`. + `SHA-512` is not supported for the whole-file digest, even if + the parts were uploaded with `SHA-512` digests. + [1]: https://tools.ietf.org/html/rfc3230 :type digest: str :param if_match: Ensures this item hasn't recently changed before @@ -837,6 +857,17 @@ def create_file_upload_session_commit( Example: "D5E3F7A" :type upload_session_id: str :param parts: The list details for the uploaded parts. + + Each entry can include `sha1` or `sha512`. Include `sha512` + on every entry or on none of them. A request where only + some entries include `sha512` is rejected. + + Include parts that the server already has, returned as + `hits` by the [`Plan upload session`](https://developer.box.com/reference/post-files-upload-sessions-id-plan) + endpoint. Use the `part_id`, `offset`, and `size` from the + plan response. If the other entries include `sha512`, + include the `sha512` value from the plan response. + Otherwise, leave the hash out of these entries. :type parts: List[UploadPart] :param digest: The [RFC3230][1] message digest of the whole file. @@ -844,6 +875,9 @@ def create_file_upload_session_commit( encoded. The format of this header is as `sha=BASE64_ENCODED_DIGEST`. + `SHA-512` is not supported for the whole-file digest, even if + the parts were uploaded with `SHA-512` digests. + [1]: https://tools.ietf.org/html/rfc3230 :type digest: str :param if_match: Ensures this item hasn't recently changed before diff --git a/box_sdk_gen/managers/query.py b/box_sdk_gen/managers/query.py index 0fc7ae27..5ea684b2 100644 --- a/box_sdk_gen/managers/query.py +++ b/box_sdk_gen/managers/query.py @@ -154,12 +154,51 @@ def create_query_v2026_r0( extra_headers: Optional[Dict[str, Optional[str]]] = None ) -> QueryResultsV2026R0: """ - Runs a query to discover Box items using a logical predicate that can filter + Runs a query to discover Box items using a logical predicate, similar to a SQL - across item fields and metadata templates. Results can be sorted, paginated, + WHERE clause. The predicate can filter across multiple metadata templates and - and shaped to include additional item or metadata fields. + item fields in a single request. Results can be sorted, paginated with markers, + + + and shaped with fields so each entry includes additional item or metadata + + + attributes. + + + This is the item-retrieval endpoint in the Query API (version 2026.0). Unlike + + + the [Metadata Query API](https://developer.box.com/reference/post-metadata-queries-execute-read), + + + it is not limited to a single metadata template or to files and folders. For + + + totals and grouped metrics over the same predicates, use + + + [Query Insights](https://developer.box.com/reference/v2026.0/post-query-insights) + + + instead of paging through every matching item. + + + For predicate syntax, parameters, examples, pagination behavior, and error + + + codes, see the + + + [Box Query guide](https://developer.box.com/guides/query/box-query). For shared + + + response schemas, including Query results and result entries, see + + + [Query resources](https://developer.box.com/reference/v2026.0/query-resources). :param query: The query definition, including the filtering predicate and its optional parameters and ancestor restrictions. diff --git a/box_sdk_gen/managers/search.py b/box_sdk_gen/managers/search.py index 6dbef299..c24c9ae8 100644 --- a/box_sdk_gen/managers/search.py +++ b/box_sdk_gen/managers/search.py @@ -144,8 +144,17 @@ def search_by_metadata_query( extra_headers: Optional[Dict[str, Optional[str]]] = None ) -> MetadataQueryResults: """ + For new integrations, use the [v2026.0 Query API](https://developer.box.com/reference/v2026.0/query-resources). + + This is the latest version of the Query API, with advanced capabilities including multi-template queries and + + + Query Insights, and is the API we will continue to enhance with new Query capabilities. + + Create a search using SQL-like syntax to return items that match specific + metadata. diff --git a/box_sdk_gen/schemas/client_error.py b/box_sdk_gen/schemas/client_error.py index fce9bae1..24840505 100644 --- a/box_sdk_gen/schemas/client_error.py +++ b/box_sdk_gen/schemas/client_error.py @@ -26,6 +26,7 @@ class ClientErrorCodeField(str, Enum): METHOD_NOT_ALLOWED = 'method_not_allowed' CONFLICT = 'conflict' PRECONDITION_FAILED = 'precondition_failed' + UNPROCESSABLE_ENTITY = 'unprocessable_entity' TOO_MANY_REQUESTS = 'too_many_requests' INTERNAL_SERVER_ERROR = 'internal_server_error' UNAVAILABLE = 'unavailable' diff --git a/box_sdk_gen/schemas/upload_part.py b/box_sdk_gen/schemas/upload_part.py index b9bef8b1..1444de79 100644 --- a/box_sdk_gen/schemas/upload_part.py +++ b/box_sdk_gen/schemas/upload_part.py @@ -10,10 +10,12 @@ class UploadPart(UploadPartMini): _fields_to_json_mapping: Dict[str, str] = { 'sha_1': 'sha1', + 'sha_512': 'sha512', **UploadPartMini._fields_to_json_mapping, } _json_to_fields_mapping: Dict[str, str] = { 'sha1': 'sha_1', + 'sha512': 'sha_512', **UploadPartMini._json_to_fields_mapping, } @@ -21,6 +23,7 @@ def __init__( self, *, sha_1: Optional[str] = None, + sha_512: Optional[str] = None, part_id: Optional[str] = None, offset: Optional[int] = None, size: Optional[int] = None, @@ -29,6 +32,9 @@ def __init__( """ :param sha_1: The SHA1 hash of the chunk., defaults to None :type sha_1: Optional[str], optional + :param sha_512: The `SHA-512` hash of the chunk, as a hex string + of 128 lower case characters., defaults to None + :type sha_512: Optional[str], optional :param part_id: The unique ID of the chunk., defaults to None :type part_id: Optional[str], optional :param offset: The offset of the chunk within the file @@ -40,3 +46,4 @@ def __init__( """ super().__init__(part_id=part_id, offset=offset, size=size, **kwargs) self.sha_1 = sha_1 + self.sha_512 = sha_512 diff --git a/box_sdk_gen/schemas/upload_part_plan.py b/box_sdk_gen/schemas/upload_part_plan.py index 18e88bb2..0c2f3923 100644 --- a/box_sdk_gen/schemas/upload_part_plan.py +++ b/box_sdk_gen/schemas/upload_part_plan.py @@ -23,7 +23,8 @@ def __init__(self, offset: int, size: int, sha_512: str, **kwargs): :type offset: int :param size: The size of the chunk in bytes. :type size: int - :param sha_512: The `SHA-512` hash of the chunk. + :param sha_512: The `SHA-512` hash of the chunk, as a hex string + of 128 lower case characters. :type sha_512: str """ super().__init__(**kwargs) diff --git a/box_sdk_gen/schemas/upload_part_plan_hit.py b/box_sdk_gen/schemas/upload_part_plan_hit.py index 83c28d78..2dda6738 100644 --- a/box_sdk_gen/schemas/upload_part_plan_hit.py +++ b/box_sdk_gen/schemas/upload_part_plan_hit.py @@ -23,7 +23,8 @@ def __init__(self, offset: int, size: int, sha_512: str, part_id: str, **kwargs) :type offset: int :param size: The size of the chunk in bytes. :type size: int - :param sha_512: The `SHA-512` hash of the chunk. + :param sha_512: The `SHA-512` hash of the chunk, as a hex string + of 128 lower case characters. :type sha_512: str :param part_id: The unique ID of the chunk. :type part_id: str diff --git a/box_sdk_gen/schemas/v2025_r0/doc_gen_document_generation_data_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/doc_gen_document_generation_data_v2025_r0.py index b7a70a2a..dd7a19b6 100644 --- a/box_sdk_gen/schemas/v2025_r0/doc_gen_document_generation_data_v2025_r0.py +++ b/box_sdk_gen/schemas/v2025_r0/doc_gen_document_generation_data_v2025_r0.py @@ -1,16 +1,31 @@ from typing import Dict +from typing import Optional + from box_sdk_gen.internal.base_object import BaseObject from box_sdk_gen.box.errors import BoxSDKError class DocGenDocumentGenerationDataV2025R0(BaseObject): - def __init__(self, generated_file_name: str, user_input: Dict, **kwargs): + def __init__( + self, + generated_file_name: str, + user_input: Dict, + *, + external_id: Optional[str] = None, + **kwargs + ): """ - :param generated_file_name: File name of the output file. - :type generated_file_name: str + :param generated_file_name: File name of the output file. + :type generated_file_name: str + :param external_id: An optional identifier supplied by the caller for this Box Doc Gen job. + The value is returned on job responses for correlation only. It is not + a Box resource ID, is not required to be unique, and cannot be used to + look up the job., defaults to None + :type external_id: Optional[str], optional """ super().__init__(**kwargs) self.generated_file_name = generated_file_name self.user_input = user_input + self.external_id = external_id diff --git a/box_sdk_gen/schemas/v2025_r0/doc_gen_job_full_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/doc_gen_job_full_v2025_r0.py index 2e4eec56..f9acc2a7 100644 --- a/box_sdk_gen/schemas/v2025_r0/doc_gen_job_full_v2025_r0.py +++ b/box_sdk_gen/schemas/v2025_r0/doc_gen_job_full_v2025_r0.py @@ -51,6 +51,7 @@ def __init__( id: str, *, created_at: Optional[str] = None, + external_id: Optional[str] = None, output_file: Optional[FileReferenceV2025R0] = None, output_file_version: Optional[FileVersionBaseV2025R0] = None, failures: Optional[DocGenJobV2025R0FailuresField] = None, @@ -58,20 +59,25 @@ def __init__( **kwargs ): """ - :param source: Source of the request. - :type source: str - :param status: Status of the job. - :type status: DocGenJobV2025R0StatusField - :param output_type: Type of the generated file. - :type output_type: str - :param id: The unique identifier that represent a Box Doc Gen job. - :type id: str - :param created_at: Time of job creation., defaults to None - :type created_at: Optional[str], optional - :param failures: Errors and warnings that occurred during document generation., defaults to None - :type failures: Optional[DocGenJobV2025R0FailuresField], optional - :param type: The value will always be `docgen_job`., defaults to DocGenJobBaseV2025R0TypeField.DOCGEN_JOB - :type type: DocGenJobBaseV2025R0TypeField, optional + :param source: Source of the request. + :type source: str + :param status: Status of the job. + :type status: DocGenJobV2025R0StatusField + :param output_type: Type of the generated file. + :type output_type: str + :param id: The unique identifier that represent a Box Doc Gen job. + :type id: str + :param created_at: Time of job creation., defaults to None + :type created_at: Optional[str], optional + :param external_id: An optional identifier supplied by the caller when the Box Doc Gen + job was created. Returned for correlation only. It is not a Box + resource ID, is not required to be unique, and cannot be used to + look up the job., defaults to None + :type external_id: Optional[str], optional + :param failures: Errors and warnings that occurred during document generation., defaults to None + :type failures: Optional[DocGenJobV2025R0FailuresField], optional + :param type: The value will always be `docgen_job`., defaults to DocGenJobBaseV2025R0TypeField.DOCGEN_JOB + :type type: DocGenJobBaseV2025R0TypeField, optional """ super().__init__( batch=batch, @@ -80,6 +86,7 @@ def __init__( status=status, output_type=output_type, id=id, + external_id=external_id, output_file=output_file, output_file_version=output_file_version, failures=failures, diff --git a/box_sdk_gen/schemas/v2025_r0/doc_gen_job_v2025_r0.py b/box_sdk_gen/schemas/v2025_r0/doc_gen_job_v2025_r0.py index 0ea76f6f..8954ca38 100644 --- a/box_sdk_gen/schemas/v2025_r0/doc_gen_job_v2025_r0.py +++ b/box_sdk_gen/schemas/v2025_r0/doc_gen_job_v2025_r0.py @@ -58,6 +58,7 @@ def __init__( output_type: str, id: str, *, + external_id: Optional[str] = None, output_file: Optional[FileReferenceV2025R0] = None, output_file_version: Optional[FileVersionBaseV2025R0] = None, failures: Optional[DocGenJobV2025R0FailuresField] = None, @@ -65,16 +66,21 @@ def __init__( **kwargs ): """ - :param status: Status of the job. - :type status: DocGenJobV2025R0StatusField - :param output_type: Type of the generated file. - :type output_type: str - :param id: The unique identifier that represent a Box Doc Gen job. - :type id: str - :param failures: Errors and warnings that occurred during document generation., defaults to None - :type failures: Optional[DocGenJobV2025R0FailuresField], optional - :param type: The value will always be `docgen_job`., defaults to DocGenJobBaseV2025R0TypeField.DOCGEN_JOB - :type type: DocGenJobBaseV2025R0TypeField, optional + :param status: Status of the job. + :type status: DocGenJobV2025R0StatusField + :param output_type: Type of the generated file. + :type output_type: str + :param id: The unique identifier that represent a Box Doc Gen job. + :type id: str + :param external_id: An optional identifier supplied by the caller when the Box Doc Gen + job was created. Returned for correlation only. It is not a Box + resource ID, is not required to be unique, and cannot be used to + look up the job., defaults to None + :type external_id: Optional[str], optional + :param failures: Errors and warnings that occurred during document generation., defaults to None + :type failures: Optional[DocGenJobV2025R0FailuresField], optional + :param type: The value will always be `docgen_job`., defaults to DocGenJobBaseV2025R0TypeField.DOCGEN_JOB + :type type: DocGenJobBaseV2025R0TypeField, optional """ super().__init__(id=id, type=type, **kwargs) self.batch = batch @@ -82,6 +88,7 @@ def __init__( self.template_file_version = template_file_version self.status = status self.output_type = output_type + self.external_id = external_id self.output_file = output_file self.output_file_version = output_file_version self.failures = failures diff --git a/docs/chunked_uploads.md b/docs/chunked_uploads.md index c515bd3b..1feee3c8 100644 --- a/docs/chunked_uploads.md +++ b/docs/chunked_uploads.md @@ -177,7 +177,7 @@ client.chunked_uploads.upload_file_part_by_url( - request_body `ByteStream` - Request body of uploadFilePart method - digest `str` - - The [RFC3230][1] message digest of the chunk uploaded. Only SHA1 is supported. The SHA1 digest must be base64 encoded. The format of this header is as `sha=BASE64_ENCODED_DIGEST`. To get the value for the `SHA` digest, use the openSSL command to encode the file part: `openssl sha1 -binary | base64`. [1]: https://tools.ietf.org/html/rfc3230 + - The [RFC3230][1] message digest of the chunk uploaded. `SHA-1` and `SHA-512` ([RFC5843][2]) are supported. The digest must be base64 encoded. The format of this header is as `sha=BASE64_ENCODED_DIGEST` for `SHA-1`, or `sha-512=BASE64_ENCODED_DIGEST` for `SHA-512`. To get the value for the digest, use the openSSL command to encode the file part: `openssl sha1 -binary | base64` for `SHA-1`, or `openssl sha512 -binary | base64` for `SHA-512`. [1]: https://tools.ietf.org/html/rfc3230 [2]: https://tools.ietf.org/html/rfc5843 - content_range `str` - The byte range of the chunk. Must not overlap with the range of a part already uploaded this session. Each part’s size must be exactly equal in size to the part size specified in the upload session that you created. One exception is the last part of the file, as this can be smaller. When providing the value for `content-range`, remember that: * The lower bound of each part's byte range must be a multiple of the part size. * The higher bound must be a multiple of the part size - 1. - extra_headers `Optional[Dict[str, Optional[str]]]` @@ -189,6 +189,9 @@ This function returns a value of type `UploadedPart`. Chunk has been uploaded successfully. +The response always includes `sha512`. It also includes +`sha1` if the `Digest` header used `SHA-1`. + ## Upload part of file Uploads a chunk of a file for an upload session. @@ -219,7 +222,7 @@ client.chunked_uploads.upload_file_part( - request_body `ByteStream` - Request body of uploadFilePart method - digest `str` - - The [RFC3230][1] message digest of the chunk uploaded. Only SHA1 is supported. The SHA1 digest must be base64 encoded. The format of this header is as `sha=BASE64_ENCODED_DIGEST`. To get the value for the `SHA` digest, use the openSSL command to encode the file part: `openssl sha1 -binary | base64`. [1]: https://tools.ietf.org/html/rfc3230 + - The [RFC3230][1] message digest of the chunk uploaded. `SHA-1` and `SHA-512` ([RFC5843][2]) are supported. The digest must be base64 encoded. The format of this header is as `sha=BASE64_ENCODED_DIGEST` for `SHA-1`, or `sha-512=BASE64_ENCODED_DIGEST` for `SHA-512`. To get the value for the digest, use the openSSL command to encode the file part: `openssl sha1 -binary | base64` for `SHA-1`, or `openssl sha512 -binary | base64` for `SHA-512`. [1]: https://tools.ietf.org/html/rfc3230 [2]: https://tools.ietf.org/html/rfc5843 - content_range `str` - The byte range of the chunk. Must not overlap with the range of a part already uploaded this session. Each part’s size must be exactly equal in size to the part size specified in the upload session that you created. One exception is the last part of the file, as this can be smaller. When providing the value for `content-range`, remember that: * The lower bound of each part's byte range must be a multiple of the part size. * The higher bound must be a multiple of the part size - 1. - extra_headers `Optional[Dict[str, Optional[str]]]` @@ -231,6 +234,9 @@ This function returns a value of type `UploadedPart`. Chunk has been uploaded successfully. +The response always includes `sha512`. It also includes +`sha1` if the `Digest` header used `SHA-1`. + ## Remove upload session by URL Abort an upload session and discard all data uploaded. @@ -334,6 +340,9 @@ This function returns a value of type `UploadParts`. Returns a list of parts that have been uploaded. +Each part includes the hash type used to upload it. Parts +uploaded with a `SHA-512` `Digest` header don't include `sha1`. + ## List parts Return a list of the chunks uploaded to the upload session so far. @@ -369,14 +378,17 @@ This function returns a value of type `UploadParts`. Returns a list of parts that have been uploaded. +Each part includes the hash type used to upload it. Parts +uploaded with a `SHA-512` `Digest` header don't include `sha1`. + ## Plan upload session by URL Plan an upload session by checking which parts already exist on the server. This endpoint allows clients to optimize uploads by skipping parts that have already been uploaded (cache hits) and only uploading missing parts. -The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions) -and [`Get upload session`](e://get-files-upload-sessions-id) endpoints. +The actual endpoint URL is returned by the [`Create upload session`](https://developer.box.com/reference/post-files-upload-sessions) +and [`Get upload session`](https://developer.box.com/reference/get-files-upload-sessions-id) endpoints. This operation is performed by calling function `create_file_upload_session_plan_by_url`. @@ -411,8 +423,8 @@ Plan an upload session by checking which parts already exist on the server. This endpoint allows clients to optimize uploads by skipping parts that have already been uploaded (cache hits) and only uploading missing parts. -The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions) -and [`Get upload session`](e://get-files-upload-sessions-id) endpoints. +The actual endpoint URL is returned by the [`Create upload session`](https://developer.box.com/reference/post-files-upload-sessions) +and [`Get upload session`](https://developer.box.com/reference/get-files-upload-sessions-id) endpoints. This operation is performed by calling function `create_file_upload_session_plan`. @@ -462,9 +474,9 @@ client.chunked_uploads.create_file_upload_session_commit_by_url( - url `str` - URL of createFileUploadSessionCommit method - parts `List[UploadPart]` - - The list details for the uploaded parts. + - The list details for the uploaded parts. Each entry can include `sha1` or `sha512`. Include `sha512` on every entry or on none of them. A request where only some entries include `sha512` is rejected. Include parts that the server already has, returned as `hits` by the [`Plan upload session`](https://developer.box.com/reference/post-files-upload-sessions-id-plan) endpoint. Use the `part_id`, `offset`, and `size` from the plan response. If the other entries include `sha512`, include the `sha512` value from the plan response. Otherwise, leave the hash out of these entries. - digest `str` - - The [RFC3230][1] message digest of the whole file. Only SHA1 is supported. The SHA1 digest must be Base64 encoded. The format of this header is as `sha=BASE64_ENCODED_DIGEST`. [1]: https://tools.ietf.org/html/rfc3230 + - The [RFC3230][1] message digest of the whole file. Only SHA1 is supported. The SHA1 digest must be Base64 encoded. The format of this header is as `sha=BASE64_ENCODED_DIGEST`. `SHA-512` is not supported for the whole-file digest, even if the parts were uploaded with `SHA-512` digests. [1]: https://tools.ietf.org/html/rfc3230 - if_match `Optional[str]` - Ensures this item hasn't recently changed before making changes. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `412 Precondition Failed` if it has changed since. - if_none_match `Optional[str]` @@ -507,9 +519,9 @@ client.chunked_uploads.create_file_upload_session_commit( - upload_session_id `str` - The ID of the upload session. Example: "D5E3F7A" - parts `List[UploadPart]` - - The list details for the uploaded parts. + - The list details for the uploaded parts. Each entry can include `sha1` or `sha512`. Include `sha512` on every entry or on none of them. A request where only some entries include `sha512` is rejected. Include parts that the server already has, returned as `hits` by the [`Plan upload session`](https://developer.box.com/reference/post-files-upload-sessions-id-plan) endpoint. Use the `part_id`, `offset`, and `size` from the plan response. If the other entries include `sha512`, include the `sha512` value from the plan response. Otherwise, leave the hash out of these entries. - digest `str` - - The [RFC3230][1] message digest of the whole file. Only SHA1 is supported. The SHA1 digest must be Base64 encoded. The format of this header is as `sha=BASE64_ENCODED_DIGEST`. [1]: https://tools.ietf.org/html/rfc3230 + - The [RFC3230][1] message digest of the whole file. Only SHA1 is supported. The SHA1 digest must be Base64 encoded. The format of this header is as `sha=BASE64_ENCODED_DIGEST`. `SHA-512` is not supported for the whole-file digest, even if the parts were uploaded with `SHA-512` digests. [1]: https://tools.ietf.org/html/rfc3230 - if_match `Optional[str]` - Ensures this item hasn't recently changed before making changes. Pass in the item's last observed `etag` value into this header and the endpoint will fail with a `412 Precondition Failed` if it has changed since. - if_none_match `Optional[str]` diff --git a/docs/query.md b/docs/query.md index 00faa1e8..b3000020 100644 --- a/docs/query.md +++ b/docs/query.md @@ -1,13 +1,28 @@ # QueryManager -- [Query for Box items](#query-for-box-items) +- [Box Query](#box-query) - [Create insights for Box items](#create-insights-for-box-items) -## Query for Box items - -Runs a query to discover Box items using a logical predicate that can filter -across item fields and metadata templates. Results can be sorted, paginated, -and shaped to include additional item or metadata fields. +## Box Query + +Runs a query to discover Box items using a logical predicate, similar to a SQL +WHERE clause. The predicate can filter across multiple metadata templates and +item fields in a single request. Results can be sorted, paginated with markers, +and shaped with fields so each entry includes additional item or metadata +attributes. + +This is the item-retrieval endpoint in the Query API (version 2026.0). Unlike +the [Metadata Query API](https://developer.box.com/reference/post-metadata-queries-execute-read), +it is not limited to a single metadata template or to files and folders. For +totals and grouped metrics over the same predicates, use +[Query Insights](https://developer.box.com/reference/v2026.0/post-query-insights) +instead of paging through every matching item. + +For predicate syntax, parameters, examples, pagination behavior, and error +codes, see the +[Box Query guide](https://developer.box.com/guides/query/box-query). For shared +response schemas, including Query results and result entries, see +[Query resources](https://developer.box.com/reference/v2026.0/query-resources). This operation is performed by calling function `create_query_v2026_r0`. diff --git a/docs/search.md b/docs/search.md index 9e0012a4..a199c2f1 100644 --- a/docs/search.md +++ b/docs/search.md @@ -5,6 +5,10 @@ ## Query files/folders by metadata +For new integrations, use the [v2026.0 Query API](https://developer.box.com/reference/v2026.0/query-resources). +This is the latest version of the Query API, with advanced capabilities including multi-template queries and +Query Insights, and is the API we will continue to enhance with new Query capabilities. + Create a search using SQL-like syntax to return items that match specific metadata. diff --git a/test/ai.py b/test/ai.py index 9ee311df..37b151ad 100644 --- a/test/ai.py +++ b/test/ai.py @@ -230,9 +230,7 @@ def testAIExtract(): [AiItemBase(id=file.id)], ai_agent=ai_extract_agent_basic_text_config, ) - expected_response: str = ( - '{"firstName": "John", "lastName": "Doe", "location": "San Francisco", "yearOfBirth": "1990", "company": "Box"}' - ) + expected_response: str = '{"firstName": "John", "lastName": "Doe", "location": "San Francisco", "yearOfBirth": "1990", "company": "Box"}' assert response.answer == expected_response assert response.completion_reason == 'done' client.files.delete_file_by_id(file.id) diff --git a/test/webhooks.py b/test/webhooks.py index 632eda6a..1ca3e0be 100644 --- a/test/webhooks.py +++ b/test/webhooks.py @@ -73,24 +73,12 @@ def testWebhookValidation(): primary_key: str = 'SamplePrimaryKey' secondary_key: str = 'SampleSecondaryKey' incorrect_key: str = 'IncorrectKey' - body: str = ( - '{"type":"webhook_event","webhook":{"id":"1234567890"},"trigger":"FILE.UPLOADED","source":{"id":"1234567890","type":"file","name":"Test.txt"}}' - ) - body_with_japanese: str = ( - '{"webhook":{"id":"1234567890"},"trigger":"FILE.UPLOADED","source":{"id":"1234567890","type":"file","name":"スクリーンショット 2020-08-05.txt"}}' - ) - body_with_emoji: str = ( - '{"webhook":{"id":"1234567890"},"trigger":"FILE.UPLOADED","source":{"id":"1234567890","type":"file","name":"😀 2020-08-05.txt"}}' - ) - body_with_carriage_return: str = ( - '{"webhook":{"id":"1234567890"},"trigger":"FILE.UPLOADED","source":{"id":"1234567890","type":"file","name":"test \r"}}' - ) - body_with_forward_slash: str = ( - '{"webhook":{"id":"1234567890"},"trigger":"FILE.UPLOADED","source":{"id":"1234567890","type":"file","name":"\/"}}' - ) - body_with_back_slash: str = ( - '{"webhook":{"id":"1234567890"},"trigger":"FILE.UPLOADED","source":{"id":"1234567890","type":"file","name":"\\"}}' - ) + body: str = '{"type":"webhook_event","webhook":{"id":"1234567890"},"trigger":"FILE.UPLOADED","source":{"id":"1234567890","type":"file","name":"Test.txt"}}' + body_with_japanese: str = '{"webhook":{"id":"1234567890"},"trigger":"FILE.UPLOADED","source":{"id":"1234567890","type":"file","name":"スクリーンショット 2020-08-05.txt"}}' + body_with_emoji: str = '{"webhook":{"id":"1234567890"},"trigger":"FILE.UPLOADED","source":{"id":"1234567890","type":"file","name":"😀 2020-08-05.txt"}}' + body_with_carriage_return: str = '{"webhook":{"id":"1234567890"},"trigger":"FILE.UPLOADED","source":{"id":"1234567890","type":"file","name":"test \r"}}' + body_with_forward_slash: str = '{"webhook":{"id":"1234567890"},"trigger":"FILE.UPLOADED","source":{"id":"1234567890","type":"file","name":"\/"}}' + body_with_back_slash: str = '{"webhook":{"id":"1234567890"},"trigger":"FILE.UPLOADED","source":{"id":"1234567890","type":"file","name":"\\"}}' headers: Dict[str, str] = { 'box-delivery-id': 'f96bb54b-ee16-4fc5-aa65-8c2d9e5b546f', 'box-delivery-timestamp': '2020-01-01T00:00:00-07:00',