Skip to content

Commit 730cb78

Browse files
committed
Release 1.2.2
1 parent c5c2e18 commit 730cb78

37 files changed

+8441
-3002
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: ci
33
on: [push]
44
jobs:
55
compile:
6-
runs-on: ubuntu-20.04
6+
runs-on: ubuntu-latest
77
steps:
88
- name: Checkout repo
99
uses: actions/checkout@v3
@@ -19,7 +19,7 @@ jobs:
1919
- name: Compile
2020
run: poetry run mypy .
2121
test:
22-
runs-on: ubuntu-20.04
22+
runs-on: ubuntu-latest
2323
steps:
2424
- name: Checkout repo
2525
uses: actions/checkout@v3
@@ -39,7 +39,7 @@ jobs:
3939
publish:
4040
needs: [compile, test]
4141
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
42-
runs-on: ubuntu-20.04
42+
runs-on: ubuntu-latest
4343
steps:
4444
- name: Checkout repo
4545
uses: actions/checkout@v3

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "vapi_server_sdk"
33

44
[tool.poetry]
55
name = "vapi_server_sdk"
6-
version = "1.2.1"
6+
version = "1.2.2"
77
description = ""
88
readme = "README.md"
99
authors = []

src/vapi/analytics/client.py

Lines changed: 30 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,31 @@
22

33
import typing
44
from ..core.client_wrapper import SyncClientWrapper
5+
from .raw_client import RawAnalyticsClient
56
from ..types.analytics_query import AnalyticsQuery
67
from ..core.request_options import RequestOptions
78
from ..types.analytics_query_result import AnalyticsQueryResult
8-
from ..core.serialization import convert_and_respect_annotation_metadata
9-
from ..core.unchecked_base_model import construct_type
10-
from json.decoder import JSONDecodeError
11-
from ..core.api_error import ApiError
129
from ..core.client_wrapper import AsyncClientWrapper
10+
from .raw_client import AsyncRawAnalyticsClient
1311

1412
# this is used as the default value for optional parameters
1513
OMIT = typing.cast(typing.Any, ...)
1614

1715

1816
class AnalyticsClient:
1917
def __init__(self, *, client_wrapper: SyncClientWrapper):
20-
self._client_wrapper = client_wrapper
18+
self._raw_client = RawAnalyticsClient(client_wrapper=client_wrapper)
19+
20+
@property
21+
def with_raw_response(self) -> RawAnalyticsClient:
22+
"""
23+
Retrieves a raw implementation of this client that returns raw responses.
24+
25+
Returns
26+
-------
27+
RawAnalyticsClient
28+
"""
29+
return self._raw_client
2130

