Skip to content

Commit 43787a2

Browse files
author
stlc-bot
committed
feat(people): publish people search in the API specification (#2094)
Stainless-Generated-From: f72caffdc8ae712c719b3c097ad17e291cdfeb2e
1 parent df6e825 commit 43787a2

15 files changed

Lines changed: 1238 additions & 1 deletion

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

‎lib/context_dev.rb‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@
121121
require_relative "context_dev/models/parse_handle_response"
122122
require_relative "context_dev/models/person_enrich_params"
123123
require_relative "context_dev/models/person_enrich_response"
124+
require_relative "context_dev/models/person_search_params"
125+
require_relative "context_dev/models/person_search_response"
124126
require_relative "context_dev/models/retry_config"
125127
require_relative "context_dev/models/utility_prefetch_params"
126128
require_relative "context_dev/models/utility_prefetch_response"

‎lib/context_dev/models.rb‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ module ContextDev
111111

112112
PersonEnrichParams = ContextDev::Models::PersonEnrichParams
113113

114+
PersonSearchParams = ContextDev::Models::PersonSearchParams
115+
114116
RetryConfig = ContextDev::Models::RetryConfig
115117

116118
UtilityPrefetchParams = ContextDev::Models::UtilityPrefetchParams
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# frozen_string_literal: true
2+
3+
module ContextDev
4+
module Models
5+
# @see ContextDev::Resources::People#search
6+
class PersonSearchParams < ContextDev::Internal::Type::BaseModel
7+
extend ContextDev::Internal::Type::RequestParameters::Converter
8+
include ContextDev::Internal::Type::RequestParameters
9+
10+
# @!attribute query
11+
# Describe the people to find.
12+
#
13+
# @return [String]
14+
required :query, String
15+
16+
# @!attribute cursor
17+
# Use next_cursor with the same query and filters to fetch the next page.
18+
#
19+
# @return [String, nil]
20+
optional :cursor, String
21+
22+
# @!attribute filters
23+
# Additional constraints every result must match.
24+
#
25+
# @return [ContextDev::Models::PersonSearchParams::Filters, nil]
26+
optional :filters, -> { ContextDev::PersonSearchParams::Filters }
27+
28+
# @!attribute tags
29+
# Labels for filtering usage in the dashboard.
30+
#
31+
# @return [Array<String>, nil]
32+
optional :tags, ContextDev::Internal::Type::ArrayOf[String]
33+
34+
# @!method initialize(query:, cursor: nil, filters: nil, tags: nil, request_options: {})
35+
# @param query [String] Describe the people to find.
36+
#
37+
# @param cursor [String] Use next_cursor with the same query and filters to fetch the next page.
38+
#
39+
# @param filters [ContextDev::Models::PersonSearchParams::Filters] Additional constraints every result must match.
40+
#
41+
# @param tags [Array<String>] Labels for filtering usage in the dashboard.
42+
#
43+
# @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}]
44+
45+
class Filters < ContextDev::Internal::Type::BaseModel
46+
# @!attribute countries
47+
# Countries people live in as two-letter codes, such as US or GB.
48+
#
49+
# @return [Array<String>, nil]
50+
optional :countries, ContextDev::Internal::Type::ArrayOf[String]
51+
52+
# @!attribute years_of_experience_max
53+
# Maximum years of professional experience.
54+
#
55+
# @return [Integer, nil]
56+
optional :years_of_experience_max, Integer
57+
58+
# @!attribute years_of_experience_min
59+
# Minimum years of professional experience.
60+
#
61+
# @return [Integer, nil]
62+
optional :years_of_experience_min, Integer
63+
64+
# @!method initialize(countries: nil, years_of_experience_max: nil, years_of_experience_min: nil)
65+
# Additional constraints every result must match.
66+
#
67+
# @param countries [Array<String>] Countries people live in as two-letter codes, such as US or GB.
68+
#
69+
# @param years_of_experience_max [Integer] Maximum years of professional experience.
70+
#
71+
# @param years_of_experience_min [Integer] Minimum years of professional experience.
72+
end
73+
end
74+
end
75+
end
Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
# frozen_string_literal: true
2+
3+
module ContextDev
4+
module Models
5+
# @see ContextDev::Resources::People#search
6+
class PersonSearchResponse < ContextDev::Internal::Type::BaseModel
7+
# @!attribute request_id
8+
# Unique ID of this request, also in `X-Request-Id`. Include it when contacting
9+
# support.
10+
#
11+
# @return [String]
12+
required :request_id, String
13+
14+
# @!attribute results
15+
# Up to 10 matching people, most relevant first.
16+
#
17+
# @return [Array<ContextDev::Models::PersonSearchResponse::Result>]
18+
required :results,
19+
-> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::PersonSearchResponse::Result] }
20+
21+
# @!attribute key_metadata
22+
# Credits this request used and your remaining balance.
23+
#
24+
# @return [ContextDev::Models::PersonSearchResponse::KeyMetadata, nil]
25+
optional :key_metadata, -> { ContextDev::Models::PersonSearchResponse::KeyMetadata }
26+
27+
# @!attribute next_cursor
28+
# Pass as cursor to fetch the next page; null when there are no more results.
29+
#
30+
# @return [String, nil]
31+
optional :next_cursor, String, nil?: true
32+
33+
# @!method initialize(request_id:, results:, key_metadata: nil, next_cursor: nil)
34+
# Some parameter documentations has been truncated, see
35+
# {ContextDev::Models::PersonSearchResponse} for more details.
36+
#
37+
# @param request_id [String] Unique ID of this request, also in `X-Request-Id`. Include it when contacting su
38+
#
39+
# @param results [Array<ContextDev::Models::PersonSearchResponse::Result>] Up to 10 matching people, most relevant first.
40+
#
41+
# @param key_metadata [ContextDev::Models::PersonSearchResponse::KeyMetadata] Credits this request used and your remaining balance.
42+
#
43+
# @param next_cursor [String, nil] Pass as cursor to fetch the next page; null when there are no more results.
44+
45+
class Result < ContextDev::Internal::Type::BaseModel
46+
# @!attribute description
47+
# What the person does.
48+
#
49+
# @return [String, nil]
50+
required :description, String, nil?: true
51+
52+
# @!attribute is_founder
53+
# Whether the person is currently a founder or co-founder.
54+
#
55+
# @return [Boolean, nil]
56+
required :is_founder, ContextDev::Internal::Type::Boolean, nil?: true
57+
58+
# @!attribute location
59+
# Where the person lives.
60+
#
61+
# @return [ContextDev::Models::PersonSearchResponse::Result::Location]
62+
required :location, -> { ContextDev::Models::PersonSearchResponse::Result::Location }
63+
64+
# @!attribute name
65+
# Full name.
66+
#
67+
# @return [String, nil]
68+
required :name, String, nil?: true
69+
70+
# @!attribute profiles
71+
# Public professional profile URLs.
72+
#
73+
# @return [Array<String>]
74+
required :profiles, ContextDev::Internal::Type::ArrayOf[String]
75+
76+
# @!attribute role
77+
# The person’s current role.
78+
#
79+
# @return [ContextDev::Models::PersonSearchResponse::Result::Role]
80+
required :role, -> { ContextDev::Models::PersonSearchResponse::Result::Role }
81+
82+
# @!attribute schools
83+
# Schools attended.
84+
#
85+
# @return [Array<String>]
86+
required :schools, ContextDev::Internal::Type::ArrayOf[String]
87+
88+
# @!attribute skills
89+
# Professional skills.
90+
#
91+
# @return [Array<String>]
92+
required :skills, ContextDev::Internal::Type::ArrayOf[String]
93+
94+
# @!attribute years_of_experience
95+
# Years of professional experience.
96+
#
97+
# @return [Integer, nil]
98+
required :years_of_experience, Integer, nil?: true
99+
100+
# @!method initialize(description:, is_founder:, location:, name:, profiles:, role:, schools:, skills:, years_of_experience:)
101+
# A person matching your search; unavailable details are null or empty lists.
102+
#
103+
# @param description [String, nil] What the person does.
104+
#
105+
# @param is_founder [Boolean, nil] Whether the person is currently a founder or co-founder.
106+
#
107+
# @param location [ContextDev::Models::PersonSearchResponse::Result::Location] Where the person lives.
108+
#
109+
# @param name [String, nil] Full name.
110+
#
111+
# @param profiles [Array<String>] Public professional profile URLs.
112+
#
113+
# @param role [ContextDev::Models::PersonSearchResponse::Result::Role] The person’s current role.
114+
#
115+
# @param schools [Array<String>] Schools attended.
116+
#
117+
# @param skills [Array<String>] Professional skills.
118+
#
119+
# @param years_of_experience [Integer, nil] Years of professional experience.
120+
121+
# @see ContextDev::Models::PersonSearchResponse::Result#location
122+
class Location < ContextDev::Internal::Type::BaseModel
123+
# @!attribute city
124+
# City.
125+
#
126+
# @return [String, nil]
127+
required :city, String, nil?: true
128+
129+
# @!attribute country_code
130+
# Country as a two-letter code, such as US or GB.
131+
#
132+
# @return [String, nil]
133+
required :country_code, String, nil?: true
134+
135+
# @!attribute region
136+
# State or region.
137+
#
138+
# @return [String, nil]
139+
required :region, String, nil?: true
140+
141+
# @!method initialize(city:, country_code:, region:)
142+
# Where the person lives.
143+
#
144+
# @param city [String, nil] City.
145+
#
146+
# @param country_code [String, nil] Country as a two-letter code, such as US or GB.
147+
#
148+
# @param region [String, nil] State or region.
149+
end
150+
151+
# @see ContextDev::Models::PersonSearchResponse::Result#role
152+
class Role < ContextDev::Internal::Type::BaseModel
153+
# @!attribute company
154+
# Current employer, when known.
155+
#
156+
# @return [ContextDev::Models::PersonSearchResponse::Result::Role::Company, nil]
157+
required :company, -> { ContextDev::Models::PersonSearchResponse::Result::Role::Company }, nil?: true
158+
159+
# @!attribute functions
160+
# Areas of responsibility.
161+
#
162+
# @return [Array<String>]
163+
required :functions, ContextDev::Internal::Type::ArrayOf[String]
164+
165+
# @!attribute seniority
166+
# Seniority level.
167+
#
168+
# @return [String, nil]
169+
required :seniority, String, nil?: true
170+
171+
# @!attribute started_on
172+
# Role start date (YYYY-MM-DD).
173+
#
174+
# @return [String, nil]
175+
required :started_on, String, nil?: true
176+
177+
# @!attribute title
178+
# Job title.
179+
#
180+
# @return [String, nil]
181+
required :title, String, nil?: true
182+
183+
# @!method initialize(company:, functions:, seniority:, started_on:, title:)
184+
# The person’s current role.
185+
#
186+
# @param company [ContextDev::Models::PersonSearchResponse::Result::Role::Company, nil] Current employer, when known.
187+
#
188+
# @param functions [Array<String>] Areas of responsibility.
189+
#
190+
# @param seniority [String, nil] Seniority level.
191+
#
192+
# @param started_on [String, nil] Role start date (YYYY-MM-DD).
193+
#
194+
# @param title [String, nil] Job title.
195+
196+
# @see ContextDev::Models::PersonSearchResponse::Result::Role#company
197+
class Company < ContextDev::Internal::Type::BaseModel
198+
# @!attribute domain
199+
# The company’s website domain.
200+
#
201+
# @return [String, nil]
202+
required :domain, String, nil?: true
203+
204+
# @!attribute name
205+
# Company name.
206+
#
207+
# @return [String, nil]
208+
required :name, String, nil?: true
209+
210+
# @!method initialize(domain:, name:)
211+
# Current employer, when known.
212+
#
213+
# @param domain [String, nil] The company’s website domain.
214+
#
215+
# @param name [String, nil] Company name.
216+
end
217+
end
218+
end
219+
220+
# @see ContextDev::Models::PersonSearchResponse#key_metadata
221+
class KeyMetadata < ContextDev::Internal::Type::BaseModel
222+
# @!attribute credits_consumed
223+
# Credits charged for this request.
224+
#
225+
# @return [Integer]
226+
required :credits_consumed, Integer
227+
228+
# @!attribute credits_remaining
229+
# Credits remaining for your organization.
230+
#
231+
# @return [Integer]
232+
required :credits_remaining, Integer
233+
234+
# @!method initialize(credits_consumed:, credits_remaining:)
235+
# Credits this request used and your remaining balance.
236+
#
237+
# @param credits_consumed [Integer] Credits charged for this request.
238+
#
239+
# @param credits_remaining [Integer] Credits remaining for your organization.
240+
end
241+
end
242+
end
243+
end

