Skip to content

Commit 4ce2f58

Browse files
committed
chore: sync SDK generation and public API spec
Merge the latest mainline SDK surface into the integration branch, preserve nullable object semantics across the newer absence-preserving generator rules, refresh the vendored public specification, and keep unstructured intermediary response bodies out of errors and logs.
2 parents 5c554aa + ac906a1 commit 4ce2f58

31 files changed

Lines changed: 20378 additions & 11120 deletions

‎.github/workflows/ci.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
uses: actions/checkout@v7
2626

2727
- name: Set up Go
28-
uses: actions/setup-go@v6
28+
uses: actions/setup-go@v7
2929
with:
3030
go-version: ${{ matrix.go-version }}
3131
cache: true
@@ -47,7 +47,7 @@ jobs:
4747
uses: actions/checkout@v7
4848

4949
- name: Set up Go
50-
uses: actions/setup-go@v6
50+
uses: actions/setup-go@v7
5151
with:
5252
go-version: 'stable'
5353

@@ -68,7 +68,7 @@ jobs:
6868
uses: actions/checkout@v7
6969

7070
- name: Set up Go
71-
uses: actions/setup-go@v6
71+
uses: actions/setup-go@v7
7272
with:
7373
go-version: 'stable'
7474
cache: true

‎.github/workflows/sync-spec.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
uses: actions/checkout@v7
2424

