Skip to content

Commit 60f3a0b

Browse files
author
stlc-bot
committed
feat(people): publish people search in the API specification (#2094)
Stainless-Generated-From: 4dd539d6f936ea827e3bc97ba49d2e1c5555301c
1 parent 01f3699 commit 60f3a0b

7 files changed

Lines changed: 363 additions & 4 deletions

File tree

‎.stats.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
configured_endpoints: 45
1+
configured_endpoints: 46

‎api.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,13 @@ Methods:
183183
Types:
184184

185185
```python
186-
from context.dev.types import PersonEnrichResponse
186+
from context.dev.types import PersonEnrichResponse, PersonSearchResponse
187187
```
188188

189189
Methods:
190190

191191
- <code title="post /people/enrich">client.people.<a href="./src/context/dev/resources/people.py">enrich</a>(\*\*<a href="src/context/dev/types/person_enrich_params.py">params</a>) -> <a href="./src/context/dev/types/person_enrich_response.py">PersonEnrichResponse</a></code>
192+
- <code title="post /people/search">client.people.<a href="./src/context/dev/resources/people.py">search</a>(\*\*<a href="src/context/dev/types/person_search_params.py">params</a>) -> <a href="./src/context/dev/types/person_search_response.py">PersonSearchResponse</a></code>
192193

193194
# News
194195

‎src/context/dev/resources/people.py‎

Lines changed: 116 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import httpx
99

10-
from ..types import person_enrich_params
10+
from ..types import person_enrich_params, person_search_params
1111
from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
1212
from .._utils import maybe_transform, async_maybe_transform
1313
from .._compat import cached_property
@@ -20,6 +20,7 @@
2020
)
2121
from .._base_client import make_request_options
2222
from ..types.person_enrich_response import PersonEnrichResponse
23+
from ..types.person_search_response import PersonSearchResponse
2324

2425
__all__ = ["PeopleResource", "AsyncPeopleResource"]
2526

@@ -120,6 +121,57 @@ def enrich(
120121
cast_to=PersonEnrichResponse,
121122
)
122123

124+
def search(
125+
self,
126+
*,
127+
query: str,
128+
cursor: str | Omit = omit,
129+
filters: person_search_params.Filters | Omit = omit,
130+
tags: SequenceNotStr[str] | Omit = omit,
131+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
132+
# The extra values given here take precedence over values defined on the client or passed to this method.
133+
extra_headers: Headers | None = None,
134+
extra_query: Query | None = None,
135+
extra_body: Body | None = None,
136+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
137+
) -> PersonSearchResponse:
138+
"""
139+
Find people with a natural-language query.
140+
141+
Args:
142+
query: Describe the people to find.
143+
144+
cursor: Use next_cursor with the same query and filters to fetch the next page.
145+
146+
filters: Additional constraints every result must match.
147+
148+
tags: Labels for filtering usage in the dashboard.
149+
150+
extra_headers: Send extra headers
151+
152+
extra_query: Add additional query parameters to the request
153+
154+
extra_body: Add additional JSON properties to the request
155+
156+
timeout: Override the client-level default timeout for this request, in seconds
157+
"""
158+
return self._post(
159+
"/people/search",
160+
body=maybe_transform(
161+
{
162+
"query": query,
163+
"cursor": cursor,
164+
"filters": filters,
165+
"tags": tags,
166+
},
167+
person_search_params.PersonSearchParams,
168+
),
169+
options=make_request_options(
170+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
171+
),
172+
cast_to=PersonSearchResponse,
173+
)
174+
123175

124176
class AsyncPeopleResource(AsyncAPIResource):
125177
@cached_property
@@ -217,6 +269,57 @@ async def enrich(
217269
cast_to=PersonEnrichResponse,
218270
)
219271

