Skip to content

Commit e6fa778

Browse files
Add Stripe-Request-Trigger header (stripe#1805)
* add "prepare" to justfile * add Stripe-Request-Trigger header
1 parent ae4dec7 commit e6fa778

23 files changed

Lines changed: 57 additions & 48 deletions

justfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import? '../sdk-codegen/utils.just'
55
_default:
66
just --list --unsorted
77

8+
# ⭐ run lint, typecheck, and tests to prepare for CI
9+
prepare: lint typecheck test
10+
811
install *args:
912
bundle install {{ if is_dependency() == "true" {"--quiet"} else {""} }} {{ args }}
1013

lib/stripe/api_requestor.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,13 +1093,13 @@ def self.uname_from_system_ver
10931093
end
10941094

10951095
AI_AGENTS = [
1096-
["ANTIGRAVITY_CLI_ALIAS", "antigravity"],
1097-
["CLAUDECODE", "claude_code"],
1098-
["CLINE_ACTIVE", "cline"],
1099-
["CODEX_SANDBOX", "codex_cli"],
1100-
["CURSOR_AGENT", "cursor"],
1101-
["GEMINI_CLI", "gemini_cli"],
1102-
["OPENCODE", "open_code"],
1096+
%w[ANTIGRAVITY_CLI_ALIAS antigravity],
1097+
%w[CLAUDECODE claude_code],
1098+
%w[CLINE_ACTIVE cline],
1099+
%w[CODEX_SANDBOX codex_cli],
1100+
%w[CURSOR_AGENT cursor],
1101+
%w[GEMINI_CLI gemini_cli],
1102+
%w[OPENCODE open_code],
11031103
].freeze
11041104

11051105
def self.detect_ai_agent(env = ENV)

lib/stripe/events/v1_billing_meter_error_report_triggered_event.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def fetch_related_object
9595
method: :get,
9696
path: related_object.url,
9797
base_address: :api,
98-
opts: { stripe_context: context }
98+
opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" }
9999
)
100100
end
101101
end
@@ -113,7 +113,7 @@ def fetch_related_object
113113
resp = @client.raw_request(
114114
:get,
115115
related_object.url,
116-
opts: { stripe_context: context },
116+
opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" },
117117
usage: ["fetch_related_object"]
118118
)
119119
@client.deserialize(resp.http_body, api_mode: Util.get_api_mode(related_object.url))

lib/stripe/events/v2_core_account_closed_event.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def fetch_related_object
1515
method: :get,
1616
path: related_object.url,
1717
base_address: :api,
18-
opts: { stripe_context: context }
18+
opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" }
1919
)
2020
end
2121
attr_reader :related_object
@@ -34,7 +34,7 @@ def fetch_related_object
3434
resp = @client.raw_request(
3535
:get,
3636
related_object.url,
37-
opts: { stripe_context: context },
37+
opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" },
3838
usage: ["fetch_related_object"]
3939
)
4040
@client.deserialize(resp.http_body, api_mode: Util.get_api_mode(related_object.url))

lib/stripe/events/v2_core_account_created_event.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def fetch_related_object
1515
method: :get,
1616
path: related_object.url,
1717
base_address: :api,
18-
opts: { stripe_context: context }
18+
opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" }
1919
)
2020
end
2121
attr_reader :related_object
@@ -34,7 +34,7 @@ def fetch_related_object
3434
resp = @client.raw_request(
3535
:get,
3636
related_object.url,
37-
opts: { stripe_context: context },
37+
opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" },
3838
usage: ["fetch_related_object"]
3939
)
4040
@client.deserialize(resp.http_body, api_mode: Util.get_api_mode(related_object.url))

lib/stripe/events/v2_core_account_including_configuration_customer_capability_status_updated_event.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def fetch_related_object
3535
method: :get,
3636
path: related_object.url,
3737
base_address: :api,
38-
opts: { stripe_context: context }
38+
opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" }
3939
)
4040
end
4141
end
@@ -53,7 +53,7 @@ def fetch_related_object
5353
resp = @client.raw_request(
5454
:get,
5555
related_object.url,
56-
opts: { stripe_context: context },
56+
opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" },
5757
usage: ["fetch_related_object"]
5858
)
5959
@client.deserialize(resp.http_body, api_mode: Util.get_api_mode(related_object.url))

lib/stripe/events/v2_core_account_including_configuration_customer_updated_event.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def fetch_related_object
1515
method: :get,
1616
path: related_object.url,
1717
base_address: :api,
18-
opts: { stripe_context: context }
18+
opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" }
1919
)
2020
end
2121
attr_reader :related_object
@@ -34,7 +34,7 @@ def fetch_related_object
3434
resp = @client.raw_request(
3535
:get,
3636
related_object.url,
37-
opts: { stripe_context: context },
37+
opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" },
3838
usage: ["fetch_related_object"]
3939
)
4040
@client.deserialize(resp.http_body, api_mode: Util.get_api_mode(related_object.url))

lib/stripe/events/v2_core_account_including_configuration_merchant_capability_status_updated_event.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def fetch_related_object
3535
method: :get,
3636
path: related_object.url,
3737
base_address: :api,
38-
opts: { stripe_context: context }
38+
opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" }
3939
)
4040
end
4141
end
@@ -53,7 +53,7 @@ def fetch_related_object
5353
resp = @client.raw_request(
5454
:get,
5555
related_object.url,
56-
opts: { stripe_context: context },
56+
opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" },
5757
usage: ["fetch_related_object"]
5858
)
5959
@client.deserialize(resp.http_body, api_mode: Util.get_api_mode(related_object.url))

lib/stripe/events/v2_core_account_including_configuration_merchant_updated_event.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def fetch_related_object
1515
method: :get,
1616
path: related_object.url,
1717
base_address: :api,
18-
opts: { stripe_context: context }
18+
opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" }
1919
)
2020
end
2121
attr_reader :related_object
@@ -34,7 +34,7 @@ def fetch_related_object
3434
resp = @client.raw_request(
3535
:get,
3636
related_object.url,
37-
opts: { stripe_context: context },
37+
opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" },
3838
usage: ["fetch_related_object"]
3939
)
4040
@client.deserialize(resp.http_body, api_mode: Util.get_api_mode(related_object.url))

lib/stripe/events/v2_core_account_including_configuration_recipient_capability_status_updated_event.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def fetch_related_object
3535
method: :get,
3636
path: related_object.url,
3737
base_address: :api,
38-
opts: { stripe_context: context }
38+
opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" }
3939
)
4040
end
4141
end
@@ -53,7 +53,7 @@ def fetch_related_object
5353
resp = @client.raw_request(
5454
:get,
5555
related_object.url,
56-
opts: { stripe_context: context },
56+
opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" },
5757
usage: ["fetch_related_object"]
5858
)
5959
@client.deserialize(resp.http_body, api_mode: Util.get_api_mode(related_object.url))

0 commit comments

Comments
 (0)