crisphive 0.2.0 → 0.3.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 (107) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +98 -10
  3. data/lib/crisphive/api/business_skill_api.rb +348 -0
  4. data/lib/crisphive/api/customer_api.rb +7 -4
  5. data/lib/crisphive/api/job_request_business_api.rb +243 -27
  6. data/lib/crisphive/api/job_types_api.rb +208 -0
  7. data/lib/crisphive/api/permission_api.rb +79 -0
  8. data/lib/crisphive/api/service_area_api.rb +208 -0
  9. data/lib/crisphive/api/technician_api.rb +8 -8
  10. data/lib/crisphive/api/technician_time_off_api.rb +240 -0
  11. data/lib/crisphive/api/vehicle_api.rb +208 -0
  12. data/lib/crisphive/api/webhooks_api.rb +213 -0
  13. data/lib/crisphive/models/api_internal_techtimeoff_actions.rb +232 -0
  14. data/lib/crisphive/models/api_internal_techtimeoff_status.rb +42 -0
  15. data/lib/crisphive/models/assignable_group.rb +289 -0
  16. data/lib/crisphive/models/book_and_confirm_job_request200_response.rb +253 -0
  17. data/lib/crisphive/models/commit_absence_resolve200_response.rb +253 -0
  18. data/lib/crisphive/models/create_job_type200_response.rb +253 -0
  19. data/lib/crisphive/models/create_service_area200_response.rb +253 -0
  20. data/lib/crisphive/models/create_skill200_response.rb +253 -0
  21. data/lib/crisphive/models/create_skill_category200_response.rb +253 -0
  22. data/lib/crisphive/models/create_technician_time_off200_response.rb +253 -0
  23. data/lib/crisphive/models/create_vehicle200_response.rb +253 -0
  24. data/lib/crisphive/models/create_webhook_endpoint200_response.rb +253 -0
  25. data/lib/crisphive/models/customer.rb +11 -1
  26. data/lib/crisphive/models/customer_contact.rb +25 -5
  27. data/lib/crisphive/models/customer_create_request.rb +12 -2
  28. data/lib/crisphive/models/customer_list_item.rb +11 -1
  29. data/lib/crisphive/models/customer_quick_books_link.rb +235 -0
  30. data/lib/crisphive/models/customer_service_area_ref.rb +225 -0
  31. data/lib/crisphive/models/customer_technician_ref.rb +225 -0
  32. data/lib/crisphive/models/customer_update_request.rb +23 -20
  33. data/lib/crisphive/models/internal_jobrequest_http_address_req.rb +475 -0
  34. data/lib/crisphive/models/job_request.rb +11 -1
  35. data/lib/crisphive/models/job_request_absence_alternative.rb +356 -0
  36. data/lib/crisphive/models/job_request_absence_alternative_cost.rb +275 -0
  37. data/lib/crisphive/models/job_request_absence_assignment.rb +319 -0
  38. data/lib/crisphive/models/job_request_absence_commit_request.rb +296 -0
  39. data/lib/crisphive/models/job_request_absence_notification.rb +283 -0
  40. data/lib/crisphive/models/job_request_absence_plan.rb +322 -0
  41. data/lib/crisphive/models/job_request_absence_preview_request.rb +280 -0
  42. data/lib/crisphive/models/job_request_absence_resolved_job.rb +499 -0
  43. data/lib/crisphive/models/job_request_absence_solver.rb +289 -0
  44. data/lib/crisphive/models/job_request_absence_time_off.rb +281 -0
  45. data/lib/crisphive/models/job_request_absence_unresolved_job.rb +364 -0
  46. data/lib/crisphive/models/job_request_action_summary.rb +1 -1
  47. data/lib/crisphive/models/job_request_attention_summary.rb +2 -2
  48. data/lib/crisphive/models/job_request_blocker.rb +363 -0
  49. data/lib/crisphive/models/job_request_blocker_ref.rb +223 -0
  50. data/lib/crisphive/models/job_request_book_and_confirm_customer.rb +302 -0
  51. data/lib/crisphive/models/job_request_book_and_confirm_emergency.rb +315 -0
  52. data/lib/crisphive/models/job_request_book_and_confirm_emergency_result.rb +279 -0
  53. data/lib/crisphive/models/job_request_book_and_confirm_refusal.rb +280 -0
  54. data/lib/crisphive/models/job_request_book_and_confirm_request.rb +466 -0
  55. data/lib/crisphive/models/job_request_book_and_confirm_response.rb +295 -0
  56. data/lib/crisphive/models/job_request_confirm_request.rb +14 -4
  57. data/lib/crisphive/models/job_request_create_request.rb +1 -1
  58. data/lib/crisphive/models/job_request_emergency_candidate.rb +26 -4
  59. data/lib/crisphive/models/job_request_emergency_candidates.rb +1 -1
  60. data/lib/crisphive/models/job_request_emergency_candidates_request.rb +24 -11
  61. data/lib/crisphive/models/job_request_emergency_commit_request.rb +11 -1
  62. data/lib/crisphive/models/job_request_emergency_inline_job.rb +353 -0
  63. data/lib/crisphive/models/job_request_emergency_plan.rb +25 -3
  64. data/lib/crisphive/models/job_request_emergency_preview_request.rb +24 -11
  65. data/lib/crisphive/models/job_request_move_commit_req.rb +11 -1
  66. data/lib/crisphive/models/job_request_move_plan.rb +11 -1
  67. data/lib/crisphive/models/job_request_move_preview_req.rb +11 -1
  68. data/lib/crisphive/models/job_request_move_warning.rb +32 -8
  69. data/lib/crisphive/models/job_request_priority_update_result.rb +217 -0
  70. data/lib/crisphive/models/job_request_quote_request.rb +14 -11
  71. data/lib/crisphive/models/job_request_reassign_fallback.rb +287 -0
  72. data/lib/crisphive/models/job_request_skill_summary.rb +1 -1
  73. data/lib/crisphive/models/job_request_status_summary.rb +1 -1
  74. data/lib/crisphive/models/job_request_time_segments.rb +2 -2
  75. data/lib/crisphive/models/job_type.rb +42 -2
  76. data/lib/crisphive/models/job_type_create_request.rb +399 -0
  77. data/lib/crisphive/models/job_type_create_response.rb +215 -0
  78. data/lib/crisphive/models/job_type_update_request.rb +400 -0
  79. data/lib/crisphive/models/list_assignable_groups200_response.rb +255 -0
  80. data/lib/crisphive/models/list_technician_time_off200_response.rb +253 -0
  81. data/lib/crisphive/models/list_webhook_event_types200_response.rb +255 -0
  82. data/lib/crisphive/models/quote_job_request200_response.rb +253 -0
  83. data/lib/crisphive/models/service_area.rb +21 -1
  84. data/lib/crisphive/models/service_area_create_request.rb +455 -0
  85. data/lib/crisphive/models/service_area_create_response.rb +215 -0
  86. data/lib/crisphive/models/service_area_update_request.rb +451 -0
  87. data/lib/crisphive/models/skill_category_create_request.rb +270 -0
  88. data/lib/crisphive/models/skill_category_create_response.rb +215 -0
  89. data/lib/crisphive/models/skill_create_request.rb +270 -0
  90. data/lib/crisphive/models/skill_create_response.rb +215 -0
  91. data/lib/crisphive/models/skill_update_request.rb +281 -0
  92. data/lib/crisphive/models/technician.rb +64 -2
  93. data/lib/crisphive/models/technician_create_request.rb +14 -11
  94. data/lib/crisphive/models/technician_time_off.rb +334 -0
  95. data/lib/crisphive/models/technician_time_off_create_request.rb +285 -0
  96. data/lib/crisphive/models/technician_time_off_create_response.rb +215 -0
  97. data/lib/crisphive/models/technician_time_off_list.rb +246 -0
  98. data/lib/crisphive/models/technician_update_request.rb +2 -2
  99. data/lib/crisphive/models/vehicle_create_request.rb +420 -0
  100. data/lib/crisphive/models/vehicle_create_response.rb +215 -0
  101. data/lib/crisphive/models/vehicle_update_request.rb +440 -0
  102. data/lib/crisphive/models/webhook_create_request.rb +320 -0
  103. data/lib/crisphive/models/webhook_create_response.rb +391 -0
  104. data/lib/crisphive/models/webhook_verification.rb +235 -0
  105. data/lib/crisphive/version.rb +1 -1
  106. data/lib/crisphive.rb +66 -0
  107. metadata +68 -2