272+
async def search(
273+
self,
274+
*,
275+
query: str,
276+
cursor: str | Omit = omit,
277+
filters: person_search_params.Filters | Omit = omit,
278+
tags: SequenceNotStr[str] | Omit = omit,
279+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
280+
# The extra values given here take precedence over values defined on the client or passed to this method.
281+
extra_headers: Headers | None = None,
282+
extra_query: Query | None = None,
283+
extra_body: Body | None = None,
284+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
285+
) -> PersonSearchResponse:
286+
"""
287+
Find people with a natural-language query.
288+
289+
Args:
290+
query: Describe the people to find.
291+
292+
cursor: Use next_cursor with the same query and filters to fetch the next page.
293+
294+
filters: Additional constraints every result must match.
295+
296+
tags: Labels for filtering usage in the dashboard.
297+
298+
extra_headers: Send extra headers
299+
300+
extra_query: Add additional query parameters to the request
301+
302+
extra_body: Add additional JSON properties to the request
303+
304+
timeout: Override the client-level default timeout for this request, in seconds
305+
"""
306+
return await self._post(
307+
"/people/search",
308+
body=await async_maybe_transform(
309+
{
310+
"query": query,
311+
"cursor": cursor,
312+
"filters": filters,
313+
"tags": tags,
314+
},
315+
person_search_params.PersonSearchParams,
316+
),
317+
options=make_request_options(
318+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
319+
),
320+
cast_to=PersonSearchResponse,
321+
)
322+
220323

221324
class PeopleResourceWithRawResponse:
222325
def __init__(self, people: PeopleResource) -> None:
@@ -225,6 +328,9 @@ def __init__(self, people: PeopleResource) -> None:
225328
self.enrich = to_raw_response_wrapper(
226329
people.enrich,
227330
)
331+
self.search = to_raw_response_wrapper(
332+
people.search,
333+
)
228334

229335

230336
class AsyncPeopleResourceWithRawResponse:
@@ -234,6 +340,9 @@ def __init__(self, people: AsyncPeopleResource) -> None:
234340
self.enrich = async_to_raw_response_wrapper(
235341
people.enrich,
236342
)
343+
self.search = async_to_raw_response_wrapper(
344+
people.search,
345+
)
237346

238347

239348
class PeopleResourceWithStreamingResponse:
@@ -243,6 +352,9 @@ def __init__(self, people: PeopleResource) -> None:
243352
self.enrich = to_streamed_response_wrapper(
244353
people.enrich,
245354
)
355+
self.search = to_streamed_response_wrapper(
356+
people.search,
357+
)
246358

247359

248360
class AsyncPeopleResourceWithStreamingResponse:
@@ -252,3 +364,6 @@ def __init__(self, people: AsyncPeopleResource) -> None:
252364
self.enrich = async_to_streamed_response_wrapper(
253365
people.enrich,
254366
)
367+
self.search = async_to_streamed_response_wrapper(
368+
people.search,
369+
)

