asana/lib.rs
1//! [`AsanaClient`](struct.AsanaClient.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;
8pub use httpclient::{Error, Result, InMemoryResponseExt};
9use std::sync::{Arc, OnceLock};
10use crate::model::*;
11use base64::{Engine, engine::general_purpose::STANDARD_NO_PAD};
12mod serde;
13static SHARED_HTTPCLIENT: OnceLock<httpclient::Client> = OnceLock::new();
14pub fn default_http_client() -> httpclient::Client {
15 httpclient::Client::new().base_url("https://app.asana.com/api/1.0")
16}
17/// Use this method if you want to add custom middleware to the httpclient.
18/// Example usage:
19///
20/// ```
21/// init_http_client(|| {
22/// default_http_client()
23/// .with_middleware(..)
24/// });
25/// ```
26pub fn init_http_client(init: fn() -> httpclient::Client) {
27 SHARED_HTTPCLIENT.get_or_init(init);
28}
29fn shared_http_client() -> &'static httpclient::Client {
30 SHARED_HTTPCLIENT.get_or_init(default_http_client)
31}
32static SHARED_OAUTH2FLOW: OnceLock<httpclient_oauth2::OAuth2Flow> = OnceLock::new();
33pub fn init_oauth2_flow(init: fn() -> httpclient_oauth2::OAuth2Flow) {
34 SHARED_OAUTH2FLOW.get_or_init(init);
35}
36fn shared_oauth2_flow() -> &'static httpclient_oauth2::OAuth2Flow {
37 let client_id = std::env::var("ASANA_CLIENT_ID")
38 .expect("ASANA_CLIENT_ID must be set");
39 let client_secret = std::env::var("ASANA_CLIENT_SECRET")
40 .expect("ASANA_CLIENT_SECRET must be set");
41 let redirect_uri = std::env::var("ASANA_REDIRECT_URI")
42 .expect("ASANA_REDIRECT_URI must be set");
43 SHARED_OAUTH2FLOW
44 .get_or_init(|| httpclient_oauth2::OAuth2Flow {
45 client_id,
46 client_secret,
47 init_endpoint: "https://app.asana.com/-/oauth_authorize".to_string(),
48 exchange_endpoint: "https://app.asana.com/-/oauth_token".to_string(),
49 refresh_endpoint: "https://app.asana.com/-/oauth_token".to_string(),
50 redirect_uri,
51 })
52}
53#[derive(Clone)]
54pub struct FluentRequest<'a, T> {
55 pub(crate) client: &'a AsanaClient,
56 pub params: T,
57}
58pub struct AsanaClient {
59 client: &'static httpclient::Client,
60 authentication: AsanaAuth,
61}
62impl AsanaClient {
63 pub fn from_env() -> Self {
64 Self {
65 client: shared_http_client(),
66 authentication: AsanaAuth::from_env(),
67 }
68 }
69 pub fn with_auth(authentication: AsanaAuth) -> Self {
70 Self {
71 client: shared_http_client(),
72 authentication,
73 }
74 }
75}
76impl AsanaClient {
77 pub(crate) fn authenticate<'a>(
78 &self,
79 mut r: httpclient::RequestBuilder<'a>,
80 ) -> httpclient::RequestBuilder<'a> {
81 match &self.authentication {
82 AsanaAuth::PersonalAccessToken { personal_access_token } => {
83 r = r.bearer_auth(personal_access_token);
84 }
85 AsanaAuth::OAuth2 { middleware } => {
86 r.middlewares.insert(0, middleware.clone());
87 }
88 }
89 r
90 }
91 /**Get an attachment
92
93Get the full record for a single attachment.*/
94 pub fn get_attachment(
95 &self,
96 attachment_gid: &str,
97 ) -> FluentRequest<'_, request::GetAttachmentRequest> {
98 FluentRequest {
99 client: self,
100 params: request::GetAttachmentRequest {
101 attachment_gid: attachment_gid.to_owned(),
102 opt_fields: None,
103 opt_pretty: None,
104 },
105 }
106 }
107 /**Delete an attachment
108
109Deletes a specific, existing attachment.
110
111Returns an empty data record.*/
112 pub fn delete_attachment(
113 &self,
114 attachment_gid: &str,
115 ) -> FluentRequest<'_, request::DeleteAttachmentRequest> {
116 FluentRequest {
117 client: self,
118 params: request::DeleteAttachmentRequest {
119 attachment_gid: attachment_gid.to_owned(),
120 opt_pretty: None,
121 },
122 }
123 }
124 /**Get attachments from an object
125
126Returns the compact records for all attachments on the object.
127
128There are three possible `parent` values for this request: `project`, `project_brief`, and `task`. For a project, an attachment refers to a file uploaded to the "Key resources" section in the project Overview. For a project brief, an attachment refers to inline files in the project brief itself. For a task, an attachment refers to a file directly associated to that task.
129
130Note that within the Asana app, inline images in the task description do not appear in the index of image thumbnails nor as stories in the task. However, requests made to `GET /attachments` for a task will return all of the images in the task, including inline images.*/
131 pub fn get_attachments_for_object(
132 &self,
133 parent: &str,
134 ) -> FluentRequest<'_, request::GetAttachmentsForObjectRequest> {
135 FluentRequest {
136 client: self,
137 params: request::GetAttachmentsForObjectRequest {
138 limit: None,
139 offset: None,
140 opt_fields: None,
141 opt_pretty: None,
142 parent: parent.to_owned(),
143 },
144 }
145 }
146 /**Upload an attachment
147
148Upload an attachment.
149
150This method uploads an attachment on an object and returns the compact
151record for the created attachment object. This is possible by either:
152
153- Providing the URL of the external resource being attached, or
154- Downloading the file content first and then uploading it as any other attachment. Note that it is not possible to attach
155files from third party services such as Dropbox, Box, Vimeo & Google Drive via the API
156
157The 100MB size limit on attachments in Asana is enforced on this endpoint.
158
159This endpoint expects a multipart/form-data encoded request containing the full contents of the file to be uploaded.
160
161Requests made should follow the HTTP/1.1 specification that line
162terminators are of the form `CRLF` or `\r\n` outlined
163[here](http://www.w3.org/Protocols/HTTP/1.1/draft-ietf-http-v11-spec-01#Basic-Rules) in order for the server to reliably and properly handle the request.*/
164 pub fn create_attachment_for_object(
165 &self,
166 ) -> FluentRequest<'_, request::CreateAttachmentForObjectRequest> {
167 FluentRequest {
168 client: self,
169 params: request::CreateAttachmentForObjectRequest {
170 opt_fields: None,
171 opt_pretty: None,
172 },
173 }
174 }
175 /**Get audit log events
176
177Retrieve the audit log events that have been captured in your domain.
178
179This endpoint will return a list of [AuditLogEvent](/reference/audit-log-api) objects, sorted by creation time in ascending order. Note that the Audit Log API captures events from October 8th, 2021 and later. Queries for events before this date will not return results.
180
181There are a number of query parameters (below) that can be used to filter the set of [AuditLogEvent](/reference/audit-log-api) objects that are returned in the response. Any combination of query parameters is valid. When no filters are provided, all of the events that have been captured in your domain will match.
182
183The list of events will always be [paginated](/docs/pagination). The default limit is 1000 events. The next set of events can be retrieved using the `offset` from the previous response. If there are no events that match the provided filters in your domain, the endpoint will return `null` for the `next_page` field. Querying again with the same filters may return new events if they were captured after the last request. Once a response includes a `next_page` with an `offset`, subsequent requests can be made with the latest `offset` to poll for new events that match the provided filters.
184
185*Note: If the filters you provided match events in your domain and `next_page` is present in the response, we will continue to send `next_page` on subsequent requests even when there are no more events that match the filters. This was put in place so that you can implement an audit log stream that will return future events that match these filters. If you are not interested in future events that match the filters you have defined, you can rely on checking empty `data` response for the end of current events that match your filters.*
186
187When no `offset` is provided, the response will begin with the oldest events that match the provided filters. It is important to note that [AuditLogEvent](/reference/audit-log-api) objects will be permanently deleted from our systems after 90 days. If you wish to keep a permanent record of these events, we recommend using a SIEM tool to ingest and store these logs.*/
188 pub fn get_audit_log_events(
189 &self,
190 workspace_gid: &str,
191 ) -> FluentRequest<'_, request::GetAuditLogEventsRequest> {
192 FluentRequest {
193 client: self,
194 params: request::GetAuditLogEventsRequest {
195 actor_gid: None,
196 actor_type: None,
197 end_at: None,
198 event_type: None,
199 limit: None,
200 offset: None,
201 resource_gid: None,
202 start_at: None,
203 workspace_gid: workspace_gid.to_owned(),
204 },
205 }
206 }
207 /**Submit parallel requests
208
209Make multiple requests in parallel to Asana's API.*/
210 pub fn create_batch_request(
211 &self,
212 data: BatchRequest,
213 ) -> FluentRequest<'_, request::CreateBatchRequestRequest> {
214 FluentRequest {
215 client: self,
216 params: request::CreateBatchRequestRequest {
217 data,
218 opt_fields: None,
219 opt_pretty: None,
220 },
221 }
222 }
223 /**Get a project's custom fields
224
225Returns a list of all of the custom fields settings on a project, in compact form. Note that, as in all queries to collections which return compact representation, `opt_fields` can be used to include more data than is returned in the compact representation. See the [documentation for input/output options](https://developers.asana.com/docs/inputoutput-options) for more information.*/
226 pub fn get_custom_field_settings_for_project(
227 &self,
228 project_gid: &str,
229 ) -> FluentRequest<'_, request::GetCustomFieldSettingsForProjectRequest> {
230 FluentRequest {
231 client: self,
232 params: request::GetCustomFieldSettingsForProjectRequest {
233 limit: None,
234 offset: None,
235 opt_fields: None,
236 opt_pretty: None,
237 project_gid: project_gid.to_owned(),
238 },
239 }
240 }
241 /**Get a portfolio's custom fields
242
243Returns a list of all of the custom fields settings on a portfolio, in compact form.*/
244 pub fn get_custom_field_settings_for_portfolio(
245 &self,
246 portfolio_gid: &str,
247 ) -> FluentRequest<'_, request::GetCustomFieldSettingsForPortfolioRequest> {
248 FluentRequest {
249 client: self,
250 params: request::GetCustomFieldSettingsForPortfolioRequest {
251 limit: None,
252 offset: None,
253 opt_fields: None,
254 opt_pretty: None,
255 portfolio_gid: portfolio_gid.to_owned(),
256 },
257 }
258 }
259 /**Create a custom field
260
261Creates a new custom field in a workspace. Every custom field is required
262to be created in a specific workspace, and this workspace cannot be
263changed once set.
264
265A custom field’s name must be unique within a workspace and not conflict
266with names of existing task properties such as `Due Date` or `Assignee`.
267A custom field’s type must be one of `text`, `enum`, `multi_enum`, `number`,
268`date`, or `people`.
269
270Returns the full record of the newly created custom field.*/
271 pub fn create_custom_field(
272 &self,
273 data: CustomFieldRequest,
274 ) -> FluentRequest<'_, request::CreateCustomFieldRequest> {
275 FluentRequest {
276 client: self,
277 params: request::CreateCustomFieldRequest {
278 data,
279 opt_fields: None,
280 opt_pretty: None,
281 },
282 }
283 }
284 /**Get a custom field
285
286Get the complete definition of a custom field’s metadata.
287
288Since custom fields can be defined for one of a number of types, and
289these types have different data and behaviors, there are fields that are
290relevant to a particular type. For instance, as noted above, enum_options
291is only relevant for the enum type and defines the set of choices that
292the enum could represent. The examples below show some of these
293type-specific custom field definitions.*/
294 pub fn get_custom_field(
295 &self,
296 custom_field_gid: &str,
297 ) -> FluentRequest<'_, request::GetCustomFieldRequest> {
298 FluentRequest {
299 client: self,
300 params: request::GetCustomFieldRequest {
301 custom_field_gid: custom_field_gid.to_owned(),
302 opt_fields: None,
303 opt_pretty: None,
304 },
305 }
306 }
307 /**Update a custom field
308
309A specific, existing custom field can be updated by making a PUT request on the URL for that custom field. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged
310When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the custom field.
311A custom field’s `type` cannot be updated.
312An enum custom field’s `enum_options` cannot be updated with this endpoint. Instead see “Work With Enum Options” for information on how to update `enum_options`.
313Locked custom fields can only be updated by the user who locked the field.
314Returns the complete updated custom field record.*/
315 pub fn update_custom_field(
316 &self,
317 custom_field_gid: &str,
318 data: CustomFieldRequest,
319 ) -> FluentRequest<'_, request::UpdateCustomFieldRequest> {
320 FluentRequest {
321 client: self,
322 params: request::UpdateCustomFieldRequest {
323 custom_field_gid: custom_field_gid.to_owned(),
324 data,
325 opt_fields: None,
326 opt_pretty: None,
327 },
328 }
329 }
330 /**Delete a custom field
331
332A specific, existing custom field can be deleted by making a DELETE request on the URL for that custom field.
333Locked custom fields can only be deleted by the user who locked the field.
334Returns an empty data record.*/
335 pub fn delete_custom_field(
336 &self,
337 custom_field_gid: &str,
338 ) -> FluentRequest<'_, request::DeleteCustomFieldRequest> {
339 FluentRequest {
340 client: self,
341 params: request::DeleteCustomFieldRequest {
342 custom_field_gid: custom_field_gid.to_owned(),
343 opt_pretty: None,
344 },
345 }
346 }
347 /**Get a workspace's custom fields
348
349Returns a list of the compact representation of all of the custom fields in a workspace.*/
350 pub fn get_custom_fields_for_workspace(
351 &self,
352 workspace_gid: &str,
353 ) -> FluentRequest<'_, request::GetCustomFieldsForWorkspaceRequest> {
354 FluentRequest {
355 client: self,
356 params: request::GetCustomFieldsForWorkspaceRequest {
357 limit: None,
358 offset: None,
359 opt_fields: None,
360 opt_pretty: None,
361 workspace_gid: workspace_gid.to_owned(),
362 },
363 }
364 }
365 /**Create an enum option
366
367Creates an enum option and adds it to this custom field’s list of enum options. A custom field can have at most 500 enum options (including disabled options). By default new enum options are inserted at the end of a custom field’s list.
368Locked custom fields can only have enum options added by the user who locked the field.
369Returns the full record of the newly created enum option.*/
370 pub fn create_enum_option_for_custom_field(
371 &self,
372 custom_field_gid: &str,
373 data: EnumOptionRequest,
374 ) -> FluentRequest<'_, request::CreateEnumOptionForCustomFieldRequest> {
375 FluentRequest {
376 client: self,
377 params: request::CreateEnumOptionForCustomFieldRequest {
378 custom_field_gid: custom_field_gid.to_owned(),
379 data,
380 opt_fields: None,
381 opt_pretty: None,
382 },
383 }
384 }
385 /**Reorder a custom field's enum
386
387Moves a particular enum option to be either before or after another specified enum option in the custom field.
388Locked custom fields can only be reordered by the user who locked the field.*/
389 pub fn insert_enum_option_for_custom_field(
390 &self,
391 custom_field_gid: &str,
392 data: EnumOptionInsertRequest,
393 ) -> FluentRequest<'_, request::InsertEnumOptionForCustomFieldRequest> {
394 FluentRequest {
395 client: self,
396 params: request::InsertEnumOptionForCustomFieldRequest {
397 custom_field_gid: custom_field_gid.to_owned(),
398 data,
399 opt_fields: None,
400 opt_pretty: None,
401 },
402 }
403 }
404 /**Update an enum option
405
406Updates an existing enum option. Enum custom fields require at least one enabled enum option.
407Locked custom fields can only be updated by the user who locked the field.
408Returns the full record of the updated enum option.*/
409 pub fn update_enum_option(
410 &self,
411 data: EnumOptionBase,
412 enum_option_gid: &str,
413 ) -> FluentRequest<'_, request::UpdateEnumOptionRequest> {
414 FluentRequest {
415 client: self,
416 params: request::UpdateEnumOptionRequest {
417 data,
418 enum_option_gid: enum_option_gid.to_owned(),
419 opt_fields: None,
420 opt_pretty: None,
421 },
422 }
423 }
424 /**Get events on a resource
425
426Returns the full record for all events that have occurred since the sync
427token was created.
428
429A `GET` request to the endpoint `/[path_to_resource]/events` can be made in
430lieu of including the resource ID in the data for the request.
431
432Asana limits a single sync token to 100 events. If more than 100 events exist
433for a given resource, `has_more: true` will be returned in the response, indicating
434that there are more events to pull.
435
436*Note: The resource returned will be the resource that triggered the
437event. This may be different from the one that the events were requested
438for. For example, a subscription to a project will contain events for
439tasks contained within the project.**/
440 pub fn get_events(
441 &self,
442 resource: &str,
443 ) -> FluentRequest<'_, request::GetEventsRequest> {
444 FluentRequest {
445 client: self,
446 params: request::GetEventsRequest {
447 opt_fields: None,
448 opt_pretty: None,
449 resource: resource.to_owned(),
450 sync: None,
451 },
452 }
453 }
454 /**Get a goal relationship
455
456Returns the complete updated goal relationship record for a single goal relationship.*/
457 pub fn get_goal_relationship(
458 &self,
459 goal_relationship_gid: &str,
460 ) -> FluentRequest<'_, request::GetGoalRelationshipRequest> {
461 FluentRequest {
462 client: self,
463 params: request::GetGoalRelationshipRequest {
464 goal_relationship_gid: goal_relationship_gid.to_owned(),
465 opt_fields: None,
466 opt_pretty: None,
467 },
468 }
469 }
470 /**Update a goal relationship
471
472An existing goal relationship can be updated by making a PUT request on the URL for
473that goal relationship. Only the fields provided in the `data` block will be updated;
474any unspecified fields will remain unchanged.
475
476Returns the complete updated goal relationship record.*/
477 pub fn update_goal_relationship(
478 &self,
479 data: GoalRelationshipRequest,
480 goal_relationship_gid: &str,
481 ) -> FluentRequest<'_, request::UpdateGoalRelationshipRequest> {
482 FluentRequest {
483 client: self,
484 params: request::UpdateGoalRelationshipRequest {
485 data,
486 goal_relationship_gid: goal_relationship_gid.to_owned(),
487 opt_fields: None,
488 opt_pretty: None,
489 },
490 }
491 }
492 /**Get goal relationships
493
494Returns compact goal relationship records.*/
495 pub fn get_goal_relationships(
496 &self,
497 supported_goal: &str,
498 ) -> FluentRequest<'_, request::GetGoalRelationshipsRequest> {
499 FluentRequest {
500 client: self,
501 params: request::GetGoalRelationshipsRequest {
502 limit: None,
503 offset: None,
504 opt_fields: None,
505 opt_pretty: None,
506 resource_subtype: None,
507 supported_goal: supported_goal.to_owned(),
508 },
509 }
510 }
511 /**Add a supporting goal relationship
512
513Creates a goal relationship by adding a supporting resource to a given goal.
514
515Returns the newly created goal relationship record.*/
516 pub fn add_supporting_relationship(
517 &self,
518 data: GoalAddSupportingRelationshipRequest,
519 goal_gid: &str,
520 ) -> FluentRequest<'_, request::AddSupportingRelationshipRequest> {
521 FluentRequest {
522 client: self,
523 params: request::AddSupportingRelationshipRequest {
524 data,
525 goal_gid: goal_gid.to_owned(),
526 opt_fields: None,
527 opt_pretty: None,
528 },
529 }
530 }
531 /**Removes a supporting goal relationship
532
533Removes a goal relationship for a given parent goal.*/
534 pub fn remove_supporting_relationship(
535 &self,
536 data: GoalRemoveSupportingRelationshipRequest,
537 goal_gid: &str,
538 ) -> FluentRequest<'_, request::RemoveSupportingRelationshipRequest> {
539 FluentRequest {
540 client: self,
541 params: request::RemoveSupportingRelationshipRequest {
542 data,
543 goal_gid: goal_gid.to_owned(),
544 opt_pretty: None,
545 },
546 }
547 }
548 /**Get a goal
549
550Returns the complete goal record for a single goal.*/
551 pub fn get_goal(
552 &self,
553 goal_gid: &str,
554 ) -> FluentRequest<'_, request::GetGoalRequest> {
555 FluentRequest {
556 client: self,
557 params: request::GetGoalRequest {
558 goal_gid: goal_gid.to_owned(),
559 opt_fields: None,
560 opt_pretty: None,
561 },
562 }
563 }
564 /**Update a goal
565
566An existing goal can be updated by making a PUT request on the URL for
567that goal. Only the fields provided in the `data` block will be updated;
568any unspecified fields will remain unchanged.
569
570Returns the complete updated goal record.*/
571 pub fn update_goal(
572 &self,
573 data: GoalUpdateRequest,
574 goal_gid: &str,
575 ) -> FluentRequest<'_, request::UpdateGoalRequest> {
576 FluentRequest {
577 client: self,
578 params: request::UpdateGoalRequest {
579 data,
580 goal_gid: goal_gid.to_owned(),
581 opt_fields: None,
582 opt_pretty: None,
583 },
584 }
585 }
586 /**Delete a goal
587
588A specific, existing goal can be deleted by making a DELETE request on the URL for that goal.
589
590Returns an empty data record.*/
591 pub fn delete_goal(
592 &self,
593 goal_gid: &str,
594 ) -> FluentRequest<'_, request::DeleteGoalRequest> {
595 FluentRequest {
596 client: self,
597 params: request::DeleteGoalRequest {
598 goal_gid: goal_gid.to_owned(),
599 opt_pretty: None,
600 },
601 }
602 }
603 /**Get goals
604
605Returns compact goal records.*/
606 pub fn get_goals(&self) -> FluentRequest<'_, request::GetGoalsRequest> {
607 FluentRequest {
608 client: self,
609 params: request::GetGoalsRequest {
610 is_workspace_level: None,
611 limit: None,
612 offset: None,
613 opt_fields: None,
614 opt_pretty: None,
615 portfolio: None,
616 project: None,
617 task: None,
618 team: None,
619 time_periods: None,
620 workspace: None,
621 },
622 }
623 }
624 /**Create a goal
625
626Creates a new goal in a workspace or team.
627
628Returns the full record of the newly created goal.*/
629 pub fn create_goal(
630 &self,
631 data: GoalRequest,
632 ) -> FluentRequest<'_, request::CreateGoalRequest> {
633 FluentRequest {
634 client: self,
635 params: request::CreateGoalRequest {
636 data,
637 opt_fields: None,
638 opt_pretty: None,
639 },
640 }
641 }
642 /**Create a goal metric
643
644Creates and adds a goal metric to a specified goal. Note that this replaces an existing goal metric if one already exists.*/
645 pub fn create_goal_metric(
646 &self,
647 data: GoalMetricRequest,
648 goal_gid: &str,
649 ) -> FluentRequest<'_, request::CreateGoalMetricRequest> {
650 FluentRequest {
651 client: self,
652 params: request::CreateGoalMetricRequest {
653 data,
654 goal_gid: goal_gid.to_owned(),
655 opt_fields: None,
656 opt_pretty: None,
657 },
658 }
659 }
660 /**Update a goal metric
661
662Updates a goal's existing metric's `current_number_value` if one exists,
663otherwise responds with a 400 status code.
664
665Returns the complete updated goal metric record.*/
666 pub fn update_goal_metric(
667 &self,
668 data: GoalMetricCurrentValueRequest,
669 goal_gid: &str,
670 ) -> FluentRequest<'_, request::UpdateGoalMetricRequest> {
671 FluentRequest {
672 client: self,
673 params: request::UpdateGoalMetricRequest {
674 data,
675 goal_gid: goal_gid.to_owned(),
676 opt_fields: None,
677 opt_pretty: None,
678 },
679 }
680 }
681 /**Add a collaborator to a goal
682
683Adds followers to a goal. Returns the goal the followers were added to.
684Each goal can be associated with zero or more followers in the system.
685Requests to add/remove followers, if successful, will return the complete updated goal record, described above.*/
686 pub fn add_followers(
687 &self,
688 data: TaskAddFollowersRequest,
689 goal_gid: &str,
690 ) -> FluentRequest<'_, request::AddFollowersRequest> {
691 FluentRequest {
692 client: self,
693 params: request::AddFollowersRequest {
694 data,
695 goal_gid: goal_gid.to_owned(),
696 opt_fields: None,
697 opt_pretty: None,
698 },
699 }
700 }
701 /**Remove a collaborator from a goal
702
703Removes followers from a goal. Returns the goal the followers were removed from.
704Each goal can be associated with zero or more followers in the system.
705Requests to add/remove followers, if successful, will return the complete updated goal record, described above.*/
706 pub fn remove_followers(
707 &self,
708 data: TaskAddFollowersRequest,
709 goal_gid: &str,
710 ) -> FluentRequest<'_, request::RemoveFollowersRequest> {
711 FluentRequest {
712 client: self,
713 params: request::RemoveFollowersRequest {
714 data,
715 goal_gid: goal_gid.to_owned(),
716 opt_fields: None,
717 opt_pretty: None,
718 },
719 }
720 }
721 /**Get parent goals from a goal
722
723Returns a compact representation of all of the parent goals of a goal.*/
724 pub fn get_parent_goals_for_goal(
725 &self,
726 goal_gid: &str,
727 ) -> FluentRequest<'_, request::GetParentGoalsForGoalRequest> {
728 FluentRequest {
729 client: self,
730 params: request::GetParentGoalsForGoalRequest {
731 goal_gid: goal_gid.to_owned(),
732 opt_fields: None,
733 opt_pretty: None,
734 },
735 }
736 }
737 /**Get a job by id
738
739Returns the full record for a job.*/
740 pub fn get_job(&self, job_gid: &str) -> FluentRequest<'_, request::GetJobRequest> {
741 FluentRequest {
742 client: self,
743 params: request::GetJobRequest {
744 job_gid: job_gid.to_owned(),
745 opt_fields: None,
746 opt_pretty: None,
747 },
748 }
749 }
750 /**Get multiple memberships
751
752Returns compact `goal_membership` or `project_membership` records. The possible types for `parent` in this request are `goal` or `project`. An additional member (user GID or team GID) can be passed in to filter to a specific membership.*/
753 pub fn get_memberships(&self) -> FluentRequest<'_, request::GetMembershipsRequest> {
754 FluentRequest {
755 client: self,
756 params: request::GetMembershipsRequest {
757 limit: None,
758 member: None,
759 offset: None,
760 opt_fields: None,
761 opt_pretty: None,
762 parent: None,
763 },
764 }
765 }
766 /**Create a membership
767
768Creates a new membership in a `goal`. `Teams` or `users` can be a member
769of `goals`.
770
771Returns the full record of the newly created membership.*/
772 pub fn create_membership(
773 &self,
774 data: CreateMembershipRequestBody,
775 ) -> FluentRequest<'_, request::CreateMembershipRequest> {
776 FluentRequest {
777 client: self,
778 params: request::CreateMembershipRequest {
779 data,
780 opt_pretty: None,
781 },
782 }
783 }
784 /**Get a membership
785
786Returns compact `project_membership` record for a single membership. `GET` only supports project memberships currently*/
787 pub fn get_membership(
788 &self,
789 membership_gid: &str,
790 ) -> FluentRequest<'_, request::GetMembershipRequest> {
791 FluentRequest {
792 client: self,
793 params: request::GetMembershipRequest {
794 membership_gid: membership_gid.to_owned(),
795 opt_fields: None,
796 opt_pretty: None,
797 },
798 }
799 }
800 /**Delete a membership
801
802A specific, existing membership can be deleted by making a `DELETE` request
803on the URL for that membership.
804
805Returns an empty data record.*/
806 pub fn delete_membership(
807 &self,
808 membership_gid: &str,
809 ) -> FluentRequest<'_, request::DeleteMembershipRequest> {
810 FluentRequest {
811 client: self,
812 params: request::DeleteMembershipRequest {
813 membership_gid: membership_gid.to_owned(),
814 opt_pretty: None,
815 },
816 }
817 }
818 /**Create an organization export request
819
820This method creates a request to export an Organization. Asana will complete the export at some point after you create the request.*/
821 pub fn create_organization_export(
822 &self,
823 data: OrganizationExportRequest,
824 ) -> FluentRequest<'_, request::CreateOrganizationExportRequest> {
825 FluentRequest {
826 client: self,
827 params: request::CreateOrganizationExportRequest {
828 data,
829 opt_fields: None,
830 opt_pretty: None,
831 },
832 }
833 }
834 /**Get details on an org export request
835
836Returns details of a previously-requested Organization export.*/
837 pub fn get_organization_export(
838 &self,
839 organization_export_gid: &str,
840 ) -> FluentRequest<'_, request::GetOrganizationExportRequest> {
841 FluentRequest {
842 client: self,
843 params: request::GetOrganizationExportRequest {
844 opt_fields: None,
845 opt_pretty: None,
846 organization_export_gid: organization_export_gid.to_owned(),
847 },
848 }
849 }
850 /**Get multiple portfolio memberships
851
852Returns a list of portfolio memberships in compact representation. You must specify `portfolio`, `portfolio` and `user`, or `workspace` and `user`.*/
853 pub fn get_portfolio_memberships(
854 &self,
855 ) -> FluentRequest<'_, request::GetPortfolioMembershipsRequest> {
856 FluentRequest {
857 client: self,
858 params: request::GetPortfolioMembershipsRequest {
859 limit: None,
860 offset: None,
861 opt_fields: None,
862 opt_pretty: None,
863 portfolio: None,
864 user: None,
865 workspace: None,
866 },
867 }
868 }
869 /**Get a portfolio membership
870
871Returns the complete portfolio record for a single portfolio membership.*/
872 pub fn get_portfolio_membership(
873 &self,
874 portfolio_membership_gid: &str,
875 ) -> FluentRequest<'_, request::GetPortfolioMembershipRequest> {
876 FluentRequest {
877 client: self,
878 params: request::GetPortfolioMembershipRequest {
879 opt_fields: None,
880 opt_pretty: None,
881 portfolio_membership_gid: portfolio_membership_gid.to_owned(),
882 },
883 }
884 }
885 /**Get memberships from a portfolio
886
887Returns the compact portfolio membership records for the portfolio.*/
888 pub fn get_portfolio_memberships_for_portfolio(
889 &self,
890 portfolio_gid: &str,
891 ) -> FluentRequest<'_, request::GetPortfolioMembershipsForPortfolioRequest> {
892 FluentRequest {
893 client: self,
894 params: request::GetPortfolioMembershipsForPortfolioRequest {
895 limit: None,
896 offset: None,
897 opt_fields: None,
898 opt_pretty: None,
899 portfolio_gid: portfolio_gid.to_owned(),
900 user: None,
901 },
902 }
903 }
904 /**Get multiple portfolios
905
906Returns a list of the portfolios in compact representation that are owned by the current API user.*/
907 pub fn get_portfolios(
908 &self,
909 workspace: &str,
910 ) -> FluentRequest<'_, request::GetPortfoliosRequest> {
911 FluentRequest {
912 client: self,
913 params: request::GetPortfoliosRequest {
914 limit: None,
915 offset: None,
916 opt_fields: None,
917 opt_pretty: None,
918 owner: None,
919 workspace: workspace.to_owned(),
920 },
921 }
922 }
923 /**Create a portfolio
924
925Creates a new portfolio in the given workspace with the supplied name.
926
927Note that portfolios created in the Asana UI may have some state
928(like the “Priority” custom field) which is automatically added
929to the portfolio when it is created. Portfolios created via our
930API will *not* be created with the same initial state to allow
931integrations to create their own starting state on a portfolio.*/
932 pub fn create_portfolio(
933 &self,
934 data: PortfolioRequest,
935 ) -> FluentRequest<'_, request::CreatePortfolioRequest> {
936 FluentRequest {
937 client: self,
938 params: request::CreatePortfolioRequest {
939 data,
940 opt_fields: None,
941 opt_pretty: None,
942 },
943 }
944 }
945 /**Get a portfolio
946
947Returns the complete portfolio record for a single portfolio.*/
948 pub fn get_portfolio(
949 &self,
950 portfolio_gid: &str,
951 ) -> FluentRequest<'_, request::GetPortfolioRequest> {
952 FluentRequest {
953 client: self,
954 params: request::GetPortfolioRequest {
955 opt_fields: None,
956 opt_pretty: None,
957 portfolio_gid: portfolio_gid.to_owned(),
958 },
959 }
960 }
961 /**Update a portfolio
962
963An existing portfolio can be updated by making a PUT request on the URL for
964that portfolio. Only the fields provided in the `data` block will be updated;
965any unspecified fields will remain unchanged.
966
967Returns the complete updated portfolio record.*/
968 pub fn update_portfolio(
969 &self,
970 data: PortfolioRequest,
971 portfolio_gid: &str,
972 ) -> FluentRequest<'_, request::UpdatePortfolioRequest> {
973 FluentRequest {
974 client: self,
975 params: request::UpdatePortfolioRequest {
976 data,
977 opt_fields: None,
978 opt_pretty: None,
979 portfolio_gid: portfolio_gid.to_owned(),
980 },
981 }
982 }
983 /**Delete a portfolio
984
985An existing portfolio can be deleted by making a DELETE request on
986the URL for that portfolio.
987
988Returns an empty data record.*/
989 pub fn delete_portfolio(
990 &self,
991 portfolio_gid: &str,
992 ) -> FluentRequest<'_, request::DeletePortfolioRequest> {
993 FluentRequest {
994 client: self,
995 params: request::DeletePortfolioRequest {
996 opt_pretty: None,
997 portfolio_gid: portfolio_gid.to_owned(),
998 },
999 }
1000 }
1001 /**Get portfolio items
1002
1003Get a list of the items in compact form in a portfolio.*/
1004 pub fn get_items_for_portfolio(
1005 &self,
1006 portfolio_gid: &str,
1007 ) -> FluentRequest<'_, request::GetItemsForPortfolioRequest> {
1008 FluentRequest {
1009 client: self,
1010 params: request::GetItemsForPortfolioRequest {
1011 limit: None,
1012 offset: None,
1013 opt_fields: None,
1014 opt_pretty: None,
1015 portfolio_gid: portfolio_gid.to_owned(),
1016 },
1017 }
1018 }
1019 /**Add a portfolio item
1020
1021Add an item to a portfolio.
1022Returns an empty data block.*/
1023 pub fn add_item_for_portfolio(
1024 &self,
1025 data: PortfolioAddItemRequest,
1026 portfolio_gid: &str,
1027 ) -> FluentRequest<'_, request::AddItemForPortfolioRequest> {
1028 FluentRequest {
1029 client: self,
1030 params: request::AddItemForPortfolioRequest {
1031 data,
1032 opt_pretty: None,
1033 portfolio_gid: portfolio_gid.to_owned(),
1034 },
1035 }
1036 }
1037 /**Remove a portfolio item
1038
1039Remove an item from a portfolio.
1040Returns an empty data block.*/
1041 pub fn remove_item_for_portfolio(
1042 &self,
1043 data: PortfolioRemoveItemRequest,
1044 portfolio_gid: &str,
1045 ) -> FluentRequest<'_, request::RemoveItemForPortfolioRequest> {
1046 FluentRequest {
1047 client: self,
1048 params: request::RemoveItemForPortfolioRequest {
1049 data,
1050 opt_pretty: None,
1051 portfolio_gid: portfolio_gid.to_owned(),
1052 },
1053 }
1054 }
1055 /**Add a custom field to a portfolio
1056
1057Custom fields are associated with portfolios by way of custom field settings. This method creates a setting for the portfolio.*/
1058 pub fn add_custom_field_setting_for_portfolio(
1059 &self,
1060 data: AddCustomFieldSettingRequest,
1061 portfolio_gid: &str,
1062 ) -> FluentRequest<'_, request::AddCustomFieldSettingForPortfolioRequest> {
1063 FluentRequest {
1064 client: self,
1065 params: request::AddCustomFieldSettingForPortfolioRequest {
1066 data,
1067 opt_pretty: None,
1068 portfolio_gid: portfolio_gid.to_owned(),
1069 },
1070 }
1071 }
1072 /**Remove a custom field from a portfolio
1073
1074Removes a custom field setting from a portfolio.*/
1075 pub fn remove_custom_field_setting_for_portfolio(
1076 &self,
1077 data: RemoveCustomFieldSettingRequest,
1078 portfolio_gid: &str,
1079 ) -> FluentRequest<'_, request::RemoveCustomFieldSettingForPortfolioRequest> {
1080 FluentRequest {
1081 client: self,
1082 params: request::RemoveCustomFieldSettingForPortfolioRequest {
1083 data,
1084 opt_pretty: None,
1085 portfolio_gid: portfolio_gid.to_owned(),
1086 },
1087 }
1088 }
1089 /**Add users to a portfolio
1090
1091Adds the specified list of users as members of the portfolio.
1092Returns the updated portfolio record.*/
1093 pub fn add_members_for_portfolio(
1094 &self,
1095 data: AddMembersRequest,
1096 portfolio_gid: &str,
1097 ) -> FluentRequest<'_, request::AddMembersForPortfolioRequest> {
1098 FluentRequest {
1099 client: self,
1100 params: request::AddMembersForPortfolioRequest {
1101 data,
1102 opt_fields: None,
1103 opt_pretty: None,
1104 portfolio_gid: portfolio_gid.to_owned(),
1105 },
1106 }
1107 }
1108 /**Remove users from a portfolio
1109
1110Removes the specified list of users from members of the portfolio.
1111Returns the updated portfolio record.*/
1112 pub fn remove_members_for_portfolio(
1113 &self,
1114 data: RemoveMembersRequest,
1115 portfolio_gid: &str,
1116 ) -> FluentRequest<'_, request::RemoveMembersForPortfolioRequest> {
1117 FluentRequest {
1118 client: self,
1119 params: request::RemoveMembersForPortfolioRequest {
1120 data,
1121 opt_fields: None,
1122 opt_pretty: None,
1123 portfolio_gid: portfolio_gid.to_owned(),
1124 },
1125 }
1126 }
1127 /**Get a project brief
1128
1129Get the full record for a project brief.*/
1130 pub fn get_project_brief(
1131 &self,
1132 project_brief_gid: &str,
1133 ) -> FluentRequest<'_, request::GetProjectBriefRequest> {
1134 FluentRequest {
1135 client: self,
1136 params: request::GetProjectBriefRequest {
1137 opt_fields: None,
1138 opt_pretty: None,
1139 project_brief_gid: project_brief_gid.to_owned(),
1140 },
1141 }
1142 }
1143 /**Update a project brief
1144
1145An existing project brief can be updated by making a PUT request on the URL for
1146that project brief. Only the fields provided in the `data` block will be updated;
1147any unspecified fields will remain unchanged.
1148
1149Returns the complete updated project brief record.*/
1150 pub fn update_project_brief(
1151 &self,
1152 data: ProjectBriefRequest,
1153 project_brief_gid: &str,
1154 ) -> FluentRequest<'_, request::UpdateProjectBriefRequest> {
1155 FluentRequest {
1156 client: self,
1157 params: request::UpdateProjectBriefRequest {
1158 data,
1159 opt_fields: None,
1160 opt_pretty: None,
1161 project_brief_gid: project_brief_gid.to_owned(),
1162 },
1163 }
1164 }
1165 /**Delete a project brief
1166
1167Deletes a specific, existing project brief.
1168
1169Returns an empty data record.*/
1170 pub fn delete_project_brief(
1171 &self,
1172 project_brief_gid: &str,
1173 ) -> FluentRequest<'_, request::DeleteProjectBriefRequest> {
1174 FluentRequest {
1175 client: self,
1176 params: request::DeleteProjectBriefRequest {
1177 opt_pretty: None,
1178 project_brief_gid: project_brief_gid.to_owned(),
1179 },
1180 }
1181 }
1182 /**Create a project brief
1183
1184Creates a new project brief.
1185
1186Returns the full record of the newly created project brief.*/
1187 pub fn create_project_brief(
1188 &self,
1189 data: ProjectBriefRequest,
1190 project_gid: &str,
1191 ) -> FluentRequest<'_, request::CreateProjectBriefRequest> {
1192 FluentRequest {
1193 client: self,
1194 params: request::CreateProjectBriefRequest {
1195 data,
1196 opt_fields: None,
1197 opt_pretty: None,
1198 project_gid: project_gid.to_owned(),
1199 },
1200 }
1201 }
1202 /**Get a project membership
1203
1204Returns the complete project record for a single project membership.*/
1205 pub fn get_project_membership(
1206 &self,
1207 project_membership_gid: &str,
1208 ) -> FluentRequest<'_, request::GetProjectMembershipRequest> {
1209 FluentRequest {
1210 client: self,
1211 params: request::GetProjectMembershipRequest {
1212 opt_fields: None,
1213 opt_pretty: None,
1214 project_membership_gid: project_membership_gid.to_owned(),
1215 },
1216 }
1217 }
1218 /**Get memberships from a project
1219
1220Returns the compact project membership records for the project.*/
1221 pub fn get_project_memberships_for_project(
1222 &self,
1223 project_gid: &str,
1224 ) -> FluentRequest<'_, request::GetProjectMembershipsForProjectRequest> {
1225 FluentRequest {
1226 client: self,
1227 params: request::GetProjectMembershipsForProjectRequest {
1228 limit: None,
1229 offset: None,
1230 opt_fields: None,
1231 opt_pretty: None,
1232 project_gid: project_gid.to_owned(),
1233 user: None,
1234 },
1235 }
1236 }
1237 /**Get a project status
1238
1239*Deprecated: new integrations should prefer the `/status_updates/{status_gid}` route.*
1240
1241Returns the complete record for a single status update.*/
1242 pub fn get_project_status(
1243 &self,
1244 project_status_gid: &str,
1245 ) -> FluentRequest<'_, request::GetProjectStatusRequest> {
1246 FluentRequest {
1247 client: self,
1248 params: request::GetProjectStatusRequest {
1249 opt_fields: None,
1250 opt_pretty: None,
1251 project_status_gid: project_status_gid.to_owned(),
1252 },
1253 }
1254 }
1255 /**Delete a project status
1256
1257*Deprecated: new integrations should prefer the `/status_updates/{status_gid}` route.*
1258
1259Deletes a specific, existing project status update.
1260
1261Returns an empty data record.*/
1262 pub fn delete_project_status(
1263 &self,
1264 project_status_gid: &str,
1265 ) -> FluentRequest<'_, request::DeleteProjectStatusRequest> {
1266 FluentRequest {
1267 client: self,
1268 params: request::DeleteProjectStatusRequest {
1269 opt_pretty: None,
1270 project_status_gid: project_status_gid.to_owned(),
1271 },
1272 }
1273 }
1274 /**Get statuses from a project
1275
1276*Deprecated: new integrations should prefer the `/status_updates` route.*
1277
1278Returns the compact project status update records for all updates on the project.*/
1279 pub fn get_project_statuses_for_project(
1280 &self,
1281 project_gid: &str,
1282 ) -> FluentRequest<'_, request::GetProjectStatusesForProjectRequest> {
1283 FluentRequest {
1284 client: self,
1285 params: request::GetProjectStatusesForProjectRequest {
1286 limit: None,
1287 offset: None,
1288 opt_fields: None,
1289 opt_pretty: None,
1290 project_gid: project_gid.to_owned(),
1291 },
1292 }
1293 }
1294 /**Create a project status
1295
1296*Deprecated: new integrations should prefer the `/status_updates` route.*
1297
1298Creates a new status update on the project.
1299
1300Returns the full record of the newly created project status update.*/
1301 pub fn create_project_status_for_project(
1302 &self,
1303 data: ProjectStatusRequest,
1304 project_gid: &str,
1305 ) -> FluentRequest<'_, request::CreateProjectStatusForProjectRequest> {
1306 FluentRequest {
1307 client: self,
1308 params: request::CreateProjectStatusForProjectRequest {
1309 data,
1310 opt_fields: None,
1311 opt_pretty: None,
1312 project_gid: project_gid.to_owned(),
1313 },
1314 }
1315 }
1316 /**Get a project template
1317
1318Returns the complete project template record for a single project template.*/
1319 pub fn get_project_template(
1320 &self,
1321 project_template_gid: &str,
1322 ) -> FluentRequest<'_, request::GetProjectTemplateRequest> {
1323 FluentRequest {
1324 client: self,
1325 params: request::GetProjectTemplateRequest {
1326 opt_fields: None,
1327 opt_pretty: None,
1328 project_template_gid: project_template_gid.to_owned(),
1329 },
1330 }
1331 }
1332 /**Delete a project template
1333
1334A specific, existing project template can be deleted by making a DELETE request on the URL for that project template.
1335
1336Returns an empty data record.*/
1337 pub fn delete_project_template(
1338 &self,
1339 project_template_gid: &str,
1340 ) -> FluentRequest<'_, request::DeleteProjectTemplateRequest> {
1341 FluentRequest {
1342 client: self,
1343 params: request::DeleteProjectTemplateRequest {
1344 opt_pretty: None,
1345 project_template_gid: project_template_gid.to_owned(),
1346 },
1347 }
1348 }
1349 /**Get multiple project templates
1350
1351Returns the compact project template records for all project templates in the given team or workspace.*/
1352 pub fn get_project_templates(
1353 &self,
1354 ) -> FluentRequest<'_, request::GetProjectTemplatesRequest> {
1355 FluentRequest {
1356 client: self,
1357 params: request::GetProjectTemplatesRequest {
1358 limit: None,
1359 offset: None,
1360 opt_fields: None,
1361 opt_pretty: None,
1362 team: None,
1363 workspace: None,
1364 },
1365 }
1366 }
1367 /**Get a team's project templates
1368
1369Returns the compact project template records for all project templates in the team.*/
1370 pub fn get_project_templates_for_team(
1371 &self,
1372 team_gid: &str,
1373 ) -> FluentRequest<'_, request::GetProjectTemplatesForTeamRequest> {
1374 FluentRequest {
1375 client: self,
1376 params: request::GetProjectTemplatesForTeamRequest {
1377 limit: None,
1378 offset: None,
1379 opt_fields: None,
1380 opt_pretty: None,
1381 team_gid: team_gid.to_owned(),
1382 },
1383 }
1384 }
1385 /**Instantiate a project from a project template
1386
1387Creates and returns a job that will asynchronously handle the project instantiation.
1388
1389To form this request, it is recommended to first make a request to [get a project template](/reference/getprojecttemplate). Then, from the response, copy the `gid` from the object in the `requested_dates` array. This `gid` should be used in `requested_dates` to instantiate a project.
1390
1391_Note: The body of this request will differ if your workspace is an organization. To determine if your workspace is an organization, use the [is_organization](/reference/workspaces) parameter._*/
1392 pub fn instantiate_project(
1393 &self,
1394 data: ProjectTemplateInstantiateProjectRequest,
1395 project_template_gid: &str,
1396 ) -> FluentRequest<'_, request::InstantiateProjectRequest> {
1397 FluentRequest {
1398 client: self,
1399 params: request::InstantiateProjectRequest {
1400 data,
1401 opt_fields: None,
1402 opt_pretty: None,
1403 project_template_gid: project_template_gid.to_owned(),
1404 },
1405 }
1406 }
1407 /**Get multiple projects
1408
1409Returns the compact project records for some filtered set of projects. Use one or more of the parameters provided to filter the projects returned.
1410*Note: This endpoint may timeout for large domains. Try filtering by team!**/
1411 pub fn get_projects(&self) -> FluentRequest<'_, request::GetProjectsRequest> {
1412 FluentRequest {
1413 client: self,
1414 params: request::GetProjectsRequest {
1415 archived: None,
1416 limit: None,
1417 offset: None,
1418 opt_fields: None,
1419 opt_pretty: None,
1420 team: None,
1421 workspace: None,
1422 },
1423 }
1424 }
1425 /**Create a project
1426
1427Create a new project in a workspace or team.
1428
1429Every project is required to be created in a specific workspace or
1430organization, and this cannot be changed once set. Note that you can use
1431the `workspace` parameter regardless of whether or not it is an
1432organization.
1433
1434If the workspace for your project is an organization, you must also
1435supply a `team` to share the project with.
1436
1437Returns the full record of the newly created project.*/
1438 pub fn create_project(
1439 &self,
1440 data: ProjectRequest,
1441 ) -> FluentRequest<'_, request::CreateProjectRequest> {
1442 FluentRequest {
1443 client: self,
1444 params: request::CreateProjectRequest {
1445 data,
1446 opt_fields: None,
1447 opt_pretty: None,
1448 },
1449 }
1450 }
1451 /**Get a project
1452
1453Returns the complete project record for a single project.*/
1454 pub fn get_project(
1455 &self,
1456 project_gid: &str,
1457 ) -> FluentRequest<'_, request::GetProjectRequest> {
1458 FluentRequest {
1459 client: self,
1460 params: request::GetProjectRequest {
1461 opt_fields: None,
1462 opt_pretty: None,
1463 project_gid: project_gid.to_owned(),
1464 },
1465 }
1466 }
1467 /**Update a project
1468
1469A specific, existing project can be updated by making a PUT request on
1470the URL for that project. Only the fields provided in the `data` block
1471will be updated; any unspecified fields will remain unchanged.
1472
1473When using this method, it is best to specify only those fields you wish
1474to change, or else you may overwrite changes made by another user since
1475you last retrieved the task.
1476
1477Returns the complete updated project record.*/
1478 pub fn update_project(
1479 &self,
1480 data: ProjectUpdateRequest,
1481 project_gid: &str,
1482 ) -> FluentRequest<'_, request::UpdateProjectRequest> {
1483 FluentRequest {
1484 client: self,
1485 params: request::UpdateProjectRequest {
1486 data,
1487 opt_fields: None,
1488 opt_pretty: None,
1489 project_gid: project_gid.to_owned(),
1490 },
1491 }
1492 }
1493 /**Delete a project
1494
1495A specific, existing project can be deleted by making a DELETE request on
1496the URL for that project.
1497
1498Returns an empty data record.*/
1499 pub fn delete_project(
1500 &self,
1501 project_gid: &str,
1502 ) -> FluentRequest<'_, request::DeleteProjectRequest> {
1503 FluentRequest {
1504 client: self,
1505 params: request::DeleteProjectRequest {
1506 opt_pretty: None,
1507 project_gid: project_gid.to_owned(),
1508 },
1509 }
1510 }
1511 /**Duplicate a project
1512
1513Creates and returns a job that will asynchronously handle the duplication.*/
1514 pub fn duplicate_project(
1515 &self,
1516 data: ProjectDuplicateRequest,
1517 project_gid: &str,
1518 ) -> FluentRequest<'_, request::DuplicateProjectRequest> {
1519 FluentRequest {
1520 client: self,
1521 params: request::DuplicateProjectRequest {
1522 data,
1523 opt_fields: None,
1524 opt_pretty: None,
1525 project_gid: project_gid.to_owned(),
1526 },
1527 }
1528 }
1529 /**Get projects a task is in
1530
1531Returns a compact representation of all of the projects the task is in.*/
1532 pub fn get_projects_for_task(
1533 &self,
1534 task_gid: &str,
1535 ) -> FluentRequest<'_, request::GetProjectsForTaskRequest> {
1536 FluentRequest {
1537 client: self,
1538 params: request::GetProjectsForTaskRequest {
1539 limit: None,
1540 offset: None,
1541 opt_fields: None,
1542 opt_pretty: None,
1543 task_gid: task_gid.to_owned(),
1544 },
1545 }
1546 }
1547 /**Get a team's projects
1548
1549Returns the compact project records for all projects in the team.*/
1550 pub fn get_projects_for_team(
1551 &self,
1552 team_gid: &str,
1553 ) -> FluentRequest<'_, request::GetProjectsForTeamRequest> {
1554 FluentRequest {
1555 client: self,
1556 params: request::GetProjectsForTeamRequest {
1557 archived: None,
1558 limit: None,
1559 offset: None,
1560 opt_fields: None,
1561 opt_pretty: None,
1562 team_gid: team_gid.to_owned(),
1563 },
1564 }
1565 }
1566 /**Create a project in a team
1567
1568Creates a project shared with the given team.
1569
1570Returns the full record of the newly created project.*/
1571 pub fn create_project_for_team(
1572 &self,
1573 data: ProjectRequest,
1574 team_gid: &str,
1575 ) -> FluentRequest<'_, request::CreateProjectForTeamRequest> {
1576 FluentRequest {
1577 client: self,
1578 params: request::CreateProjectForTeamRequest {
1579 data,
1580 opt_fields: None,
1581 opt_pretty: None,
1582 team_gid: team_gid.to_owned(),
1583 },
1584 }
1585 }
1586 /**Get all projects in a workspace
1587
1588Returns the compact project records for all projects in the workspace.
1589*Note: This endpoint may timeout for large domains. Prefer the `/teams/{team_gid}/projects` endpoint.**/
1590 pub fn get_projects_for_workspace(
1591 &self,
1592 workspace_gid: &str,
1593 ) -> FluentRequest<'_, request::GetProjectsForWorkspaceRequest> {
1594 FluentRequest {
1595 client: self,
1596 params: request::GetProjectsForWorkspaceRequest {
1597 archived: None,
1598 limit: None,
1599 offset: None,
1600 opt_fields: None,
1601 opt_pretty: None,
1602 workspace_gid: workspace_gid.to_owned(),
1603 },
1604 }
1605 }
1606 /**Create a project in a workspace
1607
1608Creates a project in the workspace.
1609
1610If the workspace for your project is an organization, you must also
1611supply a team to share the project with.
1612
1613Returns the full record of the newly created project.*/
1614 pub fn create_project_for_workspace(
1615 &self,
1616 data: ProjectRequest,
1617 workspace_gid: &str,
1618 ) -> FluentRequest<'_, request::CreateProjectForWorkspaceRequest> {
1619 FluentRequest {
1620 client: self,
1621 params: request::CreateProjectForWorkspaceRequest {
1622 data,
1623 opt_fields: None,
1624 opt_pretty: None,
1625 workspace_gid: workspace_gid.to_owned(),
1626 },
1627 }
1628 }
1629 /**Add a custom field to a project
1630
1631Custom fields are associated with projects by way of custom field settings. This method creates a setting for the project.*/
1632 pub fn add_custom_field_setting_for_project(
1633 &self,
1634 data: AddCustomFieldSettingRequest,
1635 project_gid: &str,
1636 ) -> FluentRequest<'_, request::AddCustomFieldSettingForProjectRequest> {
1637 FluentRequest {
1638 client: self,
1639 params: request::AddCustomFieldSettingForProjectRequest {
1640 data,
1641 opt_fields: None,
1642 opt_pretty: None,
1643 project_gid: project_gid.to_owned(),
1644 },
1645 }
1646 }
1647 /**Remove a custom field from a project
1648
1649Removes a custom field setting from a project.*/
1650 pub fn remove_custom_field_setting_for_project(
1651 &self,
1652 data: RemoveCustomFieldSettingRequest,
1653 project_gid: &str,
1654 ) -> FluentRequest<'_, request::RemoveCustomFieldSettingForProjectRequest> {
1655 FluentRequest {
1656 client: self,
1657 params: request::RemoveCustomFieldSettingForProjectRequest {
1658 data,
1659 opt_pretty: None,
1660 project_gid: project_gid.to_owned(),
1661 },
1662 }
1663 }
1664 /**Get task count of a project
1665
1666Get an object that holds task count fields. **All fields are excluded by default**. You must [opt in](/docs/inputoutput-options) using `opt_fields` to get any information from this endpoint.
1667
1668This endpoint has an additional [rate limit](/docs/rate-limits) and each field counts especially high against our [cost limits](/docs/rate-limits#cost-limits).
1669
1670Milestones are just tasks, so they are included in the `num_tasks`, `num_incomplete_tasks`, and `num_completed_tasks` counts.*/
1671 pub fn get_task_counts_for_project(
1672 &self,
1673 project_gid: &str,
1674 ) -> FluentRequest<'_, request::GetTaskCountsForProjectRequest> {
1675 FluentRequest {
1676 client: self,
1677 params: request::GetTaskCountsForProjectRequest {
1678 opt_fields: None,
1679 opt_pretty: None,
1680 project_gid: project_gid.to_owned(),
1681 },
1682 }
1683 }
1684 /**Add users to a project
1685
1686Adds the specified list of users as members of the project. Note that a user being added as a member may also be added as a *follower* as a result of this operation. This is because the user's default notification settings (i.e., in the "Notifcations" tab of "My Profile Settings") will override this endpoint's default behavior of setting "Tasks added" notifications to `false`.
1687Returns the updated project record.*/
1688 pub fn add_members_for_project(
1689 &self,
1690 data: AddMembersRequest,
1691 project_gid: &str,
1692 ) -> FluentRequest<'_, request::AddMembersForProjectRequest> {
1693 FluentRequest {
1694 client: self,
1695 params: request::AddMembersForProjectRequest {
1696 data,
1697 opt_fields: None,
1698 opt_pretty: None,
1699 project_gid: project_gid.to_owned(),
1700 },
1701 }
1702 }
1703 /**Remove users from a project
1704
1705Removes the specified list of users from members of the project.
1706Returns the updated project record.*/
1707 pub fn remove_members_for_project(
1708 &self,
1709 data: RemoveMembersRequest,
1710 project_gid: &str,
1711 ) -> FluentRequest<'_, request::RemoveMembersForProjectRequest> {
1712 FluentRequest {
1713 client: self,
1714 params: request::RemoveMembersForProjectRequest {
1715 data,
1716 opt_fields: None,
1717 opt_pretty: None,
1718 project_gid: project_gid.to_owned(),
1719 },
1720 }
1721 }
1722 /**Add followers to a project
1723
1724Adds the specified list of users as followers to the project. Followers are a subset of members who have opted in to receive "tasks added" notifications for a project. Therefore, if the users are not already members of the project, they will also become members as a result of this operation.
1725Returns the updated project record.*/
1726 pub fn add_followers_for_project(
1727 &self,
1728 data: AddFollowersRequest,
1729 project_gid: &str,
1730 ) -> FluentRequest<'_, request::AddFollowersForProjectRequest> {
1731 FluentRequest {
1732 client: self,
1733 params: request::AddFollowersForProjectRequest {
1734 data,
1735 opt_fields: None,
1736 opt_pretty: None,
1737 project_gid: project_gid.to_owned(),
1738 },
1739 }
1740 }
1741 /**Remove followers from a project
1742
1743Removes the specified list of users from following the project, this will not affect project membership status.
1744Returns the updated project record.*/
1745 pub fn remove_followers_for_project(
1746 &self,
1747 data: RemoveFollowersRequest,
1748 project_gid: &str,
1749 ) -> FluentRequest<'_, request::RemoveFollowersForProjectRequest> {
1750 FluentRequest {
1751 client: self,
1752 params: request::RemoveFollowersForProjectRequest {
1753 data,
1754 opt_fields: None,
1755 opt_pretty: None,
1756 project_gid: project_gid.to_owned(),
1757 },
1758 }
1759 }
1760 /**Create a project template from a project
1761
1762Creates and returns a job that will asynchronously handle the project template creation. Note that
1763while the resulting project template can be accessed with the API, it won't be visible in the Asana
1764UI until Project Templates 2.0 is launched in the app. See more in [this forum post](https://forum.asana.com/t/a-new-api-for-project-templates/156432).*/
1765 pub fn project_save_as_template(
1766 &self,
1767 data: ProjectSaveAsTemplateRequestBody,
1768 project_gid: &str,
1769 ) -> FluentRequest<'_, request::ProjectSaveAsTemplateRequest> {
1770 FluentRequest {
1771 client: self,
1772 params: request::ProjectSaveAsTemplateRequest {
1773 data,
1774 opt_fields: None,
1775 opt_pretty: None,
1776 project_gid: project_gid.to_owned(),
1777 },
1778 }
1779 }
1780 /**Trigger a rule
1781
1782Trigger a rule which uses an ["incoming web request"](/docs/incoming-web-requests) trigger.*/
1783 pub fn trigger_rule(
1784 &self,
1785 data: RuleTriggerRequest,
1786 rule_trigger_gid: &str,
1787 ) -> FluentRequest<'_, request::TriggerRuleRequest> {
1788 FluentRequest {
1789 client: self,
1790 params: request::TriggerRuleRequest {
1791 data,
1792 rule_trigger_gid: rule_trigger_gid.to_owned(),
1793 },
1794 }
1795 }
1796 /**Get a section
1797
1798Returns the complete record for a single section.*/
1799 pub fn get_section(
1800 &self,
1801 section_gid: &str,
1802 ) -> FluentRequest<'_, request::GetSectionRequest> {
1803 FluentRequest {
1804 client: self,
1805 params: request::GetSectionRequest {
1806 opt_fields: None,
1807 opt_pretty: None,
1808 section_gid: section_gid.to_owned(),
1809 },
1810 }
1811 }
1812 /**Update a section
1813
1814A specific, existing section can be updated by making a PUT request on
1815the URL for that project. Only the fields provided in the `data` block
1816will be updated; any unspecified fields will remain unchanged. (note that
1817at this time, the only field that can be updated is the `name` field.)
1818
1819When using this method, it is best to specify only those fields you wish
1820to change, or else you may overwrite changes made by another user since
1821you last retrieved the task.
1822
1823Returns the complete updated section record.*/
1824 pub fn update_section(
1825 &self,
1826 data: SectionRequest,
1827 section_gid: &str,
1828 ) -> FluentRequest<'_, request::UpdateSectionRequest> {
1829 FluentRequest {
1830 client: self,
1831 params: request::UpdateSectionRequest {
1832 data,
1833 opt_fields: None,
1834 opt_pretty: None,
1835 section_gid: section_gid.to_owned(),
1836 },
1837 }
1838 }
1839 /**Delete a section
1840
1841A specific, existing section can be deleted by making a DELETE request on
1842the URL for that section.
1843
1844Note that sections must be empty to be deleted.
1845
1846The last remaining section cannot be deleted.
1847
1848Returns an empty data block.*/
1849 pub fn delete_section(
1850 &self,
1851 section_gid: &str,
1852 ) -> FluentRequest<'_, request::DeleteSectionRequest> {
1853 FluentRequest {
1854 client: self,
1855 params: request::DeleteSectionRequest {
1856 opt_pretty: None,
1857 section_gid: section_gid.to_owned(),
1858 },
1859 }
1860 }
1861 /**Get sections in a project
1862
1863Returns the compact records for all sections in the specified project.*/
1864 pub fn get_sections_for_project(
1865 &self,
1866 project_gid: &str,
1867 ) -> FluentRequest<'_, request::GetSectionsForProjectRequest> {
1868 FluentRequest {
1869 client: self,
1870 params: request::GetSectionsForProjectRequest {
1871 limit: None,
1872 offset: None,
1873 opt_fields: None,
1874 opt_pretty: None,
1875 project_gid: project_gid.to_owned(),
1876 },
1877 }
1878 }
1879 /**Create a section in a project
1880
1881Creates a new section in a project.
1882Returns the full record of the newly created section.*/
1883 pub fn create_section_for_project(
1884 &self,
1885 data: SectionRequest,
1886 project_gid: &str,
1887 ) -> FluentRequest<'_, request::CreateSectionForProjectRequest> {
1888 FluentRequest {
1889 client: self,
1890 params: request::CreateSectionForProjectRequest {
1891 data,
1892 opt_fields: None,
1893 opt_pretty: None,
1894 project_gid: project_gid.to_owned(),
1895 },
1896 }
1897 }
1898 /**Add task to section
1899
1900Add a task to a specific, existing section. This will remove the task from other sections of the project.
1901
1902The task will be inserted at the top of a section unless an insert_before or insert_after parameter is declared.
1903
1904This does not work for separators (tasks with the resource_subtype of section).*/
1905 pub fn add_task_for_section(
1906 &self,
1907 data: SectionTaskInsertRequest,
1908 section_gid: &str,
1909 ) -> FluentRequest<'_, request::AddTaskForSectionRequest> {
1910 FluentRequest {
1911 client: self,
1912 params: request::AddTaskForSectionRequest {
1913 data,
1914 opt_pretty: None,
1915 section_gid: section_gid.to_owned(),
1916 },
1917 }
1918 }
1919 /**Move or Insert sections
1920
1921Move sections relative to each other. One of
1922`before_section` or `after_section` is required.
1923
1924Sections cannot be moved between projects.
1925
1926Returns an empty data block.*/
1927 pub fn insert_section_for_project(
1928 &self,
1929 data: ProjectSectionInsertRequest,
1930 project_gid: &str,
1931 ) -> FluentRequest<'_, request::InsertSectionForProjectRequest> {
1932 FluentRequest {
1933 client: self,
1934 params: request::InsertSectionForProjectRequest {
1935 data,
1936 opt_pretty: None,
1937 project_gid: project_gid.to_owned(),
1938 },
1939 }
1940 }
1941 /**Get a status update
1942
1943Returns the complete record for a single status update.*/
1944 pub fn get_status(
1945 &self,
1946 status_update_gid: &str,
1947 ) -> FluentRequest<'_, request::GetStatusRequest> {
1948 FluentRequest {
1949 client: self,
1950 params: request::GetStatusRequest {
1951 opt_fields: None,
1952 opt_pretty: None,
1953 status_update_gid: status_update_gid.to_owned(),
1954 },
1955 }
1956 }
1957 /**Delete a status update
1958
1959Deletes a specific, existing status update.
1960
1961Returns an empty data record.*/
1962 pub fn delete_status(
1963 &self,
1964 status_update_gid: &str,
1965 ) -> FluentRequest<'_, request::DeleteStatusRequest> {
1966 FluentRequest {
1967 client: self,
1968 params: request::DeleteStatusRequest {
1969 opt_pretty: None,
1970 status_update_gid: status_update_gid.to_owned(),
1971 },
1972 }
1973 }
1974 /**Get status updates from an object
1975
1976Returns the compact status update records for all updates on the object.*/
1977 pub fn get_statuses_for_object(
1978 &self,
1979 parent: &str,
1980 ) -> FluentRequest<'_, request::GetStatusesForObjectRequest> {
1981 FluentRequest {
1982 client: self,
1983 params: request::GetStatusesForObjectRequest {
1984 created_since: None,
1985 limit: None,
1986 offset: None,
1987 opt_fields: None,
1988 opt_pretty: None,
1989 parent: parent.to_owned(),
1990 },
1991 }
1992 }
1993 /**Create a status update
1994
1995Creates a new status update on an object.
1996Returns the full record of the newly created status update.*/
1997 pub fn create_status_for_object(
1998 &self,
1999 data: StatusUpdateRequest,
2000 ) -> FluentRequest<'_, request::CreateStatusForObjectRequest> {
2001 FluentRequest {
2002 client: self,
2003 params: request::CreateStatusForObjectRequest {
2004 data,
2005 limit: None,
2006 offset: None,
2007 opt_fields: None,
2008 opt_pretty: None,
2009 },
2010 }
2011 }
2012 /**Get a story
2013
2014Returns the full record for a single story.*/
2015 pub fn get_story(
2016 &self,
2017 story_gid: &str,
2018 ) -> FluentRequest<'_, request::GetStoryRequest> {
2019 FluentRequest {
2020 client: self,
2021 params: request::GetStoryRequest {
2022 opt_fields: None,
2023 opt_pretty: None,
2024 story_gid: story_gid.to_owned(),
2025 },
2026 }
2027 }
2028 /**Update a story
2029
2030Updates the story and returns the full record for the updated story. Only comment stories can have their text updated, and only comment stories and attachment stories can be pinned. Only one of `text` and `html_text` can be specified.*/
2031 pub fn update_story(
2032 &self,
2033 data: StoryRequest,
2034 story_gid: &str,
2035 ) -> FluentRequest<'_, request::UpdateStoryRequest> {
2036 FluentRequest {
2037 client: self,
2038 params: request::UpdateStoryRequest {
2039 data,
2040 opt_fields: None,
2041 opt_pretty: None,
2042 story_gid: story_gid.to_owned(),
2043 },
2044 }
2045 }
2046 /**Delete a story
2047
2048Deletes a story. A user can only delete stories they have created.
2049
2050Returns an empty data record.*/
2051 pub fn delete_story(
2052 &self,
2053 story_gid: &str,
2054 ) -> FluentRequest<'_, request::DeleteStoryRequest> {
2055 FluentRequest {
2056 client: self,
2057 params: request::DeleteStoryRequest {
2058 opt_pretty: None,
2059 story_gid: story_gid.to_owned(),
2060 },
2061 }
2062 }
2063 /**Get stories from a task
2064
2065Returns the compact records for all stories on the task.*/
2066 pub fn get_stories_for_task(
2067 &self,
2068 task_gid: &str,
2069 ) -> FluentRequest<'_, request::GetStoriesForTaskRequest> {
2070 FluentRequest {
2071 client: self,
2072 params: request::GetStoriesForTaskRequest {
2073 limit: None,
2074 offset: None,
2075 opt_fields: None,
2076 opt_pretty: None,
2077 task_gid: task_gid.to_owned(),
2078 },
2079 }
2080 }
2081 /**Create a story on a task
2082
2083Adds a story to a task. This endpoint currently only allows for comment
2084stories to be created. The comment will be authored by the currently
2085authenticated user, and timestamped when the server receives the request.
2086
2087Returns the full record for the new story added to the task.*/
2088 pub fn create_story_for_task(
2089 &self,
2090 data: StoryRequest,
2091 task_gid: &str,
2092 ) -> FluentRequest<'_, request::CreateStoryForTaskRequest> {
2093 FluentRequest {
2094 client: self,
2095 params: request::CreateStoryForTaskRequest {
2096 data,
2097 opt_fields: None,
2098 opt_pretty: None,
2099 task_gid: task_gid.to_owned(),
2100 },
2101 }
2102 }
2103 /**Get multiple tags
2104
2105Returns the compact tag records for some filtered set of tags. Use one or more of the parameters provided to filter the tags returned.*/
2106 pub fn get_tags(&self) -> FluentRequest<'_, request::GetTagsRequest> {
2107 FluentRequest {
2108 client: self,
2109 params: request::GetTagsRequest {
2110 limit: None,
2111 offset: None,
2112 opt_fields: None,
2113 opt_pretty: None,
2114 workspace: None,
2115 },
2116 }
2117 }
2118 /**Create a tag
2119
2120Creates a new tag in a workspace or organization.
2121
2122Every tag is required to be created in a specific workspace or
2123organization, and this cannot be changed once set. Note that you can use
2124the workspace parameter regardless of whether or not it is an
2125organization.
2126
2127Returns the full record of the newly created tag.*/
2128 pub fn create_tag(
2129 &self,
2130 data: TagRequest,
2131 ) -> FluentRequest<'_, request::CreateTagRequest> {
2132 FluentRequest {
2133 client: self,
2134 params: request::CreateTagRequest {
2135 data,
2136 opt_fields: None,
2137 opt_pretty: None,
2138 },
2139 }
2140 }
2141 /**Get a tag
2142
2143Returns the complete tag record for a single tag.*/
2144 pub fn get_tag(&self, tag_gid: &str) -> FluentRequest<'_, request::GetTagRequest> {
2145 FluentRequest {
2146 client: self,
2147 params: request::GetTagRequest {
2148 opt_fields: None,
2149 opt_pretty: None,
2150 tag_gid: tag_gid.to_owned(),
2151 },
2152 }
2153 }
2154 /**Update a tag
2155
2156Updates the properties of a tag. Only the fields provided in the `data`
2157block will be updated; any unspecified fields will remain unchanged.
2158
2159When using this method, it is best to specify only those fields you wish
2160to change, or else you may overwrite changes made by another user since
2161you last retrieved the tag.
2162
2163Returns the complete updated tag record.*/
2164 pub fn update_tag(
2165 &self,
2166 tag_gid: &str,
2167 ) -> FluentRequest<'_, request::UpdateTagRequest> {
2168 FluentRequest {
2169 client: self,
2170 params: request::UpdateTagRequest {
2171 opt_fields: None,
2172 opt_pretty: None,
2173 tag_gid: tag_gid.to_owned(),
2174 },
2175 }
2176 }
2177 /**Delete a tag
2178
2179A specific, existing tag can be deleted by making a DELETE request on
2180the URL for that tag.
2181
2182Returns an empty data record.*/
2183 pub fn delete_tag(
2184 &self,
2185 tag_gid: &str,
2186 ) -> FluentRequest<'_, request::DeleteTagRequest> {
2187 FluentRequest {
2188 client: self,
2189 params: request::DeleteTagRequest {
2190 opt_pretty: None,
2191 tag_gid: tag_gid.to_owned(),
2192 },
2193 }
2194 }
2195 /**Get a task's tags
2196
2197Get a compact representation of all of the tags the task has.*/
2198 pub fn get_tags_for_task(
2199 &self,
2200 task_gid: &str,
2201 ) -> FluentRequest<'_, request::GetTagsForTaskRequest> {
2202 FluentRequest {
2203 client: self,
2204 params: request::GetTagsForTaskRequest {
2205 limit: None,
2206 offset: None,
2207 opt_fields: None,
2208 opt_pretty: None,
2209 task_gid: task_gid.to_owned(),
2210 },
2211 }
2212 }
2213 /**Get tags in a workspace
2214
2215Returns the compact tag records for some filtered set of tags. Use one or more of the parameters provided to filter the tags returned.*/
2216 pub fn get_tags_for_workspace(
2217 &self,
2218 workspace_gid: &str,
2219 ) -> FluentRequest<'_, request::GetTagsForWorkspaceRequest> {
2220 FluentRequest {
2221 client: self,
2222 params: request::GetTagsForWorkspaceRequest {
2223 limit: None,
2224 offset: None,
2225 opt_fields: None,
2226 opt_pretty: None,
2227 workspace_gid: workspace_gid.to_owned(),
2228 },
2229 }
2230 }
2231 /**Create a tag in a workspace
2232
2233Creates a new tag in a workspace or organization.
2234
2235Every tag is required to be created in a specific workspace or
2236organization, and this cannot be changed once set. Note that you can use
2237the workspace parameter regardless of whether or not it is an
2238organization.
2239
2240Returns the full record of the newly created tag.*/
2241 pub fn create_tag_for_workspace(
2242 &self,
2243 data: TagCreateTagForWorkspaceRequest,
2244 workspace_gid: &str,
2245 ) -> FluentRequest<'_, request::CreateTagForWorkspaceRequest> {
2246 FluentRequest {
2247 client: self,
2248 params: request::CreateTagForWorkspaceRequest {
2249 data,
2250 opt_fields: None,
2251 opt_pretty: None,
2252 workspace_gid: workspace_gid.to_owned(),
2253 },
2254 }
2255 }
2256 /**Get multiple task templates
2257
2258Returns the compact task template records for some filtered set of task templates. You must specify a `project`*/
2259 pub fn get_task_templates(
2260 &self,
2261 ) -> FluentRequest<'_, request::GetTaskTemplatesRequest> {
2262 FluentRequest {
2263 client: self,
2264 params: request::GetTaskTemplatesRequest {
2265 limit: None,
2266 offset: None,
2267 opt_fields: None,
2268 opt_pretty: None,
2269 project: None,
2270 },
2271 }
2272 }
2273 /**Get a task template
2274
2275Returns the complete task template record for a single task template.*/
2276 pub fn get_task_template(
2277 &self,
2278 task_template_gid: &str,
2279 ) -> FluentRequest<'_, request::GetTaskTemplateRequest> {
2280 FluentRequest {
2281 client: self,
2282 params: request::GetTaskTemplateRequest {
2283 opt_fields: None,
2284 opt_pretty: None,
2285 task_template_gid: task_template_gid.to_owned(),
2286 },
2287 }
2288 }
2289 /**Instantiate a task from a task template
2290
2291Creates and returns a job that will asynchronously handle the task instantiation.*/
2292 pub fn instantiate_task(
2293 &self,
2294 data: TaskTemplateInstantiateTaskRequest,
2295 task_template_gid: &str,
2296 ) -> FluentRequest<'_, request::InstantiateTaskRequest> {
2297 FluentRequest {
2298 client: self,
2299 params: request::InstantiateTaskRequest {
2300 data,
2301 opt_fields: None,
2302 opt_pretty: None,
2303 task_template_gid: task_template_gid.to_owned(),
2304 },
2305 }
2306 }
2307 /**Get multiple tasks
2308
2309Returns the compact task records for some filtered set of tasks. Use one or more of the parameters provided to filter the tasks returned. You must specify a `project` or `tag` if you do not specify `assignee` and `workspace`.
2310
2311For more complex task retrieval, use [workspaces/{workspace_gid}/tasks/search](/reference/searchtasksforworkspace).*/
2312 pub fn get_tasks(&self) -> FluentRequest<'_, request::GetTasksRequest> {
2313 FluentRequest {
2314 client: self,
2315 params: request::GetTasksRequest {
2316 assignee: None,
2317 completed_since: None,
2318 limit: None,
2319 modified_since: None,
2320 offset: None,
2321 opt_fields: None,
2322 opt_pretty: None,
2323 project: None,
2324 section: None,
2325 workspace: None,
2326 },
2327 }
2328 }
2329 /**Create a task
2330
2331Creating a new task is as easy as POSTing to the `/tasks` endpoint with a
2332data block containing the fields you’d like to set on the task. Any
2333unspecified fields will take on default values.
2334
2335Every task is required to be created in a specific workspace, and this
2336workspace cannot be changed once set. The workspace need not be set
2337explicitly if you specify `projects` or a `parent` task instead.*/
2338 pub fn create_task(
2339 &self,
2340 data: TaskRequest,
2341 ) -> FluentRequest<'_, request::CreateTaskRequest> {
2342 FluentRequest {
2343 client: self,
2344 params: request::CreateTaskRequest {
2345 data,
2346 opt_fields: None,
2347 opt_pretty: None,
2348 },
2349 }
2350 }
2351 /**Get a task
2352
2353Returns the complete task record for a single task.*/
2354 pub fn get_task(
2355 &self,
2356 task_gid: &str,
2357 ) -> FluentRequest<'_, request::GetTaskRequest> {
2358 FluentRequest {
2359 client: self,
2360 params: request::GetTaskRequest {
2361 opt_fields: None,
2362 opt_pretty: None,
2363 task_gid: task_gid.to_owned(),
2364 },
2365 }
2366 }
2367 /**Update a task
2368
2369A specific, existing task can be updated by making a PUT request on the
2370URL for that task. Only the fields provided in the `data` block will be
2371updated; any unspecified fields will remain unchanged.
2372
2373When using this method, it is best to specify only those fields you wish
2374to change, or else you may overwrite changes made by another user since
2375you last retrieved the task.
2376
2377Returns the complete updated task record.*/
2378 pub fn update_task(
2379 &self,
2380 data: TaskRequest,
2381 task_gid: &str,
2382 ) -> FluentRequest<'_, request::UpdateTaskRequest> {
2383 FluentRequest {
2384 client: self,
2385 params: request::UpdateTaskRequest {
2386 data,
2387 opt_fields: None,
2388 opt_pretty: None,
2389 task_gid: task_gid.to_owned(),
2390 },
2391 }
2392 }
2393 /**Delete a task
2394
2395A specific, existing task can be deleted by making a DELETE request on
2396the URL for that task. Deleted tasks go into the “trash” of the user
2397making the delete request. Tasks can be recovered from the trash within a
2398period of 30 days; afterward they are completely removed from the system.
2399
2400Returns an empty data record.*/
2401 pub fn delete_task(
2402 &self,
2403 task_gid: &str,
2404 ) -> FluentRequest<'_, request::DeleteTaskRequest> {
2405 FluentRequest {
2406 client: self,
2407 params: request::DeleteTaskRequest {
2408 opt_pretty: None,
2409 task_gid: task_gid.to_owned(),
2410 },
2411 }
2412 }
2413 /**Duplicate a task
2414
2415Creates and returns a job that will asynchronously handle the duplication.*/
2416 pub fn duplicate_task(
2417 &self,
2418 data: TaskDuplicateRequest,
2419 task_gid: &str,
2420 ) -> FluentRequest<'_, request::DuplicateTaskRequest> {
2421 FluentRequest {
2422 client: self,
2423 params: request::DuplicateTaskRequest {
2424 data,
2425 opt_fields: None,
2426 opt_pretty: None,
2427 task_gid: task_gid.to_owned(),
2428 },
2429 }
2430 }
2431 /**Get tasks from a project
2432
2433Returns the compact task records for all tasks within the given project, ordered by their priority within the project. Tasks can exist in more than one project at a time.*/
2434 pub fn get_tasks_for_project(
2435 &self,
2436 project_gid: &str,
2437 ) -> FluentRequest<'_, request::GetTasksForProjectRequest> {
2438 FluentRequest {
2439 client: self,
2440 params: request::GetTasksForProjectRequest {
2441 completed_since: None,
2442 limit: None,
2443 offset: None,
2444 opt_fields: None,
2445 opt_pretty: None,
2446 project_gid: project_gid.to_owned(),
2447 },
2448 }
2449 }
2450 /**Get tasks from a section
2451
2452*Board view only*: Returns the compact section records for all tasks within the given section.*/
2453 pub fn get_tasks_for_section(
2454 &self,
2455 section_gid: &str,
2456 ) -> FluentRequest<'_, request::GetTasksForSectionRequest> {
2457 FluentRequest {
2458 client: self,
2459 params: request::GetTasksForSectionRequest {
2460 completed_since: None,
2461 limit: None,
2462 offset: None,
2463 opt_fields: None,
2464 opt_pretty: None,
2465 section_gid: section_gid.to_owned(),
2466 },
2467 }
2468 }
2469 /**Get tasks from a tag
2470
2471Returns the compact task records for all tasks with the given tag. Tasks can have more than one tag at a time.*/
2472 pub fn get_tasks_for_tag(
2473 &self,
2474 tag_gid: &str,
2475 ) -> FluentRequest<'_, request::GetTasksForTagRequest> {
2476 FluentRequest {
2477 client: self,
2478 params: request::GetTasksForTagRequest {
2479 limit: None,
2480 offset: None,
2481 opt_fields: None,
2482 opt_pretty: None,
2483 tag_gid: tag_gid.to_owned(),
2484 },
2485 }
2486 }
2487 /**Get tasks from a user task list
2488
2489Returns the compact list of tasks in a user’s My Tasks list.
2490*Note: Access control is enforced for this endpoint as with all Asana API endpoints, meaning a user’s private tasks will be filtered out if the API-authenticated user does not have access to them.*
2491*Note: Both complete and incomplete tasks are returned by default unless they are filtered out (for example, setting `completed_since=now` will return only incomplete tasks, which is the default view for “My Tasks” in Asana.)**/
2492 pub fn get_tasks_for_user_task_list(
2493 &self,
2494 user_task_list_gid: &str,
2495 ) -> FluentRequest<'_, request::GetTasksForUserTaskListRequest> {
2496 FluentRequest {
2497 client: self,
2498 params: request::GetTasksForUserTaskListRequest {
2499 completed_since: None,
2500 limit: None,
2501 offset: None,
2502 opt_fields: None,
2503 opt_pretty: None,
2504 user_task_list_gid: user_task_list_gid.to_owned(),
2505 },
2506 }
2507 }
2508 /**Get subtasks from a task
2509
2510Returns a compact representation of all of the subtasks of a task.*/
2511 pub fn get_subtasks_for_task(
2512 &self,
2513 task_gid: &str,
2514 ) -> FluentRequest<'_, request::GetSubtasksForTaskRequest> {
2515 FluentRequest {
2516 client: self,
2517 params: request::GetSubtasksForTaskRequest {
2518 limit: None,
2519 offset: None,
2520 opt_fields: None,
2521 opt_pretty: None,
2522 task_gid: task_gid.to_owned(),
2523 },
2524 }
2525 }
2526 /**Create a subtask
2527
2528Creates a new subtask and adds it to the parent task. Returns the full record for the newly created subtask.*/
2529 pub fn create_subtask_for_task(
2530 &self,
2531 data: TaskRequest,
2532 task_gid: &str,
2533 ) -> FluentRequest<'_, request::CreateSubtaskForTaskRequest> {
2534 FluentRequest {
2535 client: self,
2536 params: request::CreateSubtaskForTaskRequest {
2537 data,
2538 opt_fields: None,
2539 opt_pretty: None,
2540 task_gid: task_gid.to_owned(),
2541 },
2542 }
2543 }
2544 /**Set the parent of a task
2545
2546parent, or no parent task at all. Returns an empty data block. When using `insert_before` and `insert_after`, at most one of those two options can be specified, and they must already be subtasks of the parent.*/
2547 pub fn set_parent_for_task(
2548 &self,
2549 data: TaskSetParentRequest,
2550 task_gid: &str,
2551 ) -> FluentRequest<'_, request::SetParentForTaskRequest> {
2552 FluentRequest {
2553 client: self,
2554 params: request::SetParentForTaskRequest {
2555 data,
2556 opt_fields: None,
2557 opt_pretty: None,
2558 task_gid: task_gid.to_owned(),
2559 },
2560 }
2561 }
2562 /**Get dependencies from a task
2563
2564Returns the compact representations of all of the dependencies of a task.*/
2565 pub fn get_dependencies_for_task(
2566 &self,
2567 task_gid: &str,
2568 ) -> FluentRequest<'_, request::GetDependenciesForTaskRequest> {
2569 FluentRequest {
2570 client: self,
2571 params: request::GetDependenciesForTaskRequest {
2572 limit: None,
2573 offset: None,
2574 opt_fields: None,
2575 opt_pretty: None,
2576 task_gid: task_gid.to_owned(),
2577 },
2578 }
2579 }
2580 /**Set dependencies for a task
2581
2582Marks a set of tasks as dependencies of this task, if they are not already dependencies. *A task can have at most 30 dependents and dependencies combined*.*/
2583 pub fn add_dependencies_for_task(
2584 &self,
2585 data: ModifyDependenciesRequest,
2586 task_gid: &str,
2587 ) -> FluentRequest<'_, request::AddDependenciesForTaskRequest> {
2588 FluentRequest {
2589 client: self,
2590 params: request::AddDependenciesForTaskRequest {
2591 data,
2592 opt_pretty: None,
2593 task_gid: task_gid.to_owned(),
2594 },
2595 }
2596 }
2597 /**Unlink dependencies from a task
2598
2599Unlinks a set of dependencies from this task.*/
2600 pub fn remove_dependencies_for_task(
2601 &self,
2602 data: ModifyDependenciesRequest,
2603 task_gid: &str,
2604 ) -> FluentRequest<'_, request::RemoveDependenciesForTaskRequest> {
2605 FluentRequest {
2606 client: self,
2607 params: request::RemoveDependenciesForTaskRequest {
2608 data,
2609 opt_pretty: None,
2610 task_gid: task_gid.to_owned(),
2611 },
2612 }
2613 }
2614 /**Get dependents from a task
2615
2616Returns the compact representations of all of the dependents of a task.*/
2617 pub fn get_dependents_for_task(
2618 &self,
2619 task_gid: &str,
2620 ) -> FluentRequest<'_, request::GetDependentsForTaskRequest> {
2621 FluentRequest {
2622 client: self,
2623 params: request::GetDependentsForTaskRequest {
2624 limit: None,
2625 offset: None,
2626 opt_fields: None,
2627 opt_pretty: None,
2628 task_gid: task_gid.to_owned(),
2629 },
2630 }
2631 }
2632 /**Set dependents for a task
2633
2634Marks a set of tasks as dependents of this task, if they are not already dependents. *A task can have at most 30 dependents and dependencies combined*.*/
2635 pub fn add_dependents_for_task(
2636 &self,
2637 data: ModifyDependentsRequest,
2638 task_gid: &str,
2639 ) -> FluentRequest<'_, request::AddDependentsForTaskRequest> {
2640 FluentRequest {
2641 client: self,
2642 params: request::AddDependentsForTaskRequest {
2643 data,
2644 opt_pretty: None,
2645 task_gid: task_gid.to_owned(),
2646 },
2647 }
2648 }
2649 /**Unlink dependents from a task
2650
2651Unlinks a set of dependents from this task.*/
2652 pub fn remove_dependents_for_task(
2653 &self,
2654 data: ModifyDependentsRequest,
2655 task_gid: &str,
2656 ) -> FluentRequest<'_, request::RemoveDependentsForTaskRequest> {
2657 FluentRequest {
2658 client: self,
2659 params: request::RemoveDependentsForTaskRequest {
2660 data,
2661 opt_pretty: None,
2662 task_gid: task_gid.to_owned(),
2663 },
2664 }
2665 }
2666 /**Add a project to a task
2667
2668Adds the task to the specified project, in the optional location
2669specified. If no location arguments are given, the task will be added to
2670the end of the project.
2671
2672`addProject` can also be used to reorder a task within a project or
2673section that already contains it.
2674
2675At most one of `insert_before`, `insert_after`, or `section` should be
2676specified. Inserting into a section in an non-order-dependent way can be
2677done by specifying section, otherwise, to insert within a section in a
2678particular place, specify `insert_before` or `insert_after` and a task
2679within the section to anchor the position of this task.
2680
2681Returns an empty data block.*/
2682 pub fn add_project_for_task(
2683 &self,
2684 data: TaskAddProjectRequest,
2685 task_gid: &str,
2686 ) -> FluentRequest<'_, request::AddProjectForTaskRequest> {
2687 FluentRequest {
2688 client: self,
2689 params: request::AddProjectForTaskRequest {
2690 data,
2691 opt_pretty: None,
2692 task_gid: task_gid.to_owned(),
2693 },
2694 }
2695 }
2696 /**Remove a project from a task
2697
2698Removes the task from the specified project. The task will still exist in
2699the system, but it will not be in the project anymore.
2700
2701Returns an empty data block.*/
2702 pub fn remove_project_for_task(
2703 &self,
2704 data: TaskRemoveProjectRequest,
2705 task_gid: &str,
2706 ) -> FluentRequest<'_, request::RemoveProjectForTaskRequest> {
2707 FluentRequest {
2708 client: self,
2709 params: request::RemoveProjectForTaskRequest {
2710 data,
2711 opt_pretty: None,
2712 task_gid: task_gid.to_owned(),
2713 },
2714 }
2715 }
2716 /**Add a tag to a task
2717
2718Adds a tag to a task. Returns an empty data block.*/
2719 pub fn add_tag_for_task(
2720 &self,
2721 data: TaskAddTagRequest,
2722 task_gid: &str,
2723 ) -> FluentRequest<'_, request::AddTagForTaskRequest> {
2724 FluentRequest {
2725 client: self,
2726 params: request::AddTagForTaskRequest {
2727 data,
2728 opt_pretty: None,
2729 task_gid: task_gid.to_owned(),
2730 },
2731 }
2732 }
2733 /**Remove a tag from a task
2734
2735Removes a tag from a task. Returns an empty data block.*/
2736 pub fn remove_tag_for_task(
2737 &self,
2738 data: TaskRemoveTagRequest,
2739 task_gid: &str,
2740 ) -> FluentRequest<'_, request::RemoveTagForTaskRequest> {
2741 FluentRequest {
2742 client: self,
2743 params: request::RemoveTagForTaskRequest {
2744 data,
2745 opt_pretty: None,
2746 task_gid: task_gid.to_owned(),
2747 },
2748 }
2749 }
2750 /**Add followers to a task
2751
2752Adds followers to a task. Returns an empty data block.
2753Each task can be associated with zero or more followers in the system.
2754Requests to add/remove followers, if successful, will return the complete updated task record, described above.*/
2755 pub fn add_followers_for_task(
2756 &self,
2757 data: TaskAddFollowersRequest,
2758 task_gid: &str,
2759 ) -> FluentRequest<'_, request::AddFollowersForTaskRequest> {
2760 FluentRequest {
2761 client: self,
2762 params: request::AddFollowersForTaskRequest {
2763 data,
2764 opt_fields: None,
2765 opt_pretty: None,
2766 task_gid: task_gid.to_owned(),
2767 },
2768 }
2769 }
2770 /**Remove followers from a task
2771
2772Removes each of the specified followers from the task if they are following. Returns the complete, updated record for the affected task.*/
2773 pub fn remove_follower_for_task(
2774 &self,
2775 data: TaskRemoveFollowersRequest,
2776 task_gid: &str,
2777 ) -> FluentRequest<'_, request::RemoveFollowerForTaskRequest> {
2778 FluentRequest {
2779 client: self,
2780 params: request::RemoveFollowerForTaskRequest {
2781 data,
2782 opt_fields: None,
2783 opt_pretty: None,
2784 task_gid: task_gid.to_owned(),
2785 },
2786 }
2787 }
2788 /**Search tasks in a workspace
2789
2790To mirror the functionality of the Asana web app's advanced search feature, the Asana API has a task search endpoint that allows you to build complex filters to find and retrieve the exact data you need.
2791#### Premium access
2792Like the Asana web product's advance search feature, this search endpoint will only be available to premium Asana users. A user is premium if any of the following is true:
2793
2794- The workspace in which the search is being performed is a premium workspace - The user is a member of a premium team inside the workspace
2795
2796Even if a user is only a member of a premium team inside a non-premium workspace, search will allow them to find data anywhere in the workspace, not just inside the premium team. Making a search request using credentials of a non-premium user will result in a `402 Payment Required` error.
2797#### Pagination
2798Search results are not stable; repeating the same query multiple times may return the data in a different order, even if the data do not change. Because of this, the traditional [pagination](https://developers.asana.com/docs/#pagination) available elsewhere in the Asana API is not available here. However, you can paginate manually by sorting the search results by their creation time and then modifying each subsequent query to exclude data you have already seen. Page sizes are limited to a maximum of 100 items, and can be specified by the `limit` query parameter.
2799#### Eventual consistency
2800Changes in Asana (regardless of whether they’re made though the web product or the API) are forwarded to our search infrastructure to be indexed. This process can take between 10 and 60 seconds to complete under normal operation, and longer during some production incidents. Making a change to a task that would alter its presence in a particular search query will not be reflected immediately. This is also true of the advanced search feature in the web product.
2801#### Rate limits
2802You may receive a `429 Too Many Requests` response if you hit any of our [rate limits](https://developers.asana.com/docs/#rate-limits).
2803#### Custom field parameters
2804| Parameter name | Custom field type | Accepted type |
2805|---|---|---|
2806| custom_fields.{gid}.is_set | All | Boolean |
2807| custom_fields.{gid}.value | Text | String |
2808| custom_fields.{gid}.value | Number | Number |
2809| custom_fields.{gid}.value | Enum | Enum option ID |
2810| custom_fields.{gid}.starts_with | Text only | String |
2811| custom_fields.{gid}.ends_with | Text only | String |
2812| custom_fields.{gid}.contains | Text only | String |
2813| custom_fields.{gid}.less_than | Number only | Number |
2814| custom_fields.{gid}.greater_than | Number only | Number |
2815
2816
2817For example, if the gid of the custom field is 12345, these query parameter to find tasks where it is set would be `custom_fields.12345.is_set=true`. To match an exact value for an enum custom field, use the gid of the desired enum option and not the name of the enum option: `custom_fields.12345.value=67890`.
2818
2819**Not Supported**: searching for multiple exact matches of a custom field, searching for multi-enum custom field
2820
2821*Note: If you specify `projects.any` and `sections.any`, you will receive tasks for the project **and** tasks for the section. If you're looking for only tasks in a section, omit the `projects.any` from the request.**/
2822 pub fn search_tasks_for_workspace(
2823 &self,
2824 workspace_gid: &str,
2825 ) -> FluentRequest<'_, request::SearchTasksForWorkspaceRequest> {
2826 FluentRequest {
2827 client: self,
2828 params: request::SearchTasksForWorkspaceRequest {
2829 assigned_by_any: None,
2830 assigned_by_not: None,
2831 assignee_any: None,
2832 assignee_not: None,
2833 commented_on_by_not: None,
2834 completed: None,
2835 completed_at_after: None,
2836 completed_at_before: None,
2837 completed_on: None,
2838 completed_on_after: None,
2839 completed_on_before: None,
2840 created_at_after: None,
2841 created_at_before: None,
2842 created_by_any: None,
2843 created_by_not: None,
2844 created_on: None,
2845 created_on_after: None,
2846 created_on_before: None,
2847 due_at_after: None,
2848 due_at_before: None,
2849 due_on: None,
2850 due_on_after: None,
2851 due_on_before: None,
2852 followers_not: None,
2853 has_attachment: None,
2854 is_blocked: None,
2855 is_blocking: None,
2856 is_subtask: None,
2857 liked_by_not: None,
2858 modified_at_after: None,
2859 modified_at_before: None,
2860 modified_on: None,
2861 modified_on_after: None,
2862 modified_on_before: None,
2863 opt_fields: None,
2864 opt_pretty: None,
2865 portfolios_any: None,
2866 projects_all: None,
2867 projects_any: None,
2868 projects_not: None,
2869 resource_subtype: None,
2870 sections_all: None,
2871 sections_any: None,
2872 sections_not: None,
2873 sort_ascending: None,
2874 sort_by: None,
2875 start_on: None,
2876 start_on_after: None,
2877 start_on_before: None,
2878 tags_all: None,
2879 tags_any: None,
2880 tags_not: None,
2881 teams_any: None,
2882 text: None,
2883 workspace_gid: workspace_gid.to_owned(),
2884 },
2885 }
2886 }
2887 /**Get a team membership
2888
2889Returns the complete team membership record for a single team membership.*/
2890 pub fn get_team_membership(
2891 &self,
2892 team_membership_gid: &str,
2893 ) -> FluentRequest<'_, request::GetTeamMembershipRequest> {
2894 FluentRequest {
2895 client: self,
2896 params: request::GetTeamMembershipRequest {
2897 opt_fields: None,
2898 opt_pretty: None,
2899 team_membership_gid: team_membership_gid.to_owned(),
2900 },
2901 }
2902 }
2903 /**Get team memberships
2904
2905Returns compact team membership records.*/
2906 pub fn get_team_memberships(
2907 &self,
2908 ) -> FluentRequest<'_, request::GetTeamMembershipsRequest> {
2909 FluentRequest {
2910 client: self,
2911 params: request::GetTeamMembershipsRequest {
2912 limit: None,
2913 offset: None,
2914 opt_fields: None,
2915 opt_pretty: None,
2916 team: None,
2917 user: None,
2918 workspace: None,
2919 },
2920 }
2921 }
2922 /**Get memberships from a team
2923
2924Returns the compact team memberships for the team.*/
2925 pub fn get_team_memberships_for_team(
2926 &self,
2927 team_gid: &str,
2928 ) -> FluentRequest<'_, request::GetTeamMembershipsForTeamRequest> {
2929 FluentRequest {
2930 client: self,
2931 params: request::GetTeamMembershipsForTeamRequest {
2932 limit: None,
2933 offset: None,
2934 opt_fields: None,
2935 opt_pretty: None,
2936 team_gid: team_gid.to_owned(),
2937 },
2938 }
2939 }
2940 /**Get memberships from a user
2941
2942Returns the compact team membership records for the user.*/
2943 pub fn get_team_memberships_for_user(
2944 &self,
2945 user_gid: &str,
2946 workspace: &str,
2947 ) -> FluentRequest<'_, request::GetTeamMembershipsForUserRequest> {
2948 FluentRequest {
2949 client: self,
2950 params: request::GetTeamMembershipsForUserRequest {
2951 limit: None,
2952 offset: None,
2953 opt_fields: None,
2954 opt_pretty: None,
2955 user_gid: user_gid.to_owned(),
2956 workspace: workspace.to_owned(),
2957 },
2958 }
2959 }
2960 /**Create a team
2961
2962Creates a team within the current workspace.*/
2963 pub fn create_team(
2964 &self,
2965 data: TeamRequest,
2966 ) -> FluentRequest<'_, request::CreateTeamRequest> {
2967 FluentRequest {
2968 client: self,
2969 params: request::CreateTeamRequest {
2970 data,
2971 opt_fields: None,
2972 opt_pretty: None,
2973 },
2974 }
2975 }
2976 /**Get a team
2977
2978Returns the full record for a single team.*/
2979 pub fn get_team(
2980 &self,
2981 team_gid: &str,
2982 ) -> FluentRequest<'_, request::GetTeamRequest> {
2983 FluentRequest {
2984 client: self,
2985 params: request::GetTeamRequest {
2986 opt_fields: None,
2987 opt_pretty: None,
2988 team_gid: team_gid.to_owned(),
2989 },
2990 }
2991 }
2992 /**Update a team
2993
2994Updates a team within the current workspace.*/
2995 pub fn update_team(
2996 &self,
2997 data: TeamRequest,
2998 team_gid: &str,
2999 ) -> FluentRequest<'_, request::UpdateTeamRequest> {
3000 FluentRequest {
3001 client: self,
3002 params: request::UpdateTeamRequest {
3003 data,
3004 opt_fields: None,
3005 opt_pretty: None,
3006 team_gid: team_gid.to_owned(),
3007 },
3008 }
3009 }
3010 /**Get teams in a workspace
3011
3012Returns the compact records for all teams in the workspace visible to the authorized user.*/
3013 pub fn get_teams_for_workspace(
3014 &self,
3015 workspace_gid: &str,
3016 ) -> FluentRequest<'_, request::GetTeamsForWorkspaceRequest> {
3017 FluentRequest {
3018 client: self,
3019 params: request::GetTeamsForWorkspaceRequest {
3020 limit: None,
3021 offset: None,
3022 opt_fields: None,
3023 opt_pretty: None,
3024 workspace_gid: workspace_gid.to_owned(),
3025 },
3026 }
3027 }
3028 /**Get teams for a user
3029
3030Returns the compact records for all teams to which the given user is assigned.*/
3031 pub fn get_teams_for_user(
3032 &self,
3033 organization: &str,
3034 user_gid: &str,
3035 ) -> FluentRequest<'_, request::GetTeamsForUserRequest> {
3036 FluentRequest {
3037 client: self,
3038 params: request::GetTeamsForUserRequest {
3039 limit: None,
3040 offset: None,
3041 opt_fields: None,
3042 opt_pretty: None,
3043 organization: organization.to_owned(),
3044 user_gid: user_gid.to_owned(),
3045 },
3046 }
3047 }
3048 /**Add a user to a team
3049
3050The user making this call must be a member of the team in order to add others. The user being added must exist in the same organization as the team.
3051
3052Returns the complete team membership record for the newly added user.*/
3053 pub fn add_user_for_team(
3054 &self,
3055 data: TeamAddUserRequest,
3056 team_gid: &str,
3057 ) -> FluentRequest<'_, request::AddUserForTeamRequest> {
3058 FluentRequest {
3059 client: self,
3060 params: request::AddUserForTeamRequest {
3061 data,
3062 opt_fields: None,
3063 opt_pretty: None,
3064 team_gid: team_gid.to_owned(),
3065 },
3066 }
3067 }
3068 /**Remove a user from a team
3069
3070The user making this call must be a member of the team in order to remove themselves or others.*/
3071 pub fn remove_user_for_team(
3072 &self,
3073 data: TeamRemoveUserRequest,
3074 team_gid: &str,
3075 ) -> FluentRequest<'_, request::RemoveUserForTeamRequest> {
3076 FluentRequest {
3077 client: self,
3078 params: request::RemoveUserForTeamRequest {
3079 data,
3080 opt_pretty: None,
3081 team_gid: team_gid.to_owned(),
3082 },
3083 }
3084 }
3085 /**Get a time period
3086
3087Returns the full record for a single time period.*/
3088 pub fn get_time_period(
3089 &self,
3090 time_period_gid: &str,
3091 ) -> FluentRequest<'_, request::GetTimePeriodRequest> {
3092 FluentRequest {
3093 client: self,
3094 params: request::GetTimePeriodRequest {
3095 opt_fields: None,
3096 opt_pretty: None,
3097 time_period_gid: time_period_gid.to_owned(),
3098 },
3099 }
3100 }
3101 /**Get time periods
3102
3103Returns compact time period records.*/
3104 pub fn get_time_periods(
3105 &self,
3106 workspace: &str,
3107 ) -> FluentRequest<'_, request::GetTimePeriodsRequest> {
3108 FluentRequest {
3109 client: self,
3110 params: request::GetTimePeriodsRequest {
3111 end_on: None,
3112 limit: None,
3113 offset: None,
3114 opt_fields: None,
3115 opt_pretty: None,
3116 start_on: None,
3117 workspace: workspace.to_owned(),
3118 },
3119 }
3120 }
3121 /**Get time tracking entries for a task
3122
3123Returns time tracking entries for a given task.*/
3124 pub fn get_time_tracking_entries_for_task(
3125 &self,
3126 task_gid: &str,
3127 ) -> FluentRequest<'_, request::GetTimeTrackingEntriesForTaskRequest> {
3128 FluentRequest {
3129 client: self,
3130 params: request::GetTimeTrackingEntriesForTaskRequest {
3131 limit: None,
3132 offset: None,
3133 opt_fields: None,
3134 opt_pretty: None,
3135 task_gid: task_gid.to_owned(),
3136 },
3137 }
3138 }
3139 /**Create a time tracking entry
3140
3141Creates a time tracking entry on a given task.
3142
3143Returns the record of the newly created time tracking entry.*/
3144 pub fn create_time_tracking_entry(
3145 &self,
3146 data: CreateTimeTrackingEntryRequestBody,
3147 task_gid: &str,
3148 ) -> FluentRequest<'_, request::CreateTimeTrackingEntryRequest> {
3149 FluentRequest {
3150 client: self,
3151 params: request::CreateTimeTrackingEntryRequest {
3152 data,
3153 opt_fields: None,
3154 opt_pretty: None,
3155 task_gid: task_gid.to_owned(),
3156 },
3157 }
3158 }
3159 /**Get a time tracking entry
3160
3161Returns the complete time tracking entry record for a single time tracking entry.*/
3162 pub fn get_time_tracking_entry(
3163 &self,
3164 time_tracking_entry_gid: &str,
3165 ) -> FluentRequest<'_, request::GetTimeTrackingEntryRequest> {
3166 FluentRequest {
3167 client: self,
3168 params: request::GetTimeTrackingEntryRequest {
3169 opt_fields: None,
3170 opt_pretty: None,
3171 time_tracking_entry_gid: time_tracking_entry_gid.to_owned(),
3172 },
3173 }
3174 }
3175 /**Update a time tracking entry
3176
3177A specific, existing time tracking entry can be updated by making a `PUT` request on
3178the URL for that time tracking entry. Only the fields provided in the `data` block
3179will be updated; any unspecified fields will remain unchanged.
3180
3181When using this method, it is best to specify only those fields you wish
3182to change, or else you may overwrite changes made by another user since
3183you last retrieved the task.
3184
3185Returns the complete updated time tracking entry record.*/
3186 pub fn update_time_tracking_entry(
3187 &self,
3188 data: UpdateTimeTrackingEntryRequestBody,
3189 time_tracking_entry_gid: &str,
3190 ) -> FluentRequest<'_, request::UpdateTimeTrackingEntryRequest> {
3191 FluentRequest {
3192 client: self,
3193 params: request::UpdateTimeTrackingEntryRequest {
3194 data,
3195 opt_fields: None,
3196 opt_pretty: None,
3197 time_tracking_entry_gid: time_tracking_entry_gid.to_owned(),
3198 },
3199 }
3200 }
3201 /**Delete a time tracking entry
3202
3203A specific, existing time tracking entry can be deleted by making a `DELETE` request on
3204the URL for that time tracking entry.
3205
3206Returns an empty data record.*/
3207 pub fn delete_time_tracking_entry(
3208 &self,
3209 time_tracking_entry_gid: &str,
3210 ) -> FluentRequest<'_, request::DeleteTimeTrackingEntryRequest> {
3211 FluentRequest {
3212 client: self,
3213 params: request::DeleteTimeTrackingEntryRequest {
3214 opt_pretty: None,
3215 time_tracking_entry_gid: time_tracking_entry_gid.to_owned(),
3216 },
3217 }
3218 }
3219 /**Get objects via typeahead
3220
3221Retrieves objects in the workspace based via an auto-completion/typeahead
3222search algorithm. This feature is meant to provide results quickly, so do
3223not rely on this API to provide extremely accurate search results. The
3224result set is limited to a single page of results with a maximum size, so
3225you won’t be able to fetch large numbers of results.
3226
3227The typeahead search API provides search for objects from a single
3228workspace. This endpoint should be used to query for objects when
3229creating an auto-completion/typeahead search feature. This API is meant
3230to provide results quickly and should not be relied upon for accurate or
3231exhaustive search results. The results sets are limited in size and
3232cannot be paginated.
3233
3234Queries return a compact representation of each object which is typically
3235the gid and name fields. Interested in a specific set of fields or all of
3236the fields?! Of course you are. Use field selectors to manipulate what
3237data is included in a response.
3238
3239Resources with type `user` are returned in order of most contacted to
3240least contacted. This is determined by task assignments, adding the user
3241to projects, and adding the user as a follower to tasks, messages,
3242etc.
3243
3244Resources with type `project` are returned in order of recency. This is
3245determined when the user visits the project, is added to the project, and
3246completes tasks in the project.
3247
3248Resources with type `task` are returned with priority placed on tasks
3249the user is following, but no guarantee on the order of those tasks.
3250
3251Resources with type `project_template` are returned with priority
3252placed on favorited project templates.
3253
3254Leaving the `query` string empty or omitted will give you results, still
3255following the resource ordering above. This could be used to list users or
3256projects that are relevant for the requesting user's api token.*/
3257 pub fn typeahead_for_workspace(
3258 &self,
3259 resource_type: &str,
3260 workspace_gid: &str,
3261 ) -> FluentRequest<'_, request::TypeaheadForWorkspaceRequest> {
3262 FluentRequest {
3263 client: self,
3264 params: request::TypeaheadForWorkspaceRequest {
3265 count: None,
3266 opt_fields: None,
3267 opt_pretty: None,
3268 query: None,
3269 resource_type: resource_type.to_owned(),
3270 type_: None,
3271 workspace_gid: workspace_gid.to_owned(),
3272 },
3273 }
3274 }
3275 /**Get a user task list
3276
3277Returns the full record for a user task list.*/
3278 pub fn get_user_task_list(
3279 &self,
3280 user_task_list_gid: &str,
3281 ) -> FluentRequest<'_, request::GetUserTaskListRequest> {
3282 FluentRequest {
3283 client: self,
3284 params: request::GetUserTaskListRequest {
3285 opt_fields: None,
3286 opt_pretty: None,
3287 user_task_list_gid: user_task_list_gid.to_owned(),
3288 },
3289 }
3290 }
3291 /**Get a user's task list
3292
3293Returns the full record for a user's task list.*/
3294 pub fn get_user_task_list_for_user(
3295 &self,
3296 user_gid: &str,
3297 workspace: &str,
3298 ) -> FluentRequest<'_, request::GetUserTaskListForUserRequest> {
3299 FluentRequest {
3300 client: self,
3301 params: request::GetUserTaskListForUserRequest {
3302 opt_fields: None,
3303 opt_pretty: None,
3304 user_gid: user_gid.to_owned(),
3305 workspace: workspace.to_owned(),
3306 },
3307 }
3308 }
3309 /**Get multiple users
3310
3311Returns the user records for all users in all workspaces and organizations accessible to the authenticated user. Accepts an optional workspace ID parameter.
3312Results are sorted by user ID.*/
3313 pub fn get_users(&self) -> FluentRequest<'_, request::GetUsersRequest> {
3314 FluentRequest {
3315 client: self,
3316 params: request::GetUsersRequest {
3317 limit: None,
3318 offset: None,
3319 opt_fields: None,
3320 opt_pretty: None,
3321 team: None,
3322 workspace: None,
3323 },
3324 }
3325 }
3326 /**Get a user
3327
3328Returns the full user record for the single user with the provided ID.*/
3329 pub fn get_user(
3330 &self,
3331 user_gid: &str,
3332 ) -> FluentRequest<'_, request::GetUserRequest> {
3333 FluentRequest {
3334 client: self,
3335 params: request::GetUserRequest {
3336 opt_fields: None,
3337 opt_pretty: None,
3338 user_gid: user_gid.to_owned(),
3339 },
3340 }
3341 }
3342 /**Get a user's favorites
3343
3344Returns all of a user's favorites in the given workspace, of the given type.
3345Results are given in order (The same order as Asana's sidebar).*/
3346 pub fn get_favorites_for_user(
3347 &self,
3348 resource_type: &str,
3349 user_gid: &str,
3350 workspace: &str,
3351 ) -> FluentRequest<'_, request::GetFavoritesForUserRequest> {
3352 FluentRequest {
3353 client: self,
3354 params: request::GetFavoritesForUserRequest {
3355 limit: None,
3356 offset: None,
3357 opt_fields: None,
3358 opt_pretty: None,
3359 resource_type: resource_type.to_owned(),
3360 user_gid: user_gid.to_owned(),
3361 workspace: workspace.to_owned(),
3362 },
3363 }
3364 }
3365 /**Get users in a team
3366
3367Returns the compact records for all users that are members of the team.
3368Results are sorted alphabetically and limited to 2000. For more results use the `/users` endpoint.*/
3369 pub fn get_users_for_team(
3370 &self,
3371 team_gid: &str,
3372 ) -> FluentRequest<'_, request::GetUsersForTeamRequest> {
3373 FluentRequest {
3374 client: self,
3375 params: request::GetUsersForTeamRequest {
3376 offset: None,
3377 opt_fields: None,
3378 opt_pretty: None,
3379 team_gid: team_gid.to_owned(),
3380 },
3381 }
3382 }
3383 /**Get users in a workspace or organization
3384
3385Returns the compact records for all users in the specified workspace or organization.
3386Results are sorted alphabetically and limited to 2000. For more results use the `/users` endpoint.*/
3387 pub fn get_users_for_workspace(
3388 &self,
3389 workspace_gid: &str,
3390 ) -> FluentRequest<'_, request::GetUsersForWorkspaceRequest> {
3391 FluentRequest {
3392 client: self,
3393 params: request::GetUsersForWorkspaceRequest {
3394 offset: None,
3395 opt_fields: None,
3396 opt_pretty: None,
3397 workspace_gid: workspace_gid.to_owned(),
3398 },
3399 }
3400 }
3401 /**Get multiple webhooks
3402
3403Get the compact representation of all webhooks your app has registered for the authenticated user in the given workspace.*/
3404 pub fn get_webhooks(
3405 &self,
3406 workspace: &str,
3407 ) -> FluentRequest<'_, request::GetWebhooksRequest> {
3408 FluentRequest {
3409 client: self,
3410 params: request::GetWebhooksRequest {
3411 limit: None,
3412 offset: None,
3413 opt_fields: None,
3414 opt_pretty: None,
3415 resource: None,
3416 workspace: workspace.to_owned(),
3417 },
3418 }
3419 }
3420 /**Establish a webhook
3421
3422Establishing a webhook is a two-part process. First, a simple HTTP POST
3423request initiates the creation similar to creating any other resource.
3424
3425Next, in the middle of this request comes the confirmation handshake.
3426When a webhook is created, we will send a test POST to the target with an
3427`X-Hook-Secret` header. The target must respond with a `200 OK` or `204
3428No Content` and a matching `X-Hook-Secret` header to confirm that this
3429webhook subscription is indeed expected. We strongly recommend storing
3430this secret to be used to verify future webhook event signatures.
3431
3432The POST request to create the webhook will then return with the status
3433of the request. If you do not acknowledge the webhook’s confirmation
3434handshake it will fail to setup, and you will receive an error in
3435response to your attempt to create it. This means you need to be able to
3436receive and complete the webhook *while* the POST request is in-flight
3437(in other words, have a server that can handle requests asynchronously).
3438
3439Invalid hostnames like localhost will recieve a 403 Forbidden status code.
3440
3441```
3442# Request
3443curl -H "Authorization: Bearer <personal_access_token>" \
3444-X POST https://app.asana.com/api/1.0/webhooks \
3445-d "resource=8675309" \
3446-d "target=https://example.com/receive-webhook/7654"
3447```
3448
3449```
3450# Handshake sent to https://example.com/
3451POST /receive-webhook/7654
3452X-Hook-Secret: b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81
3453```
3454
3455```
3456# Handshake response sent by example.com
3457HTTP/1.1 200
3458X-Hook-Secret: b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81
3459```
3460
3461```
3462# Response
3463HTTP/1.1 201
3464{
3465 "data": {
3466 "gid": "43214",
3467 "resource": {
3468 "gid": "8675309",
3469 "name": "Bugs"
3470 },
3471 "target": "https://example.com/receive-webhook/7654",
3472 "active": false,
3473 "last_success_at": null,
3474 "last_failure_at": null,
3475 "last_failure_content": null
3476 }
3477}
3478```*/
3479 pub fn create_webhook(
3480 &self,
3481 data: WebhookRequest,
3482 ) -> FluentRequest<'_, request::CreateWebhookRequest> {
3483 FluentRequest {
3484 client: self,
3485 params: request::CreateWebhookRequest {
3486 data,
3487 opt_fields: None,
3488 opt_pretty: None,
3489 },
3490 }
3491 }
3492 /**Get a webhook
3493
3494Returns the full record for the given webhook.*/
3495 pub fn get_webhook(
3496 &self,
3497 webhook_gid: &str,
3498 ) -> FluentRequest<'_, request::GetWebhookRequest> {
3499 FluentRequest {
3500 client: self,
3501 params: request::GetWebhookRequest {
3502 opt_fields: None,
3503 opt_pretty: None,
3504 webhook_gid: webhook_gid.to_owned(),
3505 },
3506 }
3507 }
3508 /**Update a webhook
3509
3510An existing webhook's filters can be updated by making a PUT request on the URL for that webhook. Note that the webhook's previous `filters` array will be completely overwritten by the `filters` sent in the PUT request.*/
3511 pub fn update_webhook(
3512 &self,
3513 data: WebhookUpdateRequest,
3514 webhook_gid: &str,
3515 ) -> FluentRequest<'_, request::UpdateWebhookRequest> {
3516 FluentRequest {
3517 client: self,
3518 params: request::UpdateWebhookRequest {
3519 data,
3520 opt_fields: None,
3521 opt_pretty: None,
3522 webhook_gid: webhook_gid.to_owned(),
3523 },
3524 }
3525 }
3526 /**Delete a webhook
3527
3528This method *permanently* removes a webhook. Note that it may be possible to receive a request that was already in flight after deleting the webhook, but no further requests will be issued.*/
3529 pub fn delete_webhook(
3530 &self,
3531 webhook_gid: &str,
3532 ) -> FluentRequest<'_, request::DeleteWebhookRequest> {
3533 FluentRequest {
3534 client: self,
3535 params: request::DeleteWebhookRequest {
3536 opt_pretty: None,
3537 webhook_gid: webhook_gid.to_owned(),
3538 },
3539 }
3540 }
3541 /**Get a workspace membership
3542
3543Returns the complete workspace record for a single workspace membership.*/
3544 pub fn get_workspace_membership(
3545 &self,
3546 workspace_membership_gid: &str,
3547 ) -> FluentRequest<'_, request::GetWorkspaceMembershipRequest> {
3548 FluentRequest {
3549 client: self,
3550 params: request::GetWorkspaceMembershipRequest {
3551 opt_fields: None,
3552 opt_pretty: None,
3553 workspace_membership_gid: workspace_membership_gid.to_owned(),
3554 },
3555 }
3556 }
3557 /**Get workspace memberships for a user
3558
3559Returns the compact workspace membership records for the user.*/
3560 pub fn get_workspace_memberships_for_user(
3561 &self,
3562 user_gid: &str,
3563 ) -> FluentRequest<'_, request::GetWorkspaceMembershipsForUserRequest> {
3564 FluentRequest {
3565 client: self,
3566 params: request::GetWorkspaceMembershipsForUserRequest {
3567 limit: None,
3568 offset: None,
3569 opt_fields: None,
3570 opt_pretty: None,
3571 user_gid: user_gid.to_owned(),
3572 },
3573 }
3574 }
3575 /**Get the workspace memberships for a workspace
3576
3577Returns the compact workspace membership records for the workspace.*/
3578 pub fn get_workspace_memberships_for_workspace(
3579 &self,
3580 workspace_gid: &str,
3581 ) -> FluentRequest<'_, request::GetWorkspaceMembershipsForWorkspaceRequest> {
3582 FluentRequest {
3583 client: self,
3584 params: request::GetWorkspaceMembershipsForWorkspaceRequest {
3585 limit: None,
3586 offset: None,
3587 opt_fields: None,
3588 opt_pretty: None,
3589 user: None,
3590 workspace_gid: workspace_gid.to_owned(),
3591 },
3592 }
3593 }
3594 /**Get multiple workspaces
3595
3596Returns the compact records for all workspaces visible to the authorized user.*/
3597 pub fn get_workspaces(&self) -> FluentRequest<'_, request::GetWorkspacesRequest> {
3598 FluentRequest {
3599 client: self,
3600 params: request::GetWorkspacesRequest {
3601 limit: None,
3602 offset: None,
3603 opt_fields: None,
3604 opt_pretty: None,
3605 },
3606 }
3607 }
3608 /**Get a workspace
3609
3610Returns the full workspace record for a single workspace.*/
3611 pub fn get_workspace(
3612 &self,
3613 workspace_gid: &str,
3614 ) -> FluentRequest<'_, request::GetWorkspaceRequest> {
3615 FluentRequest {
3616 client: self,
3617 params: request::GetWorkspaceRequest {
3618 opt_fields: None,
3619 opt_pretty: None,
3620 workspace_gid: workspace_gid.to_owned(),
3621 },
3622 }
3623 }
3624 /**Update a workspace
3625
3626A specific, existing workspace can be updated by making a PUT request on the URL for that workspace. Only the fields provided in the data block will be updated; any unspecified fields will remain unchanged.
3627Currently the only field that can be modified for a workspace is its name.
3628Returns the complete, updated workspace record.*/
3629 pub fn update_workspace(
3630 &self,
3631 data: WorkspaceRequest,
3632 workspace_gid: &str,
3633 ) -> FluentRequest<'_, request::UpdateWorkspaceRequest> {
3634 FluentRequest {
3635 client: self,
3636 params: request::UpdateWorkspaceRequest {
3637 data,
3638 opt_fields: None,
3639 opt_pretty: None,
3640 workspace_gid: workspace_gid.to_owned(),
3641 },
3642 }
3643 }
3644 /**Add a user to a workspace or organization
3645
3646Add a user to a workspace or organization.
3647The user can be referenced by their globally unique user ID or their email address. Returns the full user record for the invited user.*/
3648 pub fn add_user_for_workspace(
3649 &self,
3650 data: WorkspaceAddUserRequest,
3651 workspace_gid: &str,
3652 ) -> FluentRequest<'_, request::AddUserForWorkspaceRequest> {
3653 FluentRequest {
3654 client: self,
3655 params: request::AddUserForWorkspaceRequest {
3656 data,
3657 opt_fields: None,
3658 opt_pretty: None,
3659 workspace_gid: workspace_gid.to_owned(),
3660 },
3661 }
3662 }
3663 /**Remove a user from a workspace or organization
3664
3665Remove a user from a workspace or organization.
3666The user making this call must be an admin in the workspace. The user can be referenced by their globally unique user ID or their email address.
3667Returns an empty data record.*/
3668 pub fn remove_user_for_workspace(
3669 &self,
3670 data: WorkspaceRemoveUserRequest,
3671 workspace_gid: &str,
3672 ) -> FluentRequest<'_, request::RemoveUserForWorkspaceRequest> {
3673 FluentRequest {
3674 client: self,
3675 params: request::RemoveUserForWorkspaceRequest {
3676 data,
3677 opt_pretty: None,
3678 workspace_gid: workspace_gid.to_owned(),
3679 },
3680 }
3681 }
3682}
3683pub enum AsanaAuth {
3684 PersonalAccessToken { personal_access_token: String },
3685 OAuth2 { middleware: Arc<httpclient_oauth2::OAuth2> },
3686}
3687impl AsanaAuth {
3688 pub fn from_env() -> Self {
3689 Self::PersonalAccessToken {
3690 personal_access_token: std::env::var("ASANA_PERSONAL_ACCESS_TOKEN")
3691 .expect("Environment variable ASANA_PERSONAL_ACCESS_TOKEN is not set."),
3692 }
3693 }
3694 pub fn oauth2(access: String, refresh: String) -> Self {
3695 let mw = shared_oauth2_flow().bearer_middleware(access, refresh);
3696 Self::OAuth2 {
3697 middleware: Arc::new(mw),
3698 }
3699 }
3700}