Skip to content

Commit e81cc3d

Browse files
feat(api): add project increment_queries and other recent endpoints
1 parent b038fbe commit e81cc3d

File tree

11 files changed

+46
-53
lines changed

11 files changed

+46
-53
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
configured_endpoints: 42
22
openapi_spec_hash: 71ff1de391293cdfb6dcb761ed89210d
3-
config_hash: 93ac12138700569dc57329400410c0fd
3+
config_hash: 2d88a0a41f5faca603ff2789a116d988

api.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,9 @@ Methods:
8383

8484
# Users
8585

86-
Types:
87-
88-
```python
89-
from codex.types import User
90-
```
91-
9286
Methods:
9387

94-
- <code title="patch /api/users/activate_account">client.users.<a href="./src/codex/resources/users/users.py">activate_account</a>(\*\*<a href="src/codex/types/user_activate_account_params.py">params</a>) -> <a href="./src/codex/types/user.py">User</a></code>
88+
- <code title="patch /api/users/activate_account">client.users.<a href="./src/codex/resources/users/users.py">activate_account</a>(\*\*<a href="src/codex/types/user_activate_account_params.py">params</a>) -> <a href="./src/codex/types/users/user_schema_public.py">UserSchemaPublic</a></code>
9589

9690
## Myself
9791

@@ -103,13 +97,13 @@ from codex.types.users import UserSchema, UserSchemaPublic
10397

10498
Methods:
10599

106-
- <code title="get /api/users/myself">client.users.myself.<a href="./src/codex/resources/users/myself/myself.py">retrieve</a>() -> <a href="./src/codex/types/user.py">User</a></code>
100+
- <code title="get /api/users/myself">client.users.myself.<a href="./src/codex/resources/users/myself/myself.py">retrieve</a>() -> <a href="./src/codex/types/users/user_schema_public.py">UserSchemaPublic</a></code>
107101

108102
### APIKey
109103

110104
Methods:
111105

112-
- <code title="get /api/users/myself/api-key">client.users.myself.api_key.<a href="./src/codex/resources/users/myself/api_key.py">retrieve</a>() -> <a href="./src/codex/types/user.py">User</a></code>
106+
- <code title="get /api/users/myself/api-key">client.users.myself.api_key.<a href="./src/codex/resources/users/myself/api_key.py">retrieve</a>() -> <a href="./src/codex/types/users/user_schema_public.py">UserSchemaPublic</a></code>
113107
- <code title="post /api/users/myself/api-key/refresh">client.users.myself.api_key.<a href="./src/codex/resources/users/myself/api_key.py">refresh</a>() -> <a href="./src/codex/types/users/user_schema.py">UserSchema</a></code>
114108

115109
### Organizations

src/codex/resources/users/myself/api_key.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
async_to_raw_response_wrapper,
1414
async_to_streamed_response_wrapper,
1515
)
16-
from ....types.user import User
1716
from ...._base_client import make_request_options
1817
from ....types.users.user_schema import UserSchema
18+
from ....types.users.user_schema_public import UserSchemaPublic
1919

2020
__all__ = ["APIKeyResource", "AsyncAPIKeyResource"]
2121

@@ -49,14 +49,14 @@ def retrieve(
4949
extra_query: Query | None = None,
5050
extra_body: Body | None = None,
5151
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
52-
) -> User:
52+
) -> UserSchemaPublic:
5353
"""Get user when authenticated with API key."""
5454
return self._get(
5555
"/api/users/myself/api-key",
5656
options=make_request_options(
5757
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
5858
),
59-
cast_to=User,
59+
cast_to=UserSchemaPublic,
6060
)
6161

6262
def refresh(
@@ -108,14 +108,14 @@ async def retrieve(
108108
extra_query: Query | None = None,
109109
extra_body: Body | None = None,
110110
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
111-
) -> User:
111+
) -> UserSchemaPublic:
112112
"""Get user when authenticated with API key."""
113113
return await self._get(
114114
"/api/users/myself/api-key",
115115
options=make_request_options(
116116
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
117117
),
118-
cast_to=User,
118+
cast_to=UserSchemaPublic,
119119
)
120120

121121
async def refresh(

src/codex/resources/users/myself/myself.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
async_to_raw_response_wrapper,
2222
async_to_streamed_response_wrapper,
2323
)
24-
from ....types.user import User
2524
from .organizations import (
2625
OrganizationsResource,
2726
AsyncOrganizationsResource,
@@ -31,6 +30,7 @@
3130
AsyncOrganizationsResourceWithStreamingResponse,
3231
)
3332
from ...._base_client import make_request_options
33+
from ....types.users.user_schema_public import UserSchemaPublic
3434

3535
__all__ = ["MyselfResource", "AsyncMyselfResource"]
3636

