This package has been deprecated

Author message:

This project has been renamed. Install @meltwater/types instead

@meltwater/api-types
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

@meltwater/api-types

This package contains types generated by openapi-typescript. The types are generated by fetching API definitions from backstage for APIs following the OpenAPI specification.

Installation

Use your favourite package manager e.g.

yarn add -D @meltwater/api-types

Examples

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 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.

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.

yarn generate

Contributing

See CONTRIBUTING.md

Releasing

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

/@meltwater/api-types/

    Package Sidebar

    Install

    npm i @meltwater/api-types

    Weekly Downloads

    11

    Version

    1.0.6

    License

    none

    Unpacked Size

    184 kB

    Total Files

    16

    Last publish

    Collaborators

    • meltwater-in-space