‎src/context/dev/types/__init__.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from .monitor_run_response import MonitorRunResponse as MonitorRunResponse
2828
from .news_search_response import NewsSearchResponse as NewsSearchResponse
2929
from .person_enrich_params import PersonEnrichParams as PersonEnrichParams
30+
from .person_search_params import PersonSearchParams as PersonSearchParams
3031
from .web_answers_response import WebAnswersResponse as WebAnswersResponse
3132
from .batch_cancel_response import BatchCancelResponse as BatchCancelResponse
3233
from .batch_delete_response import BatchDeleteResponse as BatchDeleteResponse
@@ -42,6 +43,7 @@
4243
from .web_screenshot_params import WebScreenshotParams as WebScreenshotParams
4344
from .feedback_submit_params import FeedbackSubmitParams as FeedbackSubmitParams
4445
from .person_enrich_response import PersonEnrichResponse as PersonEnrichResponse
46+
from .person_search_response import PersonSearchResponse as PersonSearchResponse
4547
from .batch_retrieve_response import BatchRetrieveResponse as BatchRetrieveResponse
4648
from .brand_retrieve_response import BrandRetrieveResponse as BrandRetrieveResponse
4749
from .monitor_create_response import MonitorCreateResponse as MonitorCreateResponse
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import Required, TypedDict
6+
7+
from .._types import SequenceNotStr
8+
9+
__all__ = ["PersonSearchParams", "Filters"]
10+
11+
12+
class PersonSearchParams(TypedDict, total=False):
13+
query: Required[str]
14+
"""Describe the people to find."""
15+
16+
cursor: str
17+
"""Use next_cursor with the same query and filters to fetch the next page."""
18+
19+
filters: Filters
20+
"""Additional constraints every result must match."""
21+
22+
tags: SequenceNotStr[str]
23+
"""Labels for filtering usage in the dashboard."""
24+
25+
26+
class Filters(TypedDict, total=False):
27+
"""Additional constraints every result must match."""
28+
29+
countries: SequenceNotStr[str]
30+
"""Countries people live in as two-letter codes, such as US or GB."""
31+
32+
years_of_experience_max: int
33+
"""Maximum years of professional experience."""
34+
35+
years_of_experience_min: int
36+
"""Minimum years of professional experience."""
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import List, Optional
4+
5+
from .._models import BaseModel
6+
7+
__all__ = ["PersonSearchResponse", "Result", "ResultLocation", "ResultRole", "ResultRoleCompany", "KeyMetadata"]
8+
9+
10+
class ResultLocation(BaseModel):
11+
"""Where the person lives."""
12+
13+
city: Optional[str] = None
14+
"""City."""
15+
16+
country_code: Optional[str] = None
17+
"""Country as a two-letter code, such as US or GB."""
18+
19+
region: Optional[str] = None
20+
"""State or region."""
21+
22+
23+
class ResultRoleCompany(BaseModel):
24+
"""Current employer, when known."""
25+
26+
domain: Optional[str] = None
27+
"""The company’s website domain."""
28+
29+
name: Optional[str] = None
30+
"""Company name."""
31+
32+
33+
class ResultRole(BaseModel):
34+
"""The person’s current role."""
35+
36+
company: Optional[ResultRoleCompany] = None
37+
"""Current employer, when known."""
38+
39+
functions: List[str]
40+
"""Areas of responsibility."""
41+
42+
seniority: Optional[str] = None
43+
"""Seniority level."""
44+
45+
started_on: Optional[str] = None
46+
"""Role start date (YYYY-MM-DD)."""
47+
48+
title: Optional[str] = None
49+
"""Job title."""
50+
51+
52+
class Result(BaseModel):
53+
"""A person matching your search; unavailable details are null or empty lists."""
54+
55+
description: Optional[str] = None
56+
"""What the person does."""
57+
58+
is_founder: Optional[bool] = None
59+
"""Whether the person is currently a founder or co-founder."""
60+
61+
location: ResultLocation
62+
"""Where the person lives."""
63+
64+
name: Optional[str] = None
65+
"""Full name."""
66+
67+
profiles: List[str]
68+
"""Public professional profile URLs."""
69+
70+
role: ResultRole
71+
"""The person’s current role."""
72+
73+
schools: List[str]
74+
"""Schools attended."""
75+
76+
skills: List[str]
77+
"""Professional skills."""
78+
79+
years_of_experience: Optional[int] = None
80+
"""Years of professional experience."""
81+
82+
83+
class KeyMetadata(BaseModel):
84+
"""Credits this request used and your remaining balance."""
85+
86+
credits_consumed: int
87+
"""Credits charged for this request."""
88+
89+
credits_remaining: int
90+
"""Credits remaining for your organization."""
91+
92+
93+
class PersonSearchResponse(BaseModel):
94+
request_id: str
95+
"""Unique ID of this request, also in `X-Request-Id`.
96+
97+
Include it when contacting support.
98+
"""
99+
100+
results: List[Result]
101+
"""Up to 10 matching people, most relevant first."""
102+
103+
key_metadata: Optional[KeyMetadata] = None
104+
"""Credits this request used and your remaining balance."""
105+
106+
next_cursor: Optional[str] = None
107+
"""Pass as cursor to fetch the next page; null when there are no more results."""

0 commit comments

Comments
 (0)