2231
def get(
2332
self, *, queries: typing.Sequence[AnalyticsQuery], request_options: typing.Optional[RequestOptions] = None
@@ -36,38 +45,24 @@ def get(
3645
typing.List[AnalyticsQueryResult]
3746
3847
"""
39-
_response = self._client_wrapper.httpx_client.request(
40-
"analytics",
41-
method="POST",
42-
json={
43-
"queries": convert_and_respect_annotation_metadata(
44-
object_=queries, annotation=typing.Sequence[AnalyticsQuery], direction="write"
45-
),
46-
},
47-
headers={
48-
"content-type": "application/json",
49-
},
50-
request_options=request_options,
51-
omit=OMIT,
52-
)
53-
try:
54-
if 200 <= _response.status_code < 300:
55-
return typing.cast(
56-
typing.List[AnalyticsQueryResult],
57-
construct_type(
58-
type_=typing.List[AnalyticsQueryResult], # type: ignore
59-
object_=_response.json(),
60-
),
61-
)
62-
_response_json = _response.json()
63-
except JSONDecodeError:
64-
raise ApiError(status_code=_response.status_code, body=_response.text)
65-
raise ApiError(status_code=_response.status_code, body=_response_json)
48+
response = self._raw_client.get(queries=queries, request_options=request_options)
49+
return response.data
6650

6751

6852
class AsyncAnalyticsClient:
6953
def __init__(self, *, client_wrapper: AsyncClientWrapper):
70-
self._client_wrapper = client_wrapper
54+
self._raw_client = AsyncRawAnalyticsClient(client_wrapper=client_wrapper)
55+
56+
@property
57+
def with_raw_response(self) -> AsyncRawAnalyticsClient:
58+
"""
59+
Retrieves a raw implementation of this client that returns raw responses.
60+
61+
Returns
62+
-------
63+
AsyncRawAnalyticsClient
64+
"""
65+
return self._raw_client
7166

7267
async def get(
7368
self, *, queries: typing.Sequence[AnalyticsQuery], request_options: typing.Optional[RequestOptions] = None
@@ -86,30 +81,5 @@ async def get(
8681
typing.List[AnalyticsQueryResult]
8782
8883
"""
89-
_response = await self._client_wrapper.httpx_client.request(
90-
"analytics",
91-
method="POST",
92-
json={
93-
"queries": convert_and_respect_annotation_metadata(
94-
object_=queries, annotation=typing.Sequence[AnalyticsQuery], direction="write"
95-
),
96-
},
97-
headers={
98-
"content-type": "application/json",
99-
},
100-
request_options=request_options,
101-
omit=OMIT,
102-
)
103-
try:
104-
if 200 <= _response.status_code < 300:
105-
return typing.cast(
106-
typing.List[AnalyticsQueryResult],
107-
construct_type(
108-
type_=typing.List[AnalyticsQueryResult], # type: ignore
109-
object_=_response.json(),
110-
),
111-
)
112-
_response_json = _response.json()
113-
except JSONDecodeError:
114-
raise ApiError(status_code=_response.status_code, body=_response.text)
115-
raise ApiError(status_code=_response.status_code, body=_response_json)
84+
response = await self._raw_client.get(queries=queries, request_options=request_options)
85+
return response.data

src/vapi/analytics/raw_client.py

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import typing
4+
from ..core.client_wrapper import SyncClientWrapper
5+
from ..types.analytics_query import AnalyticsQuery
6+
from ..core.request_options import RequestOptions
7+
from ..core.http_response import HttpResponse
8+
from ..types.analytics_query_result import AnalyticsQueryResult
9+
from ..core.serialization import convert_and_respect_annotation_metadata
10+
from ..core.unchecked_base_model import construct_type
11+
from json.decoder import JSONDecodeError
12+
from ..core.api_error import ApiError
13+
from ..core.client_wrapper import AsyncClientWrapper
14+
from ..core.http_response import AsyncHttpResponse
15+
16+
# this is used as the default value for optional parameters
17+
OMIT = typing.cast(typing.Any, ...)
18+
19+
20+
class RawAnalyticsClient:
21+
def __init__(self, *, client_wrapper: SyncClientWrapper):
22+
self._client_wrapper = client_wrapper
23+
24+
def get(
25+
self, *, queries: typing.Sequence[AnalyticsQuery], request_options: typing.Optional[RequestOptions] = None
26+
) -> HttpResponse[typing.List[AnalyticsQueryResult]]:
27+
"""
28+
Parameters
29+
----------
30+
queries : typing.Sequence[AnalyticsQuery]
31+
This is the list of metric queries you want to perform.
32+
33+
request_options : typing.Optional[RequestOptions]
34+
Request-specific configuration.
35+
36+
Returns
37+
-------
38+
HttpResponse[typing.List[AnalyticsQueryResult]]
39+
40+
"""
41+
_response = self._client_wrapper.httpx_client.request(
42+
"analytics",
43+
method="POST",
44+
json={
45+
"queries": convert_and_respect_annotation_metadata(
46+
object_=queries, annotation=typing.Sequence[AnalyticsQuery], direction="write"
47+
),
48+
},
49+
headers={
50+
"content-type": "application/json",
51+
},
52+
request_options=request_options,
53+
omit=OMIT,
54+
)
55+
try:
56+
if 200 <= _response.status_code < 300:
57+
_data = typing.cast(
58+
typing.List[AnalyticsQueryResult],
59+
construct_type(
60+
type_=typing.List[AnalyticsQueryResult], # type: ignore
61+
object_=_response.json(),
62+
),
63+
)
64+
return HttpResponse(response=_response, data=_data)
65+
_response_json = _response.json()
66+
except JSONDecodeError:
67+
raise ApiError(status_code=_response.status_code, body=_response.text)
68+
raise ApiError(status_code=_response.status_code, body=_response_json)
69+
70+
71+
class AsyncRawAnalyticsClient:
72+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
73+
self._client_wrapper = client_wrapper
74+
75+
async def get(
76+
self, *, queries: typing.Sequence[AnalyticsQuery], request_options: typing.Optional[RequestOptions] = None
77+
) -> AsyncHttpResponse[typing.List[AnalyticsQueryResult]]:
78+
"""
79+
Parameters
80+
----------
81+
queries : typing.Sequence[AnalyticsQuery]
82+
This is the list of metric queries you want to perform.
83+
84+
request_options : typing.Optional[RequestOptions]
85+
Request-specific configuration.
86+
87+
Returns
88+
-------
89+
AsyncHttpResponse[typing.List[AnalyticsQueryResult]]
90+
91+
"""
92+
_response = await self._client_wrapper.httpx_client.request(
93+
"analytics",
94+
method="POST",
95+
json={
96+
"queries": convert_and_respect_annotation_metadata(
97+
object_=queries, annotation=typing.Sequence[AnalyticsQuery], direction="write"
98+
),
99+
},
100+
headers={
101+
"content-type": "application/json",
102+
},
103+
request_options=request_options,
104+
omit=OMIT,
105+
)
106+
try:
107+
if 200 <= _response.status_code < 300:
108+
_data = typing.cast(
109+
typing.List[AnalyticsQueryResult],
110+
construct_type(
111+
type_=typing.List[AnalyticsQueryResult], # type: ignore
112+
object_=_response.json(),
113+
),
114+
)
115+
return AsyncHttpResponse(response=_response, data=_data)
116+
_response_json = _response.json()
117+
except JSONDecodeError:
118+
raise ApiError(status_code=_response.status_code, body=_response.text)
119+
raise ApiError(status_code=_response.status_code, body=_response_json)

0 commit comments

Comments
 (0)