# ScriptRunner Connect Managed API for Tempo Cloud
Managed API for Tempo Cloud is an API Client for Tempo Cloud by [Adaptavist](https://www.adaptavist.com/). You can read more about Managed APIs [here](https://docs.adaptavist.com/src/managed-apis).

This is [ScriptRunner Connect](https://scriptrunnerconnect.com) runtime specific version of the Managed API (with `sr-connect` suffix). If you want to use Managed API in any other runtime, have a look at the [runtime agnostic version](https://www.npmjs.com/package/@managed-api/tempo-cloud-v4-core).

# Supported API calls
- [fetch](https://docs.adaptavist.com/src/managed-apis/managed-api-abstractions)
- Account
    - [createAccount](https://apidocs.tempo.io/#tag/Accounts/operation/createAccount)
    - [deleteAccount](https://apidocs.tempo.io/#tag/Accounts/operation/deleteAccount)
    - [getAccountById](https://apidocs.tempo.io/#tag/Accounts/operation/getAccountById)
    - [getAccounts](https://apidocs.tempo.io/#tag/Accounts/operation/getAccounts)
    - [getLinks](https://apidocs.tempo.io/#tag/Accounts/operation/getAccountLinks)
    - [searchAccounts](https://apidocs.tempo.io/#tag/Accounts/operation/searchAccounts)
    - [updateAccount](https://apidocs.tempo.io/#tag/Accounts/operation/updateAccount)
    - Category
        - [createCategory](https://apidocs.tempo.io/#tag/Account-Categories/operation/createCategory)
        - [deleteCategory](https://apidocs.tempo.io/#tag/Account-Categories/operation/deleteCategory)
        - [getAllCategoriesOrCategoryById](https://apidocs.tempo.io/#tag/Account-Categories/operation/getCategories)
        - [getCategoryByKey](https://apidocs.tempo.io/#tag/Account-Categories/operation/getCategoryByKey)
        - [updateCategory](https://apidocs.tempo.io/#tag/Account-Categories/operation/updateCategory)
        - Type
            - [getTypes](https://apidocs.tempo.io/#tag/Account-Category-Types/operation/getTypes)
    - Link
        - [createLink](https://apidocs.tempo.io/#tag/Account-Links/operation/createLink)
        - [deleteLink](https://apidocs.tempo.io/#tag/Account-Links/operation/deleteLink)
        - [getLinkById](https://apidocs.tempo.io/#tag/Account-Links/operation/getLink)
        - [getLinkByProject](https://apidocs.tempo.io/#tag/Account-Links/operation/getLinksByProject)
- Customer
    - [createCustomer](https://apidocs.tempo.io/#tag/Customers/operation/createCustomer)
    - [deleteCustomer](https://apidocs.tempo.io/#tag/Customers/operation/deleteCustomer)
    - [getAccountsByCustomer](https://apidocs.tempo.io/#tag/Customers/operation/getCustomerAccounts)
    - [getCustomer](https://apidocs.tempo.io/#tag/Customers/operation/getCustomerById)
    - [getCustomers](https://apidocs.tempo.io/#tag/Customers/operation/getCustomers)
    - [updateCustomer](https://apidocs.tempo.io/#tag/Customers/operation/updateCustomer)
- GenericResource
    - [getGenericResource](https://apidocs.tempo.io/#tag/Generic-Resources/operation/getGenericResource)
    - [searchGenericResources](https://apidocs.tempo.io/#tag/Generic-Resources/operation/searchGenericResources)
- Plan
    - [createPlan](https://apidocs.tempo.io/#tag/Plans/operation/createPlan)
    - [deletePlanById](https://apidocs.tempo.io/#tag/Plans/operation/deletePlanById)
    - [getPlanById](https://apidocs.tempo.io/#tag/Plans/operation/getPlanById)
    - [getPlans](https://apidocs.tempo.io/#tag/Plans/operation/getPlans)
    - [getPlansForGenericResource](https://apidocs.tempo.io/#tag/Plans/operation/getPlansForGenericResource)
    - [getPlansForUser](https://apidocs.tempo.io/#tag/Plans/operation/getPlansForUser)
    - [searchPlans](https://apidocs.tempo.io/#tag/Plans/operation/searchPlans)
    - [updatePlan](https://apidocs.tempo.io/#tag/Plans/operation/updatePlan)
- Work
    - Attribute
        - [createAttribute](https://apidocs.tempo.io/#tag/Work-Attributes/operation/createWorkAttributes)
        - [deleteAttribute](https://apidocs.tempo.io/#tag/Work-Attributes/operation/deleteWorkAttributeByKey)
        - [getAttribute](https://apidocs.tempo.io/#tag/Work-Attributes/operation/getWorkAttributeByKey)
        - [getAttributes](https://apidocs.tempo.io/#tag/Work-Attributes/operation/getWorkAttributes)
        - [updateAttribute](https://apidocs.tempo.io/#tag/Work-Attributes/operation/updateWorkAttributeByKey)
- Worklog
    - [createWorklog](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/createWorklog)
    - [deleteWorklog](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/deleteWorklog)
    - [getWorklog](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/getWorklogById)
    - [getWorklogs](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/getWorklogs)
    - [updateWorklog](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/updateWorklog)
    - Search
        - [getJiraWorklogIdsByTempoWorklogIds](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/getJiraWorklogIdsByTempoWorklogIds)
        - [getWorklogsByAccount](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/getWorklogsByAccount)
        - [getWorklogsByIssueId](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/getWorklogsByIssueId)
        - [getWorklogsByProjectId](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/getWorklogsByProjectId)
        - [getWorklogsByTeam](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/getWorklogsByTeam)
        - [getWorklogsByUser](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/getWorklogsByUser)
        - [searchWorklogs](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/searchWorklogs)
    - Work
        - [createAttributeValues](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/createWorkAttributeValuesForWorklogs)
        - [getAttributeValue](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/getWorkAttributeValueForWorklog)
        - [getAttributeValues](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/getWorkAttributeValuesForWorklog)
        - [searchAttributeValues](https://apidocs.tempo.io/#tag/Worklogs/operation/searchWorkAttributeValuesForWorklogs)


# Constructing Managed API
In ScriptRunner Connect a Managed API is constructed for you, but if you need to construct it manually, here's how you can do it:
```typescript
import { TempoCloudApi } from '@managed-api/tempo-cloud-v4-sr-connect';

export default async function() {
    const api = new TempoCloudApi('API_CONNECTION_ID');
}
```

# Contact
Feel free to drop ideas, suggestions or improvements into our [Community hub](https://loop.scriptrunnerhq.com/c/integration-forum).

 # Changelog
# 2.4.0

# Improved error extraction from responses.

# 2.3.0

# Updated the following methods:
 
* `Plan.getPlans`: Add `issueIds` and `projectIds` to request.
* `Plan.searchPlans`: Add `issueIds` and `projectIds` to request.
* `Plan.createPlan`: Add `effortPeristenceType` and `plannedSeconds` to request.
* `Plan.updatePlan`: Add `effortPeristenceType` and `plannedSeconds` to request.
* `Worklog.createWorklog`: Add `bypassPeriodClosuresAndApprovals` to request.
* `Worklog.deleteWorklog`: Add `bypassPeriodClosuresAndApprovals` to request.
* `Worklog.Search.searchWorklogs`: Add `orderBy` to request.
* `Work.Attribute.createAttribute`: Add `clientSecret` and `externalUrl` to request.
* `Work.Attribute.updateAttribute`: Add `clientSecret` and `externalUrl` to request.

# 2.1.0

- Removed non-empty body from HEAD requests.

# 2.0.0

- # Breaking change: URL and query string parameters are now URL encoded, meaning if you encoded them explicitly before you have to remove your own encoding, otherwise they will get double encoded.

# 0.16.0

# Changes 

* Updated OpenApi Specification

* Field `issueId` was removed from `Worklog.updateWorklog`.

* Changed the previous `Plan.getPlans` method to `Plan.searchPlans`.

# Added support for the following Plan method:

* [Retrieve Plans](https://apidocs.tempo.io/#tag/Plans/operation/getPlans) that can be used as `Plan.getPlans` or `All.getPlans`.

# Added support for the following Worklog.Work method:

* [Search Work Attribute values](https://apidocs.tempo.io/#tag/Worklogs/operation/searchWorkAttributeValuesForWorklogs) that can be used as `Worklog.Work.searchAttributeValues` or `All.searchWorkAttributeValuesForWorklogs`.

# 0.12.0

# Changed response type for the following Account methods:

* [Retrieve Accounts](https://apidocs.tempo.io/#tag/Accounts/operation/getAccounts) that can be used as `Account.getAccounts` or `All.getAccounts`.

# 0.11.0

# Added support for the following Account methods:

* [Retrieve Account links](https://apidocs.tempo.io/#tag/Accounts/operation/getAccountLinks) that can be used as `Account.getLinks` or `All.getLinks`.

# Added support for the following Account.Category methods:

* [Retrieve Category / Retrieve all Categories](https://apidocs.tempo.io/#tag/Account-Categories/operation/getCategories) that can be used as `Account.Category.getAllCategoriesOrCategoryById` or `All.getAllCategoriesOrCategoryById`.
* [Create Category](https://apidocs.tempo.io/#tag/Account-Categories/operation/createCategory) that can be used as `Account.Category.createCategory` or `All.createCategory`.
* [Delete Category](https://apidocs.tempo.io/#tag/Account-Categories/operation/deleteCategory) that can be used as `Account.Category.deleteCategory` or `All.deleteCategory`.
* [Retrieve Category](https://apidocs.tempo.io/#tag/Account-Categories/operation/getCategoryByKey) that can be used as `Account.Category.getCategoryByKey` or `All.getCategoryByKey`.
* [Update Category](https://apidocs.tempo.io/#tag/Account-Categories/operation/updateCategory) that can be used as `Account.Category.updateCategory` or `All.updateCategory`.

# Added support for the following Account.Category.Type methods:

* [Retrieve Category Types](https://apidocs.tempo.io/#tag/Account-Category-Types/operation/getTypes) that can be used as `Account.Category.Type.getTypes` or `All.getCategoryTypes`.

# Added support for the following Account.Link methods:

* [Create Account Link](https://apidocs.tempo.io/#tag/Account-Links/operation/createLink) that can be used as `Account.Link.createLink` or `All.createAccountLink`.
* [Retrieve Account Link by Project](https://apidocs.tempo.io/#tag/Account-Links/operation/getLinksByProject) that can be used as `Account.Link.getLinkByProject` or `All.getAccountLinkByProject`.
* [Delete Account Link](https://apidocs.tempo.io/#tag/Account-Links/operation/deleteLink) that can be used as `Account.Link.deleteLink` or `All.deleteAccountLink`.
* [Retrieve Account Link](https://apidocs.tempo.io/#tag/Account-Links/operation/getLink) that can be used as `Account.Link.getLinkById` or `All.getAccountLinkById`.

# Added support for the following Customer methods:

* [Retrieve all Customers](https://apidocs.tempo.io/#tag/Customers/operation/getCustomers) that can be used as `Customer.getCustomers` or `All.getCustomers`.
* [Create Customer](https://apidocs.tempo.io/#tag/Customers/operation/createCustomer) that can be used as `Customer.createCustomer` or `All.createCustomer`.
* [Retrieve Customer](https://apidocs.tempo.io/#tag/Customers/operation/getCustomerById) that can be used as `Customer.getCustomer` or `All.getCustomer`.
* [Retrieve Accounts associated with the Customer](https://apidocs.tempo.io/#tag/Customers/operation/getCustomerAccounts) that can be used as `Customer.getAccountsByCustomer` or `All.getAccountsByCustomer`.
* [Delete Customer](https://apidocs.tempo.io/#tag/Customers/operation/deleteCustomer) that can be used as `Customer.deleteCustomer` or `All.deleteCustomer`.
* [Update Customer](https://apidocs.tempo.io/#tag/Customers/operation/updateCustomer) that can be used as `Customer.updateCustomer` or `All.updateCustomer`.

# 0.10.0

# Changed response type for the following Work.Attribute methods:

* [Retrieve Attributes](https://apidocs.tempo.io/#tag/Work-Attributes/operation/getWorkAttributes) that can be used as `Work.Attribute.getAttributes` or `All.getWorkAttributes`.

# 0.9.0

# Added support for the following Account methods:

* [Create Account](https://apidocs.tempo.io/#tag/Accounts/operation/createAccount) that can be used as `Account.createAccount` or `All.createAccount`.
* [Delete Account](https://apidocs.tempo.io/#tag/Accounts/operation/deleteAccount) that can be used as `Account.deleteAccount` or `All.deleteAccount`.
* [Update Account](https://apidocs.tempo.io/#tag/Accounts/operation/updateAccount) that can be used as `Account.updateAccount` or `All.updateAccount`.

# Added support for the following Work.Attribute methods:

* [Retrieve Attributes](https://apidocs.tempo.io/#tag/Work-Attributes/operation/getWorkAttributes) that can be used as `Work.Attribute.getAttributes` or `All.getWorkAttributes`.
* [Create Attribute](https://apidocs.tempo.io/#tag/Work-Attributes/operation/createWorkAttributes) that can be used as `Work.Attribute.createAttribute` or `All.createWorkAttribute`.
* [Delete Attribute](https://apidocs.tempo.io/#tag/Work-Attributes/operation/deleteWorkAttributeByKey) that can be used as `Work.Attribute.deleteAttribute` or `All.deleteWorkAttribute`.
* [Retrieve Attribute](https://apidocs.tempo.io/#tag/Work-Attributes/operation/getWorkAttributeByKey) that can be used as `Work.Attribute.getAttribute` or `All.getWorkAttribute`.
* [Update Attribute](https://apidocs.tempo.io/#tag/Work-Attributes/operation/updateWorkAttributeByKey) that can be used as `Work.Attribute.updateAttribute` or `All.updateWorkAttribute`.

# 0.8.0

# Added support for the following Account methods:

* [Retrieve Accounts](https://apidocs.tempo.io/#tag/Accounts/operation/getAccounts) that can be used as `Account.getAccounts` or `All.getAccounts`.
* [Search Accounts](https://apidocs.tempo.io/#tag/Accounts/operation/searchAccounts) that can be used as `Account.searchAccounts` or `All.searchAccounts`.
* [Retrieve Account](https://apidocs.tempo.io/#tag/Accounts/operation/getAccountById) that can be used as `Account.getAccountById` or `All.getAccountById`.

# Added support for the following GenericResource methods:

* [Search Generic Resources](https://apidocs.tempo.io/#tag/Generic-Resources/operation/searchGenericResources) that can be used as `GenericResource.searchGenericResources` or `All.searchGenericResources`.
* [Retrieve Generic Resources](https://apidocs.tempo.io/#tag/Generic-Resources/operation/getGenericResource) that can be used as `GenericResource.getGenericResource` or `All.getGenericResource`.

# Added support for the following Plan methods:

* [Create Plan](https://apidocs.tempo.io/#tag/Plans/operation/createPlan) that can be used as `Plan.createPlan` or `All.createPlan`.
* [Retrieve Plans for Generic Resource](https://apidocs.tempo.io/#tag/Plans/operation/getPlansForGenericResource) that can be used as `Plan.getPlansForGenericResource` or `All.getPlansForGenericResource`.
* [Search Plans](https://apidocs.tempo.io/#tag/Plans/operation/getPlans) that can be used as `Plan.getPlans` or `All.getPlans`.
* [Retrieve Plans for User](https://apidocs.tempo.io/#tag/Plans/operation/getPlansForUser) that can be used as `Plan.getPlansForUser` or `All.getPlansForUser`.
* [Delete Plan](https://apidocs.tempo.io/#tag/Plans/operation/deletePlanById) that can be used as `Plan.deletePlanById` or `All.deletePlanById`.
* [Retrieve Plan](https://apidocs.tempo.io/#tag/Plans/operation/getPlanById) that can be used as `Plan.getPlanById` or `All.getPlanById`.
* [Update Plan](https://apidocs.tempo.io/#tag/Plans/operation/updatePlan) that can be used as `Plan.updatePlan` or `All.updatePlan`.

# 0.3.0

# Removed support for the following methods:

* `Worklog.Search.getWorklogsByFilterId` or `All.getWorklogsByFilterId`.
* `Worklog.getJiraWorklog` or `All.getJiraWorklog`.

# Added support for the following Worklog.Search method:

* [Retrieve Jira Worklog Ids by Tempo Worklog Ids](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/getJiraWorklogIdsByTempoWorklogIds) that can be used as `Worklog.Search.getJiraWorklogIdsByTempoWorklogIds` or `All.getJiraWorklogIdsByTempoWorklogIds`.

# Fixed following methods:

* [Search Worklogs associated to Issue Id](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/getWorklogsByIssueId) that can be used as `Worklog.Search.getWorklogsByIssueId` or `All.getWorklogsByIssueId`.
* [Retrieve Worklogs associated to project Id](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/getWorklogsByProjectId) that can be used as `Worklog.Search.getWorklogsByProjectId` or `All.getWorklogsByProjectId`.

# 0.1.0

# Added support for the following Worklog methods:

* [Retrieve Worklogs](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/getWorklogs) that can be used as `Worklog.getWorklogs` or `All.getWorklogs`.
* [Create Worklog](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/createWorklog) that can be used as `Worklog.createWorklog` or `All.createWorklog`.
* [Retrieve Worklog for Jira Worklog ID](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/getJiraWorklog) that can be used as `Worklog.getJiraWorklog` or `All.getJiraWorklog`.
* [Delete Worklog](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/deleteWorklog) that can be used as `Worklog.deleteWorklog` or `All.deleteWorklog`.
* [Retrieve Worklog](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/getWorklogById) that can be used as `Worklog.getWorklog` or `All.getWorklog`.
* [Update Worklog](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/updateWorklog) that can be used as `Worklog.updateWorklog` or `All.updateWorklog`.

# Added support for the following Worklog.Search methods:

* [Search Worklogs associated to Account](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/getWorklogsByAccount) that can be used as `Worklog.Search.getWorklogsByAccount` or `All.getWorklogsByAccount`.
* [Search Worklogs associated to Issue](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/getWorklogsByJiraIssueKey) that can be used as `Worklog.Search.getWorklogsByJiraIssueIdOrKey` or `All.getWorklogsByJiraIssueIdOrKey`.
* [Search Worklogs associated to Jira filter ID](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/getWorklogsByFilterId) that can be used as `Worklog.Search.getWorklogsByFilterId` or `All.getWorklogsByFilterId`.
* [Search Worklogs associated to Project](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/getWorklogsByProject) that can be used as `Worklog.Search.getWorklogsByProject` or `All.getWorklogsByProject`.
* [Search Worklogs](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/searchWorklogs) that can be used as `Worklog.Search.searchWorklogs` or `All.searchWorklogs`.
* [Search Worklogs associated to Team](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/getWorklogsByTeam) that can be used as `Worklog.Search.getWorklogsByTeam` or `All.getWorklogsByTeam`.
* [Search Worklogs associated to User](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/getWorklogsByUser) that can be used as `Worklog.Search.getWorklogsByUser` or `All.getWorklogsByUser`.

# Added support for the following Worklog.Work methods:

* [Bulk create Work Attribute values for Worklogs](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/createWorkAttributeValuesForWorklogs) that can be used as `Worklog.Work.createAttributeValues` or `All.createWorkAttributeValuesForWorklogs`.
* [Retrieve Work Attribute values for Worklog](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/getWorkAttributeValuesForWorklog) that can be used as `Worklog.Work.getAttributeValues` or `All.getWorkAttributeValuesForWorklog`.
* [Retrieve Work Attribute value for Worklog](https://apidocs.tempo.io/v4/#tag/Worklogs/operation/getWorkAttributeValueForWorklog) that can be used as `Worklog.Work.getAttributeValue` or `All.getWorkAttributeValueForWorklog`.

Copyright Adaptavist 2025 (c) All rights reserved