/** * Execute a sequence of operations. * Wraps `language-common/execute`, and prepends initial state for http. * @example * execute( * create('foo'), * delete('bar') * )(state) * @private * @param {Operations} operations - Operations to be performed. * @returns {Operation} */ export function execute(...operations: Operations): Operation; /** * Get a single task of a given project. * @public * @example Get a task * getTask("1206933955023739", { * opt_fields: "name,notes,assignee", * }); * @function * @param {string} taskGid - Globally unique identifier for the task * @param {object} params - Query params to include. * @param {string} params.opt_fields - The fields to return. * @param {function} callback - (Optional) callback function * @returns {Operation} */ export function getTask(taskGid: string, params: { opt_fields: string; }, callback: Function): Operation; /** * Get the list of tasks for a given project. * @public * @example Get all tasks * getTasks("1206933955023739", { * opt_fields: "name,notes,assignee", * }); * @example Limit the number of tasks returned * getTasks("1206933955023739", { * opt_fields: "name,notes,assignee", * limit: 100, * }); * @function * @param {string} projectGid - Globally unique identifier for the project * @param {object} params - Query params to include. * @param {number} params.limit - The maximum number of tasks to return. * @param {string} params.opt_fields - The fields to return. * @param {function} callback - (Optional) callback function * @returns {Operation} */ export function getTasks(projectGid: string, params: { limit: number; opt_fields: string; }, callback: Function): Operation; /** * Update a specific task. * @public * @example Update a task * updateTask("1206933955023739", { * name: "test", * approval_status: "pending", * assignee: "12345", * }); * @function * @param {string} taskGid - Globally unique identifier for the task * @param {object} data - Body data to update the task with * @param {function} callback - (Optional) callback function * @returns {Operation} */ export function updateTask(taskGid: string, data: object, callback: Function): Operation; /** * Create a task. * @public * @example * createTask({ * name: "test", * approval_status: "pending", * assignee: "12345", * projects: ["1206933955023739"], * }); * @function * @param {object} params - Body parameters * @param {function} callback - (Optional) callback function * @returns {Operation} */ export function createTask(params: object, callback: Function): Operation; /** * Update or create a task. * @public * @example Upsert a task * upsertTask("1201382240880", { * externalId: "name", * data: { * name: "test", * approval_status: "pending", * projects: ["1201382240880"], * assignee: "12345", * }, * }); * @function * @param {string} projectGid - Globally unique identifier for the project * @param {object} params - an object with an externalId and some task data. * @param {string} params.externalId - The external id field name * @param {object} params.data - The data to upsert. * @param {function} callback - (Optional) callback function * @returns {Operation} */ export function upsertTask(projectGid: string, params: { externalId: string; data: object; }, callback: Function): Operation; /** * Search for tasks in a workspace by task name. * @public * @example Search for a task by name * searchTask("Test Search Task", { * sort_by: "modified_at" * }); * @example Search for a task by custom field only * searchTask("", { * "custom_fields.12345.value": $.data.custom_field_value, * }); * @example Search for a task by name and custom field * searchTask("Test Search Task", { * "custom_fields.12345.is_set": true, * }); * @example Search for a milestone by name * searchTask("Test Search Task", { * resource_subtype: "milestone", * }); * @function * @param {string} task - The text or name of the task to search for. * @param {object} [query] - Query params. See {@link https://developers.asana.com/reference/searchtasksforworkspace Docs} for a list of valid parameters. * @param {string} [query.resource_subtype = default_task] - The resource subtype to search for. Must be either `"default_task"` or `"milestone"`. Defaults to `"default_task"`. * @param {object} [options] - (Optional) options argument. * @param {string} [options.workspaceGid] - The workspace to search in. Defaults to the workspace specified in the configuration. * @returns {Operation} An operation that, when executed, returns the search results in state.data. */ export function searchTask(task: string, query?: { resource_subtype?: string; }, options?: { workspaceGid?: string; }): Operation; /** * Options provided to the createTaskStory request * @typedef {Object} StoryOptions * @public * @property {string} text - The plain text of the comment to add. Cannot be used with html_text. * @property {string} html_text - Opt In. HTML formatted text for a comment. This will not include the name of the creator. * @property {boolean} is_pinned - Default to `false`. Whether the story should be pinned on the resource. * @property {string} sticker_name - The name of the sticker in this story. `null` if there is no sticker. * @property {array} opt_fields - Opt In. This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. * @property {boolean} opt_pretty - Defaults to `false`. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. */ /** * Create a story to a specific task. * @public * @example Create a plain text comment * createTaskStory("1206933955023739", { * text: "This is a comment", * }); * @example Create a HTML formatted text comment * createTaskStory("1206933955023739", { * html_text: "This is a comment", * }); * @function * @param {string} taskGid - Globally unique identifier for the task * @param {StoryOptions} params - Story parameters * @param {function} callback - (Optional) callback function * @returns {Operation} */ export function createTaskStory(taskGid: string, params: StoryOptions, callback: Function): Operation; /** * Options provided to the Asana API request * @typedef {Object} RequestOptions * @public * @property {object} body - Body data to append to the request. * @property {object} query - An object of query parameters to be encoded into the URL. * @property {string} method - The HTTP method to use. Defaults to `GET` */ /** * Make a HTTP request against the Asana API. * @public * @example Get a task by id * request("/tasks/1234"); * @example Query for tasks in a given project * request("/tasks", { * query: { project: "abc" }, * }); * @example Create a new task * request("/tasks", { * method: "POST", * body: { data: { name: "do the thing", completed: false } }, * }); * @function * @param {string} path - Path to resource (excluding api/version) * @param {RequestOptions} params - (Optional) Query, body and method parameters * @param {function} callback - (Optional) Callback function * @returns {Operation} */ export function request(path: string, params: RequestOptions, callback: Function): Operation; /** * Options provided to the createTaskStory request */ export type StoryOptions = any; /** * Options provided to the Asana API request */ export type RequestOptions = any; export { alterState, as, combine, cursor, dataPath, dataValue, dateFns, each, field, fields, fn, fnIf, lastReferenceValue, log, merge, sourceValue } from "@openfn/language-common";