2525
- name: Set up Go
26-
uses: actions/setup-go@v6
26+
uses: actions/setup-go@v7
2727
with:
2828
go-version: 'stable'
2929
cache: true

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The official Go client for the [Flashduty](https://flashcat.cloud) Open API —
44

55
📖 **API reference:** <https://docs.flashcat.cloud/en/openapi/introduction>
66

7-
> **Status:** All 253 Open API endpoints across 27 services are generated from the Flashduty OpenAPI specification, covered by unit tests, and validated end-to-end against the live API.
7+
> **Status:** All 288 Open API operations across 32 services are generated from the Flashduty OpenAPI specification, covered by unit tests, and validated end-to-end against the live API.
88
99
## Install
1010

‎alerts.go‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎analytics.go‎

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎automations.go‎

Lines changed: 16 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎automations_fire.go‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,24 @@ import (
88
"strings"
99
)
1010

11+
// AutomationFireAPITriggerRequest is the payload accepted by an Automation
12+
// HTTP POST trigger.
13+
type AutomationFireAPITriggerRequest struct {
14+
// Context text passed to this Automation run.
15+
Text string `json:"text,omitempty" toon:"text,omitempty"`
16+
}
17+
18+
// AutomationFireAPITriggerResponse is the result returned by an Automation
19+
// HTTP POST trigger.
20+
type AutomationFireAPITriggerResponse struct {
21+
// Result type. The API-trigger success path returns routine_fire.
22+
Type string `json:"type" toon:"type"`
23+
// Started session ID returned by the API-trigger success path.
24+
SessionID string `json:"session_id" toon:"session_id"`
25+
// Console URL for the started session.
26+
SessionURL string `json:"session_url" toon:"session_url"`
27+
}
28+
1129
// TriggerWriteFire triggers an Automation run through its HTTP POST trigger URL.
1230
//
1331
// This endpoint authenticates with the trigger's one-time bearer token rather

‎automations_fire_test.go‎

Lines changed: 8 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,40 @@ package flashduty
22

33
import (
44
"context"
5-
"encoding/json"
65
"io"
76
"net/http"
87
"strings"
98
"testing"
109
)
1110

12-
func TestAutomationTriggerWriteFireUsesBearerTokenAndDecodesAccepted(t *testing.T) {
11+
func TestAutomationTriggerWriteFireUsesBearerToken(t *testing.T) {
1312
c := newTestClient(t, func(w http.ResponseWriter, r *http.Request) {
1413
if r.URL.Path != "/safari/automation/triggers/trig_abc/fire" {
1514
t.Errorf("path = %s", r.URL.Path)
1615
}
1716
if got := r.URL.Query().Get("app_key"); got != "" {
18-
t.Errorf("app_key must not be sent for trigger fire, got %q", got)
17+
t.Errorf("app_key must not be sent, got %q", got)
1918
}
2019
if got := r.Header.Get("Authorization"); got != "Bearer tok_secret" {
2120
t.Errorf("Authorization = %q", got)
2221
}
23-
if got := r.Header.Get("Content-Type"); got != "application/json" {
24-
t.Errorf("Content-Type = %q", got)
25-
}
2622
body, _ := io.ReadAll(r.Body)
27-
if !strings.Contains(string(body), `"text":"deployment finished"`) ||
28-
!strings.Contains(string(body), `"dedup_key":"deploy-1"`) {
23+
if !strings.Contains(string(body), `"text":"deployment finished"`) {
2924
t.Errorf("body = %s", body)
3025
}
31-
3226
w.Header().Set("Flashcat-Request-Id", "RIDF")
33-
w.WriteHeader(http.StatusAccepted)
34-
_, _ = io.WriteString(w, `{"request_id":"RIDF","data":{"run_id":"taskrun_1","rule_id":"auto_1","trigger_kind":"http_post","status":"running"}}`)
27+
w.WriteHeader(http.StatusOK)
28+
_, _ = io.WriteString(w, `{"request_id":"RIDF","data":{"type":"routine_fire","session_id":"sess_1","session_url":"/safari/session/sess_1"}}`)
3529
})
3630

37-
out, resp, err := c.Automations.TriggerWriteFire(context.Background(), "trig_abc", "tok_secret", &AutomationFireAPITriggerRequest{
38-
Text: "deployment finished",
39-
DedupKey: "deploy-1",
40-
})
31+
out, resp, err := c.Automations.TriggerWriteFire(context.Background(), "trig_abc", "tok_secret", &AutomationFireAPITriggerRequest{Text: "deployment finished"})
4132
if err != nil {
4233
t.Fatalf("TriggerWriteFire error: %v", err)
4334
}
44-
if resp == nil || resp.StatusCode != http.StatusAccepted || resp.RequestID != "RIDF" {
35+
if resp == nil || resp.StatusCode != http.StatusOK || resp.RequestID != "RIDF" {
4536
t.Fatalf("response meta = %+v", resp)
4637
}
47-
if out == nil || out.RunID != "taskrun_1" || out.RuleID != "auto_1" || out.TriggerKind != "http_post" || out.Status != "running" {
38+
if out == nil || out.Type != "routine_fire" || out.SessionID != "sess_1" || out.SessionURL != "/safari/session/sess_1" {
4839
t.Fatalf("decoded response = %+v", out)
4940
}
5041
}
@@ -61,34 +52,3 @@ func TestAutomationTriggerWriteFireValidatesInputs(t *testing.T) {
6152
t.Fatal("expected empty token error")
6253
}
6354
}
64-
65-
func TestAutomationRuleUpdateRequestCanSendFalseValues(t *testing.T) {
66-
payload, err := json.Marshal(&AutomationRuleUpdateRequest{
67-
RuleID: "auto_1",
68-
Enabled: Bool(false),
69-
ScheduleTriggerEnabled: Bool(false),
70-
HTTPPostTriggerEnabled: Bool(false),
71-
RotateHTTPPostTriggerToken: false,
72-
TeamID: Int64(0),
73-
EnvironmentID: String(""),
74-
})
75-
if err != nil {
76-
t.Fatal(err)
77-
}
78-
got := string(payload)
79-
for _, want := range []string{
80-
`"rule_id":"auto_1"`,
81-
`"enabled":false`,
82-
`"schedule_trigger_enabled":false`,
83-
`"http_post_trigger_enabled":false`,
84-
`"team_id":0`,
85-
`"environment_id":""`,
86-
} {
87-
if !strings.Contains(got, want) {
88-
t.Fatalf("payload %s missing %s", got, want)
89-
}
90-
}
91-
if strings.Contains(got, "rotate_http_post_trigger_token") {
92-
t.Fatalf("zero rotate flag should stay omitted: %s", got)
93-
}
94-
}

‎automations_models.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,10 @@ type AutomationRuleUpdateRequest struct {
2626
HTTPPostTriggerEnabled *bool `json:"http_post_trigger_enabled,omitempty" toon:"http_post_trigger_enabled,omitempty"`
2727
// Whether to rotate the HTTP POST trigger token. The new token is returned only in this response.
2828
RotateHTTPPostTriggerToken bool `json:"rotate_http_post_trigger_token,omitempty" toon:"rotate_http_post_trigger_token,omitempty"`
29+
// Whether the on-call incident trigger is enabled. Sending true creates it when missing and channel/severity filters are provided.
30+
OncallIncidentTriggerEnabled *bool `json:"oncall_incident_trigger_enabled,omitempty" toon:"oncall_incident_trigger_enabled,omitempty"`
31+
// On-call channel IDs whose new incidents can trigger this rule.
32+
OncallIncidentChannelIDs *[]int64 `json:"oncall_incident_channel_ids,omitempty" toon:"oncall_incident_channel_ids,omitempty"`
33+
// Incident severities that can trigger this rule.
34+
OncallIncidentSeverities *[]string `json:"oncall_incident_severities,omitempty" toon:"oncall_incident_severities,omitempty"`
2935
}

‎channels.go‎

Lines changed: 0 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)