@@ -0,0 +1,240 @@
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 TechnicianTimeOffApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Record a technician's time off (sick day, leave)
23
+ # Records a time-off block for a technician. The record is created PENDING; a business staff member approves it on the dashboard — EXCEPT for the sick-call flow, where `commitAbsenceResolve` approves the pending record that covers the absence itself. `start_datetime`/`end_datetime` are RFC3339 INSTANTS with an offset (e.g. `2030-06-15T04:00:00Z` for midnight Toronto), unlike the business-local naive datetimes used by scheduling calls — a whole day off is that day's local midnight to the next in UTC. Overlapping an existing record for the same technician is refused (`TIME_OFF_OVERLAP`); list `GET /technicians/{id}/time-off` first. Creating a record immediately flags the technician's jobs in that window as needing attention on the dispatch board. Supports Idempotency-Key.
24
+ # @param technician_time_off_create_request [TechnicianTimeOffCreateRequest] Time off details
25
+ # @param [Hash] opts the optional parameters
26
+ # @option opts [String] :idempotency_key Unique key making retries safe: a repeat send with the same key replays the original response (header Idempotent-Replayed: true) instead of re-running the operation. Reusing a key with a different body returns 422 IDEMPOTENCY_KEY_REUSE.
27
+ # @return [CreateTechnicianTimeOff200Response]
28
+ def create_technician_time_off(technician_time_off_create_request, opts = {})
29
+ data, _status_code, _headers = create_technician_time_off_with_http_info(technician_time_off_create_request, opts)
30
+ data
31
+ end
32
+
33
+ # Record a technician&#39;s time off (sick day, leave)
34
+ # Records a time-off block for a technician. The record is created PENDING; a business staff member approves it on the dashboard — EXCEPT for the sick-call flow, where &#x60;commitAbsenceResolve&#x60; approves the pending record that covers the absence itself. &#x60;start_datetime&#x60;/&#x60;end_datetime&#x60; are RFC3339 INSTANTS with an offset (e.g. &#x60;2030-06-15T04:00:00Z&#x60; for midnight Toronto), unlike the business-local naive datetimes used by scheduling calls — a whole day off is that day&#39;s local midnight to the next in UTC. Overlapping an existing record for the same technician is refused (&#x60;TIME_OFF_OVERLAP&#x60;); list &#x60;GET /technicians/{id}/time-off&#x60; first. Creating a record immediately flags the technician&#39;s jobs in that window as needing attention on the dispatch board. Supports Idempotency-Key.
35
+ # @param technician_time_off_create_request [TechnicianTimeOffCreateRequest] Time off details
36
+ # @param [Hash] opts the optional parameters
37
+ # @option opts [String] :idempotency_key Unique key making retries safe: a repeat send with the same key replays the original response (header Idempotent-Replayed: true) instead of re-running the operation. Reusing a key with a different body returns 422 IDEMPOTENCY_KEY_REUSE.
38
+ # @return [Array<(CreateTechnicianTimeOff200Response, Integer, Hash)>] CreateTechnicianTimeOff200Response data, response status code and response headers
39
+ def create_technician_time_off_with_http_info(technician_time_off_create_request, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: TechnicianTimeOffApi.create_technician_time_off ...'
42
+ end
43
+ # verify the required parameter 'technician_time_off_create_request' is set
44
+ if @api_client.config.client_side_validation && technician_time_off_create_request.nil?
45
+ fail ArgumentError, "Missing the required parameter 'technician_time_off_create_request' when calling TechnicianTimeOffApi.create_technician_time_off"
46
+ end
47
+ # resource path
48
+ local_var_path = '/technician-time-off'
49
+
50
+ # query parameters
51
+ query_params = opts[:query_params] || {}
52
+
53
+ # header parameters
54
+ header_params = opts[:header_params] || {}
55
+ # HTTP header 'Accept' (if needed)
56
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
57
+ # HTTP header 'Content-Type'
58
+ content_type = @api_client.select_header_content_type(['application/json'])
59
+ if !content_type.nil?
60
+ header_params['Content-Type'] = content_type
61
+ end
62
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
63
+
64
+ # form parameters
65
+ form_params = opts[:form_params] || {}
66
+
67
+ # http body (model)
68
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(technician_time_off_create_request)
69
+
70
+ # return_type
71
+ return_type = opts[:debug_return_type] || 'CreateTechnicianTimeOff200Response'
72
+
73
+ # auth_names
74
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
75
+
76
+ new_options = opts.merge(
77
+ :operation => :"TechnicianTimeOffApi.create_technician_time_off",
78
+ :header_params => header_params,
79
+ :query_params => query_params,
80
+ :form_params => form_params,
81
+ :body => post_body,
82
+ :auth_names => auth_names,
83
+ :return_type => return_type
84
+ )
85
+
86
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
87
+ if @api_client.config.debugging
88
+ @api_client.config.logger.debug "API called: TechnicianTimeOffApi#create_technician_time_off\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
89
+ end
90
+ return data, status_code, headers
91
+ end
92
+
93
+ # Delete a technician's time off (e.g. back from a sick day)
94
+ # Removes a time-off record, in ANY status (pending, approved, rejected or cancelled). This is the \"the technician can come in after all\" call: once an approved record is deleted the technician is bookable again in that window for NEW bookings and schedule moves. It does NOT move any job back — jobs that `commitAbsenceResolve` already re-assigned to other technicians stay where they are (their customers may already have been told), and a job flagged as needing attention when the record was created keeps that flag until it is moved or re-assigned. To give the technician work again, book or move jobs onto them explicitly. The record is soft-deleted (it no longer appears in `GET /technicians/{id}/time-off`); deleting it again answers `TIME_OFF_NOT_FOUND`. A sandbox (`chsk_test_`) key can only delete sandbox records — a live record id answers `TIME_OFF_NOT_FOUND`, and the reverse holds for a live key.
95
+ # @param id [String] Time Off ID
96
+ # @param [Hash] opts the optional parameters
97
+ # @return [ResponseEnvelope]
98
+ def delete_technician_time_off(id, opts = {})
99
+ data, _status_code, _headers = delete_technician_time_off_with_http_info(id, opts)
100
+ data
101
+ end
102
+
103
+ # Delete a technician&#39;s time off (e.g. back from a sick day)
104
+ # Removes a time-off record, in ANY status (pending, approved, rejected or cancelled). This is the \&quot;the technician can come in after all\&quot; call: once an approved record is deleted the technician is bookable again in that window for NEW bookings and schedule moves. It does NOT move any job back — jobs that &#x60;commitAbsenceResolve&#x60; already re-assigned to other technicians stay where they are (their customers may already have been told), and a job flagged as needing attention when the record was created keeps that flag until it is moved or re-assigned. To give the technician work again, book or move jobs onto them explicitly. The record is soft-deleted (it no longer appears in &#x60;GET /technicians/{id}/time-off&#x60;); deleting it again answers &#x60;TIME_OFF_NOT_FOUND&#x60;. A sandbox (&#x60;chsk_test_&#x60;) key can only delete sandbox records — a live record id answers &#x60;TIME_OFF_NOT_FOUND&#x60;, and the reverse holds for a live key.
105
+ # @param id [String] Time Off ID
106
+ # @param [Hash] opts the optional parameters
107
+ # @return [Array<(ResponseEnvelope, Integer, Hash)>] ResponseEnvelope data, response status code and response headers
108
+ def delete_technician_time_off_with_http_info(id, opts = {})
109
+ if @api_client.config.debugging
110
+ @api_client.config.logger.debug 'Calling API: TechnicianTimeOffApi.delete_technician_time_off ...'
111
+ end
112
+ # verify the required parameter 'id' is set
113
+ if @api_client.config.client_side_validation && id.nil?
114
+ fail ArgumentError, "Missing the required parameter 'id' when calling TechnicianTimeOffApi.delete_technician_time_off"
115
+ end
116
+ # resource path
117
+ local_var_path = '/technician-time-off/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
118
+
119
+ # query parameters
120
+ query_params = opts[:query_params] || {}
121
+
122
+ # header parameters
123
+ header_params = opts[:header_params] || {}
124
+ # HTTP header 'Accept' (if needed)
125
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
126
+
127
+ # form parameters
128
+ form_params = opts[:form_params] || {}
129
+
130
+ # http body (model)
131
+ post_body = opts[:debug_body]
132
+
133
+ # return_type
134
+ return_type = opts[:debug_return_type] || 'ResponseEnvelope'
135
+
136
+ # auth_names
137
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
138
+
139
+ new_options = opts.merge(
140
+ :operation => :"TechnicianTimeOffApi.delete_technician_time_off",
141
+ :header_params => header_params,
142
+ :query_params => query_params,
143
+ :form_params => form_params,
144
+ :body => post_body,
145
+ :auth_names => auth_names,
146
+ :return_type => return_type
147
+ )
148
+
149
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
150
+ if @api_client.config.debugging
151
+ @api_client.config.logger.debug "API called: TechnicianTimeOffApi#delete_technician_time_off\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
152
+ end
153
+ return data, status_code, headers
154
+ end
155
+
156
+ # List time off for a specific technician
157
+ # Returns the technician's time-off records (pending, approved, rejected, cancelled), paginated, optionally bounded by start_date/end_date (YYYY-MM-DD, inclusive overlap) and status. Read this before recording a new block (overlaps are refused) and to see whether an absence is already recorded before `commitAbsenceResolve`.
158
+ # @param id [String] Technician ID
159
+ # @param [Hash] opts the optional parameters
160
+ # @option opts [Integer] :page Page number (default 1)
161
+ # @option opts [Integer] :limit Items per page (default 15)
162
+ # @option opts [String] :start_date Filter by start date (YYYY-MM-DD)
163
+ # @option opts [String] :end_date Filter by end date (YYYY-MM-DD)
164
+ # @option opts [Array<String>] :status_ids Filter by status (multi: pending|approved|rejected|cancelled)
165
+ # @option opts [String] :keyword Search reason (case-insensitive substring)
166
+ # @option opts [String] :since RFC3339 cursor for short-polling; echo back next_since from prior response
167
+ # @return [ListTechnicianTimeOff200Response]
168
+ def list_technician_time_off(id, opts = {})
169
+ data, _status_code, _headers = list_technician_time_off_with_http_info(id, opts)
170
+ data
171
+ end
172
+
173
+ # List time off for a specific technician
174
+ # Returns the technician&#39;s time-off records (pending, approved, rejected, cancelled), paginated, optionally bounded by start_date/end_date (YYYY-MM-DD, inclusive overlap) and status. Read this before recording a new block (overlaps are refused) and to see whether an absence is already recorded before &#x60;commitAbsenceResolve&#x60;.
175
+ # @param id [String] Technician ID
176
+ # @param [Hash] opts the optional parameters
177
+ # @option opts [Integer] :page Page number (default 1)
178
+ # @option opts [Integer] :limit Items per page (default 15)
179
+ # @option opts [String] :start_date Filter by start date (YYYY-MM-DD)
180
+ # @option opts [String] :end_date Filter by end date (YYYY-MM-DD)
181
+ # @option opts [Array<String>] :status_ids Filter by status (multi: pending|approved|rejected|cancelled)
182
+ # @option opts [String] :keyword Search reason (case-insensitive substring)
183
+ # @option opts [String] :since RFC3339 cursor for short-polling; echo back next_since from prior response
184
+ # @return [Array<(ListTechnicianTimeOff200Response, Integer, Hash)>] ListTechnicianTimeOff200Response data, response status code and response headers
185
+ def list_technician_time_off_with_http_info(id, opts = {})
186
+ if @api_client.config.debugging
187
+ @api_client.config.logger.debug 'Calling API: TechnicianTimeOffApi.list_technician_time_off ...'
188
+ end
189
+ # verify the required parameter 'id' is set
190
+ if @api_client.config.client_side_validation && id.nil?
191
+ fail ArgumentError, "Missing the required parameter 'id' when calling TechnicianTimeOffApi.list_technician_time_off"
192
+ end
193
+ # resource path
194
+ local_var_path = '/technicians/{id}/time-off'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
195
+
196
+ # query parameters
197
+ query_params = opts[:query_params] || {}
198
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
199
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
200
+ query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?
201
+ query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?
202
+ query_params[:'status_ids'] = @api_client.build_collection_param(opts[:'status_ids'], :multi) if !opts[:'status_ids'].nil?
203
+ query_params[:'keyword'] = opts[:'keyword'] if !opts[:'keyword'].nil?
204
+ query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
205
+
206
+ # header parameters
207
+ header_params = opts[:header_params] || {}
208
+ # HTTP header 'Accept' (if needed)
209
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
210
+
211
+ # form parameters
212
+ form_params = opts[:form_params] || {}
213
+
214
+ # http body (model)
215
+ post_body = opts[:debug_body]
216
+
217
+ # return_type
218
+ return_type = opts[:debug_return_type] || 'ListTechnicianTimeOff200Response'
219
+
220
+ # auth_names
221
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
222
+
223
+ new_options = opts.merge(
224
+ :operation => :"TechnicianTimeOffApi.list_technician_time_off",
225
+ :header_params => header_params,
226
+ :query_params => query_params,
227
+ :form_params => form_params,
228
+ :body => post_body,
229
+ :auth_names => auth_names,
230
+ :return_type => return_type
231
+ )
232
+
233
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
234
+ if @api_client.config.debugging
235
+ @api_client.config.logger.debug "API called: TechnicianTimeOffApi#list_technician_time_off\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
236
+ end
237
+ return data, status_code, headers
238
+ end
239
+ end
240
+ end
@@ -19,6 +19,140 @@ module Crisphive
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
+ # Add a vehicle to the fleet
23
+ # Registers a van, truck or car in the business's own fleet. Vehicles are what a confirmed job's crew travels in: at confirm, Crisphive auto-selects one vehicle for the whole crew from the lead technician's vehicles, then from unowned fleet vehicles, and blocks a vehicle already booked for an overlapping job. `name` is the only required field, so a bulk fleet import needs nothing else; brand, model, year, plate_number, current_mileage and vehicle_type (van, truck or car) can be filled in later with updateVehicle. Names and plate numbers must be unique in the business (VEHICLE_DUPLICATE_NAME / VEHICLE_DUPLICATE_PLATE). `owner_id` records who has CLAIMED the vehicle as their primary one. The owner must be a lead technician or a management role; a buddy- or float-tier profile is refused with VEHICLE_OWNER_TIER_NOT_ALLOWED, an unknown profile with VEHICLE_INVALID_OWNER. Deciding which vehicles a technician may USE is a separate relation: use replaceTechnicianVehicles for that, not this tool. Send an Idempotency-Key header (the `idempotency_key` argument over MCP) so a retried call replays the original response instead of creating a duplicate vehicle.
24
+ # @param vehicle_create_request [VehicleCreateRequest] Vehicle details
25
+ # @param [Hash] opts the optional parameters
26
+ # @option opts [String] :idempotency_key Unique key making retries safe: a repeat send with the same key replays the original response (header Idempotent-Replayed: true) instead of re-running the operation. Reusing a key with a different body returns 422 IDEMPOTENCY_KEY_REUSE.
27
+ # @return [CreateVehicle200Response]
28
+ def create_vehicle(vehicle_create_request, opts = {})
29
+ data, _status_code, _headers = create_vehicle_with_http_info(vehicle_create_request, opts)
30
+ data
31
+ end
32
+
33
+ # Add a vehicle to the fleet
34
+ # Registers a van, truck or car in the business&#39;s own fleet. Vehicles are what a confirmed job&#39;s crew travels in: at confirm, Crisphive auto-selects one vehicle for the whole crew from the lead technician&#39;s vehicles, then from unowned fleet vehicles, and blocks a vehicle already booked for an overlapping job. &#x60;name&#x60; is the only required field, so a bulk fleet import needs nothing else; brand, model, year, plate_number, current_mileage and vehicle_type (van, truck or car) can be filled in later with updateVehicle. Names and plate numbers must be unique in the business (VEHICLE_DUPLICATE_NAME / VEHICLE_DUPLICATE_PLATE). &#x60;owner_id&#x60; records who has CLAIMED the vehicle as their primary one. The owner must be a lead technician or a management role; a buddy- or float-tier profile is refused with VEHICLE_OWNER_TIER_NOT_ALLOWED, an unknown profile with VEHICLE_INVALID_OWNER. Deciding which vehicles a technician may USE is a separate relation: use replaceTechnicianVehicles for that, not this tool. Send an Idempotency-Key header (the &#x60;idempotency_key&#x60; argument over MCP) so a retried call replays the original response instead of creating a duplicate vehicle.
35
+ # @param vehicle_create_request [VehicleCreateRequest] Vehicle details
36
+ # @param [Hash] opts the optional parameters
37
+ # @option opts [String] :idempotency_key Unique key making retries safe: a repeat send with the same key replays the original response (header Idempotent-Replayed: true) instead of re-running the operation. Reusing a key with a different body returns 422 IDEMPOTENCY_KEY_REUSE.
38
+ # @return [Array<(CreateVehicle200Response, Integer, Hash)>] CreateVehicle200Response data, response status code and response headers
39
+ def create_vehicle_with_http_info(vehicle_create_request, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: VehicleApi.create_vehicle ...'
42
+ end
43
+ # verify the required parameter 'vehicle_create_request' is set
44
+ if @api_client.config.client_side_validation && vehicle_create_request.nil?
45
+ fail ArgumentError, "Missing the required parameter 'vehicle_create_request' when calling VehicleApi.create_vehicle"
46
+ end
47
+ # resource path
48
+ local_var_path = '/vehicles'
49
+
50
+ # query parameters
51
+ query_params = opts[:query_params] || {}
52
+
53
+ # header parameters
54
+ header_params = opts[:header_params] || {}
55
+ # HTTP header 'Accept' (if needed)
56
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
57
+ # HTTP header 'Content-Type'
58
+ content_type = @api_client.select_header_content_type(['application/json'])
59
+ if !content_type.nil?
60
+ header_params['Content-Type'] = content_type
61
+ end
62
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
63
+
64
+ # form parameters
65
+ form_params = opts[:form_params] || {}
66
+
67
+ # http body (model)
68
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(vehicle_create_request)
69
+
70
+ # return_type
71
+ return_type = opts[:debug_return_type] || 'CreateVehicle200Response'
72
+
73
+ # auth_names
74
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
75
+
76
+ new_options = opts.merge(
77
+ :operation => :"VehicleApi.create_vehicle",
78
+ :header_params => header_params,
79
+ :query_params => query_params,
80
+ :form_params => form_params,
81
+ :body => post_body,
82
+ :auth_names => auth_names,
83
+ :return_type => return_type
84
+ )
85
+
86
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
87
+ if @api_client.config.debugging
88
+ @api_client.config.logger.debug "API called: VehicleApi#create_vehicle\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
89
+ end
90
+ return data, status_code, headers
91
+ end
92
+
93
+ # Retire a vehicle from the fleet
94
+ # Soft-deletes the vehicle and, in the same transaction, removes it from every technician's vehicle list. It no longer appears in listVehicles or getVehicle and can no longer be auto-selected for a crew. Jobs that referenced it keep the stored reference but no longer display an assigned vehicle, and upcoming jobs are NOT given a replacement automatically. Reach for this only when a vehicle leaves the fleet for good (sold, written off, off-lease). For a van that is merely in the workshop, set its `status` to maintenance with updateVehicle instead, so the record stays in the fleet and can be brought straight back.
95
+ # @param id [String] Vehicle ID
96
+ # @param [Hash] opts the optional parameters
97
+ # @return [ResponseEnvelope]
98
+ def delete_vehicle(id, opts = {})
99
+ data, _status_code, _headers = delete_vehicle_with_http_info(id, opts)
100
+ data
101
+ end
102
+
103
+ # Retire a vehicle from the fleet
104
+ # Soft-deletes the vehicle and, in the same transaction, removes it from every technician&#39;s vehicle list. It no longer appears in listVehicles or getVehicle and can no longer be auto-selected for a crew. Jobs that referenced it keep the stored reference but no longer display an assigned vehicle, and upcoming jobs are NOT given a replacement automatically. Reach for this only when a vehicle leaves the fleet for good (sold, written off, off-lease). For a van that is merely in the workshop, set its &#x60;status&#x60; to maintenance with updateVehicle instead, so the record stays in the fleet and can be brought straight back.
105
+ # @param id [String] Vehicle ID
106
+ # @param [Hash] opts the optional parameters
107
+ # @return [Array<(ResponseEnvelope, Integer, Hash)>] ResponseEnvelope data, response status code and response headers
108
+ def delete_vehicle_with_http_info(id, opts = {})
109
+ if @api_client.config.debugging
110
+ @api_client.config.logger.debug 'Calling API: VehicleApi.delete_vehicle ...'
111
+ end
112
+ # verify the required parameter 'id' is set
113
+ if @api_client.config.client_side_validation && id.nil?
114
+ fail ArgumentError, "Missing the required parameter 'id' when calling VehicleApi.delete_vehicle"
115
+ end
116
+ # resource path
117
+ local_var_path = '/vehicles/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
118
+
119
+ # query parameters
120
+ query_params = opts[:query_params] || {}
121
+
122
+ # header parameters
123
+ header_params = opts[:header_params] || {}
124
+ # HTTP header 'Accept' (if needed)
125
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
126
+
127
+ # form parameters
128
+ form_params = opts[:form_params] || {}
129
+
130
+ # http body (model)
131
+ post_body = opts[:debug_body]
132
+
133
+ # return_type
134
+ return_type = opts[:debug_return_type] || 'ResponseEnvelope'
135
+
136
+ # auth_names
137
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
138
+
139
+ new_options = opts.merge(
140
+ :operation => :"VehicleApi.delete_vehicle",
141
+ :header_params => header_params,
142
+ :query_params => query_params,
143
+ :form_params => form_params,
144
+ :body => post_body,
145
+ :auth_names => auth_names,
146
+ :return_type => return_type
147
+ )
148
+
149
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
150
+ if @api_client.config.debugging
151
+ @api_client.config.logger.debug "API called: VehicleApi#delete_vehicle\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
152
+ end
153
+ return data, status_code, headers
154
+ end
155
+
22
156
  # Get a vehicle
23
157
  # Returns one fleet vehicle (service van/truck): identity, plate, operational status (idle, on job, maintenance) and which technicians use it — the fleet-management view of a single asset.
24
158
  # @param id [String] Vehicle ID
@@ -153,5 +287,79 @@ module Crisphive
153
287
  end
154
288
  return data, status_code, headers
155
289
  end
290
+
291
+ # Change a vehicle's details
292
+ # Edits an existing fleet record in place; the vehicle id and the technicians who use it are untouched. Partial update: omit a field to KEEP its current value, send \"\" to CLEAR an optional text field (brand, model, plate_number). Exceptions: `name` rejects \"\" because a vehicle must stay identifiable, and `vehicle_type` (van, truck, car) and `status` (inactive, idle, on_job, maintenance) must be valid enum values when present; an empty string there is a 400. `owner_id`: omit to keep the current owner, \"\" to unclaim, or a UUID to reassign; the new owner must be a lead or management profile (VEHICLE_OWNER_TIER_NOT_ALLOWED otherwise). Use this for corrections and odometer updates, and set `status` to maintenance or inactive when a vehicle is temporarily out of service so it stays in the fleet. To change which technicians may use it, call replaceTechnicianVehicles; to take it out of the fleet for good, call deleteVehicle.
293
+ # @param id [String] Vehicle ID
294
+ # @param vehicle_update_request [VehicleUpdateRequest] Vehicle details
295
+ # @param [Hash] opts the optional parameters
296
+ # @return [ResponseEnvelope]
297
+ def update_vehicle(id, vehicle_update_request, opts = {})
298
+ data, _status_code, _headers = update_vehicle_with_http_info(id, vehicle_update_request, opts)
299
+ data
300
+ end
301
+
302
+ # Change a vehicle&#39;s details
303
+ # Edits an existing fleet record in place; the vehicle id and the technicians who use it are untouched. Partial update: omit a field to KEEP its current value, send \&quot;\&quot; to CLEAR an optional text field (brand, model, plate_number). Exceptions: &#x60;name&#x60; rejects \&quot;\&quot; because a vehicle must stay identifiable, and &#x60;vehicle_type&#x60; (van, truck, car) and &#x60;status&#x60; (inactive, idle, on_job, maintenance) must be valid enum values when present; an empty string there is a 400. &#x60;owner_id&#x60;: omit to keep the current owner, \&quot;\&quot; to unclaim, or a UUID to reassign; the new owner must be a lead or management profile (VEHICLE_OWNER_TIER_NOT_ALLOWED otherwise). Use this for corrections and odometer updates, and set &#x60;status&#x60; to maintenance or inactive when a vehicle is temporarily out of service so it stays in the fleet. To change which technicians may use it, call replaceTechnicianVehicles; to take it out of the fleet for good, call deleteVehicle.
304
+ # @param id [String] Vehicle ID
305
+ # @param vehicle_update_request [VehicleUpdateRequest] Vehicle details
306
+ # @param [Hash] opts the optional parameters
307
+ # @return [Array<(ResponseEnvelope, Integer, Hash)>] ResponseEnvelope data, response status code and response headers
308
+ def update_vehicle_with_http_info(id, vehicle_update_request, opts = {})
309
+ if @api_client.config.debugging
310
+ @api_client.config.logger.debug 'Calling API: VehicleApi.update_vehicle ...'
311
+ end
312
+ # verify the required parameter 'id' is set
313
+ if @api_client.config.client_side_validation && id.nil?
314
+ fail ArgumentError, "Missing the required parameter 'id' when calling VehicleApi.update_vehicle"
315
+ end
316
+ # verify the required parameter 'vehicle_update_request' is set
317
+ if @api_client.config.client_side_validation && vehicle_update_request.nil?
318
+ fail ArgumentError, "Missing the required parameter 'vehicle_update_request' when calling VehicleApi.update_vehicle"
319
+ end
320
+ # resource path
321
+ local_var_path = '/vehicles/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
322
+
323
+ # query parameters
324
+ query_params = opts[:query_params] || {}
325
+
326
+ # header parameters
327
+ header_params = opts[:header_params] || {}
328
+ # HTTP header 'Accept' (if needed)
329
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
330
+ # HTTP header 'Content-Type'
331
+ content_type = @api_client.select_header_content_type(['application/json'])
332
+ if !content_type.nil?
333
+ header_params['Content-Type'] = content_type
334
+ end
335
+
336
+ # form parameters
337
+ form_params = opts[:form_params] || {}
338
+
339
+ # http body (model)
340
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(vehicle_update_request)
341
+
342
+ # return_type
343
+ return_type = opts[:debug_return_type] || 'ResponseEnvelope'
344
+
345
+ # auth_names
346
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
347
+
348
+ new_options = opts.merge(
349
+ :operation => :"VehicleApi.update_vehicle",
350
+ :header_params => header_params,
351
+ :query_params => query_params,
352
+ :form_params => form_params,
353
+ :body => post_body,
354
+ :auth_names => auth_names,
355
+ :return_type => return_type
356
+ )
357
+
358
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
359
+ if @api_client.config.debugging
360
+ @api_client.config.logger.debug "API called: VehicleApi#update_vehicle\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
361
+ end
362
+ return data, status_code, headers
363
+ end
156
364
  end
157
365
  end