tag::server_api[]
190987
@RequestMapping(value = "/fraudcheck", method = PUT, consumes = FRAUD_SERVICE_JSON_VERSION_1, produces = FRAUD_SERVICE_JSON_VERSION_1)
	public FraudCheckResult fraudCheck(@RequestBody FraudCheck fraudCheck) {
		// end::server_api[]
		// tag::new_impl[]
		if (amountGreaterThanThreshold(fraudCheck)) {
			return new FraudCheckResult(FraudCheckStatus.FRAUD, AMOUNT_TOO_HIGH);
		}
		// end::new_impl[]
		// tag::initial_impl[]
		return new FraudCheckResult(FraudCheckStatus.OK, NO_REASON);
		// end::initial_impl[]
	}
322753
def get_posts_tags(subscribers, object_list, feed, tag_name):
	''''''

	tagd = dict()
	user_obj = None
	tag_obj = None
	tags = models.Tag.objects.extra(
		select=dict(post_id='{0}.{1}'.format(
			*it.imap( connection.ops.quote_name,
				('feedjack_post_tags', 'post_id') ) )),
		tables=['feedjack_post_tags'],
		where=[
		'{0}.{1}={2}.{3}'.format(*it.imap( connection.ops.quote_name,
			('feedjack_tag', 'id', 'feedjack_post_tags', 'tag_id') )),
		'{0}.{1} IN ({2})'.format(
			connection.ops.quote_name('feedjack_post_tags'),
			connection.ops.quote_name('post_id'),
			', '.join([str(post.id) for post in object_list]) ) ] )

	for tag in tags:
		if tag.post_id not in tagd: tagd[tag.post_id] = list()
		tagd[tag.post_id].append(tag)
		if tag_name and tag.name == tag_name: tag_obj = tag

	subd = dict()
	for sub in subscribers: subd[sub.feed.id] = sub
	for post in object_list:
		if post.id in tagd: post.qtags = tagd[post.id]
		else: post.qtags = list()
		post.subscriber = subd[post.feed.id]
		if feed == post.feed: user_obj = post.subscriber

	return user_obj, tag_obj
880515
function tagSetMatch(tagSet, serverTags) {
  const keys = Object.keys(tagSet);
  const serverTagKeys = Object.keys(serverTags);
  for (let i = 0; i < keys.length; ++i) {
    const key = keys[i];
    if (serverTagKeys.indexOf(key) === -1 || serverTags[key] !== tagSet[key]) {
      return false;
    }
  }

  return true;
}
1070811
def site_tags(site_id)
      tag_summary = []
      site_tag = JSON.parse(AJAX.get(self, "/api/2.0/sites/#{site_id}/tags", AJAX::CONTENT_TYPE::JSON, { per_page: 2_147_483_647 }))
      site_tag['resources'].each do |json|
        tag_summary << TagSummary.parse(json)
      end
      tag_summary
    end
657440
private void writeIntArrayTagPayload(IntArrayTag tag) throws IOException {
        int[] ints = tag.getValue();
        os.writeInt(ints.length);
        for (int i = 0; i < ints.length; i++) {
            os.writeInt(ints[i]);
        }
    }
141411
private static function fetchHostname(array $server): array
    {
        $server += ['SERVER_PORT' => null];
        if (null !== $server['SERVER_PORT']) {
            $server['SERVER_PORT'] = (int) $server['SERVER_PORT'];
        }

        if (isset($server['HTTP_HOST'])) {
            preg_match(',^(?<host>(\[.*\]|[^:])*)(\:(?<port>[^/?\#]*))?$,x', $server['HTTP_HOST'], $matches);

            return [
                $matches['host'],
                isset($matches['port']) ? (int) $matches['port'] : $server['SERVER_PORT'],
            ];
        }

        if (!isset($server['SERVER_ADDR'])) {
            throw new SyntaxError('The host could not be detected');
        }

        if (false === filter_var($server['SERVER_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
            $server['SERVER_ADDR'] = '['.$server['SERVER_ADDR'].']';
        }

        return [$server['SERVER_ADDR'], $server['SERVER_PORT']];
    }
175272
function (id)
		{
			var m = this.getModule('server-'+id, function (server) {
				self.e.loadServer(server);
			});
			_serverModules.push(m);
			return m;
		}
1103881
public function createServerRequestFromArray(array $server){
        $method     = $server["REQUEST_METHOD"] ?? "GET";

        return new ServerRequest(
            $method,
            (new UriFactory())->createFromServer($server),
            $server,
            self::getUploadedFiles($_FILES),
            $_COOKIE,
            $_GET,
            self::getProtocolVersion($server)
        );
    }
101239
public static function useStaging($client_id, $client_secret, $api_version = null)
    {
        if (self::$production !== null) {
            throw new RuntimeException('API mode has already been set.');
        }
        self::$production    = false;
        self::$client_id     = $client_id;
        self::$client_secret = $client_secret;
        self::$api_version   = $api_version;
    }
367088
function(tag) {
    var posts = [];
    for (var key in this.posts) {
      if (this.posts[key].tags && this.posts[key].tags.indexOf(tag) !== -1) {
        posts.push(this.posts[key]);
      }
    }
    return posts;
  }
1218600
def organization_tags(self, id, **kwargs):
        ""
        api_path = "/api/v2/organizations/{id}/tags.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)
996772
def tags(key = nil)
      if custom?
        tags = @data[:data][:sdk][:custom][:tags]
      else
        tags = @data[:data][key]
      end
      key ? tags[key] : tags
    end
354136
def database_add_tags(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/addTags' % object_id, input_params, always_retry=always_retry, **kwargs)
635922
def tagged(self, tag, offset=0, count=25):
        ''''''
        return json.loads(self.client('tag', 'get', tag, offset, count))
1246489
def load_tags(timeout)
      cmd = { :name => :get_tags }
      res = blocking_request(cmd, timeout)
      raise TagError.new("Retrieving current tags failed: #{res.inspect}") unless res.kind_of?(Array)

      ::Chef::Log.info("Successfully loaded current tags: '#{res.join("', '")}'")
      res
    end
916847
def api_stop(server_state):
    
    api_srv = server_state['api']

    if api_srv is not None:
        log.info("Shutting down API")
        api_srv.stop_server()
        api_srv.join()
        log.info("API server joined")
    else:
        log.info("API already joined")

    server_state['api'] = None
488234
def tag(self, name, action='ADD', params=None):
        
        if not name:
            self._tcex.handle_error(925, ['name', 'tag', 'name', 'name', name])

        if not self.can_update():
            self._tcex.handle_error(910, [self.type])

        if action in ['GET', 'ADD', 'DELETE']:
            return self.tc_requests.tag(
                self.api_type,
                self.api_sub_type,
                self.unique_id,
                name,
                action=action,
                owner=self.owner,
                params=params,
            )
        self._tcex.handle_error(925, ['action', 'tag', 'action', 'action', action])
        return None