77
88import httpx
99
10- from ...types import project_list_params , project_create_params , project_update_params
10+ from ...types import (
11+ project_list_params ,
12+ project_create_params ,
13+ project_update_params ,
14+ project_retrieve_analytics_params ,
15+ )
1116from .entries import (
1217 EntriesResource ,
1318 AsyncEntriesResource ,
4651from ...types .project_list_response import ProjectListResponse
4752from ...types .project_return_schema import ProjectReturnSchema
4853from ...types .project_retrieve_response import ProjectRetrieveResponse
54+ from ...types .project_retrieve_analytics_response import ProjectRetrieveAnalyticsResponse
4955
5056__all__ = ["ProjectsResource" , "AsyncProjectsResource" ]
5157
@@ -354,6 +360,59 @@ def increment_queries(
354360 cast_to = object ,
355361 )
356362
363+ def retrieve_analytics (
364+ self ,
365+ project_id : str ,
366+ * ,
367+ end : int | NotGiven = NOT_GIVEN ,
368+ sme_limit : int | NotGiven = NOT_GIVEN ,
369+ start : int | NotGiven = NOT_GIVEN ,
370+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
371+ # The extra values given here take precedence over values defined on the client or passed to this method.
372+ extra_headers : Headers | None = None ,
373+ extra_query : Query | None = None ,
374+ extra_body : Body | None = None ,
375+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
376+ ) -> ProjectRetrieveAnalyticsResponse :
377+ """
378+ Get Project Analytics Route
379+
380+ Args:
381+ end: End timestamp in seconds since epoch
382+
383+ sme_limit: Limit the number of top SME contributors to return.
384+
385+ start: Start timestamp in seconds since epoch
386+
387+ extra_headers: Send extra headers
388+
389+ extra_query: Add additional query parameters to the request
390+
391+ extra_body: Add additional JSON properties to the request
392+
393+ timeout: Override the client-level default timeout for this request, in seconds
394+ """
395+ if not project_id :
396+ raise ValueError (f"Expected a non-empty value for `project_id` but received { project_id !r} " )
397+ return self ._get (
398+ f"/api/projects/{ project_id } /analytics/" ,
399+ options = make_request_options (
400+ extra_headers = extra_headers ,
401+ extra_query = extra_query ,
402+ extra_body = extra_body ,
403+ timeout = timeout ,
404+ query = maybe_transform (
405+ {
406+ "end" : end ,
407+ "sme_limit" : sme_limit ,
408+ "start" : start ,
409+ },
410+ project_retrieve_analytics_params .ProjectRetrieveAnalyticsParams ,
411+ ),
412+ ),
413+ cast_to = ProjectRetrieveAnalyticsResponse ,
414+ )
415+
357416
358417class AsyncProjectsResource (AsyncAPIResource ):
359418 @cached_property
@@ -659,6 +718,59 @@ async def increment_queries(
659718 cast_to = object ,
660719 )
661720
721+ async def retrieve_analytics (
722+ self ,
723+ project_id : str ,
724+ * ,
725+ end : int | NotGiven = NOT_GIVEN ,
726+ sme_limit : int | NotGiven = NOT_GIVEN ,
727+ start : int | NotGiven = NOT_GIVEN ,
728+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
729+ # The extra values given here take precedence over values defined on the client or passed to this method.
730+ extra_headers : Headers | None = None ,
731+ extra_query : Query | None = None ,
732+ extra_body : Body | None = None ,
733+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
734+ ) -> ProjectRetrieveAnalyticsResponse :
735+ """
736+ Get Project Analytics Route
737+
738+ Args:
739+ end: End timestamp in seconds since epoch
740+
741+ sme_limit: Limit the number of top SME contributors to return.
742+
743+ start: Start timestamp in seconds since epoch
744+
745+ extra_headers: Send extra headers
746+
747+ extra_query: Add additional query parameters to the request
748+
749+ extra_body: Add additional JSON properties to the request
750+
751+ timeout: Override the client-level default timeout for this request, in seconds
752+ """
753+ if not project_id :
754+ raise ValueError (f"Expected a non-empty value for `project_id` but received { project_id !r} " )
755+ return await self ._get (
756+ f"/api/projects/{ project_id } /analytics/" ,
757+ options = make_request_options (
758+ extra_headers = extra_headers ,
759+ extra_query = extra_query ,
760+ extra_body = extra_body ,
761+ timeout = timeout ,
762+ query = await async_maybe_transform (
763+ {
764+ "end" : end ,
765+ "sme_limit" : sme_limit ,
766+ "start" : start ,
767+ },
768+ project_retrieve_analytics_params .ProjectRetrieveAnalyticsParams ,
769+ ),
770+ ),
771+ cast_to = ProjectRetrieveAnalyticsResponse ,
772+ )
773+
662774
663775class ProjectsResourceWithRawResponse :
664776 def __init__ (self , projects : ProjectsResource ) -> None :
@@ -685,6 +797,9 @@ def __init__(self, projects: ProjectsResource) -> None:
685797 self .increment_queries = to_raw_response_wrapper (
686798 projects .increment_queries ,
687799 )
800+ self .retrieve_analytics = to_raw_response_wrapper (
801+ projects .retrieve_analytics ,
802+ )
688803
689804 @cached_property
690805 def access_keys (self ) -> AccessKeysResourceWithRawResponse :
@@ -724,6 +839,9 @@ def __init__(self, projects: AsyncProjectsResource) -> None:
724839 self .increment_queries = async_to_raw_response_wrapper (
725840 projects .increment_queries ,
726841 )
842+ self .retrieve_analytics = async_to_raw_response_wrapper (
843+ projects .retrieve_analytics ,
844+ )
727845
728846 @cached_property
729847 def access_keys (self ) -> AsyncAccessKeysResourceWithRawResponse :
@@ -763,6 +881,9 @@ def __init__(self, projects: ProjectsResource) -> None:
763881 self .increment_queries = to_streamed_response_wrapper (
764882 projects .increment_queries ,
765883 )
884+ self .retrieve_analytics = to_streamed_response_wrapper (
885+ projects .retrieve_analytics ,
886+ )
766887
767888 @cached_property
768889 def access_keys (self ) -> AccessKeysResourceWithStreamingResponse :
@@ -802,6 +923,9 @@ def __init__(self, projects: AsyncProjectsResource) -> None:
802923 self .increment_queries = async_to_streamed_response_wrapper (
803924 projects .increment_queries ,
804925 )
926+ self .retrieve_analytics = async_to_streamed_response_wrapper (
927+ projects .retrieve_analytics ,
928+ )
805929
806930 @cached_property
807931 def access_keys (self ) -> AsyncAccessKeysResourceWithStreamingResponse :
0 commit comments