java/resources/uploads/subresources/parts/index.md +0 −110 deleted
File Deleted View Diff
1# Parts
2
3## Add upload part
4
5`UploadPart uploads().parts().create(PartCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())`
6
7**post** `/uploads/{upload_id}/parts`
8
9Adds a [Part](https://platform.openai.com/docs/api-reference/uploads/part-object) to an [Upload](https://platform.openai.com/docs/api-reference/uploads/object) object. A Part represents a chunk of bytes from the file you are trying to upload.
10
11Each Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 8 GB.
12
13It is possible to add multiple Parts in parallel. You can decide the intended order of the Parts when you [complete the Upload](https://platform.openai.com/docs/api-reference/uploads/complete).
14
15### Parameters
16
17- `PartCreateParams params`
18
19 - `Optional<String> uploadId`
20
21 - `String data`
22
23 The chunk of bytes for this Part.
24
25### Returns
26
27- `class UploadPart:`
28
29 The upload Part represents a chunk of bytes we can add to an Upload object.
30
31 - `String id`
32
33 The upload Part unique identifier, which can be referenced in API endpoints.
34
35 - `long createdAt`
36
37 The Unix timestamp (in seconds) for when the Part was created.
38
39 - `JsonValue; object_ "upload.part"constant`
40
41 The object type, which is always `upload.part`.
42
43 - `UPLOAD_PART("upload.part")`
44
45 - `String uploadId`
46
47 The ID of the Upload object that this Part was added to.
48
49### Example
50
51```java
52package com.openai.example;
53
54import com.openai.client.OpenAIClient;
55import com.openai.client.okhttp.OpenAIOkHttpClient;
56import com.openai.models.uploads.parts.PartCreateParams;
57import com.openai.models.uploads.parts.UploadPart;
58import java.io.ByteArrayInputStream;
59
60public final class Main {
61 private Main() {}
62
63 public static void main(String[] args) {
64 OpenAIClient client = OpenAIOkHttpClient.fromEnv();
65
66 PartCreateParams params = PartCreateParams.builder()
67 .uploadId("upload_abc123")
68 .data(new ByteArrayInputStream("Example data".getBytes()))
69 .build();
70 UploadPart uploadPart = client.uploads().parts().create(params);
71 }
72}
73```
74
75#### Response
76
77```json
78{
79 "id": "id",
80 "created_at": 0,
81 "object": "upload.part",
82 "upload_id": "upload_id"
83}
84```
85
86## Domain Types
87
88### Upload Part
89
90- `class UploadPart:`
91
92 The upload Part represents a chunk of bytes we can add to an Upload object.
93
94 - `String id`
95
96 The upload Part unique identifier, which can be referenced in API endpoints.
97
98 - `long createdAt`
99
100 The Unix timestamp (in seconds) for when the Part was created.
101
102 - `JsonValue; object_ "upload.part"constant`
103
104 The object type, which is always `upload.part`.
105
106 - `UPLOAD_PART("upload.part")`
107
108 - `String uploadId`
109
110 The ID of the Upload object that this Part was added to.