@@ -72,14 +72,14 @@ def retrieve(
7272
extra_query: Query | None = None,
7373
extra_body: Body | None = None,
7474
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
75-
) -> User:
75+
) -> UserSchemaPublic:
7676
"""Get user info for frontend."""
7777
return self._get(
7878
"/api/users/myself",
7979
options=make_request_options(
8080
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
8181
),
82-
cast_to=User,
82+
cast_to=UserSchemaPublic,
8383
)
8484

8585

@@ -120,14 +120,14 @@ async def retrieve(
120120
extra_query: Query | None = None,
121121
extra_body: Body | None = None,
122122
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
123-
) -> User:
123+
) -> UserSchemaPublic:
124124
"""Get user info for frontend."""
125125
return await self._get(
126126
"/api/users/myself",
127127
options=make_request_options(
128128
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
129129
),
130-
cast_to=User,
130+
cast_to=UserSchemaPublic,
131131
)
132132

133133

src/codex/resources/users/users.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
async_to_raw_response_wrapper,
2222
async_to_streamed_response_wrapper,
2323
)
24-
from ...types.user import User
2524
from .verification import (
2625
VerificationResource,
2726
AsyncVerificationResource,
@@ -39,6 +38,7 @@
3938
AsyncMyselfResourceWithStreamingResponse,
4039
)
4140
from ..._base_client import make_request_options
41+
from ...types.users.user_schema_public import UserSchemaPublic
4242

4343
__all__ = ["UsersResource", "AsyncUsersResource"]
4444

@@ -87,7 +87,7 @@ def activate_account(
8787
extra_query: Query | None = None,
8888
extra_body: Body | None = None,
8989
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
90-
) -> User:
90+
) -> UserSchemaPublic:
9191
"""
9292
Activate an authenticated user's account
9393
@@ -117,7 +117,7 @@ def activate_account(
117117
options=make_request_options(
118118
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
119119
),
120-
cast_to=User,
120+
cast_to=UserSchemaPublic,
121121
)
122122

123123

@@ -165,7 +165,7 @@ async def activate_account(
165165
extra_query: Query | None = None,
166166
extra_body: Body | None = None,
167167
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
168-
) -> User:
168+
) -> UserSchemaPublic:
169169
"""
170170
Activate an authenticated user's account
171171
@@ -195,7 +195,7 @@ async def activate_account(
195195
options=make_request_options(
196196
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
197197
),
198-
cast_to=User,
198+
cast_to=UserSchemaPublic,
199199
)
200200

201201

src/codex/types/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from __future__ import annotations
44

5-
from .user import User as User
65
from .tlm_score_params import TlmScoreParams as TlmScoreParams
76
from .tlm_prompt_params import TlmPromptParams as TlmPromptParams
87
from .tlm_score_response import TlmScoreResponse as TlmScoreResponse

src/codex/types/users/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
from __future__ import annotations
44

55
from .user_schema import UserSchema as UserSchema
6+
from .user_schema_public import UserSchemaPublic as UserSchemaPublic
67
from .verification_resend_response import VerificationResendResponse as VerificationResendResponse

src/codex/types/user.py renamed to src/codex/types/users/user_schema_public.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
from typing import Optional
44

5-
from .._models import BaseModel
5+
from ..._models import BaseModel
66

7-
__all__ = ["User"]
7+
__all__ = ["UserSchemaPublic"]
88

99

10-
class User(BaseModel):
10+
class UserSchemaPublic(BaseModel):
1111
id: str
1212

1313
api_key: str

tests/api_resources/test_users.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
import pytest
99

1010
from codex import Codex, AsyncCodex
11-
from codex.types import User
1211
from tests.utils import assert_matches_type
1312
from codex._utils import parse_datetime
13+
from codex.types.users import UserSchemaPublic
1414

1515
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
1616

@@ -25,7 +25,7 @@ def test_method_activate_account(self, client: Codex) -> None:
2525
first_name="first_name",
2626
last_name="last_name",
2727
)
28-
assert_matches_type(User, user, path=["response"])
28+
assert_matches_type(UserSchemaPublic, user, path=["response"])
2929

3030
@pytest.mark.skip()
3131
@parametrize
@@ -39,7 +39,7 @@ def test_method_activate_account_with_all_params(self, client: Codex) -> None:
3939
phone_number="phone_number",
4040
user_provided_company_name="user_provided_company_name",
4141
)
42-
assert_matches_type(User, user, path=["response"])
42+
assert_matches_type(UserSchemaPublic, user, path=["response"])
4343

4444
@pytest.mark.skip()
4545
@parametrize
@@ -52,7 +52,7 @@ def test_raw_response_activate_account(self, client: Codex) -> None:
5252
assert response.is_closed is True
5353
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
5454
user = response.parse()
55-
assert_matches_type(User, user, path=["response"])
55+
assert_matches_type(UserSchemaPublic, user, path=["response"])
5656

