MCPcopy Index your code
hub / github.com/Flagsmith/flagsmith / create_mv_option_with_api

Function create_mv_option_with_api

api/tests/integration/helpers.py:45–70  ·  view source on GitHub ↗
(
    client: APIClient,
    project_id: int,
    feature_id: str,
    default_percentage_allocation: float,
    value: str,
    key: str | None = None,
)

Source from the content-addressed store, hash-verified

43
44
45def create_mv_option_with_api(
46 client: APIClient,
47 project_id: int,
48 feature_id: str,
49 default_percentage_allocation: float,
50 value: str,
51 key: str | None = None,
52) -> int:
53 url = reverse(
54 "api-v1:projects:feature-mv-options-list",
55 args=[project_id, feature_id],
56 )
57 data: dict[str, typing.Any] = {
58 "type": STRING,
59 "feature": feature_id,
60 "string_value": value,
61 "default_percentage_allocation": default_percentage_allocation,
62 }
63 if key is not None:
64 data["key"] = key
65 response = client.post(
66 url,
67 data=json.dumps(data),
68 content_type="application/json",
69 )
70 return response.json()["id"] # type: ignore[no-any-return]
71
72
73def get_env_feature_states_list_with_api(client: APIClient, query_params: dict) -> dict: # type: ignore[type-arg]

Calls 3

reverseFunction · 0.50
postMethod · 0.45
jsonMethod · 0.45