----------------------------------------------------------------------------
 client endpoints
762010
def client_to_scim(info)
    ['authorities', 'scope', 'autoapprove'].each { |a| info[a] = names_to_ids(info[a], :group) if info.key?(a) }
    info
  end
123789
public function forClients()
    {
        $this->router->group(['middleware' => ['web', 'auth']], function ($router) {
            $router->get('/clients', [
                'uses' => 'ClientController@forUser',
                'as' => 'passport.clients.index',
            ]);

            $router->post('/clients', [
                'uses' => 'ClientController@store',
                'as' => 'passport.clients.store',
            ]);

            $router->put('/clients/{client_id}', [
                'uses' => 'ClientController@update',
                'as' => 'passport.clients.update',
            ]);

            $router->delete('/clients/{client_id}', [
                'uses' => 'ClientController@destroy',
                'as' => 'passport.clients.destroy',
            ]);
        });
    }
749443
public function request(Client $client, $endpoint, $options, $method = 'GET')
    {
        try {
            return $client->request($method, $endpoint, [
                'form_params' => $options,
            ]);
        } catch (ClientException $exception) {
            static::throwException(static::extractOriginalExceptionMessage($exception), $exception);
        }
    }
922681
function Client(key, password, endpoint) {
  if (!(this instanceof Client)) {
    return new Client(key, password, endpoint);
  }

  endpoint = typeof endpoint !== 'undefined' ? endpoint : Client.MODE_SANDBOX;

  var _key = key,
    _password = password,
    _endpoint = endpoint,
    _errors = [],
    _isValid = false;

  var emptyErrors = function () {
    _errors = [];
  };

  var addError = function (errorCode) {
    if (_errors.indexOf(errorCode) < 0) {
      _errors.push(errorCode);
    }
    _isValid = false;
  };

  var validate = function () {
    _isValid = true;
    if (!_key || !_password) {
      addError(ClientError.INVALID_CREDENTIAL);
    } else if (!_endpoint) {
      addError(ClientError.INVALID_ENDPOINT);
    }
    if (_errors.length > 0) {
      _isValid = false;
    }
  };

  Object.defineProperties(this, {

    /**
     * @member {String} module:Rapid/Client~Client#key
     */
    key: {
      get: function () {
        return _key;
      },
      set: function (key) {
        emptyErrors();
        _key        = key;
        Service.key = _key;
        validate();
      }
    },

    /**
     * @member {String} module:Rapid/Client~Client#password
     */
    password: {
      get: function () {
        return _password;
      },
      set: function (password) {
        emptyErrors();
        _password        = password;
        Service.password = _password;
        validate();
      }
    },

    /**
     * @member {String} module:Rapid/Client~Client#endpoint
     */
    endpoint: {
      get: function () {
        return _endpoint;
      },
      set: function (endpoint) {
        emptyErrors();
        if (endpoint) {
          switch (endpoint.toLowerCase()) {
            case Client.MODE_SANDBOX:
              _endpoint = Client.ENDPOINT_SANDBOX;
              break;
            case Client.MODE_PRODUCTION:
              _endpoint = Client.ENDPOINT_PRODUCTION;
              break;
            default:
              _endpoint = endpoint;
          }
        } else {
          _endpoint = endpoint;
        }
        Service.baseUrl = _endpoint;
        validate();
      }
    },

    /**
     * @member {Boolean} module:Rapid/Client~Client#isValid
     */
    isValid: {
      get: function () {
        return _isValid;
      }
    },

    /**
     * @member {Array} module:Rapid/Client~Client#errors
     */
    errors: {
      get: function () {
        return _errors;
      }
    }
  });

  this.setCredential(key, password);
  this.endpoint = endpoint;
}
482796
public final void server() {
    String port = parsedArguments.getString("port");
    String model = parsedArguments.getString(MODEL);
    String lexer = parsedArguments.getString("lexer");
    String dictTag = parsedArguments.getString("dictTag");
    String dictPath = parsedArguments.getString("dictPath");
    String clearFeatures = parsedArguments.getString("clearFeatures");
    String outputFormat = parsedArguments.getString("outputFormat");
    String lang = parsedArguments.getString("language");
    Properties serverproperties = setNameServerProperties(port, model, lang,
        lexer, dictTag, dictPath, clearFeatures, outputFormat);
    new NERTaggerServer(serverproperties);
  }