5757
@pytest.mark.skip()
5858
@parametrize
@@ -65,7 +65,7 @@ def test_streaming_response_activate_account(self, client: Codex) -> None:
6565
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
6666

6767
user = response.parse()
68-
assert_matches_type(User, user, path=["response"])
68+
assert_matches_type(UserSchemaPublic, user, path=["response"])
6969

7070
assert cast(Any, response.is_closed) is True
7171

@@ -80,7 +80,7 @@ async def test_method_activate_account(self, async_client: AsyncCodex) -> None:
8080
first_name="first_name",
8181
last_name="last_name",
8282
)
83-
assert_matches_type(User, user, path=["response"])
83+
assert_matches_type(UserSchemaPublic, user, path=["response"])
8484

8585
@pytest.mark.skip()
8686
@parametrize
@@ -94,7 +94,7 @@ async def test_method_activate_account_with_all_params(self, async_client: Async
9494
phone_number="phone_number",
9595
user_provided_company_name="user_provided_company_name",
9696
)
97-
assert_matches_type(User, user, path=["response"])
97+
assert_matches_type(UserSchemaPublic, user, path=["response"])
9898

9999
@pytest.mark.skip()
100100
@parametrize
@@ -107,7 +107,7 @@ async def test_raw_response_activate_account(self, async_client: AsyncCodex) ->
107107
assert response.is_closed is True
108108
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
109109
user = await response.parse()
110-
assert_matches_type(User, user, path=["response"])
110+
assert_matches_type(UserSchemaPublic, user, path=["response"])
111111

112112
@pytest.mark.skip()
113113
@parametrize
@@ -120,6 +120,6 @@ async def test_streaming_response_activate_account(self, async_client: AsyncCode
120120
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
121121

122122
user = await response.parse()
123-
assert_matches_type(User, user, path=["response"])
123+
assert_matches_type(UserSchemaPublic, user, path=["response"])
124124

125125
assert cast(Any, response.is_closed) is True

tests/api_resources/users/myself/test_api_key.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
import pytest
99

1010
from codex import Codex, AsyncCodex
11-
from codex.types import User
1211
from tests.utils import assert_matches_type
13-
from codex.types.users import UserSchema
12+
from codex.types.users import UserSchema, UserSchemaPublic
1413

1514
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
1615

@@ -22,7 +21,7 @@ class TestAPIKey:
2221
@parametrize
2322
def test_method_retrieve(self, client: Codex) -> None:
2423
api_key = client.users.myself.api_key.retrieve()
25-
assert_matches_type(User, api_key, path=["response"])
24+
assert_matches_type(UserSchemaPublic, api_key, path=["response"])
2625

2726
@pytest.mark.skip()
2827
@parametrize
@@ -32,7 +31,7 @@ def test_raw_response_retrieve(self, client: Codex) -> None:
3231
assert response.is_closed is True
3332
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
3433
api_key = response.parse()
35-
assert_matches_type(User, api_key, path=["response"])
34+
assert_matches_type(UserSchemaPublic, api_key, path=["response"])
3635

3736
@pytest.mark.skip()
3837
@parametrize
@@ -42,7 +41,7 @@ def test_streaming_response_retrieve(self, client: Codex) -> None:
4241
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
4342

4443
api_key = response.parse()
45-
assert_matches_type(User, api_key, path=["response"])
44+
assert_matches_type(UserSchemaPublic, api_key, path=["response"])
4645

4746
assert cast(Any, response.is_closed) is True
4847

@@ -82,7 +81,7 @@ class TestAsyncAPIKey:
8281
@parametrize
8382
async def test_method_retrieve(self, async_client: AsyncCodex) -> None:
8483
api_key = await async_client.users.myself.api_key.retrieve()
85-
assert_matches_type(User, api_key, path=["response"])
84+
assert_matches_type(UserSchemaPublic, api_key, path=["response"])
8685

8786
@pytest.mark.skip()
8887
@parametrize
@@ -92,7 +91,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncCodex) -> None:
9291
assert response.is_closed is True
9392
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
9493
api_key = await response.parse()
95-
assert_matches_type(User, api_key, path=["response"])
94+
assert_matches_type(UserSchemaPublic, api_key, path=["response"])
9695

9796
@pytest.mark.skip()
9897
@parametrize
@@ -102,7 +101,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncCodex) -> No
102101
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
103102

104103
api_key = await response.parse()
105-
assert_matches_type(User, api_key, path=["response"])
104+
assert_matches_type(UserSchemaPublic, api_key, path=["response"])
106105

107106
assert cast(Any, response.is_closed) is True
108107

0 commit comments

Comments
 (0)