File size: 10,644 Bytes
9410704
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# This file was auto-generated by Fern from our API Definition.

from __future__ import annotations

import typing

from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.request_options import RequestOptions
from .raw_client import AsyncRawWorkspaceClient, RawWorkspaceClient

if typing.TYPE_CHECKING:
    from .analytics.client import AnalyticsClient, AsyncAnalyticsClient
    from .audit_logs.client import AsyncAuditLogsClient, AuditLogsClient
    from .auth_connections.client import AsyncAuthConnectionsClient, AuthConnectionsClient
    from .groups.client import AsyncGroupsClient, GroupsClient
    from .invites.client import AsyncInvitesClient, InvitesClient
    from .members.client import AsyncMembersClient, MembersClient
    from .resources.client import AsyncResourcesClient, ResourcesClient
    from .usage.client import AsyncUsageClient, UsageClient
# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)


class WorkspaceClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawWorkspaceClient(client_wrapper=client_wrapper)
        self._client_wrapper = client_wrapper
        self._audit_logs: typing.Optional[AuditLogsClient] = None
        self._auth_connections: typing.Optional[AuthConnectionsClient] = None
        self._groups: typing.Optional[GroupsClient] = None
        self._invites: typing.Optional[InvitesClient] = None
        self._members: typing.Optional[MembersClient] = None
        self._resources: typing.Optional[ResourcesClient] = None
        self._usage: typing.Optional[UsageClient] = None
        self._analytics: typing.Optional[AnalyticsClient] = None

    @property
    def with_raw_response(self) -> RawWorkspaceClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawWorkspaceClient
        """
        return self._raw_client

    def set_third_party_disabling_policy(
        self,
        *,
        third_party_disable_allowed: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Any:
        """
        Set the workspace-wide Third-Party Disabling policy. When set, it forces, for every API key in the workspace, whether the holder of a key (potentially a third party who found it) may disable it via the self-disable endpoint or when it leaks publicly — overriding each key's own setting. Pass `true` to allow it for all keys, `false` to forbid it for all keys, or `null` to clear the override so per-key values and the plan default apply again. Workspace admins only.

        Parameters
        ----------
        third_party_disable_allowed : typing.Optional[bool]
            `true` forces every key in the workspace to be disable-able by its holder; `false` forbids it for every key; `null` clears the override (per-key values and the plan default apply).

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Any
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.workspace.set_third_party_disabling_policy()
        """
        _response = self._raw_client.set_third_party_disabling_policy(
            third_party_disable_allowed=third_party_disable_allowed, request_options=request_options
        )
        return _response.data

    @property
    def audit_logs(self):
        if self._audit_logs is None:
            from .audit_logs.client import AuditLogsClient  # noqa: E402

            self._audit_logs = AuditLogsClient(client_wrapper=self._client_wrapper)
        return self._audit_logs

    @property
    def auth_connections(self):
        if self._auth_connections is None:
            from .auth_connections.client import AuthConnectionsClient  # noqa: E402

            self._auth_connections = AuthConnectionsClient(client_wrapper=self._client_wrapper)
        return self._auth_connections

    @property
    def groups(self):
        if self._groups is None:
            from .groups.client import GroupsClient  # noqa: E402

            self._groups = GroupsClient(client_wrapper=self._client_wrapper)
        return self._groups

    @property
    def invites(self):
        if self._invites is None:
            from .invites.client import InvitesClient  # noqa: E402

            self._invites = InvitesClient(client_wrapper=self._client_wrapper)
        return self._invites

    @property
    def members(self):
        if self._members is None:
            from .members.client import MembersClient  # noqa: E402

            self._members = MembersClient(client_wrapper=self._client_wrapper)
        return self._members

    @property
    def resources(self):
        if self._resources is None:
            from .resources.client import ResourcesClient  # noqa: E402

            self._resources = ResourcesClient(client_wrapper=self._client_wrapper)
        return self._resources

    @property
    def usage(self):
        if self._usage is None:
            from .usage.client import UsageClient  # noqa: E402

            self._usage = UsageClient(client_wrapper=self._client_wrapper)
        return self._usage

    @property
    def analytics(self):
        if self._analytics is None:
            from .analytics.client import AnalyticsClient  # noqa: E402

            self._analytics = AnalyticsClient(client_wrapper=self._client_wrapper)
        return self._analytics


class AsyncWorkspaceClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawWorkspaceClient(client_wrapper=client_wrapper)
        self._client_wrapper = client_wrapper
        self._audit_logs: typing.Optional[AsyncAuditLogsClient] = None
        self._auth_connections: typing.Optional[AsyncAuthConnectionsClient] = None
        self._groups: typing.Optional[AsyncGroupsClient] = None
        self._invites: typing.Optional[AsyncInvitesClient] = None
        self._members: typing.Optional[AsyncMembersClient] = None
        self._resources: typing.Optional[AsyncResourcesClient] = None
        self._usage: typing.Optional[AsyncUsageClient] = None
        self._analytics: typing.Optional[AsyncAnalyticsClient] = None

    @property
    def with_raw_response(self) -> AsyncRawWorkspaceClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawWorkspaceClient
        """
        return self._raw_client

    async def set_third_party_disabling_policy(
        self,
        *,
        third_party_disable_allowed: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Any:
        """
        Set the workspace-wide Third-Party Disabling policy. When set, it forces, for every API key in the workspace, whether the holder of a key (potentially a third party who found it) may disable it via the self-disable endpoint or when it leaks publicly — overriding each key's own setting. Pass `true` to allow it for all keys, `false` to forbid it for all keys, or `null` to clear the override so per-key values and the plan default apply again. Workspace admins only.

        Parameters
        ----------
        third_party_disable_allowed : typing.Optional[bool]
            `true` forces every key in the workspace to be disable-able by its holder; `false` forbids it for every key; `null` clears the override (per-key values and the plan default apply).

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Any
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.workspace.set_third_party_disabling_policy()


        asyncio.run(main())
        """
        _response = await self._raw_client.set_third_party_disabling_policy(
            third_party_disable_allowed=third_party_disable_allowed, request_options=request_options
        )
        return _response.data

    @property
    def audit_logs(self):
        if self._audit_logs is None:
            from .audit_logs.client import AsyncAuditLogsClient  # noqa: E402

            self._audit_logs = AsyncAuditLogsClient(client_wrapper=self._client_wrapper)
        return self._audit_logs

    @property
    def auth_connections(self):
        if self._auth_connections is None:
            from .auth_connections.client import AsyncAuthConnectionsClient  # noqa: E402

            self._auth_connections = AsyncAuthConnectionsClient(client_wrapper=self._client_wrapper)
        return self._auth_connections

    @property
    def groups(self):
        if self._groups is None:
            from .groups.client import AsyncGroupsClient  # noqa: E402

            self._groups = AsyncGroupsClient(client_wrapper=self._client_wrapper)
        return self._groups

    @property
    def invites(self):
        if self._invites is None:
            from .invites.client import AsyncInvitesClient  # noqa: E402

            self._invites = AsyncInvitesClient(client_wrapper=self._client_wrapper)
        return self._invites

    @property
    def members(self):
        if self._members is None:
            from .members.client import AsyncMembersClient  # noqa: E402

            self._members = AsyncMembersClient(client_wrapper=self._client_wrapper)
        return self._members

    @property
    def resources(self):
        if self._resources is None:
            from .resources.client import AsyncResourcesClient  # noqa: E402

            self._resources = AsyncResourcesClient(client_wrapper=self._client_wrapper)
        return self._resources

    @property
    def usage(self):
        if self._usage is None:
            from .usage.client import AsyncUsageClient  # noqa: E402

            self._usage = AsyncUsageClient(client_wrapper=self._client_wrapper)
        return self._usage

    @property
    def analytics(self):
        if self._analytics is None:
            from .analytics.client import AsyncAnalyticsClient  # noqa: E402

            self._analytics = AsyncAnalyticsClient(client_wrapper=self._client_wrapper)
        return self._analytics