open-index/open-npm huggingface dataset:
npm package: @meltwater/api-types
Description: A collection of interfaces generated from APIs adhering to the OpenAPI spec
Author: Per Karlsson
Latest version: 1.0.6
Deprecated: This project has been renamed. Install @meltwater/types instead

[![](https://github.com/meltwater/api-types/actions/workflows/ci.yaml/badge.svg)](https://github.com/meltwater/api-types/actions/workflows/ci.yaml)

# @meltwater/api-types

This package contains types generated by [`openapi-typescript`](https://github.com/drwpow/openapi-typescript). The types are generated by fetching API definitions from backstage for APIs following the [`OpenAPI specification`](https://spec.openapis.org/oas/latest.html).

### Installation

Use your favourite package manager e.g.

```
yarn add -D @meltwater/api-types
```

## Examples

### Usage with [`openapi-fetch`](https://github.com/drwpow/openapi-typescript/tree/main/packages/openapi-fetch)

This is where these types shine as they allow you to get fully typed requests and responses with full intellisense support.

```typescript
import createClient from "openapi-fetch";
import type { MasfsearchV3 } from "@meltwater/api-types";

const { GET } = createClient<MasfsearchV3.paths>({
  baseUrl: "https://masfsearch-staging.meltwater.io/masfsearch",
});

const { data, error } = await GET("/v3/companies/{companyId}/searches/metadata", {
  params: {
    path: {
      companyId: "example",
    },
    header: {
      "X-Client-Name": "example",
    },
  },
});
```

### Usage with [`axios`](https://github.com/axios/axios)

```typescript
import axios from "axios";
import type { MasfsearchV3 } from "../src/index.js";

const companyId = "example";

const { data } = await axios.get<MasfsearchV3.components["schemas"]["SavedSearchMetadataResponse"]>(
  `/masfsearch/v3/companies/${companyId}/searches/metadata`,
);
```

> _You're **NOT** limited to using `openapi-fetch` or `axios`._

## Available APIs

- masfsearch-v3
- search-api-v2
- alerting-api-v2
- export-api-v2
- document-modification-service
- consumer-ready-document-api

## Running locally

This package uses node `lts` and `yarn 4`.

### Installation

Later versions of yarn will not reuse the values of `npm login` so you'll have to run `yarn npm login` to gain access to private `@meltwater/*` packages.

```bash
nvm use

yarn install
```

### Generating types

Run the following command to generate types. You'll have to be using the AWS VPN to be able to query the backstage API.

```bash
yarn generate
```

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md)

## Releasing

The package is following the `semantic-release` workflow and will automatically get released when running in CI.