How to use the swagger-client.http function in swagger-client

To help you get started, we’ve selected a few swagger-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wso2 / carbon-apimgt / features / apimgt / org.wso2.carbon.apimgt.publisher.feature / src / main / resources / publisher / source / src / app / data / APIClient.js View on Github external
this._client = promisedResolve.then((resolved) => {
            const argsv = Object.assign(args, {
                spec: this._fixSpec(resolved.spec),
                requestInterceptor: this._getRequestInterceptor(),
                responseInterceptor: this._getResponseInterceptor(),
            });
            SwaggerClient.http.withCredentials = true;
            return new SwaggerClient(argsv);
        });
        this._client.catch(AuthManager.unauthorizedErrorHandler);
github wso2 / carbon-apimgt / features / apimgt / org.wso2.carbon.apimgt.admin.feature / src / main / resources / admin / source / src / app / data / APIClient.js View on Github external
static getScopeForResource(resourcePath, resourceMethod) {
        if (!APIClient.spec) {
            SwaggerClient.http.withCredentials = true;
            APIClient.spec = SwaggerClient.resolve({url: Utils.getSwaggerURL()});
        }
        return APIClient.spec.then(
            resolved => {
                return resolved.spec.paths[resourcePath] && resolved.spec.paths[resourcePath][resourceMethod] && resolved.spec.paths[resourcePath][resourceMethod].security[0].OAuth2Security[0];
            }
        )
    }
github wso2 / carbon-apimgt / features / apimgt / org.wso2.carbon.apimgt.admin.feature / src / main / resources / admin / source / src / app / data / APIClient.js View on Github external
resolved => {
                const argsv = Object.assign(args,
                    {
                        spec: this._fixSpec(resolved.spec),
                        authorizations: authorizations,
                        requestInterceptor: this._getRequestInterceptor(),
                        responseInterceptor: this._getResponseInterceptor()
                    });
                SwaggerClient.http.withCredentials = true;
                return new SwaggerClient(argsv);
            }
        );
github wso2 / carbon-apimgt / features / apimgt / org.wso2.carbon.apimgt.store.feature / src / main / resources / store-new / source / src / app / data / APIClient.jsx View on Github external
resolved => {
                const argsv = Object.assign(args,
                    {
                        spec: this._fixSpec(resolved.spec),
                        authorizations: authorizations,
                        requestInterceptor: this._getRequestInterceptor(),
                        responseInterceptor: this._getResponseInterceptor()
                    });
                SwaggerClient.http.withCredentials = true;
                return new SwaggerClient(argsv);
            }
        );
github wso2 / carbon-apimgt / features / apimgt / org.wso2.carbon.apimgt.publisher.feature / src / main / resources / publisher-new / source / src / app / data / APIClient.js View on Github external
this._client = promisedResolve.then((resolved) => {
            const argsv = Object.assign(args, {
                spec: this._fixSpec(resolved.spec),
                requestInterceptor: this._getRequestInterceptor(),
                responseInterceptor: this._getResponseInterceptor(),
            });
            SwaggerClient.http.withCredentials = true;
            return new SwaggerClient(argsv);
        });
        this._client.catch(AuthManager.unauthorizedErrorHandler);
github wso2 / carbon-apimgt / features / apimgt / org.wso2.carbon.apimgt.store.feature / src / main / resources / devportal / source / src / app / data / APIClient.jsx View on Github external
this._client = promisedResolve.then((resolved) => {
            const argsv = Object.assign(
                args,
                {
                    spec: this._fixSpec(resolved.spec),
                    authorizations,
                    requestInterceptor: this._getRequestInterceptor(),
                    responseInterceptor: this._getResponseInterceptor(),
                },
            );
            SwaggerClient.http.withCredentials = true;
            return new SwaggerClient(argsv);
        } );
        this._client.catch(AuthManager.unauthorizedErrorHandler);
github wso2 / carbon-apimgt / features / apimgt / org.wso2.carbon.apimgt.publisher.feature / src / main / resources / publisher-new / source / src / app / data / APIClient.js View on Github external
static getScopeForResource(resourcePath, resourceMethod) {
        if (!APIClient.spec) {
            SwaggerClient.http.withCredentials = true;
            APIClient.spec = SwaggerClient.resolve({ url: Utils.getSwaggerURL() });
        }
        return APIClient.spec.then((resolved) => {
            return (
                resolved.spec.paths[resourcePath] &&
                resolved.spec.paths[resourcePath][resourceMethod] &&
                resolved.spec.paths[resourcePath][resourceMethod].security[0].OAuth2Security[0]
            );
        });
    }
github wso2 / carbon-apimgt / features / apimgt / org.wso2.carbon.apimgt.store.feature / src / main / resources / store-new / source / src / app / data / APIClient.jsx View on Github external
constructor(host, args = {}) {
        this.host = host || location.host;

        const authorizations = {
            OAuth2Security: {
                token: {access_token: AuthManager.getUser() ? AuthManager.getUser().getPartialToken() : ""}
            }
        };

        SwaggerClient.http.withCredentials = true;
        let promisedResolve = SwaggerClient.resolve({url: Utils.getSwaggerURL(), requestInterceptor: (request) => { request.headers.Accept = "text/yaml";}});
        APIClient.spec = promisedResolve;
        this._client = promisedResolve.then(
            resolved => {
                const argsv = Object.assign(args,
                    {
                        spec: this._fixSpec(resolved.spec),
                        authorizations: authorizations,
                        requestInterceptor: this._getRequestInterceptor(),
                        responseInterceptor: this._getResponseInterceptor()
                    });
                SwaggerClient.http.withCredentials = true;
                return new SwaggerClient(argsv);
            }
        );
        this._client.catch(AuthManager.unauthorizedErrorHandler);
github wso2 / carbon-apimgt / features / apimgt / org.wso2.carbon.apimgt.store.feature / src / main / resources / devportal / source / src / app / data / APIClient.jsx View on Github external
static getScopeForResource(resourcePath, resourceMethod) {
        if (!APIClient.spec) {
            SwaggerClient.http.withCredentials = true;
            APIClient.spec = SwaggerClient.resolve({ url: Utils.getSwaggerURL() });
        }
        return APIClient.spec.then((resolved) => {
            return resolved.spec.paths[resourcePath] && resolved.spec.paths[resourcePath][resourceMethod] && resolved.spec.paths[resourcePath][resourceMethod].security[0].OAuth2Security[0];
        } );
    }
github wso2 / carbon-apimgt / features / apimgt / org.wso2.carbon.apimgt.publisher.feature / src / main / resources / publisher / source / src / app / data / APIClient.js View on Github external
constructor(environment, args = {}) {
        this.environment = environment || Utils.getCurrentEnvironment();
        SwaggerClient.http.withCredentials = true;
        const promisedResolve = SwaggerClient.resolve({
            url: Utils.getSwaggerURL(),
            requestInterceptor: (request) => {
                request.headers.Accept = 'text/yaml';
            },
        });
        APIClient.spec = promisedResolve;
        this._client = promisedResolve.then((resolved) => {
            const argsv = Object.assign(args, {
                spec: this._fixSpec(resolved.spec),
                requestInterceptor: this._getRequestInterceptor(),
                responseInterceptor: this._getResponseInterceptor(),
            });
            SwaggerClient.http.withCredentials = true;
            return new SwaggerClient(argsv);
        });