Get contract messages from App Store Connect's "olympus" endpoint
331901
def fetch_program_license_agreement_messages
      all_messages = []

      messages_request = request(:get, "https://appstoreconnect.apple.com/olympus/v1/contractMessages")
      body = messages_request.body
      if body
        body = JSON.parse(body) if body.kind_of?(String)
        body.map do |messages|
          all_messages.push(messages["message"])
        end
      end

      return all_messages
    end
200847
def list_endpoints(app_id, custom_headers:nil)
      response = list_endpoints_async(app_id, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end
870773
async def get_name_endpoint(request: web.Request) -> web.Response:
    
    return web.json_response(
        data={'name': request.app[DEVICE_NAME_VARNAME]},
        status=200)
249391
function Endpoint() {
  var self = this;
  const subscriptions = {};
  const ps = new Pubsub();
  this._publish = ps.publish;
  this._subscribe = ps.subscribe;
  this.active = false;
  this.connections = [];

  /**
   * Publishes a new connection.
   * @function _newConnection
   * @private
   * @param {string} sID socket ID
   * @returns this
   */
  this._newConnection = sId => {
    self.connections.push(sId || 'unknown');
    self.active = true;
    self._publish('change', {count: self.connections.length});
    return this;
  };

  /**
   * Records a lost connection.
   * @function _lostConnection
   * @private
   * @param {string} sID socket ID
   * @returns this
   */
  this._lostConnection = sId => {
    const index = this.connections.indexOf(sId);
    this.connections.splice(index, 1);
    if (this.connections.length === 0) {
      this.active = false;
    }

    self._publish('change', {count: self.connections.length});

    return this;
  };

  /**
   * Subscribe an action to perform when a message is received.
   * @function onmessage
   * @param {string} type
   * @param {messageResponse}
   * @param {boolean} [historical=false] Whether or not to call the listener if this message has been received before this listener was set.
   * @returns {subscription}
   */
  this.onmessage = (type, cb, historical = false) => {
    return self._subscribe(type, cb, historical);
  };

  /**
   * Subscribe an action to perform when the connection changes.
   * @function onchange
   * @param {changeCallback}
   * @returns {subscription}
   */
  this.onchange = cb => {
    return self._subscribe('change', cb);
  };

  /**
   * Remove all subscriptions to connection events.
   * @function clear
   */
  this.clear = ps.clear;
}
253633
def _get_subscriptions_endpoint(self):
        

        s = self.settings()

        params = {
            'access_token': self.app_access_token,
        }

        return (
            GRAPH_ENDPOINT.format(f'{s["app_id"]}/subscriptions'),
            params,
        )
1320985
def get_endpoint_obj(client, endpoint, object_id):
    '''  '''
    endpoint = '/'.join([endpoint, str(object_id)])
    return client.authenticated_request(endpoint).json()
817789
def get_endpoints_by_subscriber_id(self, subscriber_id):
        
        self._validate_subscriber_id(subscriber_id)

        url = "/notification/v1/endpoint?subscriber_id={}".format(
            subscriber_id)

        response = NWS_DAO().getURL(url, self._read_headers)

        if response.status != 200:
            raise DataFailureException(url, response.status, response.data)

        data = json.loads(response.data)

        endpoints = []
        for datum in data.get("Endpoints", []):
            endpoints.append(self._endpoint_from_json(datum))
        return endpoints
841470
def _get_valid_endpoint(resp, name, entry_type):
        
        catalog = resp.get('token', {}).get('catalog', [])
        for entry in catalog:
            if (
                entry.get('name')
                and entry.get('type')
                and entry.get('name') == name
                and entry.get('type') == entry_type
            ):
                # Collect any endpoints on the public or internal interface
                valid_endpoints = {}
                for ep in entry.get('endpoints'):
                    interface = ep.get('interface', '')
                    if interface in ['public', 'internal']:
                        valid_endpoints[interface] = ep.get('url')

                if valid_endpoints:
                    # Favor public endpoints over internal
                    return valid_endpoints.get('public', valid_endpoints.get('internal'))

        return None
129944
def fetch_job_messages(offset, job_id, opts = {})
      data, _status_code, _headers = fetch_job_messages_with_http_info(offset, job_id, opts)
      return data
    end
793827
def message(message)
      reqdata = reqdata()
      reqdata.merge!({
        :nick => @endpoint[:nick],
        :type => "chat",
        :style => "",
        :timestamp => Time.now.to_f * 1000
      })
      reqdata.merge!(message)
      httpost('/messages', reqdata)
    end
914769
def get_endpoint_by_address(self, endpoint_addr):
        
        url = "/notification/v1/endpoint?endpoint_address={}".format(
            endpoint_addr)

        response = NWS_DAO().getURL(url, self._read_headers)

        if response.status != 200:
            raise DataFailureException(url, response.status, response.data)

        data = json.loads(response.data)
        try:
            return self._endpoint_from_json(data.get("Endpoints")[0])
        except IndexError:
            raise DataFailureException(url, 404, "No SMS endpoint found")
395414
def get_endpoint_by_subscriber_id_and_protocol(
            self, subscriber_id, protocol):
        
        self._validate_subscriber_id(subscriber_id)
        self._validate_endpoint_protocol(protocol)

        url = "/notification/v1/endpoint?subscriber_id={}&protocol={}".format(
            subscriber_id, protocol)

        response = NWS_DAO().getURL(url, self._read_headers)

        if response.status != 200:
            raise DataFailureException(url, response.status, response.data)

        data = json.loads(response.data)
        try:
            return self._endpoint_from_json(data.get("Endpoints")[0])
        except IndexError:
            raise DataFailureException(url, 404, "No SMS endpoint found")
305218
def endpoint_catalog(catalog=None):  # noqa: E501
    
    if connexion.request.is_json:
        catalog = UserAuth.from_dict(connexion.request.get_json())  # noqa: E501

    if (not hasAccess()):
        return redirectUnauthorized()

    driver = LoadedDrivers.getDefaultDriver()
    auth = None
    if (catalog):
        auth = catalog
    return Response(status=200, body=driver.getCatalog(auth))
8873
def get(self):
        
        base_endpoint = self.config.get('endpoint', 'flasgger')
        specs = [
            {
                "url": url_for(".".join((base_endpoint, spec['endpoint']))),
                "title": spec.get('title', 'API Spec 1'),
                "version": spec.get("version", '0.0.1'),
                "endpoint": spec.get('endpoint')
            }
            for spec in self.config.get('specs', [])
        ]
        data = {
            "specs": specs,
            "title": self.config.get('title', 'Flasgger')
        }
        if request.args.get('json'):
            # calling with ?json returns specs
            return jsonify(data)
        else:  # pragma: no cover
            data['flasgger_config'] = self.config
            data['json'] = json
            data['flasgger_version'] = __version__
            data['favicon'] = self.config.get(
                'favicon',
                url_for('flasgger.static', filename='favicon-32x32.png')
            )
            data['swagger_ui_bundle_js'] = self.config.get(
                'swagger_ui_bundle_js',
                url_for('flasgger.static', filename='swagger-ui-bundle.js')
            )
            data['swagger_ui_standalone_preset_js'] = self.config.get(
                'swagger_ui_standalone_preset_js',
                url_for('flasgger.static',
                        filename='swagger-ui-standalone-preset.js')
            )
            data['jquery_js'] = self.config.get(
                'jquery_js',
                url_for('flasgger.static', filename='lib/jquery.min.js')
            )
            data['swagger_ui_css'] = self.config.get(
                'swagger_ui_css',
                url_for('flasgger.static', filename='swagger-ui.css')
            )
            return render_template(
                'flasgger/index.html',
                **data
            )
1345962
def get_by_contract(self, contract_hash):
        
        hash = contract_hash
        if isinstance(contract_hash, str) and len(contract_hash) == 40:
            hash = UInt160.ParseString(contract_hash)

        if not isinstance(hash, UInt160):
            raise Exception("Incorrect address format")

        contractlist_snapshot = self.db.prefixed_db(NotificationPrefix.PREFIX_CONTRACT).snapshot()
        results = []

        for val in contractlist_snapshot.iterator(prefix=bytes(hash.Data), include_key=False):
            if len(val) > 4:
                try:
                    event = SmartContractEvent.FromByteArray(val)
                    results.append(event)
                except Exception as e:
                    logger.error("could not parse event: %s %s" % (e, val))
        return results
1366481
def _pullMessage(self):
        """"""
        data = {
            "msgs_recv": 0,
            "sticky_token": self._sticky,
            "sticky_pool": self._pool,
            "clientid": self._client_id,
            "state": "active" if self._markAlive else "offline",
        }
        return self._get(self.req_url.STICKY, data, fix_request=True, as_json=True)
53739
def _detect(self):
        
        results = []
        for c in self.contracts:
            unindexed_params = self.detect_erc20_unindexed_event_params(c)
            if unindexed_params:
                info = "{} ({}) does not mark important ERC20 parameters as 'indexed':\n"
                info = info.format(c.name, c.source_mapping_str)
                for (event, parameter) in unindexed_params:
                    info += "\t-{} ({}) does not index parameter '{}'\n".format(event.name, event.source_mapping_str, parameter.name)

                # Add the events to the JSON (note: we do not add the params/vars as they have no source mapping).
                json = self.generate_json_result(info)
                self.add_functions_to_json([event for event, _ in unindexed_params], json)
                results.append(json)

        return results