‎lib/context_dev/resources/people.rb‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,34 @@ def enrich(params = {})
4545
)
4646
end
4747

48+
# Find people with a natural-language query.
49+
#
50+
# @overload search(query:, cursor: nil, filters: nil, tags: nil, request_options: {})
51+
#
52+
# @param query [String] Describe the people to find.
53+
#
54+
# @param cursor [String] Use next_cursor with the same query and filters to fetch the next page.
55+
#
56+
# @param filters [ContextDev::Models::PersonSearchParams::Filters] Additional constraints every result must match.
57+
#
58+
# @param tags [Array<String>] Labels for filtering usage in the dashboard.
59+
#
60+
# @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil]
61+
#
62+
# @return [ContextDev::Models::PersonSearchResponse]
63+
#
64+
# @see ContextDev::Models::PersonSearchParams
65+
def search(params)
66+
parsed, options = ContextDev::PersonSearchParams.dump_request(params)
67+
@client.request(
68+
method: :post,
69+
path: "people/search",
70+
body: parsed,
71+
model: ContextDev::Models::PersonSearchResponse,
72+
options: options
73+
)
74+
end
75+
4876
# @api private
4977
#
5078
# @param client [ContextDev::Client]

‎rbi/context_dev/models.rbi‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ module ContextDev
7676

7777
PersonEnrichParams = ContextDev::Models::PersonEnrichParams
7878

79+
PersonSearchParams = ContextDev::Models::PersonSearchParams
80+
7981
RetryConfig = ContextDev::Models::RetryConfig
8082

8183
UtilityPrefetchParams = ContextDev::Models::UtilityPrefetchParams

0 commit comments

Comments
 (0)