7
7
8
8
import httpx
9
9
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
+ )
11
16
from .entries import (
12
17
EntriesResource ,
13
18
AsyncEntriesResource ,
46
51
from ...types .project_list_response import ProjectListResponse
47
52
from ...types .project_return_schema import ProjectReturnSchema
48
53
from ...types .project_retrieve_response import ProjectRetrieveResponse
54
+ from ...types .project_retrieve_analytics_response import ProjectRetrieveAnalyticsResponse
49
55
50
56
__all__ = ["ProjectsResource" , "AsyncProjectsResource" ]
51
57
@@ -354,6 +360,59 @@ def increment_queries(
354
360
cast_to = object ,
355
361
)
356
362
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
+
357
416
358
417
class AsyncProjectsResource (AsyncAPIResource ):
359
418
@cached_property
@@ -659,6 +718,59 @@ async def increment_queries(
659
718
cast_to = object ,
660
719
)
661
720
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
+
662
774
663
775
class ProjectsResourceWithRawResponse :
664
776
def __init__ (self , projects : ProjectsResource ) -> None :
@@ -685,6 +797,9 @@ def __init__(self, projects: ProjectsResource) -> None:
685
797
self .increment_queries = to_raw_response_wrapper (
686
798
projects .increment_queries ,
687
799
)
800
+ self .retrieve_analytics = to_raw_response_wrapper (
801
+ projects .retrieve_analytics ,
802
+ )
688
803
689
804
@cached_property
690
805
def access_keys (self ) -> AccessKeysResourceWithRawResponse :
@@ -724,6 +839,9 @@ def __init__(self, projects: AsyncProjectsResource) -> None:
724
839
self .increment_queries = async_to_raw_response_wrapper (
725
840
projects .increment_queries ,
726
841
)
842
+ self .retrieve_analytics = async_to_raw_response_wrapper (
843
+ projects .retrieve_analytics ,
844
+ )
727
845
728
846
@cached_property
729
847
def access_keys (self ) -> AsyncAccessKeysResourceWithRawResponse :
@@ -763,6 +881,9 @@ def __init__(self, projects: ProjectsResource) -> None:
763
881
self .increment_queries = to_streamed_response_wrapper (
764
882
projects .increment_queries ,
765
883
)
884
+ self .retrieve_analytics = to_streamed_response_wrapper (
885
+ projects .retrieve_analytics ,
886
+ )
766
887
767
888
@cached_property
768
889
def access_keys (self ) -> AccessKeysResourceWithStreamingResponse :
@@ -802,6 +923,9 @@ def __init__(self, projects: AsyncProjectsResource) -> None:
802
923
self .increment_queries = async_to_streamed_response_wrapper (
803
924
projects .increment_queries ,
804
925
)
926
+ self .retrieve_analytics = async_to_streamed_response_wrapper (
927
+ projects .retrieve_analytics ,
928
+ )
805
929
806
930
@cached_property
807
931
def access_keys (self ) -> AsyncAccessKeysResourceWithStreamingResponse :
0 commit comments