Skip to content

Commit 1893a78

Browse files
authored
chore: Update features api endpoints (#6)
The non-suffixed `features` and `features/:key` endpoints are deprecated and have been replaced with `features/resolve` and `features/:key/resolve` respectively. Those endpoints will instead be used to return the actual feature(s) configuration.
1 parent fd81391 commit 1893a78

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

lib/kickplan/resource/features.ex

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ defmodule Kickplan.Features do
1212
def resolve(key, _) when is_list(key) or is_map(key), do: resolve(nil, key)
1313

1414
def resolve(key, params) do
15-
with {:ok, resp} <- Client.post("features/#{key}", params) do
15+
path =
16+
["features", key, "resolve"]
17+
|> Enum.reject(&is_nil/1)
18+
|> Enum.join("/")
19+
20+
with {:ok, resp} <- Client.post(path, params) do
1621
{:ok, resp |> Response.into(Schema.Resolution)}
1722
end
1823
end

test/cassettes/features/resolve-all.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"with_body": "true"
66
},
77
"body": "{}",
8-
"url": "https://demo-control.fly.dev/api/features/",
8+
"url": "https://demo-control.fly.dev/api/features/resolve",
99
"headers": {
1010
"Authorization": "***",
1111
"Content-Type": "application/json",
@@ -22,11 +22,11 @@
2222
"cache-control": "max-age=0, private, must-revalidate",
2323
"content-length": "308",
2424
"content-type": "application/json; charset=utf-8",
25-
"date": "Thu, 22 Aug 2024 19:19:14 GMT",
26-
"server": "Fly/5e55b43a7 (2024-08-21)",
27-
"x-request-id": "F-4jJk91UgTYSXkAAAyB",
25+
"date": "Mon, 26 Aug 2024 18:58:38 GMT",
26+
"server": "Fly/21b3f2da (2024-08-24)",
27+
"x-request-id": "F-9cWPS8oKftqV0AAA8B",
2828
"via": "1.1 fly.io",
29-
"fly-request-id": "01J5XREQJRTKHBC3Y5CJQAPDYK-sea"
29+
"fly-request-id": "01J680VX6EBS8X27Z7J6E9W1KA-sea"
3030
},
3131
"status_code": 200
3232
}

test/cassettes/features/resolve.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"with_body": "true"
66
},
77
"body": "{}",
8-
"url": "https://demo-control.fly.dev/api/features/contact-limit",
8+
"url": "https://demo-control.fly.dev/api/features/contact-limit/resolve",
99
"headers": {
1010
"Authorization": "***",
1111
"Content-Type": "application/json",
@@ -22,11 +22,11 @@
2222
"cache-control": "max-age=0, private, must-revalidate",
2323
"content-length": "33",
2424
"content-type": "application/json; charset=utf-8",
25-
"date": "Thu, 22 Aug 2024 19:43:57 GMT",
26-
"server": "Fly/5e55b43a7 (2024-08-21)",
27-
"x-request-id": "F-4kf6KMXpujMxwAAAyx",
25+
"date": "Mon, 26 Aug 2024 18:58:39 GMT",
26+
"server": "Fly/21b3f2da (2024-08-24)",
27+
"x-request-id": "F-9cWQfLfHOHRrIAAA8R",
2828
"via": "1.1 fly.io",
29-
"fly-request-id": "01J5XSVZZEBDC5XTBGR0QKYXXJ-sea"
29+
"fly-request-id": "01J680VXGEBVK6BMW59K9SC91H-sea"
3030
},
3131
"status_code": 200
3232
}

0 commit comments

Comments
 (0)