2.10.0 • Published 3 months ago

conjure-client v2.10.0

Weekly downloads
5,928
License
Apache-2.0
Repository
github
Last release
3 months ago

conjure-typescript-runtime

A light-weight Promise based HTTP client library for the browser.

Overview

conjure-typescript-runtime leverages fetch to provide a simple interface for making HTTP requests. conjure-typescript-runtime was designed to handle the RPC layer for clients generated by Conjure-TypeScript.

Browser compatibility: This library uses fetch so you should ensure that your runtime environment supports ES6 features.

Example

import { DefaultHttpApiBridge, MediaType } from "conjure-client";
import { SomeService } from "some-conjure-api";

const bridge = new DefaultHttpApiBridge({
    baseUrl: "https://some.base.url.com",
    userAgent: {
        productName: "yourProductName",
        productVersion: "1.0.0"
    }
})

const service = new SomeService(bridge);
service.getSomeResult()
    .then(function (response) {
        // handle success
        console.log(response);
    })
    .catch(function (error) {
        // handle error
        console.log(error);
    })
    .then(function () {
        // always executed
    });

Contributing

See the CONTRIBUTING.md document.

License

This project is made available under the Apache 2.0 License.