• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

box / box-java-sdk / #4027

11 Oct 2024 12:22PM UTC coverage: 71.745% (+0.04%) from 71.703%
#4027

push

github

web-flow
feat: Support AI extract and AI extract structured (#1266)

125 of 167 new or added lines in 8 files covered. (74.85%)

1 existing line in 1 file now uncovered.

8039 of 11205 relevant lines covered (71.74%)

0.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.5
/src/main/java/com/box/sdk/BoxAIExtractField.java
1
package com.box.sdk;
2

3
import com.box.sdk.internal.utils.JsonUtils;
4
import com.eclipsesource.json.JsonArray;
5
import com.eclipsesource.json.JsonObject;
6
import java.util.List;
7

8
public class BoxAIExtractField extends BoxJSONObject {
9
    /**
10
     * The type of the field. It include but is not limited to string, float, date, enum, and multiSelect.
11
     */
12
    private String type;
13
    /**
14
     * The description of the field.
15
     */
16
    private String description;
17
    /**
18
     * The display name of the field.
19
     */
20
    private String displayName;
21
    /**
22
     * The key of the field.
23
     */
24
    private String key;
25
    /**
26
     * A list of options for this field.
27
     * This is most often used in combination with the enum and multiSelect field types.
28
     */
29
    private List<BoxAIExtractFieldOption> options;
30
    /**
31
     * The prompt of the field.
32
     */
33
    private String prompt;
34

35
    /**
36
     * Constructs a BoxAIExtractField object with a given key.
37
     */
NEW
38
    public BoxAIExtractField(String key) {
×
NEW
39
        this.key = key;
×
NEW
40
    }
×
41

42
    /**
43
     * Constructs a BoxAIExtractField object with a given type, description, display name, key, options, and prompt.
44
     *
45
     * @param type        the type of the field.
46
     * @param description the description of the field.
47
     * @param displayName the display name of the field.
48
     * @param key         the key of the field.
49
     * @param options     a list of options for this field.
50
     * @param prompt      the prompt of the field.
51
     */
52
    public BoxAIExtractField(String type,
53
                             String description,
54
                             String displayName,
55
                             String key, List<BoxAIExtractFieldOption> options,
56
                             String prompt) {
1✔
57
        this.type = type;
1✔
58
        this.description = description;
1✔
59
        this.displayName = displayName;
1✔
60
        this.key = key;
1✔
61
        this.options = options;
1✔
62
        this.prompt = prompt;
1✔
63
    }
1✔
64

65
    public JsonObject getJSONObject() {
66
        JsonObject jsonObject = new JsonObject();
1✔
67
        JsonUtils.addIfNotNull(jsonObject, "type", this.type);
1✔
68
        JsonUtils.addIfNotNull(jsonObject, "description", this.description);
1✔
69
        JsonUtils.addIfNotNull(jsonObject, "displayName", this.displayName);
1✔
70
        JsonUtils.addIfNotNull(jsonObject, "key", this.key);
1✔
71
        if (this.options != null) {
1✔
72
            JsonArray options = new JsonArray();
1✔
73
            for (BoxAIExtractFieldOption option : this.options) {
1✔
74
                options.add(option.getJSONObject());
1✔
75
            }
1✔
76
            jsonObject.add("options", options);
1✔
77
        }
78
        JsonUtils.addIfNotNull(jsonObject, "prompt", this.prompt);
1✔
79
        return jsonObject;
1✔
80
    }
81
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc