crisphive 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +219 -0
  4. data/Rakefile +10 -0
  5. data/crisphive.gemspec +40 -0
  6. data/git_push.sh +57 -0
  7. data/lib/crisphive/api/business_skill_api.rb +211 -0
  8. data/lib/crisphive/api/customer_api.rb +371 -0
  9. data/lib/crisphive/api/job_request_business_api.rb +449 -0
  10. data/lib/crisphive/api/job_types_api.rb +141 -0
  11. data/lib/crisphive/api/service_area_api.rb +148 -0
  12. data/lib/crisphive/api/technician_api.rb +163 -0
  13. data/lib/crisphive/api/vehicle_api.rb +157 -0
  14. data/lib/crisphive/api_client.rb +437 -0
  15. data/lib/crisphive/api_error.rb +58 -0
  16. data/lib/crisphive/configuration.rb +393 -0
  17. data/lib/crisphive/models/create_customer200_response.rb +250 -0
  18. data/lib/crisphive/models/create_job_request200_response.rb +250 -0
  19. data/lib/crisphive/models/customer.rb +235 -0
  20. data/lib/crisphive/models/customer_address.rb +295 -0
  21. data/lib/crisphive/models/customer_address_request.rb +475 -0
  22. data/lib/crisphive/models/customer_contact.rb +255 -0
  23. data/lib/crisphive/models/customer_create_request.rb +383 -0
  24. data/lib/crisphive/models/customer_create_response.rb +215 -0
  25. data/lib/crisphive/models/customer_list.rb +247 -0
  26. data/lib/crisphive/models/customer_list_item.rb +341 -0
  27. data/lib/crisphive/models/customer_profile.rb +321 -0
  28. data/lib/crisphive/models/customer_spending.rb +299 -0
  29. data/lib/crisphive/models/customer_tier_progress.rb +235 -0
  30. data/lib/crisphive/models/customer_update_request.rb +434 -0
  31. data/lib/crisphive/models/get_customer200_response.rb +250 -0
  32. data/lib/crisphive/models/get_job_request200_response.rb +250 -0
  33. data/lib/crisphive/models/get_job_request_timeline200_response.rb +250 -0
  34. data/lib/crisphive/models/get_job_type200_response.rb +250 -0
  35. data/lib/crisphive/models/get_service_area200_response.rb +250 -0
  36. data/lib/crisphive/models/get_technician200_response.rb +250 -0
  37. data/lib/crisphive/models/get_vehicle200_response.rb +250 -0
  38. data/lib/crisphive/models/job_date.rb +225 -0
  39. data/lib/crisphive/models/job_date_business_range.rb +263 -0
  40. data/lib/crisphive/models/job_date_period.rb +41 -0
  41. data/lib/crisphive/models/job_date_period_entry.rb +247 -0
  42. data/lib/crisphive/models/job_request.rb +537 -0
  43. data/lib/crisphive/models/job_request_action_audit_by.rb +259 -0
  44. data/lib/crisphive/models/job_request_action_audit_entry.rb +235 -0
  45. data/lib/crisphive/models/job_request_action_summary.rb +281 -0
  46. data/lib/crisphive/models/job_request_address_summary.rb +295 -0
  47. data/lib/crisphive/models/job_request_archive_summary.rb +245 -0
  48. data/lib/crisphive/models/job_request_arrival_window.rb +235 -0
  49. data/lib/crisphive/models/job_request_assigned_vehicle.rb +225 -0
  50. data/lib/crisphive/models/job_request_assignment_summary.rb +255 -0
  51. data/lib/crisphive/models/job_request_booking_windows.rb +247 -0
  52. data/lib/crisphive/models/job_request_business_time_range.rb +279 -0
  53. data/lib/crisphive/models/job_request_changes.rb +237 -0
  54. data/lib/crisphive/models/job_request_create_request.rb +339 -0
  55. data/lib/crisphive/models/job_request_create_response.rb +245 -0
  56. data/lib/crisphive/models/job_request_crew_member.rb +352 -0
  57. data/lib/crisphive/models/job_request_customer_summary.rb +245 -0
  58. data/lib/crisphive/models/job_request_day_windows.rb +227 -0
  59. data/lib/crisphive/models/job_request_job_date_business_range_request.rb +279 -0
  60. data/lib/crisphive/models/job_request_job_date_period_request.rb +268 -0
  61. data/lib/crisphive/models/job_request_job_date_request.rb +269 -0
  62. data/lib/crisphive/models/job_request_list.rb +227 -0
  63. data/lib/crisphive/models/job_request_period.rb +261 -0
  64. data/lib/crisphive/models/job_request_quote_summary.rb +245 -0
  65. data/lib/crisphive/models/job_request_rating_summary.rb +245 -0
  66. data/lib/crisphive/models/job_request_schedule.rb +289 -0
  67. data/lib/crisphive/models/job_request_session.rb +274 -0
  68. data/lib/crisphive/models/job_request_skill_summary.rb +255 -0
  69. data/lib/crisphive/models/job_request_status_summary.rb +225 -0
  70. data/lib/crisphive/models/job_request_technician_info.rb +265 -0
  71. data/lib/crisphive/models/job_request_timeline.rb +257 -0
  72. data/lib/crisphive/models/job_request_timeline_action.rb +311 -0
  73. data/lib/crisphive/models/job_request_timeline_event.rb +291 -0
  74. data/lib/crisphive/models/job_type.rb +309 -0
  75. data/lib/crisphive/models/list_customers200_response.rb +250 -0
  76. data/lib/crisphive/models/list_job_request_booking_windows200_response.rb +250 -0
  77. data/lib/crisphive/models/list_job_request_changes200_response.rb +250 -0
  78. data/lib/crisphive/models/list_job_requests200_response.rb +250 -0
  79. data/lib/crisphive/models/list_job_types200_response.rb +252 -0
  80. data/lib/crisphive/models/list_service_areas200_response.rb +250 -0
  81. data/lib/crisphive/models/list_skill_categories200_response.rb +250 -0
  82. data/lib/crisphive/models/list_skills200_response.rb +250 -0
  83. data/lib/crisphive/models/list_skills_by_category200_response.rb +250 -0
  84. data/lib/crisphive/models/list_technicians200_response.rb +250 -0
  85. data/lib/crisphive/models/list_vehicles200_response.rb +250 -0
  86. data/lib/crisphive/models/pagination.rb +250 -0
  87. data/lib/crisphive/models/response_envelope.rb +244 -0
  88. data/lib/crisphive/models/service_area.rb +315 -0
  89. data/lib/crisphive/models/service_area_list.rb +227 -0
  90. data/lib/crisphive/models/skill.rb +278 -0
  91. data/lib/crisphive/models/skill_by_category_list.rb +225 -0
  92. data/lib/crisphive/models/skill_category.rb +250 -0
  93. data/lib/crisphive/models/skill_category_list.rb +225 -0
  94. data/lib/crisphive/models/skill_list.rb +217 -0
  95. data/lib/crisphive/models/skill_summary.rb +255 -0
  96. data/lib/crisphive/models/technician.rb +499 -0
  97. data/lib/crisphive/models/technician_address.rb +275 -0
  98. data/lib/crisphive/models/technician_lead_ref.rb +225 -0
  99. data/lib/crisphive/models/technician_list.rb +247 -0
  100. data/lib/crisphive/models/technician_service_area_ref.rb +225 -0
  101. data/lib/crisphive/models/technician_status.rb +41 -0
  102. data/lib/crisphive/models/vehicle.rb +413 -0
  103. data/lib/crisphive/models/vehicle_list.rb +247 -0
  104. data/lib/crisphive/models/vehicle_owner.rb +225 -0
  105. data/lib/crisphive/version.rb +15 -0
  106. data/lib/crisphive.rb +134 -0
  107. data/spec/spec_helper.rb +111 -0
  108. metadata +220 -0
@@ -0,0 +1,449 @@
1
+ =begin
2
+ #CrispHive Developer API
3
+
4
+ #Public REST API for integrating CrispHive from your own backend. Authenticate every request with a secret API key as a Bearer token (`Authorization: Bearer chsk_live_…`). The key prefix selects the data environment: `chsk_live_…` → production (live), `chsk_test_…` → sandbox (isolated test). **Key scopes (restricted keys).** A key is either *full-access* (can call every endpoint below) or *restricted* to a set of permission codes chosen at creation — the same codes as the dashboard permission grid (e.g. `customers_view`, `job_create`, `team_manage`). A restricted key calling an endpoint outside its scope gets `403`. The full code list is the permission catalog (`GET /permission/modules` on the dashboard API). Create, scope, and revoke keys from the business dashboard. Every response is wrapped in the envelope `{ \"error_code\": 0, \"message\": \"Success\", \"data\": <payload> }`.
5
+
6
+ The version of the OpenAPI document: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.11.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Crisphive
16
+ class JobRequestBusinessApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create a job request (business actor)
23
+ # @param job_request_create_request [JobRequestCreateRequest] Booking payload
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [String] :x_timezone Customer IANA timezone
26
+ # @return [CreateJobRequest200Response]
27
+ def create_job_request(job_request_create_request, opts = {})
28
+ data, _status_code, _headers = create_job_request_with_http_info(job_request_create_request, opts)
29
+ data
30
+ end
31
+
32
+ # Create a job request (business actor)
33
+ # @param job_request_create_request [JobRequestCreateRequest] Booking payload
34
+ # @param [Hash] opts the optional parameters
35
+ # @option opts [String] :x_timezone Customer IANA timezone
36
+ # @return [Array<(CreateJobRequest200Response, Integer, Hash)>] CreateJobRequest200Response data, response status code and response headers
37
+ def create_job_request_with_http_info(job_request_create_request, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: JobRequestBusinessApi.create_job_request ...'
40
+ end
41
+ # verify the required parameter 'job_request_create_request' is set
42
+ if @api_client.config.client_side_validation && job_request_create_request.nil?
43
+ fail ArgumentError, "Missing the required parameter 'job_request_create_request' when calling JobRequestBusinessApi.create_job_request"
44
+ end
45
+ # resource path
46
+ local_var_path = '/job-requests'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
55
+ # HTTP header 'Content-Type'
56
+ content_type = @api_client.select_header_content_type(['application/json'])
57
+ if !content_type.nil?
58
+ header_params['Content-Type'] = content_type
59
+ end
60
+ header_params[:'X-Timezone'] = opts[:'x_timezone'] if !opts[:'x_timezone'].nil?
61
+
62
+ # form parameters
63
+ form_params = opts[:form_params] || {}
64
+
65
+ # http body (model)
66
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(job_request_create_request)
67
+
68
+ # return_type
69
+ return_type = opts[:debug_return_type] || 'CreateJobRequest200Response'
70
+
71
+ # auth_names
72
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
73
+
74
+ new_options = opts.merge(
75
+ :operation => :"JobRequestBusinessApi.create_job_request",
76
+ :header_params => header_params,
77
+ :query_params => query_params,
78
+ :form_params => form_params,
79
+ :body => post_body,
80
+ :auth_names => auth_names,
81
+ :return_type => return_type
82
+ )
83
+
84
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
85
+ if @api_client.config.debugging
86
+ @api_client.config.logger.debug "API called: JobRequestBusinessApi#create_job_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
87
+ end
88
+ return data, status_code, headers
89
+ end
90
+
91
+ # Get a job request
92
+ # @param id [String] Job request ID (UUID or short_code)
93
+ # @param [Hash] opts the optional parameters
94
+ # @return [GetJobRequest200Response]
95
+ def get_job_request(id, opts = {})
96
+ data, _status_code, _headers = get_job_request_with_http_info(id, opts)
97
+ data
98
+ end
99
+
100
+ # Get a job request
101
+ # @param id [String] Job request ID (UUID or short_code)
102
+ # @param [Hash] opts the optional parameters
103
+ # @return [Array<(GetJobRequest200Response, Integer, Hash)>] GetJobRequest200Response data, response status code and response headers
104
+ def get_job_request_with_http_info(id, opts = {})
105
+ if @api_client.config.debugging
106
+ @api_client.config.logger.debug 'Calling API: JobRequestBusinessApi.get_job_request ...'
107
+ end
108
+ # verify the required parameter 'id' is set
109
+ if @api_client.config.client_side_validation && id.nil?
110
+ fail ArgumentError, "Missing the required parameter 'id' when calling JobRequestBusinessApi.get_job_request"
111
+ end
112
+ # resource path
113
+ local_var_path = '/job-requests/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
114
+
115
+ # query parameters
116
+ query_params = opts[:query_params] || {}
117
+
118
+ # header parameters
119
+ header_params = opts[:header_params] || {}
120
+ # HTTP header 'Accept' (if needed)
121
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
122
+
123
+ # form parameters
124
+ form_params = opts[:form_params] || {}
125
+
126
+ # http body (model)
127
+ post_body = opts[:debug_body]
128
+
129
+ # return_type
130
+ return_type = opts[:debug_return_type] || 'GetJobRequest200Response'
131
+
132
+ # auth_names
133
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
134
+
135
+ new_options = opts.merge(
136
+ :operation => :"JobRequestBusinessApi.get_job_request",
137
+ :header_params => header_params,
138
+ :query_params => query_params,
139
+ :form_params => form_params,
140
+ :body => post_body,
141
+ :auth_names => auth_names,
142
+ :return_type => return_type
143
+ )
144
+
145
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
146
+ if @api_client.config.debugging
147
+ @api_client.config.logger.debug "API called: JobRequestBusinessApi#get_job_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
148
+ end
149
+ return data, status_code, headers
150
+ end
151
+
152
+ # Job timeline (business surface — also serves tech via BusinessAuth)
153
+ # Per-status events[] composed from workflow snapshot + scattered typed cols + action_audit. FE renders as the Job Timeline panel (completed step = filled check, current = outline ring, upcoming = empty). entered_at nil for upcoming steps + older jobs missing the typed-col backfill.
154
+ # @param id [String] Job request ID (UUID or short_code)
155
+ # @param [Hash] opts the optional parameters
156
+ # @return [GetJobRequestTimeline200Response]
157
+ def get_job_request_timeline(id, opts = {})
158
+ data, _status_code, _headers = get_job_request_timeline_with_http_info(id, opts)
159
+ data
160
+ end
161
+
162
+ # Job timeline (business surface — also serves tech via BusinessAuth)
163
+ # Per-status events[] composed from workflow snapshot + scattered typed cols + action_audit. FE renders as the Job Timeline panel (completed step &#x3D; filled check, current &#x3D; outline ring, upcoming &#x3D; empty). entered_at nil for upcoming steps + older jobs missing the typed-col backfill.
164
+ # @param id [String] Job request ID (UUID or short_code)
165
+ # @param [Hash] opts the optional parameters
166
+ # @return [Array<(GetJobRequestTimeline200Response, Integer, Hash)>] GetJobRequestTimeline200Response data, response status code and response headers
167
+ def get_job_request_timeline_with_http_info(id, opts = {})
168
+ if @api_client.config.debugging
169
+ @api_client.config.logger.debug 'Calling API: JobRequestBusinessApi.get_job_request_timeline ...'
170
+ end
171
+ # verify the required parameter 'id' is set
172
+ if @api_client.config.client_side_validation && id.nil?
173
+ fail ArgumentError, "Missing the required parameter 'id' when calling JobRequestBusinessApi.get_job_request_timeline"
174
+ end
175
+ # resource path
176
+ local_var_path = '/job-requests/{id}/timeline'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
177
+
178
+ # query parameters
179
+ query_params = opts[:query_params] || {}
180
+
181
+ # header parameters
182
+ header_params = opts[:header_params] || {}
183
+ # HTTP header 'Accept' (if needed)
184
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
185
+
186
+ # form parameters
187
+ form_params = opts[:form_params] || {}
188
+
189
+ # http body (model)
190
+ post_body = opts[:debug_body]
191
+
192
+ # return_type
193
+ return_type = opts[:debug_return_type] || 'GetJobRequestTimeline200Response'
194
+
195
+ # auth_names
196
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
197
+
198
+ new_options = opts.merge(
199
+ :operation => :"JobRequestBusinessApi.get_job_request_timeline",
200
+ :header_params => header_params,
201
+ :query_params => query_params,
202
+ :form_params => form_params,
203
+ :body => post_body,
204
+ :auth_names => auth_names,
205
+ :return_type => return_type
206
+ )
207
+
208
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
209
+ if @api_client.config.debugging
210
+ @api_client.config.logger.debug "API called: JobRequestBusinessApi#get_job_request_timeline\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
211
+ end
212
+ return data, status_code, headers
213
+ end
214
+
215
+ # Booking availability (business actor)
216
+ # @param x_timezone [String] Customer IANA timezone
217
+ # @param [Hash] opts the optional parameters
218
+ # @option opts [String] :from Start YYYY-MM-DD
219
+ # @option opts [String] :to End YYYY-MM-DD
220
+ # @return [ListJobRequestBookingWindows200Response]
221
+ def list_job_request_booking_windows(x_timezone, opts = {})
222
+ data, _status_code, _headers = list_job_request_booking_windows_with_http_info(x_timezone, opts)
223
+ data
224
+ end
225
+
226
+ # Booking availability (business actor)
227
+ # @param x_timezone [String] Customer IANA timezone
228
+ # @param [Hash] opts the optional parameters
229
+ # @option opts [String] :from Start YYYY-MM-DD
230
+ # @option opts [String] :to End YYYY-MM-DD
231
+ # @return [Array<(ListJobRequestBookingWindows200Response, Integer, Hash)>] ListJobRequestBookingWindows200Response data, response status code and response headers
232
+ def list_job_request_booking_windows_with_http_info(x_timezone, opts = {})
233
+ if @api_client.config.debugging
234
+ @api_client.config.logger.debug 'Calling API: JobRequestBusinessApi.list_job_request_booking_windows ...'
235
+ end
236
+ # verify the required parameter 'x_timezone' is set
237
+ if @api_client.config.client_side_validation && x_timezone.nil?
238
+ fail ArgumentError, "Missing the required parameter 'x_timezone' when calling JobRequestBusinessApi.list_job_request_booking_windows"
239
+ end
240
+ # resource path
241
+ local_var_path = '/job-requests/booking-windows'
242
+
243
+ # query parameters
244
+ query_params = opts[:query_params] || {}
245
+ query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
246
+ query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
247
+
248
+ # header parameters
249
+ header_params = opts[:header_params] || {}
250
+ # HTTP header 'Accept' (if needed)
251
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
252
+ header_params[:'X-Timezone'] = x_timezone
253
+
254
+ # form parameters
255
+ form_params = opts[:form_params] || {}
256
+
257
+ # http body (model)
258
+ post_body = opts[:debug_body]
259
+
260
+ # return_type
261
+ return_type = opts[:debug_return_type] || 'ListJobRequestBookingWindows200Response'
262
+
263
+ # auth_names
264
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
265
+
266
+ new_options = opts.merge(
267
+ :operation => :"JobRequestBusinessApi.list_job_request_booking_windows",
268
+ :header_params => header_params,
269
+ :query_params => query_params,
270
+ :form_params => form_params,
271
+ :body => post_body,
272
+ :auth_names => auth_names,
273
+ :return_type => return_type
274
+ )
275
+
276
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
277
+ if @api_client.config.debugging
278
+ @api_client.config.logger.debug "API called: JobRequestBusinessApi#list_job_request_booking_windows\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
279
+ end
280
+ return data, status_code, headers
281
+ end
282
+
283
+ # Poll for new & changed job requests (sync feed)
284
+ # Keep your own copy of bookings in sync WITHOUT re-listing everything: returns the job requests whose state changed (created, status transition, reschedule, soft-delete/archive) at or after the `since` cursor, ordered oldest-change-first (updated_at ASC). How to use it: (1) On your first poll OMIT `since` — the server primes the cursor at \"now\", returns no items and a `next_since`. (2) Store `next_since` and pass it as `since` on the next poll. (3) Apply each returned item to your store by UPSERTING on `id` (the server re-scans a ~5s safety window, so the same job may appear again — never blindly append). (4) If `has_more` is true the page filled to `limit` and more changes are already waiting — poll again immediately; otherwise wait your normal interval (e.g. 5–15s). This is NOT pagination — it is a time-keyed change feed. Use the paginated GET /job-requests for the initial bulk load, then this endpoint to stay live. Filters (status_keys, customer_id, …) narrow the feed to the slice you care about.
285
+ # @param [Hash] opts the optional parameters
286
+ # @option opts [String] :status_keys Comma-separated status slugs — only surface changes to jobs in these statuses
287
+ # @option opts [String] :priority Priority filter (normal|emergency)
288
+ # @option opts [String] :customer_id Only changes to this customer&#39;s jobs (UUID)
289
+ # @option opts [String] :technician_id Only changes to jobs assigned to this technician (UUID)
290
+ # @option opts [String] :scheduled_from Filter from (YYYY-MM-DD or RFC3339); range is [from, to)
291
+ # @option opts [String] :scheduled_to Filter to (YYYY-MM-DD or RFC3339), exclusive
292
+ # @option opts [String] :since RFC3339 cursor from the prior response&#39;s next_since. OMIT on the first poll to prime the cursor at server-now.
293
+ # @option opts [Integer] :limit Max changes per poll (default 15, max 1000). If the page fills, has_more&#x3D;true.
294
+ # @return [ListJobRequestChanges200Response]
295
+ def list_job_request_changes(opts = {})
296
+ data, _status_code, _headers = list_job_request_changes_with_http_info(opts)
297
+ data
298
+ end
299
+
300
+ # Poll for new &amp; changed job requests (sync feed)
301
+ # Keep your own copy of bookings in sync WITHOUT re-listing everything: returns the job requests whose state changed (created, status transition, reschedule, soft-delete/archive) at or after the &#x60;since&#x60; cursor, ordered oldest-change-first (updated_at ASC). How to use it: (1) On your first poll OMIT &#x60;since&#x60; — the server primes the cursor at \&quot;now\&quot;, returns no items and a &#x60;next_since&#x60;. (2) Store &#x60;next_since&#x60; and pass it as &#x60;since&#x60; on the next poll. (3) Apply each returned item to your store by UPSERTING on &#x60;id&#x60; (the server re-scans a ~5s safety window, so the same job may appear again — never blindly append). (4) If &#x60;has_more&#x60; is true the page filled to &#x60;limit&#x60; and more changes are already waiting — poll again immediately; otherwise wait your normal interval (e.g. 5–15s). This is NOT pagination — it is a time-keyed change feed. Use the paginated GET /job-requests for the initial bulk load, then this endpoint to stay live. Filters (status_keys, customer_id, …) narrow the feed to the slice you care about.
302
+ # @param [Hash] opts the optional parameters
303
+ # @option opts [String] :status_keys Comma-separated status slugs — only surface changes to jobs in these statuses
304
+ # @option opts [String] :priority Priority filter (normal|emergency)
305
+ # @option opts [String] :customer_id Only changes to this customer&#39;s jobs (UUID)
306
+ # @option opts [String] :technician_id Only changes to jobs assigned to this technician (UUID)
307
+ # @option opts [String] :scheduled_from Filter from (YYYY-MM-DD or RFC3339); range is [from, to)
308
+ # @option opts [String] :scheduled_to Filter to (YYYY-MM-DD or RFC3339), exclusive
309
+ # @option opts [String] :since RFC3339 cursor from the prior response&#39;s next_since. OMIT on the first poll to prime the cursor at server-now.
310
+ # @option opts [Integer] :limit Max changes per poll (default 15, max 1000). If the page fills, has_more&#x3D;true.
311
+ # @return [Array<(ListJobRequestChanges200Response, Integer, Hash)>] ListJobRequestChanges200Response data, response status code and response headers
312
+ def list_job_request_changes_with_http_info(opts = {})
313
+ if @api_client.config.debugging
314
+ @api_client.config.logger.debug 'Calling API: JobRequestBusinessApi.list_job_request_changes ...'
315
+ end
316
+ # resource path
317
+ local_var_path = '/job-requests/changes'
318
+
319
+ # query parameters
320
+ query_params = opts[:query_params] || {}
321
+ query_params[:'status_keys'] = opts[:'status_keys'] if !opts[:'status_keys'].nil?
322
+ query_params[:'priority'] = opts[:'priority'] if !opts[:'priority'].nil?
323
+ query_params[:'customer_id'] = opts[:'customer_id'] if !opts[:'customer_id'].nil?
324
+ query_params[:'technician_id'] = opts[:'technician_id'] if !opts[:'technician_id'].nil?
325
+ query_params[:'scheduled_from'] = opts[:'scheduled_from'] if !opts[:'scheduled_from'].nil?
326
+ query_params[:'scheduled_to'] = opts[:'scheduled_to'] if !opts[:'scheduled_to'].nil?
327
+ query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
328
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
329
+
330
+ # header parameters
331
+ header_params = opts[:header_params] || {}
332
+ # HTTP header 'Accept' (if needed)
333
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
334
+
335
+ # form parameters
336
+ form_params = opts[:form_params] || {}
337
+
338
+ # http body (model)
339
+ post_body = opts[:debug_body]
340
+
341
+ # return_type
342
+ return_type = opts[:debug_return_type] || 'ListJobRequestChanges200Response'
343
+
344
+ # auth_names
345
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
346
+
347
+ new_options = opts.merge(
348
+ :operation => :"JobRequestBusinessApi.list_job_request_changes",
349
+ :header_params => header_params,
350
+ :query_params => query_params,
351
+ :form_params => form_params,
352
+ :body => post_body,
353
+ :auth_names => auth_names,
354
+ :return_type => return_type
355
+ )
356
+
357
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
358
+ if @api_client.config.debugging
359
+ @api_client.config.logger.debug "API called: JobRequestBusinessApi#list_job_request_changes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
360
+ end
361
+ return data, status_code, headers
362
+ end
363
+
364
+ # List job requests
365
+ # @param [Hash] opts the optional parameters
366
+ # @option opts [String] :status_keys Comma-separated status slugs
367
+ # @option opts [String] :status active (default) | archived | all
368
+ # @option opts [String] :customer_id Customer UUID
369
+ # @option opts [String] :technician_id Technician UUID
370
+ # @option opts [String] :scheduled_from Filter from (YYYY-MM-DD or RFC3339); range is [from, to)
371
+ # @option opts [String] :scheduled_to Filter to (YYYY-MM-DD or RFC3339), exclusive
372
+ # @option opts [String] :q Search short_code or description (case-insensitive, partial match)
373
+ # @option opts [String] :sort Sort key
374
+ # @option opts [Integer] :page Page number
375
+ # @option opts [Integer] :limit Page size
376
+ # @return [ListJobRequests200Response]
377
+ def list_job_requests(opts = {})
378
+ data, _status_code, _headers = list_job_requests_with_http_info(opts)
379
+ data
380
+ end
381
+
382
+ # List job requests
383
+ # @param [Hash] opts the optional parameters
384
+ # @option opts [String] :status_keys Comma-separated status slugs
385
+ # @option opts [String] :status active (default) | archived | all
386
+ # @option opts [String] :customer_id Customer UUID
387
+ # @option opts [String] :technician_id Technician UUID
388
+ # @option opts [String] :scheduled_from Filter from (YYYY-MM-DD or RFC3339); range is [from, to)
389
+ # @option opts [String] :scheduled_to Filter to (YYYY-MM-DD or RFC3339), exclusive
390
+ # @option opts [String] :q Search short_code or description (case-insensitive, partial match)
391
+ # @option opts [String] :sort Sort key
392
+ # @option opts [Integer] :page Page number
393
+ # @option opts [Integer] :limit Page size
394
+ # @return [Array<(ListJobRequests200Response, Integer, Hash)>] ListJobRequests200Response data, response status code and response headers
395
+ def list_job_requests_with_http_info(opts = {})
396
+ if @api_client.config.debugging
397
+ @api_client.config.logger.debug 'Calling API: JobRequestBusinessApi.list_job_requests ...'
398
+ end
399
+ # resource path
400
+ local_var_path = '/job-requests'
401
+
402
+ # query parameters
403
+ query_params = opts[:query_params] || {}
404
+ query_params[:'status_keys'] = opts[:'status_keys'] if !opts[:'status_keys'].nil?
405
+ query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
406
+ query_params[:'customer_id'] = opts[:'customer_id'] if !opts[:'customer_id'].nil?
407
+ query_params[:'technician_id'] = opts[:'technician_id'] if !opts[:'technician_id'].nil?
408
+ query_params[:'scheduled_from'] = opts[:'scheduled_from'] if !opts[:'scheduled_from'].nil?
409
+ query_params[:'scheduled_to'] = opts[:'scheduled_to'] if !opts[:'scheduled_to'].nil?
410
+ query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
411
+ query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
412
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
413
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
414
+
415
+ # header parameters
416
+ header_params = opts[:header_params] || {}
417
+ # HTTP header 'Accept' (if needed)
418
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
419
+
420
+ # form parameters
421
+ form_params = opts[:form_params] || {}
422
+
423
+ # http body (model)
424
+ post_body = opts[:debug_body]
425
+
426
+ # return_type
427
+ return_type = opts[:debug_return_type] || 'ListJobRequests200Response'
428
+
429
+ # auth_names
430
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
431
+
432
+ new_options = opts.merge(
433
+ :operation => :"JobRequestBusinessApi.list_job_requests",
434
+ :header_params => header_params,
435
+ :query_params => query_params,
436
+ :form_params => form_params,
437
+ :body => post_body,
438
+ :auth_names => auth_names,
439
+ :return_type => return_type
440
+ )
441
+
442
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
443
+ if @api_client.config.debugging
444
+ @api_client.config.logger.debug "API called: JobRequestBusinessApi#list_job_requests\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
445
+ end
446
+ return data, status_code, headers
447
+ end
448
+ end
449
+ end
@@ -0,0 +1,141 @@
1
+ =begin
2
+ #CrispHive Developer API
3
+
4
+ #Public REST API for integrating CrispHive from your own backend. Authenticate every request with a secret API key as a Bearer token (`Authorization: Bearer chsk_live_…`). The key prefix selects the data environment: `chsk_live_…` → production (live), `chsk_test_…` → sandbox (isolated test). **Key scopes (restricted keys).** A key is either *full-access* (can call every endpoint below) or *restricted* to a set of permission codes chosen at creation — the same codes as the dashboard permission grid (e.g. `customers_view`, `job_create`, `team_manage`). A restricted key calling an endpoint outside its scope gets `403`. The full code list is the permission catalog (`GET /permission/modules` on the dashboard API). Create, scope, and revoke keys from the business dashboard. Every response is wrapped in the envelope `{ \"error_code\": 0, \"message\": \"Success\", \"data\": <payload> }`.
5
+
6
+ The version of the OpenAPI document: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.11.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Crisphive
16
+ class JobTypesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Get a job type
23
+ # @param id [String] Job Type ID
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [GetJobType200Response]
26
+ def get_job_type(id, opts = {})
27
+ data, _status_code, _headers = get_job_type_with_http_info(id, opts)
28
+ data
29
+ end
30
+
31
+ # Get a job type
32
+ # @param id [String] Job Type ID
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(GetJobType200Response, Integer, Hash)>] GetJobType200Response data, response status code and response headers
35
+ def get_job_type_with_http_info(id, opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: JobTypesApi.get_job_type ...'
38
+ end
39
+ # verify the required parameter 'id' is set
40
+ if @api_client.config.client_side_validation && id.nil?
41
+ fail ArgumentError, "Missing the required parameter 'id' when calling JobTypesApi.get_job_type"
42
+ end
43
+ # resource path
44
+ local_var_path = '/job-types/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
45
+
46
+ # query parameters
47
+ query_params = opts[:query_params] || {}
48
+
49
+ # header parameters
50
+ header_params = opts[:header_params] || {}
51
+ # HTTP header 'Accept' (if needed)
52
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
53
+
54
+ # form parameters
55
+ form_params = opts[:form_params] || {}
56
+
57
+ # http body (model)
58
+ post_body = opts[:debug_body]
59
+
60
+ # return_type
61
+ return_type = opts[:debug_return_type] || 'GetJobType200Response'
62
+
63
+ # auth_names
64
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
65
+
66
+ new_options = opts.merge(
67
+ :operation => :"JobTypesApi.get_job_type",
68
+ :header_params => header_params,
69
+ :query_params => query_params,
70
+ :form_params => form_params,
71
+ :body => post_body,
72
+ :auth_names => auth_names,
73
+ :return_type => return_type
74
+ )
75
+
76
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
77
+ if @api_client.config.debugging
78
+ @api_client.config.logger.debug "API called: JobTypesApi#get_job_type\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
79
+ end
80
+ return data, status_code, headers
81
+ end
82
+
83
+ # List job types
84
+ # @param [Hash] opts the optional parameters
85
+ # @option opts [String] :status Filter by status (active|inactive)
86
+ # @return [ListJobTypes200Response]
87
+ def list_job_types(opts = {})
88
+ data, _status_code, _headers = list_job_types_with_http_info(opts)
89
+ data
90
+ end
91
+
92
+ # List job types
93
+ # @param [Hash] opts the optional parameters
94
+ # @option opts [String] :status Filter by status (active|inactive)
95
+ # @return [Array<(ListJobTypes200Response, Integer, Hash)>] ListJobTypes200Response data, response status code and response headers
96
+ def list_job_types_with_http_info(opts = {})
97
+ if @api_client.config.debugging
98
+ @api_client.config.logger.debug 'Calling API: JobTypesApi.list_job_types ...'
99
+ end
100
+ # resource path
101
+ local_var_path = '/job-types'
102
+
103
+ # query parameters
104
+ query_params = opts[:query_params] || {}
105
+ query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
106
+
107
+ # header parameters
108
+ header_params = opts[:header_params] || {}
109
+ # HTTP header 'Accept' (if needed)
110
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
111
+
112
+ # form parameters
113
+ form_params = opts[:form_params] || {}
114
+
115
+ # http body (model)
116
+ post_body = opts[:debug_body]
117
+
118
+ # return_type
119
+ return_type = opts[:debug_return_type] || 'ListJobTypes200Response'
120
+
121
+ # auth_names
122
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
123
+
124
+ new_options = opts.merge(
125
+ :operation => :"JobTypesApi.list_job_types",
126
+ :header_params => header_params,
127
+ :query_params => query_params,
128
+ :form_params => form_params,
129
+ :body => post_body,
130
+ :auth_names => auth_names,
131
+ :return_type => return_type
132
+ )
133
+
134
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
135
+ if @api_client.config.debugging
136
+ @api_client.config.logger.debug "API called: JobTypesApi#list_job_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
137
+ end
138
+ return data, status_code, headers
139
+ end
140
+ end
141
+ end