How to use openapi - 4 common examples

To help you get started, we’ve selected a few openapi 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 Tencent / TSW / bin / lib / util / mail / mail.js View on Github external
postData.appid = config.appid;
    postData.now = Date.now();

    const sig = openapi.signature({
        pathname    : url.parse(config.runtimeReportUrl).pathname,
        method        : 'POST',
        data        : postData,
        appkey        : config.appkey
    });

    postData.sig = sig;

    require('ajax').request({
        url            : config.runtimeReportUrl,
        type        : 'POST',
        l5api        : config.tswL5api['openapi.tswjs.org'],
        dcapi        : {
            key: 'EVENT_TSW_OPENAPI_RUNTIME_REPORT'
        },
        data        : postData,
        keepAlive    : true,
        autoToken    : false,
        dataType    : 'json'
    }).fail(function() {
        logger.error('runtime report fail.');
        defer.reject();
    }).done(function(d) {
        if(d.result) {
            if(d.result.code === 0) {
                logger.debug('runtime report success.');
                return defer.resolve();
            }else{
github Tencent / TSW / bin / tsw / util / CD.js View on Github external
return defer.reject();
    }

    var sig	= openapi.signature({
        pathname: url.parse(config.utilCDUrl).pathname,
        method: 'POST',
        data: postData,
        appkey: config.appkey
    });

    postData.sig	= sig;

    require('ajax').request({
        url			: config.utilCDUrl,
        type		: 'POST',
        l5api		: config.tswL5api['openapi.tswjs.org'],
        dcapi		: {
            key: 'EVENT_TSW_OPENAPI_UTIL_CD'
        },
        data		: postData,
        keepAlive	: true,
        autoToken	: false,
        dataType	: 'json'
    }).fail(function(){
        logger.error('checkByOpenapi fail.');
        defer.reject();
    }).done(function(d){
        var data = null;
        if(d.result && d.result.code === 0){
            data = d.result.data;
        }
github Tencent / TSW / bin / tsw / api / tnm2 / index.js View on Github external
process.nextTick(function() {
        require('ajax').request({
            url: config.appReportUrl,
            type: 'POST',
            l5api: config.tswL5api['openapi.tswjs.org'],
            dcapi: {
                key: 'EVENT_TSW_OPENAPI_APP_REPORT'
            },
            data: postData,
            keepAlive: true,
            autoToken: false,
            dataType: 'json'
        }).fail(function() {
            logger.error('app report fail.');
            defer.reject();
        }).done(function(d) {
            if (d.result) {
                if (d.result.code === 0) {
                    logger.debug('app report success.');
                    return defer.resolve();
                } else {
github Tencent / TSW / bin / tsw / util / auto-report / logReport.js View on Github external
postData.now = Date.now();


  const sig = openapi.signature({
    pathname: url.parse(config.logReportUrl).pathname,
    method: 'POST',
    data: postData,
    appkey: config.appkey
  });

  postData.sig = sig;

  require('ajax').request({
    url: config.logReportUrl,
    type: 'POST',
    l5api: config.tswL5api['openapi.tswjs.org'],
    dcapi: {
      key: 'EVENT_TSW_OPENAPI_LOG_REPORT'
    },
    data: postData,
    keepAlive: true,
    autoToken: false,
    dataType: 'json'
  }).done(function () {
    logger.debug('reportCloud success.');
  }).fail(function () {
    logger.error('reportCloud fail.');
  });

};

openapi

Generate JavaScript or TypeScript code from Swagger/OpenAPI specifications

MIT
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis

Popular openapi functions