Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

### Fixed

- Send the required `scope: by_schedule_ids` in Forward `schedules().archiveMany(...)`. Earlier releases sent only `schedule_ids`, so every batch archive request was rejected with HTTP 400 `invalid_request`; existing calls work without code changes.

## [0.3.0]

### Added
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Environment/File use page/next_page pagination; retain explicit forward/backward

Skill multipart uses repeated files parts and relative filenames. Skill ZIP downloads are direct authenticated streams, not File download grants. Credential updates must enforce zero retries regardless of request overrides; test both status and connection failures. Preserve write-only secret handling, metadata merge-patch nulls, and the distinction between create/update/response auth models.

Schedule batch archive sends only schedule_ids (1–50 unique nonempty IDs); do not copy the older TS scope field. Keep request trigger policy fields separate from computed response fields, preserve merge-patch omission/null distinctions and Batch decimal credits. Batch task cursors use custom IDs; output/error grants are not generic File IDs. Examples must preserve pending inputs and never print signed URLs.
Schedule batch archive always sends `scope: by_schedule_ids` with schedule_ids (1–50 unique nonempty IDs); the server rejects a missing scope. Keep request trigger policy fields separate from computed response fields, preserve merge-patch omission/null distinctions and Batch decimal credits. Batch task cursors use custom IDs; output/error grants are not generic File IDs. Examples must preserve pending inputs and never print signed URLs.

Channel QR authorization and message-scope Pairing are different flows. Keep request-only IM credentials separate from redacted response configuration, and never print QR payloads/session keys or pairing codes. Channel tests must not send real IM messages; live QR/pairing acceptance needs a dedicated authorized connection. Preserve fixed/pairing required-field rules and the current code-or-Pairing-ID selector.

Expand Down
2 changes: 1 addition & 1 deletion docs/schedules-batches.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ ScheduleArchiveManyResponse result = client.schedules().archiveMany(
RequestOptions.builder().idempotencyKey(archiveKey).build());
```

The request contains **only `schedule_ids`**. The builder snapshots and deduplicates IDs in insertion order and requires 1–50 unique, nonempty IDs. The current official contract rejects `scope` and other extra fields. This differs from the older TypeScript baseline's `scope: by_schedule_ids` implementation; Java follows the current contract. The endpoint permits PAT or administrator SAT; an Identity-bound SAT cannot perform this administrator operation. SDK does not infer permissions from token text.
The SDK sends the required `scope: by_schedule_ids` together with `schedule_ids`; it is the only supported scope and has no server default. The builder snapshots and deduplicates IDs in insertion order and requires 1–50 unique, nonempty IDs. Other extra fields are rejected. The endpoint permits PAT or administrator SAT; an Identity-bound SAT cannot perform this administrator operation. SDK does not infer permissions from token text.

## Batch creation and inspection

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
import com.qoder.cloudagents.errors.ConfigurationException;
import java.util.*;

/** An explicit, bounded set of Schedule IDs. The server rejects extra fields including scope. */
/**
* An explicit, bounded set of Schedule IDs. Requests always carry the only supported scope, {@code
* by_schedule_ids}; the server rejects a missing scope and other extra fields.
*/
public final class ScheduleArchiveManyParams implements JsonSerializable {
private static final String SCOPE = "by_schedule_ids";
private final List<String> ids;

private ScheduleArchiveManyParams(List<String> value) {
Expand All @@ -26,7 +30,10 @@ public List<String> scheduleIds() {
}

public JsonValue toJsonValue() {
return JsonValue.of(Collections.singletonMap("schedule_ids", ids));
Map<String, Object> body = new LinkedHashMap<>();
body.put("scope", SCOPE);
body.put("schedule_ids", ids);
return JsonValue.of(body);
}

public static Builder builder() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static Stream<Arguments> routes() {
"archiveMany",
"POST",
"/schedules/archive",
"{\"schedule_ids\":[\"sched_1\",\"sched_2\"]}",
"{\"scope\":\"by_schedule_ids\",\"schedule_ids\":[\"sched_1\",\"sched_2\"]}",
"{\"archived_count\":2}"
},
{"scheduleGet", "GET", "/schedules/id%2F%3F%23%25", "", "{\"id\":\"sched_1\"}"},
Expand Down Expand Up @@ -358,7 +358,10 @@ void boundedArchiveAndRequiredParametersFailBeforeSending() {
ids.clear();
ScheduleArchiveManyParams p = b.build();
assertEquals(Arrays.asList("s1", "s2"), p.scheduleIds());
assertEquals(Collections.singleton("schedule_ids"), p.toJsonValue().asObject().keySet());
assertEquals(
Arrays.asList("scope", "schedule_ids"),
new ArrayList<>(p.toJsonValue().asObject().keySet()));
assertEquals("by_schedule_ids", p.toJsonValue().get("scope").asString());
assertThrows(UnsupportedOperationException.class, () -> p.scheduleIds().clear());
ScheduleSink sink = ScheduleSink.builder().type("im_channel").build();
assertThrows(
Expand Down
Loading