Skip to content

Commit 3e3f7b5

Browse files
chore: add get secret to stainless (#7833)
1 parent 7656890 commit 3e3f7b5

4 files changed

Lines changed: 91 additions & 12 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 115
1+
configured_endpoints: 116
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-563a11030291b5dd44e1b1b917e3e7bb865d7c873bf49c82056bfade22166843.yml
33
openapi_spec_hash: 20770e5f6ed8370fc14ff0e1351ccffc
4-
config_hash: 12de9459ff629b6a3072a75b236b7b70
4+
config_hash: 436c8d4e665915db22b5d98fe58382c1

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ from runloop_api_client.types import (
381381
Methods:
382382

383383
- <code title="post /v1/secrets">client.secrets.<a href="./src/runloop_api_client/resources/secrets.py">create</a>(\*\*<a href="src/runloop_api_client/types/secret_create_params.py">params</a>) -> <a href="./src/runloop_api_client/types/secret_view.py">SecretView</a></code>
384+
- <code title="get /v1/secrets/{name}">client.secrets.<a href="./src/runloop_api_client/resources/secrets.py">retrieve</a>(name) -> <a href="./src/runloop_api_client/types/secret_view.py">SecretView</a></code>
384385
- <code title="post /v1/secrets/{name}">client.secrets.<a href="./src/runloop_api_client/resources/secrets.py">update</a>(name, \*\*<a href="src/runloop_api_client/types/secret_update_params.py">params</a>) -> <a href="./src/runloop_api_client/types/secret_view.py">SecretView</a></code>
385386
- <code title="get /v1/secrets">client.secrets.<a href="./src/runloop_api_client/resources/secrets.py">list</a>(\*\*<a href="src/runloop_api_client/types/secret_list_params.py">params</a>) -> <a href="./src/runloop_api_client/types/secret_list_view.py">SecretListView</a></code>
386387
- <code title="post /v1/secrets/{name}/delete">client.secrets.<a href="./src/runloop_api_client/resources/secrets.py">delete</a>(name) -> <a href="./src/runloop_api_client/types/secret_view.py">SecretView</a></code>

src/runloop_api_client/resources/secrets.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,17 @@ def retrieve(
100100
self,
101101
name: str,
102102
*,
103+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
104+
# The extra values given here take precedence over values defined on the client or passed to this method.
103105
extra_headers: Headers | None = None,
104106
extra_query: Query | None = None,
105107
extra_body: Body | None = None,
106108
timeout: float | httpx.Timeout | None | NotGiven = not_given,
107109
) -> SecretView:
108110
"""Retrieve a Secret by name.
109111
112+
The secret value is not included for security.
113+
110114
Args:
111115
extra_headers: Send extra headers
112116
@@ -119,12 +123,9 @@ def retrieve(
119123
if not name:
120124
raise ValueError(f"Expected a non-empty value for `name` but received {name!r}")
121125
return self._get(
122-
f"/v1/secrets/{name}",
126+
path_template("/v1/secrets/{name}", name=name),
123127
options=make_request_options(
124-
extra_headers=extra_headers,
125-
extra_query=extra_query,
126-
extra_body=extra_body,
127-
timeout=timeout,
128+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
128129
),
129130
cast_to=SecretView,
130131
)
@@ -336,13 +337,17 @@ async def retrieve(
336337
self,
337338
name: str,
338339
*,
340+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
341+
# The extra values given here take precedence over values defined on the client or passed to this method.
339342
extra_headers: Headers | None = None,
340343
extra_query: Query | None = None,
341344
extra_body: Body | None = None,
342345
timeout: float | httpx.Timeout | None | NotGiven = not_given,
343346
) -> SecretView:
344347
"""Retrieve a Secret by name.
345348
349+
The secret value is not included for security.
350+
346351
Args:
347352
extra_headers: Send extra headers
348353
@@ -355,12 +360,9 @@ async def retrieve(
355360
if not name:
356361
raise ValueError(f"Expected a non-empty value for `name` but received {name!r}")
357362
return await self._get(
358-
f"/v1/secrets/{name}",
363+
path_template("/v1/secrets/{name}", name=name),
359364
options=make_request_options(
360-
extra_headers=extra_headers,
361-
extra_query=extra_query,
362-
extra_body=extra_body,
363-
timeout=timeout,
365+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
364366
),
365367
cast_to=SecretView,
366368
)

tests/api_resources/test_secrets.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,44 @@ def test_streaming_response_create(self, client: Runloop) -> None:
5454

5555
assert cast(Any, response.is_closed) is True
5656

57+
@parametrize
58+
def test_method_retrieve(self, client: Runloop) -> None:
59+
secret = client.secrets.retrieve(
60+
"name",
61+
)
62+
assert_matches_type(SecretView, secret, path=["response"])
63+
64+
@parametrize
65+
def test_raw_response_retrieve(self, client: Runloop) -> None:
66+
response = client.secrets.with_raw_response.retrieve(
67+
"name",
68+
)
69+
70+
assert response.is_closed is True
71+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
72+
secret = response.parse()
73+
assert_matches_type(SecretView, secret, path=["response"])
74+
75+
@parametrize
76+
def test_streaming_response_retrieve(self, client: Runloop) -> None:
77+
with client.secrets.with_streaming_response.retrieve(
78+
"name",
79+
) as response:
80+
assert not response.is_closed
81+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
82+
83+
secret = response.parse()
84+
assert_matches_type(SecretView, secret, path=["response"])
85+
86+
assert cast(Any, response.is_closed) is True
87+
88+
@parametrize
89+
def test_path_params_retrieve(self, client: Runloop) -> None:
90+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"):
91+
client.secrets.with_raw_response.retrieve(
92+
"",
93+
)
94+
5795
@parametrize
5896
def test_method_update(self, client: Runloop) -> None:
5997
secret = client.secrets.update(
@@ -206,6 +244,44 @@ async def test_streaming_response_create(self, async_client: AsyncRunloop) -> No
206244

207245
assert cast(Any, response.is_closed) is True
208246

247+
@parametrize
248+
async def test_method_retrieve(self, async_client: AsyncRunloop) -> None:
249+
secret = await async_client.secrets.retrieve(
250+
"name",
251+
)
252+
assert_matches_type(SecretView, secret, path=["response"])
253+
254+
@parametrize
255+
async def test_raw_response_retrieve(self, async_client: AsyncRunloop) -> None:
256+
response = await async_client.secrets.with_raw_response.retrieve(
257+
"name",
258+
)
259+
260+
assert response.is_closed is True
261+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
262+
secret = await response.parse()
263+
assert_matches_type(SecretView, secret, path=["response"])
264+
265+
@parametrize
266+
async def test_streaming_response_retrieve(self, async_client: AsyncRunloop) -> None:
267+
async with async_client.secrets.with_streaming_response.retrieve(
268+
"name",
269+
) as response:
270+
assert not response.is_closed
271+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
272+
273+
secret = await response.parse()
274+
assert_matches_type(SecretView, secret, path=["response"])
275+
276+
assert cast(Any, response.is_closed) is True
277+
278+
@parametrize
279+
async def test_path_params_retrieve(self, async_client: AsyncRunloop) -> None:
280+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"):
281+
await async_client.secrets.with_raw_response.retrieve(
282+
"",
283+
)
284+
209285
@parametrize
210286
async def test_method_update(self, async_client: AsyncRunloop) -> None:
211287
secret = await async_client.secrets.update(

0 commit comments

Comments
 (0)