514559
function Endpoint(log, role, settings, filters) {
  Duplex.call(this);

  // * Initializing logging infrastructure
  this._log = log.child({ component: 'endpoint', e: this });

  // * First part of the handshake process: sending and receiving the client connection header
  //   prelude.
  assert((role === 'CLIENT') || role === 'SERVER');
  if (role === 'CLIENT') {
    this._writePrelude();
  } else {
    this._readPrelude();
  }

  // * Initialization of component. This includes the second part of the handshake process:
  //   sending the first SETTINGS frame. This is done by the connection class right after
  //   initialization.
  this._initializeDataFlow(role, settings, filters || {});

  // * Initialization of management code.
  this._initializeManagement();

  // * Initializing error handling.
  this._initializeErrorHandling();
}
1034732
function RestClient(url, options) { // XXX what are the options?
  // call super
  Endpoint.call(this)

  /*****************************************************************************
   * @property {string} url -- xxx
   */
  this.url = url
  // setting this.client = this !!! this is so that child endpoint get
  // this.client set properly when calling end
  /*****************************************************************************
   * @property {xxx} client -- xxx
   */
  this.client = this
  /*****************************************************************************
   * @property {object} defaultOptions -- xxx
   */
  this.defaultOptions = options || {}

  // setup authenticator
  if ("authentication" in this.defaultOptions) {
    this._setupAuthentication(this.defaultOptions["authentication"])
  }

  // allow accessing "request" module from this client
  this.request = require("request")
}
1308635
@Override
   public void onEndpointInstantiated(final Endpoint endpoint, final Invocation invocation)
   {
      final Object _targetBean = this.getTargetBean(invocation);
      // TODO: refactor injection to AS IL
      final Reference reference = endpoint.getInstanceProvider().getInstance(_targetBean.getClass().getName());
      final Object targetBean = reference.getValue();

      InjectionHelper.injectWebServiceContext(targetBean, ThreadLocalAwareWebServiceContext.getInstance());

      if (!reference.isInitialized())
      {
         InjectionHelper.callPostConstructMethod(targetBean);
         reference.setInitialized();
      }

      endpoint.addAttachment(PreDestroyHolder.class, new PreDestroyHolder(targetBean));
   }
820060
function (method, endpoint, routerMiddelware) {
		var self = this;

		if (typeof routerMiddelware == 'object'){
			this.app[method](endpoint, function (req, res, next) {
				var middlewareFunction = []
				routerMiddelware.forEach(function (m) {
					middlewareFunction.push(function (cb) {
						self.__exec__middlewares(m, req, res, cb);
					});
				});

				async.waterfall(middlewareFunction);
			});
		} else {
			this.app[method](endpoint, function (req, res, next) {
				self.__exec__middleware(routerMiddelware)(req, res, next);
			});
		}
	}
293899
function (events) {
			// Check and enrich the event source if necessary
			_.each(events, function (event) {
				if (event.sourceId === undefined) {
					event.setSourceId(this.sourceId);
				}
			}, this);

			var options = {
				data: events,
				headers: { "Content-Type": "application/json" }
			};

			this.restClient.post(this.endpointUrl + "/events", options, function (data, response) {
				print(data);
			});
		}
301600
def call_on_each_endpoint(self, callback):
        

        if 'paths' not in self.swagger_dict:
            return

        for path, d in list(self.swagger_dict['paths'].items()):
            for method, op_spec in list(d.items()):
                data = EndpointData(path, method)

                # Which server method handles this endpoint?
                if 'x-bind-server' not in op_spec:
                    if 'x-no-bind-server' in op_spec:
                        # That route should not be auto-generated
                        log.info("Skipping generation of %s %s" % (method, path))
                        continue
                    else:
                        raise Exception("Swagger api defines no x-bind-server for %s %s" % (method, path))
                data.handler_server = op_spec['x-bind-server']

                # Make sure that endpoint only produces 'application/json'
                if 'produces' not in op_spec:
                    raise Exception("Swagger api has no 'produces' section for %s %s" % (method, path))
                if len(op_spec['produces']) != 1:
                    raise Exception("Expecting only one type under 'produces' for %s %s" % (method, path))
                if op_spec['produces'][0] == 'application/json':
                    data.produces_json = True
                elif op_spec['produces'][0] == 'text/html':
                    data.produces_html = True
                else:
                    raise Exception("Only 'application/json' or 'text/html' are supported. See %s %s" % (method, path))

                # Which client method handles this endpoint?
                if 'x-bind-client' in op_spec:
                    data.handler_client = op_spec['x-bind-client']

                # Should we decorate the server handler?
                if 'x-decorate-server' in op_spec:
                    data.decorate_server = op_spec['x-decorate-server']

                # Should we manipulate the requests parameters?
                if 'x-decorate-request' in op_spec:
                    data.decorate_request = op_spec['x-decorate-request']

                # Generate a bravado-core operation object
                data.operation = Operation.from_spec(self.spec, path, method, op_spec)

                # Figure out how parameters are passed: one json in body? one or
                # more values in query?
                if 'parameters' in op_spec:
                    params = op_spec['parameters']
                    for p in params:
                        if p['in'] == 'body':
                            data.param_in_body = True
                        if p['in'] == 'query':
                            data.param_in_query = True
                        if p['in'] == 'path':
                            data.param_in_path = True

                    if data.param_in_path:
                        # Substitute {...} with <...> in path, to make a Flask friendly path
                        data.path = data.path.replace('{', '<').replace('}', '>')

                    if data.param_in_body and data.param_in_query:
                        raise Exception("Cannot support params in both body and param (%s %s)" % (method, path))

                else:
                    data.no_params = True

                callback(data)
