Debian Codegraph @

stripe/apps/_secret_service.py

raw
1 # -*- coding: utf-8 -*-
2 # File generated from our OpenAPI spec
3 from stripe._stripe_service import StripeService
4 from typing import Optional, cast
5 from typing_extensions import TYPE_CHECKING
6
7 if TYPE_CHECKING:
8 from stripe._list_object import ListObject
9 from stripe._request_options import RequestOptions
10 from stripe.apps._secret import Secret
11 from stripe.params.apps._secret_create_params import SecretCreateParams
12 from stripe.params.apps._secret_delete_where_params import (
13 SecretDeleteWhereParams,
14 )
15 from stripe.params.apps._secret_find_params import SecretFindParams
16 from stripe.params.apps._secret_list_params import SecretListParams
17
18
19 class SecretService(StripeService):
20 def list(
21 self,
22 params: "SecretListParams",
23 options: Optional["RequestOptions"] = None,
24 ) -> "ListObject[Secret]":
25 """
26 List all secrets stored on the given scope.
27 """
28 return cast(
29 "ListObject[Secret]",
30 self._request(
31 "get",
32 "/v1/apps/secrets",
33 base_address="api",
34 params=params,
35 options=options,
36 ),
37 )
38
39 async def list_async(
40 self,
41 params: "SecretListParams",
42 options: Optional["RequestOptions"] = None,
43 ) -> "ListObject[Secret]":
44 """
45 List all secrets stored on the given scope.
46 """
47 return cast(
48 "ListObject[Secret]",
49 await self._request_async(
50 "get",
51 "/v1/apps/secrets",
52 base_address="api",
53 params=params,
54 options=options,
55 ),
56 )
57
58 def create(
59 self,
60 params: "SecretCreateParams",
61 options: Optional["RequestOptions"] = None,
62 ) -> "Secret":
63 """
64 Create or replace a secret in the secret store.
65 """
66 return cast(
67 "Secret",
68 self._request(
69 "post",
70 "/v1/apps/secrets",
71 base_address="api",
72 params=params,
73 options=options,
74 ),
75 )
76
77 async def create_async(
78 self,
79 params: "SecretCreateParams",
80 options: Optional["RequestOptions"] = None,
81 ) -> "Secret":
82 """
83 Create or replace a secret in the secret store.
84 """
85 return cast(
86 "Secret",
87 await self._request_async(
88 "post",
89 "/v1/apps/secrets",
90 base_address="api",
91 params=params,
92 options=options,
93 ),
94 )
95
96 def find(
97 self,
98 params: "SecretFindParams",
99 options: Optional["RequestOptions"] = None,
100 ) -> "Secret":
101 """
102 Finds a secret in the secret store by name and scope.
103 """
104 return cast(
105 "Secret",
106 self._request(
107 "get",
108 "/v1/apps/secrets/find",
109 base_address="api",
110 params=params,
111 options=options,
112 ),
113 )
114
115 async def find_async(
116 self,
117 params: "SecretFindParams",
118 options: Optional["RequestOptions"] = None,
119 ) -> "Secret":
120 """
121 Finds a secret in the secret store by name and scope.
122 """
123 return cast(
124 "Secret",
125 await self._request_async(
126 "get",
127 "/v1/apps/secrets/find",
128 base_address="api",
129 params=params,
130 options=options,
131 ),
132 )
133
134 def delete_where(
135 self,
136 params: "SecretDeleteWhereParams",
137 options: Optional["RequestOptions"] = None,
138 ) -> "Secret":
139 """
140 Deletes a secret from the secret store by name and scope.
141 """
142 return cast(
143 "Secret",
144 self._request(
145 "post",
146 "/v1/apps/secrets/delete",
147 base_address="api",
148 params=params,
149 options=options,
150 ),
151 )
152
153 async def delete_where_async(
154 self,
155 params: "SecretDeleteWhereParams",
156 options: Optional["RequestOptions"] = None,
157 ) -> "Secret":
158 """
159 Deletes a secret from the secret store by name and scope.
160 """
161 return cast(
162 "Secret",
163 await self._request_async(
164 "post",
165 "/v1/apps/secrets/delete",
166 base_address="api",
167 params=params,
168 options=options,
169 ),
170 )