git-off

git off handles large files in git repos
git clone https://noulin.net/git/git-off.git
Log | Files | Refs | README

api.js (2371B)


      1 var Collection = require('./collection');
      2 var Operation = require('./operation');
      3 var Shape = require('./shape');
      4 var Paginator = require('./paginator');
      5 var ResourceWaiter = require('./resource_waiter');
      6 
      7 var util = require('../util');
      8 var property = util.property;
      9 var memoizedProperty = util.memoizedProperty;
     10 
     11 function Api(api, options) {
     12   api = api || {};
     13   options = options || {};
     14   options.api = this;
     15 
     16   api.metadata = api.metadata || {};
     17 
     18   property(this, 'isApi', true, false);
     19   property(this, 'apiVersion', api.metadata.apiVersion);
     20   property(this, 'endpointPrefix', api.metadata.endpointPrefix);
     21   property(this, 'signingName', api.metadata.signingName);
     22   property(this, 'globalEndpoint', api.metadata.globalEndpoint);
     23   property(this, 'signatureVersion', api.metadata.signatureVersion);
     24   property(this, 'jsonVersion', api.metadata.jsonVersion);
     25   property(this, 'targetPrefix', api.metadata.targetPrefix);
     26   property(this, 'protocol', api.metadata.protocol);
     27   property(this, 'timestampFormat', api.metadata.timestampFormat);
     28   property(this, 'xmlNamespaceUri', api.metadata.xmlNamespace);
     29   property(this, 'abbreviation', api.metadata.serviceAbbreviation);
     30   property(this, 'fullName', api.metadata.serviceFullName);
     31 
     32   memoizedProperty(this, 'className', function() {
     33     var name = api.metadata.serviceAbbreviation || api.metadata.serviceFullName;
     34     if (!name) return null;
     35 
     36     name = name.replace(/^Amazon|AWS\s*|\(.*|\s+|\W+/g, '');
     37     if (name === 'ElasticLoadBalancing') name = 'ELB';
     38     return name;
     39   });
     40 
     41   property(this, 'operations', new Collection(api.operations, options, function(name, operation) {
     42     return new Operation(name, operation, options);
     43   }, util.string.lowerFirst));
     44 
     45   property(this, 'shapes', new Collection(api.shapes, options, function(name, shape) {
     46     return Shape.create(shape, options);
     47   }));
     48 
     49   property(this, 'paginators', new Collection(api.paginators, options, function(name, paginator) {
     50     return new Paginator(name, paginator, options);
     51   }));
     52 
     53   property(this, 'waiters', new Collection(api.waiters, options, function(name, waiter) {
     54     return new ResourceWaiter(name, waiter, options);
     55   }, util.string.lowerFirst));
     56 
     57   if (options.documentation) {
     58     property(this, 'documentation', api.documentation);
     59     property(this, 'documentationUrl', api.documentationUrl);
     60   }
     61 }
     62 
     63 module.exports = Api;