harvest_api/lib.rs
1//! [`HarvestClient`](struct.HarvestClient.html) is the main entry point for this library.
2//!
3//! Library created with [`libninja`](https://www.libninja.com).
4#![allow(non_camel_case_types)]
5#![allow(unused)]
6pub mod model;
7pub mod request;
8use crate::model::*;
9
10pub struct HarvestClient {
11 pub(crate) client: httpclient::Client,
12 authentication: HarvestAuthentication,
13}
14impl HarvestClient {
15 pub fn from_env() -> Self {
16 let url = "https://api.harvestapp.com/v2".to_string();
17 Self {
18 client: httpclient::Client::new(Some(url)),
19 authentication: HarvestAuthentication::from_env(),
20 }
21 }
22}
23impl HarvestClient {
24 pub fn new(url: &str, authentication: HarvestAuthentication) -> Self {
25 let client = httpclient::Client::new(Some(url.to_string()));
26 Self { client, authentication }
27 }
28 pub fn with_authentication(mut self, authentication: HarvestAuthentication) -> Self {
29 self.authentication = authentication;
30 self
31 }
32 pub fn authenticate<'a>(
33 &self,
34 mut r: httpclient::RequestBuilder<'a>,
35 ) -> httpclient::RequestBuilder<'a> {
36 match &self.authentication {
37 HarvestAuthentication::BearerAuth { bearer_auth, account_auth } => {
38 r = r.header("Authorization", bearer_auth);
39 r = r.header("Harvest-Account-Id", account_auth);
40 }
41 }
42 r
43 }
44 pub fn with_middleware<M: httpclient::Middleware + 'static>(
45 mut self,
46 middleware: M,
47 ) -> Self {
48 self.client = self.client.with_middleware(middleware);
49 self
50 }
51 /**List all clients
52
53Returns a list of your clients. The clients are returned sorted by creation date, with the most recently created clients appearing first.
54
55The response contains an object with a clients property that contains an array of up to per_page clients. Each entry in the array is a separate client object. If no more clients are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your clients.
56
57See endpoint docs at <https://help.getharvest.com/api-v2/clients-api/clients/clients/#list-all-clients>.*/
58 pub fn list_clients(&self) -> request::ListClientsRequest {
59 request::ListClientsRequest {
60 client: &self,
61 is_active: None,
62 updated_since: None,
63 page: None,
64 per_page: None,
65 }
66 }
67 /**Create a client
68
69Creates a new client object. Returns a client object and a 201 Created response code if the call succeeded.
70
71See endpoint docs at <https://help.getharvest.com/api-v2/clients-api/clients/clients/#create-a-client>.*/
72 pub fn create_client(&self) -> request::CreateClientRequest {
73 request::CreateClientRequest {
74 client: &self,
75 name: None,
76 is_active: None,
77 address: None,
78 currency: None,
79 }
80 }
81 /**Retrieve a client
82
83Retrieves the client with the given ID. Returns a client object and a 200 OK response code if a valid identifier was provided.
84
85See endpoint docs at <https://help.getharvest.com/api-v2/clients-api/clients/clients/#retrieve-a-client>.*/
86 pub fn retrieve_client(&self, client_id: &str) -> request::RetrieveClientRequest {
87 request::RetrieveClientRequest {
88 client: &self,
89 client_id: client_id.to_owned(),
90 }
91 }
92 /**Delete a client
93
94Delete a client. Deleting a client is only possible if it has no projects, invoices, or estimates associated with it. Returns a 200 OK response code if the call succeeded.
95
96See endpoint docs at <https://help.getharvest.com/api-v2/clients-api/clients/clients/#delete-a-client>.*/
97 pub fn delete_client(&self, client_id: &str) -> request::DeleteClientRequest {
98 request::DeleteClientRequest {
99 client: &self,
100 client_id: client_id.to_owned(),
101 }
102 }
103 /**Update a client
104
105Updates the specific client by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Returns a client object and a 200 OK response code if the call succeeded.
106
107See endpoint docs at <https://help.getharvest.com/api-v2/clients-api/clients/clients/#update-a-client>.*/
108 pub fn update_client(&self, client_id: &str) -> request::UpdateClientRequest {
109 request::UpdateClientRequest {
110 client: &self,
111 client_id: client_id.to_owned(),
112 name: None,
113 is_active: None,
114 address: None,
115 currency: None,
116 }
117 }
118 /**Retrieve a company
119
120Retrieves the company for the currently authenticated user. Returns a
121company object and a 200 OK response code.
122
123See endpoint docs at <https://help.getharvest.com/api-v2/company-api/company/company/#retrieve-a-company>.*/
124 pub fn retrieve_company(&self) -> request::RetrieveCompanyRequest {
125 request::RetrieveCompanyRequest {
126 client: &self,
127 }
128 }
129 /**Update a company
130
131Updates the company setting the values of the parameters passed. Any parameters not provided will be left unchanged. Returns a company object and a 200 OK response code if the call succeeded.
132
133See endpoint docs at <https://help.getharvest.com/api-v2/company-api/company/company/#update-a-company>.*/
134 pub fn update_company(&self) -> request::UpdateCompanyRequest {
135 request::UpdateCompanyRequest {
136 client: &self,
137 wants_timestamp_timers: None,
138 weekly_capacity: None,
139 }
140 }
141 /**List all contacts
142
143Returns a list of your contacts. The contacts are returned sorted by creation date, with the most recently created contacts appearing first.
144
145The response contains an object with a contacts property that contains an array of up to per_page contacts. Each entry in the array is a separate contact object. If no more contacts are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your contacts.
146
147See endpoint docs at <https://help.getharvest.com/api-v2/clients-api/clients/contacts/#list-all-contacts>.*/
148 pub fn list_contacts(&self) -> request::ListContactsRequest {
149 request::ListContactsRequest {
150 client: &self,
151 client_id: None,
152 updated_since: None,
153 page: None,
154 per_page: None,
155 }
156 }
157 /**Create a contact
158
159Creates a new contact object. Returns a contact object and a 201 Created response code if the call succeeded.
160
161See endpoint docs at <https://help.getharvest.com/api-v2/clients-api/clients/contacts/#create-a-contact>.*/
162 pub fn create_contact(&self) -> request::CreateContactRequest {
163 request::CreateContactRequest {
164 client: &self,
165 client_id: None,
166 title: None,
167 first_name: None,
168 last_name: None,
169 email: None,
170 phone_office: None,
171 phone_mobile: None,
172 fax: None,
173 }
174 }
175 /**Retrieve a contact
176
177Retrieves the contact with the given ID. Returns a contact object and a 200 OK response code if a valid identifier was provided.
178
179See endpoint docs at <https://help.getharvest.com/api-v2/clients-api/clients/contacts/#retrieve-a-contact>.*/
180 pub fn retrieve_contact(&self, contact_id: &str) -> request::RetrieveContactRequest {
181 request::RetrieveContactRequest {
182 client: &self,
183 contact_id: contact_id.to_owned(),
184 }
185 }
186 /**Delete a contact
187
188Delete a contact. Returns a 200 OK response code if the call succeeded.
189
190See endpoint docs at <https://help.getharvest.com/api-v2/clients-api/clients/contacts/#delete-a-contact>.*/
191 pub fn delete_contact(&self, contact_id: &str) -> request::DeleteContactRequest {
192 request::DeleteContactRequest {
193 client: &self,
194 contact_id: contact_id.to_owned(),
195 }
196 }
197 /**Update a contact
198
199Updates the specific contact by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Returns a contact object and a 200 OK response code if the call succeeded.
200
201See endpoint docs at <https://help.getharvest.com/api-v2/clients-api/clients/contacts/#update-a-contact>.*/
202 pub fn update_contact(&self, contact_id: &str) -> request::UpdateContactRequest {
203 request::UpdateContactRequest {
204 client: &self,
205 contact_id: contact_id.to_owned(),
206 client_id: None,
207 title: None,
208 first_name: None,
209 last_name: None,
210 email: None,
211 phone_office: None,
212 phone_mobile: None,
213 fax: None,
214 }
215 }
216 /**List all estimate item categories
217
218Returns a list of your estimate item categories. The estimate item categories are returned sorted by creation date, with the most recently created estimate item categories appearing first.
219
220The response contains an object with a estimate_item_categories property that contains an array of up to per_page estimate item categories. Each entry in the array is a separate estimate item category object. If no more estimate item categories are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your estimate item categories.
221
222See endpoint docs at <https://help.getharvest.com/api-v2/estimates-api/estimates/estimate-item-categories/#list-all-estimate-item-categories>.*/
223 pub fn list_estimate_item_categories(
224 &self,
225 ) -> request::ListEstimateItemCategoriesRequest {
226 request::ListEstimateItemCategoriesRequest {
227 client: &self,
228 updated_since: None,
229 page: None,
230 per_page: None,
231 }
232 }
233 /**Create an estimate item category
234
235Creates a new estimate item category object. Returns an estimate item category object and a 201 Created response code if the call succeeded.
236
237See endpoint docs at <https://help.getharvest.com/api-v2/estimates-api/estimates/estimate-item-categories/#create-an-estimate-item-category>.*/
238 pub fn create_estimate_item_category(
239 &self,
240 ) -> request::CreateEstimateItemCategoryRequest {
241 request::CreateEstimateItemCategoryRequest {
242 client: &self,
243 name: None,
244 }
245 }
246 /**Retrieve an estimate item category
247
248Retrieves the estimate item category with the given ID. Returns an estimate item category object and a 200 OK response code if a valid identifier was provided.
249
250See endpoint docs at <https://help.getharvest.com/api-v2/estimates-api/estimates/estimate-item-categories/#retrieve-an-estimate-item-category>.*/
251 pub fn retrieve_estimate_item_category(
252 &self,
253 estimate_item_category_id: &str,
254 ) -> request::RetrieveEstimateItemCategoryRequest {
255 request::RetrieveEstimateItemCategoryRequest {
256 client: &self,
257 estimate_item_category_id: estimate_item_category_id.to_owned(),
258 }
259 }
260 /**Delete an estimate item category
261
262Delete an estimate item category. Returns a 200 OK response code if the call succeeded.
263
264See endpoint docs at <https://help.getharvest.com/api-v2/estimates-api/estimates/estimate-item-categories/#delete-an-estimate-item-category>.*/
265 pub fn delete_estimate_item_category(
266 &self,
267 estimate_item_category_id: &str,
268 ) -> request::DeleteEstimateItemCategoryRequest {
269 request::DeleteEstimateItemCategoryRequest {
270 client: &self,
271 estimate_item_category_id: estimate_item_category_id.to_owned(),
272 }
273 }
274 /**Update an estimate item category
275
276Updates the specific estimate item category by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Returns an estimate item category object and a 200 OK response code if the call succeeded.
277
278See endpoint docs at <https://help.getharvest.com/api-v2/estimates-api/estimates/estimate-item-categories/#update-an-estimate-item-category>.*/
279 pub fn update_estimate_item_category(
280 &self,
281 estimate_item_category_id: &str,
282 ) -> request::UpdateEstimateItemCategoryRequest {
283 request::UpdateEstimateItemCategoryRequest {
284 client: &self,
285 estimate_item_category_id: estimate_item_category_id.to_owned(),
286 name: None,
287 }
288 }
289 /**List all estimates
290
291Returns a list of your estimates. The estimates are returned sorted by issue date, with the most recently issued estimates appearing first.
292
293The response contains an object with a estimates property that contains an array of up to per_page estimates. Each entry in the array is a separate estimate object. If no more estimates are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your estimates.
294
295See endpoint docs at <https://help.getharvest.com/api-v2/estimates-api/estimates/estimates/#list-all-estimates>.*/
296 pub fn list_estimates(&self) -> request::ListEstimatesRequest {
297 request::ListEstimatesRequest {
298 client: &self,
299 client_id: None,
300 updated_since: None,
301 from: None,
302 to: None,
303 state: None,
304 page: None,
305 per_page: None,
306 }
307 }
308 /**Create an estimate
309
310Creates a new estimate object. Returns an estimate object and a 201 Created response code if the call succeeded.
311
312See endpoint docs at <https://help.getharvest.com/api-v2/estimates-api/estimates/estimates/#create-an-estimate>.*/
313 pub fn create_estimate(&self) -> request::CreateEstimateRequest {
314 request::CreateEstimateRequest {
315 client: &self,
316 client_id: None,
317 number: None,
318 purchase_order: None,
319 tax: None,
320 tax2: None,
321 discount: None,
322 subject: None,
323 notes: None,
324 currency: None,
325 issue_date: None,
326 line_items: None,
327 }
328 }
329 /**Retrieve an estimate
330
331Retrieves the estimate with the given ID. Returns an estimate object and a 200 OK response code if a valid identifier was provided.
332
333See endpoint docs at <https://help.getharvest.com/api-v2/estimates-api/estimates/estimates/#retrieve-an-estimate>.*/
334 pub fn retrieve_estimate(
335 &self,
336 estimate_id: &str,
337 ) -> request::RetrieveEstimateRequest {
338 request::RetrieveEstimateRequest {
339 client: &self,
340 estimate_id: estimate_id.to_owned(),
341 }
342 }
343 /**Delete an estimate
344
345Delete an estimate. Returns a 200 OK response code if the call succeeded.
346
347See endpoint docs at <https://help.getharvest.com/api-v2/estimates-api/estimates/estimates/#delete-an-estimate>.*/
348 pub fn delete_estimate(&self, estimate_id: &str) -> request::DeleteEstimateRequest {
349 request::DeleteEstimateRequest {
350 client: &self,
351 estimate_id: estimate_id.to_owned(),
352 }
353 }
354 /**Update an estimate
355
356Updates the specific estimate by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Returns an estimate object and a 200 OK response code if the call succeeded.
357
358See endpoint docs at <https://help.getharvest.com/api-v2/estimates-api/estimates/estimates/#update-an-estimate>.*/
359 pub fn update_estimate(&self, estimate_id: &str) -> request::UpdateEstimateRequest {
360 request::UpdateEstimateRequest {
361 client: &self,
362 estimate_id: estimate_id.to_owned(),
363 client_id: None,
364 number: None,
365 purchase_order: None,
366 tax: None,
367 tax2: None,
368 discount: None,
369 subject: None,
370 notes: None,
371 currency: None,
372 issue_date: None,
373 line_items: None,
374 }
375 }
376 /**List all messages for an estimate
377
378Returns a list of messages associated with a given estimate. The estimate messages are returned sorted by creation date, with the most recently created messages appearing first.
379
380The response contains an object with an estimate_messages property that contains an array of up to per_page messages. Each entry in the array is a separate message object. If no more messages are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your messages.
381
382See endpoint docs at <https://help.getharvest.com/api-v2/estimates-api/estimates/estimate-messages/#list-all-messages-for-an-estimate>.*/
383 pub fn list_messages_for_estimate(
384 &self,
385 estimate_id: &str,
386 ) -> request::ListMessagesForEstimateRequest {
387 request::ListMessagesForEstimateRequest {
388 client: &self,
389 estimate_id: estimate_id.to_owned(),
390 updated_since: None,
391 page: None,
392 per_page: None,
393 }
394 }
395 /**Create an estimate message or change estimate status
396
397Creates a new estimate message object. Returns an estimate message object and a 201 Created response code if the call succeeded.
398
399See endpoint docs at <https://help.getharvest.com/api-v2/estimates-api/estimates/estimate-messages/#create-an-estimate-message>.*/
400 pub fn create_estimate_message(
401 &self,
402 estimate_id: &str,
403 ) -> request::CreateEstimateMessageRequest {
404 request::CreateEstimateMessageRequest {
405 client: &self,
406 estimate_id: estimate_id.to_owned(),
407 event_type: None,
408 recipients: None,
409 subject: None,
410 body: None,
411 send_me_a_copy: None,
412 }
413 }
414 /**Delete an estimate message
415
416Delete an estimate message. Returns a 200 OK response code if the call succeeded.
417
418See endpoint docs at <https://help.getharvest.com/api-v2/estimates-api/estimates/estimate-messages/#delete-an-estimate-message>.*/
419 pub fn delete_estimate_message(
420 &self,
421 estimate_id: &str,
422 message_id: &str,
423 ) -> request::DeleteEstimateMessageRequest {
424 request::DeleteEstimateMessageRequest {
425 client: &self,
426 estimate_id: estimate_id.to_owned(),
427 message_id: message_id.to_owned(),
428 }
429 }
430 /**List all expense categories
431
432Returns a list of your expense categories. The expense categories are returned sorted by creation date, with the most recently created expense categories appearing first.
433
434The response contains an object with a expense_categories property that contains an array of up to per_page expense categories. Each entry in the array is a separate expense category object. If no more expense categories are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your expense categories.
435
436See endpoint docs at <https://help.getharvest.com/api-v2/expenses-api/expenses/expense-categories/#list-all-expense-categories>.*/
437 pub fn list_expense_categories(&self) -> request::ListExpenseCategoriesRequest {
438 request::ListExpenseCategoriesRequest {
439 client: &self,
440 is_active: None,
441 updated_since: None,
442 page: None,
443 per_page: None,
444 }
445 }
446 /**Create an expense category
447
448Creates a new expense category object. Returns an expense category object and a 201 Created response code if the call succeeded.
449
450See endpoint docs at <https://help.getharvest.com/api-v2/expenses-api/expenses/expense-categories/#create-an-expense-category>.*/
451 pub fn create_expense_category(&self) -> request::CreateExpenseCategoryRequest {
452 request::CreateExpenseCategoryRequest {
453 client: &self,
454 name: None,
455 unit_name: None,
456 unit_price: None,
457 is_active: None,
458 }
459 }
460 /**Retrieve an expense category
461
462Retrieves the expense category with the given ID. Returns an expense category object and a 200 OK response code if a valid identifier was provided.
463
464See endpoint docs at <https://help.getharvest.com/api-v2/expenses-api/expenses/expense-categories/#retrieve-an-expense-category>.*/
465 pub fn retrieve_expense_category(
466 &self,
467 expense_category_id: &str,
468 ) -> request::RetrieveExpenseCategoryRequest {
469 request::RetrieveExpenseCategoryRequest {
470 client: &self,
471 expense_category_id: expense_category_id.to_owned(),
472 }
473 }
474 /**Delete an expense category
475
476Delete an expense category. Returns a 200 OK response code if the call succeeded.
477
478See endpoint docs at <https://help.getharvest.com/api-v2/expenses-api/expenses/expense-categories/#delete-an-expense-category>.*/
479 pub fn delete_expense_category(
480 &self,
481 expense_category_id: &str,
482 ) -> request::DeleteExpenseCategoryRequest {
483 request::DeleteExpenseCategoryRequest {
484 client: &self,
485 expense_category_id: expense_category_id.to_owned(),
486 }
487 }
488 /**Update an expense category
489
490Updates the specific expense category by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Returns an expense category object and a 200 OK response code if the call succeeded.
491
492See endpoint docs at <https://help.getharvest.com/api-v2/expenses-api/expenses/expense-categories/#update-an-expense-category>.*/
493 pub fn update_expense_category(
494 &self,
495 expense_category_id: &str,
496 ) -> request::UpdateExpenseCategoryRequest {
497 request::UpdateExpenseCategoryRequest {
498 client: &self,
499 expense_category_id: expense_category_id.to_owned(),
500 name: None,
501 unit_name: None,
502 unit_price: None,
503 is_active: None,
504 }
505 }
506 /**List all expenses
507
508Returns a list of your expenses. If accessing this endpoint as an Administrator, all expenses in the account will be returned. If accessing this endpoint as a Manager, all expenses for assigned teammates and managed projects will be returned. The expenses are returned sorted by the spent_at date, with the most recent expenses appearing first.
509
510The response contains an object with a expenses property that contains an array of up to per_page expenses. Each entry in the array is a separate expense object. If no more expenses are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your expenses.
511
512See endpoint docs at <https://help.getharvest.com/api-v2/expenses-api/expenses/expenses/#list-all-expenses>.*/
513 pub fn list_expenses(&self) -> request::ListExpensesRequest {
514 request::ListExpensesRequest {
515 client: &self,
516 user_id: None,
517 client_id: None,
518 project_id: None,
519 is_billed: None,
520 updated_since: None,
521 from: None,
522 to: None,
523 page: None,
524 per_page: None,
525 }
526 }
527 /**Create an expense
528
529Creates a new expense object. Returns an expense object and a 201 Created response code if the call succeeded.
530
531See endpoint docs at <https://help.getharvest.com/api-v2/expenses-api/expenses/expenses/#create-an-expense>.*/
532 pub fn create_expense(&self) -> request::CreateExpenseRequest {
533 request::CreateExpenseRequest {
534 client: &self,
535 user_id: None,
536 project_id: None,
537 expense_category_id: None,
538 spent_date: None,
539 units: None,
540 total_cost: None,
541 notes: None,
542 billable: None,
543 receipt: None,
544 }
545 }
546 /**Retrieve an expense
547
548Retrieves the expense with the given ID. Returns an expense object and a 200 OK response code if a valid identifier was provided.
549
550See endpoint docs at <https://help.getharvest.com/api-v2/expenses-api/expenses/expenses/#retrieve-an-expense>.*/
551 pub fn retrieve_expense(&self, expense_id: &str) -> request::RetrieveExpenseRequest {
552 request::RetrieveExpenseRequest {
553 client: &self,
554 expense_id: expense_id.to_owned(),
555 }
556 }
557 /**Delete an expense
558
559Delete an expense. Returns a 200 OK response code if the call succeeded.
560
561See endpoint docs at <https://help.getharvest.com/api-v2/expenses-api/expenses/expenses/#delete-an-expense>.*/
562 pub fn delete_expense(&self, expense_id: &str) -> request::DeleteExpenseRequest {
563 request::DeleteExpenseRequest {
564 client: &self,
565 expense_id: expense_id.to_owned(),
566 }
567 }
568 /**Update an expense
569
570Updates the specific expense by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Returns an expense object and a 200 OK response code if the call succeeded.
571
572See endpoint docs at <https://help.getharvest.com/api-v2/expenses-api/expenses/expenses/#update-an-expense>.*/
573 pub fn update_expense(&self, expense_id: &str) -> request::UpdateExpenseRequest {
574 request::UpdateExpenseRequest {
575 client: &self,
576 expense_id: expense_id.to_owned(),
577 project_id: None,
578 expense_category_id: None,
579 spent_date: None,
580 units: None,
581 total_cost: None,
582 notes: None,
583 billable: None,
584 receipt: None,
585 delete_receipt: None,
586 }
587 }
588 /**List all invoice item categories
589
590Returns a list of your invoice item categories. The invoice item categories are returned sorted by creation date, with the most recently created invoice item categories appearing first.
591
592The response contains an object with a invoice_item_categories property that contains an array of up to per_page invoice item categories. Each entry in the array is a separate invoice item category object. If no more invoice item categories are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your invoice item categories.
593
594See endpoint docs at <https://help.getharvest.com/api-v2/invoices-api/invoices/invoice-item-categories/#list-all-invoice-item-categories>.*/
595 pub fn list_invoice_item_categories(
596 &self,
597 ) -> request::ListInvoiceItemCategoriesRequest {
598 request::ListInvoiceItemCategoriesRequest {
599 client: &self,
600 updated_since: None,
601 page: None,
602 per_page: None,
603 }
604 }
605 /**Create an invoice item category
606
607Creates a new invoice item category object. Returns an invoice item category object and a 201 Created response code if the call succeeded.
608
609See endpoint docs at <https://help.getharvest.com/api-v2/invoices-api/invoices/invoice-item-categories/#create-an-invoice-item-category>.*/
610 pub fn create_invoice_item_category(
611 &self,
612 ) -> request::CreateInvoiceItemCategoryRequest {
613 request::CreateInvoiceItemCategoryRequest {
614 client: &self,
615 name: None,
616 }
617 }
618 /**Retrieve an invoice item category
619
620Retrieves the invoice item category with the given ID. Returns an invoice item category object and a 200 OK response code if a valid identifier was provided.
621
622See endpoint docs at <https://help.getharvest.com/api-v2/invoices-api/invoices/invoice-item-categories/#retrieve-an-invoice-item-category>.*/
623 pub fn retrieve_invoice_item_category(
624 &self,
625 invoice_item_category_id: &str,
626 ) -> request::RetrieveInvoiceItemCategoryRequest {
627 request::RetrieveInvoiceItemCategoryRequest {
628 client: &self,
629 invoice_item_category_id: invoice_item_category_id.to_owned(),
630 }
631 }
632 /**Delete an invoice item category
633
634Delete an invoice item category. Deleting an invoice item category is only possible if use_as_service and use_as_expense are both false. Returns a 200 OK response code if the call succeeded.
635
636See endpoint docs at <https://help.getharvest.com/api-v2/invoices-api/invoices/invoice-item-categories/#delete-an-invoice-item-category>.*/
637 pub fn delete_invoice_item_category(
638 &self,
639 invoice_item_category_id: &str,
640 ) -> request::DeleteInvoiceItemCategoryRequest {
641 request::DeleteInvoiceItemCategoryRequest {
642 client: &self,
643 invoice_item_category_id: invoice_item_category_id.to_owned(),
644 }
645 }
646 /**Update an invoice item category
647
648Updates the specific invoice item category by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Returns an invoice item category object and a 200 OK response code if the call succeeded.
649
650See endpoint docs at <https://help.getharvest.com/api-v2/invoices-api/invoices/invoice-item-categories/#update-an-invoice-item-category>.*/
651 pub fn update_invoice_item_category(
652 &self,
653 invoice_item_category_id: &str,
654 ) -> request::UpdateInvoiceItemCategoryRequest {
655 request::UpdateInvoiceItemCategoryRequest {
656 client: &self,
657 invoice_item_category_id: invoice_item_category_id.to_owned(),
658 name: None,
659 }
660 }
661 /**List all invoices
662
663Returns a list of your invoices. The invoices are returned sorted by issue date, with the most recently issued invoices appearing first.
664
665The response contains an object with a invoices property that contains an array of up to per_page invoices. Each entry in the array is a separate invoice object. If no more invoices are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your invoices.
666
667See endpoint docs at <https://help.getharvest.com/api-v2/invoices-api/invoices/invoices/#list-all-invoices>.*/
668 pub fn list_invoices(&self) -> request::ListInvoicesRequest {
669 request::ListInvoicesRequest {
670 client: &self,
671 client_id: None,
672 project_id: None,
673 updated_since: None,
674 from: None,
675 to: None,
676 state: None,
677 page: None,
678 per_page: None,
679 }
680 }
681 /**Create an invoice
682
683Creates a new invoice object. Returns an invoice object and a 201 Created response code if the call succeeded.
684
685See endpoint docs at <https://help.getharvest.com/api-v2/invoices-api/invoices/invoices/#create-a-free-form-invoice>.*/
686 pub fn create_invoice(&self) -> request::CreateInvoiceRequest {
687 request::CreateInvoiceRequest {
688 client: &self,
689 client_id: None,
690 retainer_id: None,
691 estimate_id: None,
692 number: None,
693 purchase_order: None,
694 tax: None,
695 tax2: None,
696 discount: None,
697 subject: None,
698 notes: None,
699 currency: None,
700 issue_date: None,
701 due_date: None,
702 payment_term: None,
703 line_items_import: None,
704 line_items: None,
705 }
706 }
707 /**Retrieve an invoice
708
709Retrieves the invoice with the given ID. Returns an invoice object and a 200 OK response code if a valid identifier was provided.
710
711See endpoint docs at <https://help.getharvest.com/api-v2/invoices-api/invoices/invoices/#retrieve-an-invoice>.*/
712 pub fn retrieve_invoice(&self, invoice_id: &str) -> request::RetrieveInvoiceRequest {
713 request::RetrieveInvoiceRequest {
714 client: &self,
715 invoice_id: invoice_id.to_owned(),
716 }
717 }
718 /**Delete an invoice
719
720Delete an invoice. Returns a 200 OK response code if the call succeeded.
721
722See endpoint docs at <https://help.getharvest.com/api-v2/invoices-api/invoices/invoices/#delete-an-invoice>.*/
723 pub fn delete_invoice(&self, invoice_id: &str) -> request::DeleteInvoiceRequest {
724 request::DeleteInvoiceRequest {
725 client: &self,
726 invoice_id: invoice_id.to_owned(),
727 }
728 }
729 /**Update an invoice
730
731Updates the specific invoice by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Returns an invoice object and a 200 OK response code if the call succeeded.
732
733See endpoint docs at <https://help.getharvest.com/api-v2/invoices-api/invoices/invoices/#update-an-invoice>.*/
734 pub fn update_invoice(&self, invoice_id: &str) -> request::UpdateInvoiceRequest {
735 request::UpdateInvoiceRequest {
736 client: &self,
737 invoice_id: invoice_id.to_owned(),
738 client_id: None,
739 retainer_id: None,
740 estimate_id: None,
741 number: None,
742 purchase_order: None,
743 tax: None,
744 tax2: None,
745 discount: None,
746 subject: None,
747 notes: None,
748 currency: None,
749 issue_date: None,
750 due_date: None,
751 payment_term: None,
752 line_items: None,
753 }
754 }
755 /**List all messages for an invoice
756
757Returns a list of messages associated with a given invoice. The invoice messages are returned sorted by creation date, with the most recently created messages appearing first.
758
759The response contains an object with an invoice_messages property that contains an array of up to per_page messages. Each entry in the array is a separate message object. If no more messages are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your messages.
760
761See endpoint docs at <https://help.getharvest.com/api-v2/invoices-api/invoices/invoice-messages/#list-all-messages-for-an-invoice>.*/
762 pub fn list_messages_for_invoice(
763 &self,
764 invoice_id: &str,
765 ) -> request::ListMessagesForInvoiceRequest {
766 request::ListMessagesForInvoiceRequest {
767 client: &self,
768 invoice_id: invoice_id.to_owned(),
769 updated_since: None,
770 page: None,
771 per_page: None,
772 }
773 }
774 /**Create an invoice message or change invoice status
775
776Creates a new invoice message object. Returns an invoice message object and a 201 Created response code if the call succeeded.
777
778See endpoint docs at <https://help.getharvest.com/api-v2/invoices-api/invoices/invoice-messages/#create-an-invoice-message>.*/
779 pub fn create_invoice_message(
780 &self,
781 invoice_id: &str,
782 ) -> request::CreateInvoiceMessageRequest {
783 request::CreateInvoiceMessageRequest {
784 client: &self,
785 invoice_id: invoice_id.to_owned(),
786 event_type: None,
787 recipients: None,
788 subject: None,
789 body: None,
790 include_link_to_client_invoice: None,
791 attach_pdf: None,
792 send_me_a_copy: None,
793 thank_you: None,
794 }
795 }
796 /**Retrieve invoice message subject and body for specific invoice
797
798Returns the subject and body text as configured in Harvest of an invoice message for a specific invoice and a 200 OK response code if the call succeeded. Does not create the invoice message. If no parameters are passed, will return the subject and body of a general invoice message for the specific invoice.
799
800See endpoint docs at <https://help.getharvest.com/api-v2/invoices-api/invoices/invoice-messages/#retrieve-invoice-message-subject-and-body-for-specific-invoice>.*/
801 pub fn retrieve_invoice_message_subject_and_body_for_specific_invoice(
802 &self,
803 invoice_id: &str,
804 ) -> request::RetrieveInvoiceMessageSubjectAndBodyForSpecificInvoiceRequest {
805 request::RetrieveInvoiceMessageSubjectAndBodyForSpecificInvoiceRequest {
806 client: &self,
807 invoice_id: invoice_id.to_owned(),
808 thank_you: None,
809 reminder: None,
810 }
811 }
812 /**Delete an invoice message
813
814Delete an invoice message. Returns a 200 OK response code if the call succeeded.
815
816See endpoint docs at <https://help.getharvest.com/api-v2/invoices-api/invoices/invoice-messages/#delete-an-invoice-message>.*/
817 pub fn delete_invoice_message(
818 &self,
819 invoice_id: &str,
820 message_id: &str,
821 ) -> request::DeleteInvoiceMessageRequest {
822 request::DeleteInvoiceMessageRequest {
823 client: &self,
824 invoice_id: invoice_id.to_owned(),
825 message_id: message_id.to_owned(),
826 }
827 }
828 /**List all payments for an invoice
829
830Returns a list of payments associate with a given invoice. The payments are returned sorted by creation date, with the most recently created payments appearing first.
831
832The response contains an object with an invoice_payments property that contains an array of up to per_page payments. Each entry in the array is a separate payment object. If no more payments are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your payments.
833
834See endpoint docs at <https://help.getharvest.com/api-v2/invoices-api/invoices/invoice-payments/#list-all-payments-for-an-invoice>.*/
835 pub fn list_payments_for_invoice(
836 &self,
837 invoice_id: &str,
838 ) -> request::ListPaymentsForInvoiceRequest {
839 request::ListPaymentsForInvoiceRequest {
840 client: &self,
841 invoice_id: invoice_id.to_owned(),
842 updated_since: None,
843 page: None,
844 per_page: None,
845 }
846 }
847 /**Create an invoice payment
848
849Creates a new invoice payment object. Returns an invoice payment object and a 201 Created response code if the call succeeded.
850
851See endpoint docs at <https://help.getharvest.com/api-v2/invoices-api/invoices/invoice-payments/#create-an-invoice-payment>.*/
852 pub fn create_invoice_payment(
853 &self,
854 invoice_id: &str,
855 ) -> request::CreateInvoicePaymentRequest {
856 request::CreateInvoicePaymentRequest {
857 client: &self,
858 invoice_id: invoice_id.to_owned(),
859 amount: None,
860 paid_at: None,
861 paid_date: None,
862 notes: None,
863 }
864 }
865 /**Delete an invoice payment
866
867Delete an invoice payment. Returns a 200 OK response code if the call succeeded.
868
869See endpoint docs at <https://help.getharvest.com/api-v2/invoices-api/invoices/invoice-payments/#delete-an-invoice-payment>.*/
870 pub fn delete_invoice_payment(
871 &self,
872 invoice_id: &str,
873 payment_id: &str,
874 ) -> request::DeleteInvoicePaymentRequest {
875 request::DeleteInvoicePaymentRequest {
876 client: &self,
877 invoice_id: invoice_id.to_owned(),
878 payment_id: payment_id.to_owned(),
879 }
880 }
881 /**List all projects
882
883Returns a list of your projects. The projects are returned sorted by creation date, with the most recently created projects appearing first.
884
885The response contains an object with a projects property that contains an array of up to per_page projects. Each entry in the array is a separate project object. If no more projects are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your projects.
886
887See endpoint docs at <https://help.getharvest.com/api-v2/projects-api/projects/projects/#list-all-projects>.*/
888 pub fn list_projects(&self) -> request::ListProjectsRequest {
889 request::ListProjectsRequest {
890 client: &self,
891 is_active: None,
892 client_id: None,
893 updated_since: None,
894 page: None,
895 per_page: None,
896 }
897 }
898 /**Create a project
899
900Creates a new project object. Returns a project object and a 201 Created response code if the call succeeded.
901
902See endpoint docs at <https://help.getharvest.com/api-v2/projects-api/projects/projects/#create-a-project>.*/
903 pub fn create_project(&self) -> request::CreateProjectRequest {
904 request::CreateProjectRequest {
905 client: &self,
906 client_id: None,
907 name: None,
908 code: None,
909 is_active: None,
910 is_billable: None,
911 is_fixed_fee: None,
912 bill_by: None,
913 hourly_rate: None,
914 budget: None,
915 budget_by: None,
916 budget_is_monthly: None,
917 notify_when_over_budget: None,
918 over_budget_notification_percentage: None,
919 show_budget_to_all: None,
920 cost_budget: None,
921 cost_budget_include_expenses: None,
922 fee: None,
923 notes: None,
924 starts_on: None,
925 ends_on: None,
926 }
927 }
928 /**Retrieve a project
929
930Retrieves the project with the given ID. Returns a project object and a 200 OK response code if a valid identifier was provided.
931
932See endpoint docs at <https://help.getharvest.com/api-v2/projects-api/projects/projects/#retrieve-a-project>.*/
933 pub fn retrieve_project(&self, project_id: &str) -> request::RetrieveProjectRequest {
934 request::RetrieveProjectRequest {
935 client: &self,
936 project_id: project_id.to_owned(),
937 }
938 }
939 /**Delete a project
940
941Deletes a project and any time entries or expenses tracked to it.
942However, invoices associated with the project will not be deleted.
943If you don’t want the project’s time entries and expenses to be deleted, you should archive the project instead.
944
945See endpoint docs at <https://help.getharvest.com/api-v2/projects-api/projects/projects/#delete-a-project>.*/
946 pub fn delete_project(&self, project_id: &str) -> request::DeleteProjectRequest {
947 request::DeleteProjectRequest {
948 client: &self,
949 project_id: project_id.to_owned(),
950 }
951 }
952 /**Update a project
953
954Updates the specific project by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Returns a project object and a 200 OK response code if the call succeeded.
955
956See endpoint docs at <https://help.getharvest.com/api-v2/projects-api/projects/projects/#update-a-project>.*/
957 pub fn update_project(&self, project_id: &str) -> request::UpdateProjectRequest {
958 request::UpdateProjectRequest {
959 client: &self,
960 project_id: project_id.to_owned(),
961 client_id: None,
962 name: None,
963 code: None,
964 is_active: None,
965 is_billable: None,
966 is_fixed_fee: None,
967 bill_by: None,
968 hourly_rate: None,
969 budget: None,
970 budget_by: None,
971 budget_is_monthly: None,
972 notify_when_over_budget: None,
973 over_budget_notification_percentage: None,
974 show_budget_to_all: None,
975 cost_budget: None,
976 cost_budget_include_expenses: None,
977 fee: None,
978 notes: None,
979 starts_on: None,
980 ends_on: None,
981 }
982 }
983 /**List all task assignments for a specific project
984
985Returns a list of your task assignments for the project identified by PROJECT_ID. The task assignments are returned sorted by creation date, with the most recently created task assignments appearing first.
986
987The response contains an object with a task_assignments property that contains an array of up to per_page task assignments. Each entry in the array is a separate task assignment object. If no more task assignments are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your task assignments.
988
989See endpoint docs at <https://help.getharvest.com/api-v2/projects-api/projects/task-assignments/#list-all-task-assignments-for-a-specific-project>.*/
990 pub fn list_task_assignments_for_specific_project(
991 &self,
992 project_id: &str,
993 ) -> request::ListTaskAssignmentsForSpecificProjectRequest {
994 request::ListTaskAssignmentsForSpecificProjectRequest {
995 client: &self,
996 project_id: project_id.to_owned(),
997 is_active: None,
998 updated_since: None,
999 page: None,
1000 per_page: None,
1001 }
1002 }
1003 /**Create a task assignment
1004
1005Creates a new task assignment object. Returns a task assignment object and a 201 Created response code if the call succeeded.
1006
1007See endpoint docs at <https://help.getharvest.com/api-v2/projects-api/projects/task-assignments/#create-a-task-assignment>.*/
1008 pub fn create_task_assignment(
1009 &self,
1010 project_id: &str,
1011 ) -> request::CreateTaskAssignmentRequest {
1012 request::CreateTaskAssignmentRequest {
1013 client: &self,
1014 project_id: project_id.to_owned(),
1015 task_id: None,
1016 is_active: None,
1017 billable: None,
1018 hourly_rate: None,
1019 budget: None,
1020 }
1021 }
1022 /**Retrieve a task assignment
1023
1024Retrieves the task assignment with the given ID. Returns a task assignment object and a 200 OK response code if a valid identifier was provided.
1025
1026See endpoint docs at <https://help.getharvest.com/api-v2/projects-api/projects/task-assignments/#retrieve-a-task-assignment>.*/
1027 pub fn retrieve_task_assignment(
1028 &self,
1029 project_id: &str,
1030 task_assignment_id: &str,
1031 ) -> request::RetrieveTaskAssignmentRequest {
1032 request::RetrieveTaskAssignmentRequest {
1033 client: &self,
1034 project_id: project_id.to_owned(),
1035 task_assignment_id: task_assignment_id.to_owned(),
1036 }
1037 }
1038 /**Delete a task assignment
1039
1040Delete a task assignment. Deleting a task assignment is only possible if it has no time entries associated with it. Returns a 200 OK response code if the call succeeded.
1041
1042See endpoint docs at <https://help.getharvest.com/api-v2/projects-api/projects/task-assignments/#delete-a-task-assignment>.*/
1043 pub fn delete_task_assignment(
1044 &self,
1045 project_id: &str,
1046 task_assignment_id: &str,
1047 ) -> request::DeleteTaskAssignmentRequest {
1048 request::DeleteTaskAssignmentRequest {
1049 client: &self,
1050 project_id: project_id.to_owned(),
1051 task_assignment_id: task_assignment_id.to_owned(),
1052 }
1053 }
1054 /**Update a task assignment
1055
1056Updates the specific task assignment by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Returns a task assignment object and a 200 OK response code if the call succeeded.
1057
1058See endpoint docs at <https://help.getharvest.com/api-v2/projects-api/projects/task-assignments/#update-a-task-assignment>.*/
1059 pub fn update_task_assignment(
1060 &self,
1061 project_id: &str,
1062 task_assignment_id: &str,
1063 ) -> request::UpdateTaskAssignmentRequest {
1064 request::UpdateTaskAssignmentRequest {
1065 client: &self,
1066 project_id: project_id.to_owned(),
1067 task_assignment_id: task_assignment_id.to_owned(),
1068 is_active: None,
1069 billable: None,
1070 hourly_rate: None,
1071 budget: None,
1072 }
1073 }
1074 /**List all user assignments for a specific project
1075
1076Returns a list of user assignments for the project identified by PROJECT_ID. The user assignments are returned sorted by creation date, with the most recently created user assignments appearing first.
1077
1078The response contains an object with a user_assignments property that contains an array of up to per_page user assignments. Each entry in the array is a separate user assignment object. If no more user assignments are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your user assignments.
1079
1080See endpoint docs at <https://help.getharvest.com/api-v2/projects-api/projects/user-assignments/#list-all-user-assignments-for-a-specific-project>.*/
1081 pub fn list_user_assignments_for_specific_project(
1082 &self,
1083 project_id: &str,
1084 ) -> request::ListUserAssignmentsForSpecificProjectRequest {
1085 request::ListUserAssignmentsForSpecificProjectRequest {
1086 client: &self,
1087 project_id: project_id.to_owned(),
1088 user_id: None,
1089 is_active: None,
1090 updated_since: None,
1091 page: None,
1092 per_page: None,
1093 }
1094 }
1095 /**Create a user assignment
1096
1097Creates a new user assignment object. Returns a user assignment object and a 201 Created response code if the call succeeded.
1098
1099See endpoint docs at <https://help.getharvest.com/api-v2/projects-api/projects/user-assignments/#create-a-user-assignment>.*/
1100 pub fn create_user_assignment(
1101 &self,
1102 project_id: &str,
1103 ) -> request::CreateUserAssignmentRequest {
1104 request::CreateUserAssignmentRequest {
1105 client: &self,
1106 project_id: project_id.to_owned(),
1107 user_id: None,
1108 is_active: None,
1109 is_project_manager: None,
1110 use_default_rates: None,
1111 hourly_rate: None,
1112 budget: None,
1113 }
1114 }
1115 /**Retrieve a user assignment
1116
1117Retrieves the user assignment with the given ID. Returns a user assignment object and a 200 OK response code if a valid identifier was provided.
1118
1119See endpoint docs at <https://help.getharvest.com/api-v2/projects-api/projects/user-assignments/#retrieve-a-user-assignment>.*/
1120 pub fn retrieve_user_assignment(
1121 &self,
1122 project_id: &str,
1123 user_assignment_id: &str,
1124 ) -> request::RetrieveUserAssignmentRequest {
1125 request::RetrieveUserAssignmentRequest {
1126 client: &self,
1127 project_id: project_id.to_owned(),
1128 user_assignment_id: user_assignment_id.to_owned(),
1129 }
1130 }
1131 /**Delete a user assignment
1132
1133Delete a user assignment. Deleting a user assignment is only possible if it has no time entries or expenses associated with it. Returns a 200 OK response code if the call succeeded.
1134
1135See endpoint docs at <https://help.getharvest.com/api-v2/projects-api/projects/user-assignments/#delete-a-user-assignment>.*/
1136 pub fn delete_user_assignment(
1137 &self,
1138 project_id: &str,
1139 user_assignment_id: &str,
1140 ) -> request::DeleteUserAssignmentRequest {
1141 request::DeleteUserAssignmentRequest {
1142 client: &self,
1143 project_id: project_id.to_owned(),
1144 user_assignment_id: user_assignment_id.to_owned(),
1145 }
1146 }
1147 /**Update a user assignment
1148
1149Updates the specific user assignment by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Returns a user assignment object and a 200 OK response code if the call succeeded.
1150
1151See endpoint docs at <https://help.getharvest.com/api-v2/projects-api/projects/user-assignments/#update-a-user-assignment>.*/
1152 pub fn update_user_assignment(
1153 &self,
1154 project_id: &str,
1155 user_assignment_id: &str,
1156 ) -> request::UpdateUserAssignmentRequest {
1157 request::UpdateUserAssignmentRequest {
1158 client: &self,
1159 project_id: project_id.to_owned(),
1160 user_assignment_id: user_assignment_id.to_owned(),
1161 is_active: None,
1162 is_project_manager: None,
1163 use_default_rates: None,
1164 hourly_rate: None,
1165 budget: None,
1166 }
1167 }
1168 /**Expense Categories Report
1169
1170See endpoint docs at <https://help.getharvest.com/api-v2/reports-api/reports/expense-reports/#expense-categories-report>.*/
1171 pub fn expense_categories_report(
1172 &self,
1173 from: &str,
1174 to: &str,
1175 ) -> request::ExpenseCategoriesReportRequest {
1176 request::ExpenseCategoriesReportRequest {
1177 client: &self,
1178 from: from.to_owned(),
1179 to: to.to_owned(),
1180 page: None,
1181 per_page: None,
1182 }
1183 }
1184 /**Clients Report
1185
1186See endpoint docs at <https://help.getharvest.com/api-v2/reports-api/reports/expense-reports/#clients-report>.*/
1187 pub fn clients_expenses_report(
1188 &self,
1189 from: &str,
1190 to: &str,
1191 ) -> request::ClientsExpensesReportRequest {
1192 request::ClientsExpensesReportRequest {
1193 client: &self,
1194 from: from.to_owned(),
1195 to: to.to_owned(),
1196 page: None,
1197 per_page: None,
1198 }
1199 }
1200 /**Projects Report
1201
1202See endpoint docs at <https://help.getharvest.com/api-v2/reports-api/reports/expense-reports/#projects-report>.*/
1203 pub fn projects_expenses_report(
1204 &self,
1205 from: &str,
1206 to: &str,
1207 ) -> request::ProjectsExpensesReportRequest {
1208 request::ProjectsExpensesReportRequest {
1209 client: &self,
1210 from: from.to_owned(),
1211 to: to.to_owned(),
1212 page: None,
1213 per_page: None,
1214 }
1215 }
1216 /**Team Report
1217
1218See endpoint docs at <https://help.getharvest.com/api-v2/reports-api/reports/expense-reports/#team-report>.*/
1219 pub fn team_expenses_report(
1220 &self,
1221 from: &str,
1222 to: &str,
1223 ) -> request::TeamExpensesReportRequest {
1224 request::TeamExpensesReportRequest {
1225 client: &self,
1226 from: from.to_owned(),
1227 to: to.to_owned(),
1228 page: None,
1229 per_page: None,
1230 }
1231 }
1232 /**Project Budget Report
1233
1234The response contains an object with a results property that contains an array of up to per_page results. Each entry in the array is a separate result object. If no more results are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your results.
1235
1236See endpoint docs at <https://help.getharvest.com/api-v2/reports-api/reports/project-budget-report/#project-budget-report>.*/
1237 pub fn project_budget_report(&self) -> request::ProjectBudgetReportRequest {
1238 request::ProjectBudgetReportRequest {
1239 client: &self,
1240 page: None,
1241 per_page: None,
1242 is_active: None,
1243 }
1244 }
1245 /**Clients Report
1246
1247See endpoint docs at <https://help.getharvest.com/api-v2/reports-api/reports/time-reports/#clients-report>.*/
1248 pub fn clients_time_report(
1249 &self,
1250 from: &str,
1251 to: &str,
1252 ) -> request::ClientsTimeReportRequest {
1253 request::ClientsTimeReportRequest {
1254 client: &self,
1255 from: from.to_owned(),
1256 to: to.to_owned(),
1257 page: None,
1258 per_page: None,
1259 }
1260 }
1261 /**Projects Report
1262
1263See endpoint docs at <https://help.getharvest.com/api-v2/reports-api/reports/time-reports/#projects-report>.*/
1264 pub fn projects_time_report(
1265 &self,
1266 from: &str,
1267 to: &str,
1268 ) -> request::ProjectsTimeReportRequest {
1269 request::ProjectsTimeReportRequest {
1270 client: &self,
1271 from: from.to_owned(),
1272 to: to.to_owned(),
1273 page: None,
1274 per_page: None,
1275 }
1276 }
1277 /**Tasks Report
1278
1279See endpoint docs at <https://help.getharvest.com/api-v2/reports-api/reports/time-reports/#tasks-report>.*/
1280 pub fn tasks_report(&self, from: &str, to: &str) -> request::TasksReportRequest {
1281 request::TasksReportRequest {
1282 client: &self,
1283 from: from.to_owned(),
1284 to: to.to_owned(),
1285 page: None,
1286 per_page: None,
1287 }
1288 }
1289 /**Team Report
1290
1291See endpoint docs at <https://help.getharvest.com/api-v2/reports-api/reports/time-reports/#team-report>.*/
1292 pub fn team_time_report(
1293 &self,
1294 from: &str,
1295 to: &str,
1296 ) -> request::TeamTimeReportRequest {
1297 request::TeamTimeReportRequest {
1298 client: &self,
1299 from: from.to_owned(),
1300 to: to.to_owned(),
1301 page: None,
1302 per_page: None,
1303 }
1304 }
1305 /**Uninvoiced Report
1306
1307The response contains an object with a results property that contains an array of up to per_page results. Each entry in the array is a separate result object. If no more results are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your results.
1308
1309Note: Each request requires both the from and to parameters to be supplied in the URL’s query string. The timeframe supplied cannot exceed 1 year (365 days).
1310
1311See endpoint docs at <https://help.getharvest.com/api-v2/reports-api/reports/uninvoiced-report/#uninvoiced-report>.*/
1312 pub fn uninvoiced_report(
1313 &self,
1314 from: &str,
1315 to: &str,
1316 ) -> request::UninvoicedReportRequest {
1317 request::UninvoicedReportRequest {
1318 client: &self,
1319 from: from.to_owned(),
1320 to: to.to_owned(),
1321 page: None,
1322 per_page: None,
1323 }
1324 }
1325 /**List all roles
1326
1327Returns a list of roles in the account. The roles are returned sorted by creation date, with the most recently created roles appearing first.
1328
1329The response contains an object with a roles property that contains an array of up to per_page roles. Each entry in the array is a separate role object. If no more roles are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your roles.
1330
1331See endpoint docs at <https://help.getharvest.com/api-v2/roles-api/roles/roles/#list-all-roles>.*/
1332 pub fn list_roles(&self) -> request::ListRolesRequest {
1333 request::ListRolesRequest {
1334 client: &self,
1335 page: None,
1336 per_page: None,
1337 }
1338 }
1339 /**Create a role
1340
1341Creates a new role object. Returns a role object and a 201 Created response code if the call succeeded.
1342
1343See endpoint docs at <https://help.getharvest.com/api-v2/roles-api/roles/roles/#create-a-role>.*/
1344 pub fn create_role(&self) -> request::CreateRoleRequest {
1345 request::CreateRoleRequest {
1346 client: &self,
1347 name: None,
1348 user_ids: None,
1349 }
1350 }
1351 /**Retrieve a role
1352
1353Retrieves the role with the given ID. Returns a role object and a 200 OK response code if a valid identifier was provided.
1354
1355See endpoint docs at <https://help.getharvest.com/api-v2/roles-api/roles/roles/#retrieve-a-role>.*/
1356 pub fn retrieve_role(&self, role_id: &str) -> request::RetrieveRoleRequest {
1357 request::RetrieveRoleRequest {
1358 client: &self,
1359 role_id: role_id.to_owned(),
1360 }
1361 }
1362 /**Delete a role
1363
1364Delete a role. Deleting a role will unlink it from any users it was assigned to. Returns a 200 OK response code if the call succeeded.
1365
1366See endpoint docs at <https://help.getharvest.com/api-v2/roles-api/roles/roles/#delete-a-role>.*/
1367 pub fn delete_role(&self, role_id: &str) -> request::DeleteRoleRequest {
1368 request::DeleteRoleRequest {
1369 client: &self,
1370 role_id: role_id.to_owned(),
1371 }
1372 }
1373 /**Update a role
1374
1375Updates the specific role by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Returns a role object and a 200 OK response code if the call succeeded.
1376
1377See endpoint docs at <https://help.getharvest.com/api-v2/roles-api/roles/roles/#update-a-role>.*/
1378 pub fn update_role(&self, role_id: &str) -> request::UpdateRoleRequest {
1379 request::UpdateRoleRequest {
1380 client: &self,
1381 role_id: role_id.to_owned(),
1382 name: None,
1383 user_ids: None,
1384 }
1385 }
1386 /**List all task assignments
1387
1388Returns a list of your task assignments. The task assignments are returned sorted by creation date, with the most recently created task assignments appearing first.
1389
1390The response contains an object with a task_assignments property that contains an array of up to per_page task assignments. Each entry in the array is a separate task assignment object. If no more task assignments are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your task assignments.
1391
1392See endpoint docs at <https://help.getharvest.com/api-v2/projects-api/projects/task-assignments/#list-all-task-assignments>.*/
1393 pub fn list_task_assignments(&self) -> request::ListTaskAssignmentsRequest {
1394 request::ListTaskAssignmentsRequest {
1395 client: &self,
1396 is_active: None,
1397 updated_since: None,
1398 page: None,
1399 per_page: None,
1400 }
1401 }
1402 /**List all tasks
1403
1404Returns a list of your tasks. The tasks are returned sorted by creation date, with the most recently created tasks appearing first.
1405
1406The response contains an object with a tasks property that contains an array of up to per_page tasks. Each entry in the array is a separate task object. If no more tasks are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your tasks.
1407
1408See endpoint docs at <https://help.getharvest.com/api-v2/tasks-api/tasks/tasks/#list-all-tasks>.*/
1409 pub fn list_tasks(&self) -> request::ListTasksRequest {
1410 request::ListTasksRequest {
1411 client: &self,
1412 is_active: None,
1413 updated_since: None,
1414 page: None,
1415 per_page: None,
1416 }
1417 }
1418 /**Create a task
1419
1420Creates a new task object. Returns a task object and a 201 Created response code if the call succeeded.
1421
1422See endpoint docs at <https://help.getharvest.com/api-v2/tasks-api/tasks/tasks/#create-a-task>.*/
1423 pub fn create_task(&self) -> request::CreateTaskRequest {
1424 request::CreateTaskRequest {
1425 client: &self,
1426 name: None,
1427 billable_by_default: None,
1428 default_hourly_rate: None,
1429 is_default: None,
1430 is_active: None,
1431 }
1432 }
1433 /**Retrieve a task
1434
1435Retrieves the task with the given ID. Returns a task object and a 200 OK response code if a valid identifier was provided.
1436
1437See endpoint docs at <https://help.getharvest.com/api-v2/tasks-api/tasks/tasks/#retrieve-a-task>.*/
1438 pub fn retrieve_task(&self, task_id: &str) -> request::RetrieveTaskRequest {
1439 request::RetrieveTaskRequest {
1440 client: &self,
1441 task_id: task_id.to_owned(),
1442 }
1443 }
1444 /**Delete a task
1445
1446Delete a task. Deleting a task is only possible if it has no time entries associated with it. Returns a 200 OK response code if the call succeeded.
1447
1448See endpoint docs at <https://help.getharvest.com/api-v2/tasks-api/tasks/tasks/#delete-a-task>.*/
1449 pub fn delete_task(&self, task_id: &str) -> request::DeleteTaskRequest {
1450 request::DeleteTaskRequest {
1451 client: &self,
1452 task_id: task_id.to_owned(),
1453 }
1454 }
1455 /**Update a task
1456
1457Updates the specific task by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Returns a task object and a 200 OK response code if the call succeeded.
1458
1459See endpoint docs at <https://help.getharvest.com/api-v2/tasks-api/tasks/tasks/#update-a-task>.*/
1460 pub fn update_task(&self, task_id: &str) -> request::UpdateTaskRequest {
1461 request::UpdateTaskRequest {
1462 client: &self,
1463 task_id: task_id.to_owned(),
1464 name: None,
1465 billable_by_default: None,
1466 default_hourly_rate: None,
1467 is_default: None,
1468 is_active: None,
1469 }
1470 }
1471 /**List all time entries
1472
1473Returns a list of time entries. The time entries are returned sorted by spent_date date. At this time, the sort option can’t be customized.
1474
1475The response contains an object with a time_entries property that contains an array of up to per_page time entries. Each entry in the array is a separate time entry object. If no more time entries are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your time entries.
1476
1477See endpoint docs at <https://help.getharvest.com/api-v2/timesheets-api/timesheets/time-entries/#list-all-time-entries>.*/
1478 pub fn list_time_entries(&self) -> request::ListTimeEntriesRequest {
1479 request::ListTimeEntriesRequest {
1480 client: &self,
1481 user_id: None,
1482 client_id: None,
1483 project_id: None,
1484 task_id: None,
1485 external_reference_id: None,
1486 is_billed: None,
1487 is_running: None,
1488 updated_since: None,
1489 from: None,
1490 to: None,
1491 page: None,
1492 per_page: None,
1493 }
1494 }
1495 /**Create a time entry
1496
1497Creates a new time entry object. Returns a time entry object and a 201 Created response code if the call succeeded.
1498
1499You should only use this method to create time entries when your account is configured to track time via duration. You can verify this by visiting the Settings page in your Harvest account or by checking if wants_timestamp_timers is false in the Company API.
1500
1501See endpoint docs at <https://help.getharvest.com/api-v2/timesheets-api/timesheets/time-entries/#create-a-time-entry-via-duration>.*/
1502 pub fn create_time_entry(&self) -> request::CreateTimeEntryRequest {
1503 request::CreateTimeEntryRequest {
1504 client: &self,
1505 user_id: None,
1506 project_id: None,
1507 task_id: None,
1508 spent_date: None,
1509 started_time: None,
1510 ended_time: None,
1511 notes: None,
1512 external_reference: None,
1513 hours: None,
1514 }
1515 }
1516 /**Retrieve a time entry
1517
1518Retrieves the time entry with the given ID. Returns a time entry object and a 200 OK response code if a valid identifier was provided.
1519
1520See endpoint docs at <https://help.getharvest.com/api-v2/timesheets-api/timesheets/time-entries/#retrieve-a-time-entry>.*/
1521 pub fn retrieve_time_entry(
1522 &self,
1523 time_entry_id: &str,
1524 ) -> request::RetrieveTimeEntryRequest {
1525 request::RetrieveTimeEntryRequest {
1526 client: &self,
1527 time_entry_id: time_entry_id.to_owned(),
1528 }
1529 }
1530 /**Delete a time entry
1531
1532Delete a time entry. Deleting a time entry is only possible if it’s not closed and the associated project and task haven’t been archived. However, Admins can delete closed entries. Returns a 200 OK response code if the call succeeded.
1533
1534See endpoint docs at <https://help.getharvest.com/api-v2/timesheets-api/timesheets/time-entries/#delete-a-time-entry>.*/
1535 pub fn delete_time_entry(
1536 &self,
1537 time_entry_id: &str,
1538 ) -> request::DeleteTimeEntryRequest {
1539 request::DeleteTimeEntryRequest {
1540 client: &self,
1541 time_entry_id: time_entry_id.to_owned(),
1542 }
1543 }
1544 /**Update a time entry
1545
1546Updates the specific time entry by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Returns a time entry object and a 200 OK response code if the call succeeded.
1547
1548See endpoint docs at <https://help.getharvest.com/api-v2/timesheets-api/timesheets/time-entries/#update-a-time-entry>.*/
1549 pub fn update_time_entry(
1550 &self,
1551 time_entry_id: &str,
1552 ) -> request::UpdateTimeEntryRequest {
1553 request::UpdateTimeEntryRequest {
1554 client: &self,
1555 time_entry_id: time_entry_id.to_owned(),
1556 project_id: None,
1557 task_id: None,
1558 spent_date: None,
1559 started_time: None,
1560 ended_time: None,
1561 hours: None,
1562 notes: None,
1563 external_reference: None,
1564 }
1565 }
1566 /**Delete a time entry’s external reference
1567
1568Delete a time entry’s external reference. Returns a 200 OK response code if the call succeeded.
1569
1570See endpoint docs at <https://help.getharvest.com/api-v2/timesheets-api/timesheets/time-entries/#delete-a-time-entrys-external-reference>.*/
1571 pub fn delete_time_entry_external_reference(
1572 &self,
1573 time_entry_id: &str,
1574 ) -> request::DeleteTimeEntryExternalReferenceRequest {
1575 request::DeleteTimeEntryExternalReferenceRequest {
1576 client: &self,
1577 time_entry_id: time_entry_id.to_owned(),
1578 }
1579 }
1580 /**Restart a stopped time entry
1581
1582Restarting a time entry is only possible if it isn’t currently running. Returns a 200 OK response code if the call succeeded.
1583
1584See endpoint docs at <https://help.getharvest.com/api-v2/timesheets-api/timesheets/time-entries/#restart-a-stopped-time-entry>.*/
1585 pub fn restart_stopped_time_entry(
1586 &self,
1587 time_entry_id: &str,
1588 ) -> request::RestartStoppedTimeEntryRequest {
1589 request::RestartStoppedTimeEntryRequest {
1590 client: &self,
1591 time_entry_id: time_entry_id.to_owned(),
1592 }
1593 }
1594 /**Stop a running time entry
1595
1596Stopping a time entry is only possible if it’s currently running. Returns a 200 OK response code if the call succeeded.
1597
1598See endpoint docs at <https://help.getharvest.com/api-v2/timesheets-api/timesheets/time-entries/#stop-a-running-time-entry>.*/
1599 pub fn stop_running_time_entry(
1600 &self,
1601 time_entry_id: &str,
1602 ) -> request::StopRunningTimeEntryRequest {
1603 request::StopRunningTimeEntryRequest {
1604 client: &self,
1605 time_entry_id: time_entry_id.to_owned(),
1606 }
1607 }
1608 /**List all user assignments
1609
1610Returns a list of your projects user assignments, active and archived. The user assignments are returned sorted by creation date, with the most recently created user assignments appearing first.
1611
1612The response contains an object with a user_assignments property that contains an array of up to per_page user assignments. Each entry in the array is a separate user assignment object. If no more user assignments are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your user assignments.
1613
1614See endpoint docs at <https://help.getharvest.com/api-v2/projects-api/projects/user-assignments/#list-all-user-assignments>.*/
1615 pub fn list_user_assignments(&self) -> request::ListUserAssignmentsRequest {
1616 request::ListUserAssignmentsRequest {
1617 client: &self,
1618 user_id: None,
1619 is_active: None,
1620 updated_since: None,
1621 page: None,
1622 per_page: None,
1623 }
1624 }
1625 /**List all users
1626
1627Returns a list of your users. The users are returned sorted by creation date, with the most recently created users appearing first.
1628
1629The response contains an object with a users property that contains an array of up to per_page users. Each entry in the array is a separate user object. If no more users are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your users.
1630
1631See endpoint docs at <https://help.getharvest.com/api-v2/users-api/users/users/#list-all-users>.*/
1632 pub fn list_users(&self) -> request::ListUsersRequest {
1633 request::ListUsersRequest {
1634 client: &self,
1635 is_active: None,
1636 updated_since: None,
1637 page: None,
1638 per_page: None,
1639 }
1640 }
1641 /**Create a user
1642
1643Creates a new user object and sends an invitation email to the address specified in the email parameter. Returns a user object and a 201 Created response code if the call succeeded.
1644
1645See endpoint docs at <https://help.getharvest.com/api-v2/users-api/users/users/#create-a-user>.*/
1646 pub fn create_user(&self) -> request::CreateUserRequest {
1647 request::CreateUserRequest {
1648 client: &self,
1649 first_name: None,
1650 last_name: None,
1651 email: None,
1652 timezone: None,
1653 has_access_to_all_future_projects: None,
1654 is_contractor: None,
1655 is_active: None,
1656 weekly_capacity: None,
1657 default_hourly_rate: None,
1658 cost_rate: None,
1659 roles: None,
1660 access_roles: None,
1661 }
1662 }
1663 /**Retrieve the currently authenticated user
1664
1665Retrieves the currently authenticated user. Returns a user object and a 200 OK response code.
1666
1667See endpoint docs at <https://help.getharvest.com/api-v2/users-api/users/users/#retrieve-the-currently-authenticated-user>.*/
1668 pub fn retrieve_the_currently_authenticated_user(
1669 &self,
1670 ) -> request::RetrieveTheCurrentlyAuthenticatedUserRequest {
1671 request::RetrieveTheCurrentlyAuthenticatedUserRequest {
1672 client: &self,
1673 }
1674 }
1675 /**List active project assignments for the currently authenticated user
1676
1677Returns a list of your active project assignments for the currently authenticated user. The project assignments are returned sorted by creation date, with the most recently created project assignments appearing first.
1678
1679The response contains an object with a project_assignments property that contains an array of up to per_page project assignments. Each entry in the array is a separate project assignment object. If no more project assignments are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your project assignments.
1680
1681See endpoint docs at <https://help.getharvest.com/api-v2/users-api/users/project-assignments/#list-active-project-assignments-for-the-currently-authenticated-user>.*/
1682 pub fn list_active_project_assignments_for_the_currently_authenticated_user(
1683 &self,
1684 ) -> request::ListActiveProjectAssignmentsForTheCurrentlyAuthenticatedUserRequest {
1685 request::ListActiveProjectAssignmentsForTheCurrentlyAuthenticatedUserRequest {
1686 client: &self,
1687 page: None,
1688 per_page: None,
1689 }
1690 }
1691 /**Retrieve a user
1692
1693Retrieves the user with the given ID. Returns a user object and a 200 OK response code if a valid identifier was provided.
1694
1695See endpoint docs at <https://help.getharvest.com/api-v2/users-api/users/users/#retrieve-a-user>.*/
1696 pub fn retrieve_user(&self, user_id: &str) -> request::RetrieveUserRequest {
1697 request::RetrieveUserRequest {
1698 client: &self,
1699 user_id: user_id.to_owned(),
1700 }
1701 }
1702 /**Delete a user
1703
1704Delete a user. Deleting a user is only possible if they have no time entries or expenses associated with them. Returns a 200 OK response code if the call succeeded.
1705
1706See endpoint docs at <https://help.getharvest.com/api-v2/users-api/users/users/#delete-a-user>.*/
1707 pub fn delete_user(&self, user_id: &str) -> request::DeleteUserRequest {
1708 request::DeleteUserRequest {
1709 client: &self,
1710 user_id: user_id.to_owned(),
1711 }
1712 }
1713 /**Update a user
1714
1715Updates the specific user by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Returns a user object and a 200 OK response code if the call succeeded.
1716
1717See endpoint docs at <https://help.getharvest.com/api-v2/users-api/users/users/#update-a-user>.*/
1718 pub fn update_user(&self, user_id: &str) -> request::UpdateUserRequest {
1719 request::UpdateUserRequest {
1720 client: &self,
1721 user_id: user_id.to_owned(),
1722 first_name: None,
1723 last_name: None,
1724 email: None,
1725 timezone: None,
1726 has_access_to_all_future_projects: None,
1727 is_contractor: None,
1728 is_active: None,
1729 weekly_capacity: None,
1730 default_hourly_rate: None,
1731 cost_rate: None,
1732 roles: None,
1733 access_roles: None,
1734 }
1735 }
1736 /**List all billable rates for a specific user
1737
1738Returns a list of billable rates for the user identified by USER_ID. The billable rates are returned sorted by start_date, with the oldest starting billable rates appearing first.
1739
1740The response contains an object with a billable_rates property that contains an array of up to per_page billable rates. Each entry in the array is a separate billable rate object. If no more billable rates are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your billable rates.
1741
1742See endpoint docs at <https://help.getharvest.com/api-v2/users-api/users/billable-rates/#list-all-billable-rates-for-a-specific-user>.*/
1743 pub fn list_billable_rates_for_specific_user(
1744 &self,
1745 user_id: &str,
1746 ) -> request::ListBillableRatesForSpecificUserRequest {
1747 request::ListBillableRatesForSpecificUserRequest {
1748 client: &self,
1749 user_id: user_id.to_owned(),
1750 page: None,
1751 per_page: None,
1752 }
1753 }
1754 /**Create a billable rate
1755
1756Creates a new billable rate object. Returns a billable rate object and a 201 Created response code if the call succeeded.
1757
1758
1759 Creating a billable rate with no start_date will replace a user’s existing rate(s).
1760 Creating a billable rate with a start_date that is before a user’s existing rate(s) will replace those billable rates with the new one.
1761
1762
1763See endpoint docs at <https://help.getharvest.com/api-v2/users-api/users/billable-rates/#create-a-billable-rate>.*/
1764 pub fn create_billable_rate(
1765 &self,
1766 user_id: &str,
1767 ) -> request::CreateBillableRateRequest {
1768 request::CreateBillableRateRequest {
1769 client: &self,
1770 user_id: user_id.to_owned(),
1771 amount: None,
1772 start_date: None,
1773 }
1774 }
1775 /**Retrieve a billable rate
1776
1777Retrieves the billable rate with the given ID. Returns a billable rate object and a 200 OK response code if a valid identifier was provided.
1778
1779See endpoint docs at <https://help.getharvest.com/api-v2/users-api/users/billable-rates/#retrieve-a-billable-rate>.*/
1780 pub fn retrieve_billable_rate(
1781 &self,
1782 user_id: &str,
1783 billable_rate_id: &str,
1784 ) -> request::RetrieveBillableRateRequest {
1785 request::RetrieveBillableRateRequest {
1786 client: &self,
1787 user_id: user_id.to_owned(),
1788 billable_rate_id: billable_rate_id.to_owned(),
1789 }
1790 }
1791 /**List all cost rates for a specific user
1792
1793Returns a list of cost rates for the user identified by USER_ID. The cost rates are returned sorted by start_date, with the oldest starting cost rates appearing first.
1794
1795The response contains an object with a cost_rates property that contains an array of up to per_page cost rates. Each entry in the array is a separate cost rate object. If no more cost rates are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your cost rates.
1796
1797See endpoint docs at <https://help.getharvest.com/api-v2/users-api/users/cost-rates/#list-all-cost-rates-for-a-specific-user>.*/
1798 pub fn list_cost_rates_for_specific_user(
1799 &self,
1800 user_id: &str,
1801 ) -> request::ListCostRatesForSpecificUserRequest {
1802 request::ListCostRatesForSpecificUserRequest {
1803 client: &self,
1804 user_id: user_id.to_owned(),
1805 page: None,
1806 per_page: None,
1807 }
1808 }
1809 /**Create a cost rate
1810
1811Creates a new cost rate object. Returns a cost rate object and a 201 Created response code if the call succeeded.
1812
1813
1814 Creating a cost rate with no start_date will replace a user’s existing rate(s).
1815 Creating a cost rate with a start_date that is before a user’s existing rate(s) will replace those cost rates with the new one.
1816
1817
1818See endpoint docs at <https://help.getharvest.com/api-v2/users-api/users/cost-rates/#create-a-cost-rate>.*/
1819 pub fn create_cost_rate(&self, user_id: &str) -> request::CreateCostRateRequest {
1820 request::CreateCostRateRequest {
1821 client: &self,
1822 user_id: user_id.to_owned(),
1823 amount: None,
1824 start_date: None,
1825 }
1826 }
1827 /**Retrieve a cost rate
1828
1829Retrieves the cost rate with the given ID. Returns a cost rate object and a 200 OK response code if a valid identifier was provided.
1830
1831See endpoint docs at <https://help.getharvest.com/api-v2/users-api/users/cost-rates/#retrieve-a-cost-rate>.*/
1832 pub fn retrieve_cost_rate(
1833 &self,
1834 user_id: &str,
1835 cost_rate_id: &str,
1836 ) -> request::RetrieveCostRateRequest {
1837 request::RetrieveCostRateRequest {
1838 client: &self,
1839 user_id: user_id.to_owned(),
1840 cost_rate_id: cost_rate_id.to_owned(),
1841 }
1842 }
1843 /**List active project assignments
1844
1845Returns a list of active project assignments for the user identified by USER_ID. The project assignments are returned sorted by creation date, with the most recently created project assignments appearing first.
1846
1847The response contains an object with a project_assignments property that contains an array of up to per_page project assignments. Each entry in the array is a separate project assignment object. If no more project assignments are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your project assignments.
1848
1849See endpoint docs at <https://help.getharvest.com/api-v2/users-api/users/project-assignments/#list-active-project-assignments>.*/
1850 pub fn list_active_project_assignments(
1851 &self,
1852 user_id: &str,
1853 ) -> request::ListActiveProjectAssignmentsRequest {
1854 request::ListActiveProjectAssignmentsRequest {
1855 client: &self,
1856 user_id: user_id.to_owned(),
1857 updated_since: None,
1858 page: None,
1859 per_page: None,
1860 }
1861 }
1862 /**List all assigned teammates for a specific user
1863
1864Returns a list of assigned teammates for the user identified by USER_ID. The USER_ID must belong to a user that is a Manager, if not, a 422 Unprocessable Entity status code will be returned.
1865
1866The response contains an object with a teammates property that contains an array of up to per_page teammates. Each entry in the array is a separate teammate object. If no more teammates are available, the resulting array will be empty. Several additional pagination properties are included in the response to simplify paginating your teammates.
1867
1868See endpoint docs at <https://help.getharvest.com/api-v2/users-api/users/teammates/#list-all-assigned-teammates-for-a-specific-user>.*/
1869 pub fn list_assigned_teammates_for_specific_user(
1870 &self,
1871 user_id: &str,
1872 ) -> request::ListAssignedTeammatesForSpecificUserRequest {
1873 request::ListAssignedTeammatesForSpecificUserRequest {
1874 client: &self,
1875 user_id: user_id.to_owned(),
1876 page: None,
1877 per_page: None,
1878 }
1879 }
1880 /**Update a user’s assigned teammates
1881
1882Updates the the assigned teammates for a specific user. Returns list of assigned teammates and a 200 OK response code if the call succeeded. The USER_ID must belong to a user that is a Manager, if not, a 422 Unprocessable Entity status code will be returned.
1883
1884Adding teammates for the first time will add the people_manager access role to the Manager. Any IDs not included in the teammate_ids that are currently assigned will be unassigned from the Manager. Use an empty array to unassign all users. This will also remove the people_manager access role from the Manager.
1885
1886See endpoint docs at <https://help.getharvest.com/api-v2/users-api/users/teammates/#update-a-users-assigned-teammates>.*/
1887 pub fn update_user_assigned_teammates(
1888 &self,
1889 user_id: &str,
1890 ) -> request::UpdateUserAssignedTeammatesRequest {
1891 request::UpdateUserAssignedTeammatesRequest {
1892 client: &self,
1893 user_id: user_id.to_owned(),
1894 teammate_ids: None,
1895 }
1896 }
1897}
1898pub enum HarvestAuthentication {
1899 BearerAuth { bearer_auth: String, account_auth: String },
1900}
1901impl HarvestAuthentication {
1902 pub fn from_env() -> Self {
1903 Self::BearerAuth {
1904 bearer_auth: std::env::var("HARVEST_BEARER_AUTH")
1905 .expect("Environment variable HARVEST_BEARER_AUTH is not set."),
1906 account_auth: std::env::var("HARVEST_ACCOUNT_AUTH")
1907 .expect("Environment variable HARVEST_ACCOUNT_AUTH is not set."),
1908 }
1909 }
1910}