# @atlassianlabs/jql-editor-autocomplete-rest

> Autocomplete REST API integration for the JQL Editor.

Latest version **1.1.2** (published 2023-07-12) · 0 weekly downloads

## Install

```sh
npm install @atlassianlabs/jql-editor-autocomplete-rest
pnpm add @atlassianlabs/jql-editor-autocomplete-rest
yarn add @atlassianlabs/jql-editor-autocomplete-rest
bun add @atlassianlabs/jql-editor-autocomplete-rest
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2023-07-12 |
| First published | 2021-12-10 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 458.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Atlassian Pty Ltd |
| Maintainers | doklovic, prkb, crumley, nrundquist, dkolbly-atlassian, kpainter-atl, soneymathew |

## Links

- npm: https://www.npmjs.com/package/@atlassianlabs/jql-editor-autocomplete-rest
- Repository: https://bitbucket.org/atlassian/atlassian-frontend
- Homepage: https://bitbucket.org/atlassian/atlassian-frontend#readme
- Issues: https://bitbucket.org/atlassian/atlassian-frontend/issues
- npm.io page: https://npm.io/package/@atlassianlabs/jql-editor-autocomplete-rest

## Dependencies (6)

- [rxjs](https://npm.io/package/rxjs.md) ^5.5.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.0.0
- [react-magnetic-di](https://npm.io/package/react-magnetic-di.md) ^2.2.6
- [react-sweet-state](https://npm.io/package/react-sweet-state.md) ^2.6.5
- [@atlassianlabs/jql-editor-common](https://npm.io/package/@atlassianlabs/jql-editor-common.md) ^1.0.0

## Recent versions

- 1.1.2 (latest) — 2023-07-12
- 1.1.1 — 2023-07-12
- 1.1.0 — 2023-06-02
- 1.0.1 — 2022-09-26
- 1.0.0 — 2022-02-21
- 0.0.2 — 2021-12-17
- 0.0.1 — 2021-12-10

## README

# JQL Editor Autocomplete REST

[![Atlassian license](https://img.shields.io/badge/license-Apache%202.0-blue.svg?style=flat-square)](LICENSE)

This package wraps the callbacks needed to fetch autocomplete data for the JQL editor, and provides simple hooks to
delegate to [Jira Cloud REST API's](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-jql/).

We require these configurable hooks to allow consumers to define their own fetch library given their app environment,
e.g. Jira, Connect, Forge etc.

## Usage

A minimal configuration of the autocomplete provider is as follows:

```typescript jsx
import { useAutocompleteProvider } from '@atlassianlabs/jql-editor-autocomplete-rest';

const getInitialData = async (url: string) => {
  const response = await fetch(url, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ includeCollapsedFields: true })
  });
  const data = response.json();
  
  return {
    jqlFields: data.visibleFieldNames,
    jqlFunctions: data.visibleFunctionNames,
  };
};

const getSuggestions = async (url: string) => {
  const response = await fetch(url);
  return response.json();
};

const useMyAutocompleteProvider = () => {
  return useAutocompleteProvider('my-app', getInitialData, getSuggestions);
};
```

## Installation

```sh
yarn add @atlassianlabs/jql-editor-autocomplete-rest
```

## Support

For developers outside of Atlassian looking for help, or to report issues, [please make a post on the community forum](https://community.developer.atlassian.com/c/atlassian-ecosystem-design).
We will monitor the forums and redirect topics to the appropriate maintainers.

## License
Copyright (c) 2021 - 2022 Atlassian and others. Apache 2.0 licensed, see [LICENSE](LICENSE) file.

---
_Source: https://npm.io/package/@atlassianlabs/jql-editor-autocomplete-rest · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