980544
function renderClientside(_ctx, opt) {
  var out = '<script>if (window.$ && !$.templates) $.templates = {}</script>';
  if (_ctx.clientTemplates) {
    var templates = {};
    ///jscript/templatename.html => $.templates['templatename'] = function() {}
    _.each(_ctx.clientTemplates, function(value) {
      if (!templates[value.template]) {
        var scriptpath = value.template;
        var ext = path.extname(scriptpath);
        if (ext.length)
          scriptpath = scriptpath.slice(0, -1*ext.length);
        out += "<script async defer src='/jswig/" + normalizePath(scriptpath) +".js'></script>\n";
        templates[value.template] = true;
      }
    });
    out += '<script src="' + path.join( (opt && opt.jsbase) || "/js/", "swig.min.js") + '"></script>\n';

    var clientData = {};
    var modelJson = JSON.stringify(_ctx.clientTemplates,
      function(k,v) {return serializeRefs(k,v,clientData)}).replace(/"@@@(.+?)@@@"/g, "\$.dbCache['$1']");
    out += "\n<script>$.dbCache=" + JSON.stringify(clientData) + ';\n';
    out += "$(document).ready(function() {$.each(" + modelJson
    +", function(domid, model) {\n"
    +"     $('#'+domid).data('_template', model.template);\n"
    +"     $('#'+domid).data('_model', model.model);});\n"
    +"});</script>\n";
    //XXX should be a generic way to introspect _ctx for variables intended for client and to render them
    if (_ctx.routes && _ctx.routes.getUrlMapSource) { //XXX dbRender() needs to add routes to template locals
      out += "\n<script>$.routes=" + _ctx.routes.getUrlMapSource() + '</script>\n';
    }
 }
  return out;
}
1277731
def _attach_endpoints(self):
        """"""
        for name, endpoint in inspect.getmembers(self):
            if inspect.isclass(endpoint) and issubclass(endpoint, self._Endpoint) and (endpoint is not self._Endpoint):
                endpoint_instance = endpoint(self.base_requester)
                setattr(self, endpoint_instance.endpoint, endpoint_instance)
1013695
def get_endpoints(query = nil)
      @client.make_request(:get, @client.concat_user_path("#{DOMAIN_PATH}/#{id}/endpoints"), query)[0].map do |i|
        endpoint = EndPoint.new(i, @client)
        endpoint.domain_id = id
        endpoint
      end
    end
59537
def __add_endpoints(self):
        
        for mapping in endpoint_mappings:
            if all(map(self.config.get, mapping.keys)):
                self.__add_single_endpoint(
                    mapping.cls, mapping.endpoint, mapping.is_protected
                )

        self.bp.exception(exceptions.SanicJWTException)(
            self.responses.exception_response
        )

        if not self.instance_is_blueprint:
            url_prefix = self._get_url_prefix()
            self.instance.blueprint(self.bp, url_prefix=url_prefix)
499292
protected void configureMessageEndpoint(ApplicationContext context) {
        if (context.containsBean(MESSAGE_ENDPOINT_BEAN_NAME)) {
            WebServiceEndpoint messageEndpoint = context.getBean(MESSAGE_ENDPOINT_BEAN_NAME, WebServiceEndpoint.class);

            EndpointAdapter endpointAdapter = webServiceServer.getEndpointAdapter();
            if (endpointAdapter != null) {
                messageEndpoint.setEndpointAdapter(endpointAdapter);
            }

            WebServiceEndpointConfiguration endpointConfiguration = new WebServiceEndpointConfiguration();
            endpointConfiguration.setHandleMimeHeaders(webServiceServer.isHandleMimeHeaders());
            endpointConfiguration.setHandleAttributeHeaders(webServiceServer.isHandleAttributeHeaders());
            endpointConfiguration.setKeepSoapEnvelope(webServiceServer.isKeepSoapEnvelope());
            endpointConfiguration.setMessageConverter(webServiceServer.getMessageConverter());
            messageEndpoint.setEndpointConfiguration(endpointConfiguration);

            if (StringUtils.hasText(webServiceServer.getSoapHeaderNamespace())) {
                messageEndpoint.setDefaultNamespaceUri(webServiceServer.getSoapHeaderNamespace());
            }

            if (StringUtils.hasText(webServiceServer.getSoapHeaderPrefix())) {
                messageEndpoint.setDefaultPrefix(webServiceServer.getSoapHeaderPrefix());
            }
        }
    }
1198423
function createEndPoint (local) {
  var endPoint = new EndPoint(local), local = endPoint.local;
  if (!endPoints[local.port]) endPoints[local.port] = {};
  return endPoints[local.port][local.address] = endPoint;
}