3535)
3636
3737if TYPE_CHECKING :
38- from .resources import auth , queue , account , actions , authors , content , wordlist
38+ from .resources import auth , queue , account , actions , authors , content , webhooks , wordlist , webhook_secret
3939 from .resources .auth import AuthResource , AsyncAuthResource
4040 from .resources .account import AccountResource , AsyncAccountResource
4141 from .resources .authors import AuthorsResource , AsyncAuthorsResource
4242 from .resources .content import ContentResource , AsyncContentResource
43+ from .resources .webhooks import WebhooksResource , AsyncWebhooksResource
4344 from .resources .queue .queue import QueueResource , AsyncQueueResource
45+ from .resources .webhook_secret import WebhookSecretResource , AsyncWebhookSecretResource
4446 from .resources .actions .actions import ActionsResource , AsyncActionsResource
4547 from .resources .wordlist .wordlist import WordlistResource , AsyncWordlistResource
4648
@@ -97,6 +99,7 @@ def __init__(
9799
98100 if base_url is None :
99101 base_url = os .environ .get ("MODERATION_API_BASE_URL" )
102+ self ._base_url_overridden = base_url is not None
100103 if base_url is None :
101104 base_url = f"https://api.moderationapi.com/v1"
102105
@@ -162,6 +165,18 @@ def wordlist(self) -> WordlistResource:
162165
163166 return WordlistResource (self )
164167
168+ @cached_property
169+ def webhooks (self ) -> WebhooksResource :
170+ from .resources .webhooks import WebhooksResource
171+
172+ return WebhooksResource (self )
173+
174+ @cached_property
175+ def webhook_secret (self ) -> WebhookSecretResource :
176+ from .resources .webhook_secret import WebhookSecretResource
177+
178+ return WebhookSecretResource (self )
179+
165180 @cached_property
166181 def with_raw_response (self ) -> ModerationAPIWithRawResponse :
167182 return ModerationAPIWithRawResponse (self )
@@ -226,7 +241,7 @@ def copy(
226241 params = set_default_query
227242
228243 http_client = http_client or self ._client
229- return self .__class__ (
244+ client = self .__class__ (
230245 secret_key = secret_key or self .secret_key ,
231246 base_url = base_url or self .base_url ,
232247 timeout = self .timeout if isinstance (timeout , NotGiven ) else timeout ,
@@ -236,6 +251,8 @@ def copy(
236251 default_query = params ,
237252 ** _extra_kwargs ,
238253 )
254+ client ._base_url_overridden = self ._base_url_overridden or base_url is not None
255+ return client
239256
240257 # Alias for `copy` for nicer inline usage, e.g.
241258 # client.with_options(timeout=10).foo.create(...)
@@ -316,6 +333,7 @@ def __init__(
316333
317334 if base_url is None :
318335 base_url = os .environ .get ("MODERATION_API_BASE_URL" )
336+ self ._base_url_overridden = base_url is not None
319337 if base_url is None :
320338 base_url = f"https://api.moderationapi.com/v1"
321339
@@ -381,6 +399,18 @@ def wordlist(self) -> AsyncWordlistResource:
381399
382400 return AsyncWordlistResource (self )
383401
402+ @cached_property
403+ def webhooks (self ) -> AsyncWebhooksResource :
404+ from .resources .webhooks import AsyncWebhooksResource
405+
406+ return AsyncWebhooksResource (self )
407+
408+ @cached_property
409+ def webhook_secret (self ) -> AsyncWebhookSecretResource :
410+ from .resources .webhook_secret import AsyncWebhookSecretResource
411+
412+ return AsyncWebhookSecretResource (self )
413+
384414 @cached_property
385415 def with_raw_response (self ) -> AsyncModerationAPIWithRawResponse :
386416 return AsyncModerationAPIWithRawResponse (self )
@@ -445,7 +475,7 @@ def copy(
445475 params = set_default_query
446476
447477 http_client = http_client or self ._client
448- return self .__class__ (
478+ client = self .__class__ (
449479 secret_key = secret_key or self .secret_key ,
450480 base_url = base_url or self .base_url ,
451481 timeout = self .timeout if isinstance (timeout , NotGiven ) else timeout ,
@@ -455,6 +485,8 @@ def copy(
455485 default_query = params ,
456486 ** _extra_kwargs ,
457487 )
488+ client ._base_url_overridden = self ._base_url_overridden or base_url is not None
489+ return client
458490
459491 # Alias for `copy` for nicer inline usage, e.g.
460492 # client.with_options(timeout=10).foo.create(...)
@@ -542,6 +574,18 @@ def wordlist(self) -> wordlist.WordlistResourceWithRawResponse:
542574
543575 return WordlistResourceWithRawResponse (self ._client .wordlist )
544576
577+ @cached_property
578+ def webhooks (self ) -> webhooks .WebhooksResourceWithRawResponse :
579+ from .resources .webhooks import WebhooksResourceWithRawResponse
580+
581+ return WebhooksResourceWithRawResponse (self ._client .webhooks )
582+
583+ @cached_property
584+ def webhook_secret (self ) -> webhook_secret .WebhookSecretResourceWithRawResponse :
585+ from .resources .webhook_secret import WebhookSecretResourceWithRawResponse
586+
587+ return WebhookSecretResourceWithRawResponse (self ._client .webhook_secret )
588+
545589
546590class AsyncModerationAPIWithRawResponse :
547591 _client : AsyncModerationAPI
@@ -591,6 +635,18 @@ def wordlist(self) -> wordlist.AsyncWordlistResourceWithRawResponse:
591635
592636 return AsyncWordlistResourceWithRawResponse (self ._client .wordlist )
593637
638+ @cached_property
639+ def webhooks (self ) -> webhooks .AsyncWebhooksResourceWithRawResponse :
640+ from .resources .webhooks import AsyncWebhooksResourceWithRawResponse
641+
642+ return AsyncWebhooksResourceWithRawResponse (self ._client .webhooks )
643+
644+ @cached_property
645+ def webhook_secret (self ) -> webhook_secret .AsyncWebhookSecretResourceWithRawResponse :
646+ from .resources .webhook_secret import AsyncWebhookSecretResourceWithRawResponse
647+
648+ return AsyncWebhookSecretResourceWithRawResponse (self ._client .webhook_secret )
649+
594650
595651class ModerationAPIWithStreamedResponse :
596652 _client : ModerationAPI
@@ -640,6 +696,18 @@ def wordlist(self) -> wordlist.WordlistResourceWithStreamingResponse:
640696
641697 return WordlistResourceWithStreamingResponse (self ._client .wordlist )
642698
699+ @cached_property
700+ def webhooks (self ) -> webhooks .WebhooksResourceWithStreamingResponse :
701+ from .resources .webhooks import WebhooksResourceWithStreamingResponse
702+
703+ return WebhooksResourceWithStreamingResponse (self ._client .webhooks )
704+
705+ @cached_property
706+ def webhook_secret (self ) -> webhook_secret .WebhookSecretResourceWithStreamingResponse :
707+ from .resources .webhook_secret import WebhookSecretResourceWithStreamingResponse
708+
709+ return WebhookSecretResourceWithStreamingResponse (self ._client .webhook_secret )
710+
643711
644712class AsyncModerationAPIWithStreamedResponse :
645713 _client : AsyncModerationAPI
@@ -689,6 +757,18 @@ def wordlist(self) -> wordlist.AsyncWordlistResourceWithStreamingResponse:
689757
690758 return AsyncWordlistResourceWithStreamingResponse (self ._client .wordlist )
691759
760+ @cached_property
761+ def webhooks (self ) -> webhooks .AsyncWebhooksResourceWithStreamingResponse :
762+ from .resources .webhooks import AsyncWebhooksResourceWithStreamingResponse
763+
764+ return AsyncWebhooksResourceWithStreamingResponse (self ._client .webhooks )
765+
766+ @cached_property
767+ def webhook_secret (self ) -> webhook_secret .AsyncWebhookSecretResourceWithStreamingResponse :
768+ from .resources .webhook_secret import AsyncWebhookSecretResourceWithStreamingResponse
769+
770+ return AsyncWebhookSecretResourceWithStreamingResponse (self ._client .webhook_secret )
771+
692772
693773Client = ModerationAPI
694774
0 commit comments