This package contains types generated by openapi-typescript
. The types are generated by fetching API definitions from backstage for APIs following the OpenAPI specification
.
Use your favourite package manager e.g.
yarn add -D @meltwater/api-types
Usage with openapi-fetch
This is where these types shine as they allow you to get fully typed requests and responses with full intellisense support.
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
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
oraxios
.
- masfsearch-v3
- search-api-v2
- alerting-api-v2
- export-api-v2
- document-modification-service
- consumer-ready-document-api
This package uses node lts
and yarn 4
.
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.
nvm use
yarn install
Run the following command to generate types. You'll have to be using the AWS VPN to be able to query the backstage API.
yarn generate
See CONTRIBUTING.md
The package is following the semantic-release
workflow and will automatically get released when running in CI.