Creates a tag object

    :param name: Name for tag
    :type name: str
    :returns: json
194314
def post(request):
    
    res = Result()
    data = request.POST or json.loads(request.body)['body']
    name = data.get('name', None)

    if not name:
        res.isError = True
        res.message = "No name given"

        return JsonResponse(res.asDict())
    
    tag = Tag.objects.get_or_create(name=name.lower())[0]

    res.append(tag.json())

    return JsonResponse(res.asDict())
586224
public CreateTagResponse create(String tagName) {
        BeanUtil.requireNonNull(tagName, "tagName is null");
        CreateTagResponse response;
        LOG.debug("创建标签.....");
        String url = BASE_API_URL + "cgi-bin/tags/create?access_token=#";
        Map<String, Object> param = new HashMap<String, Object>();
        Map<String, Object> tag = new HashMap<String, Object>();
        tag.put("name", tagName);
        param.put("tag", tag);
        BaseResponse r = executePost(url, JSONUtil.toJson(param));
        String resultJson = isSuccess(r.getErrcode()) ? r.getErrmsg() : r.toJsonString();
        response = JSONUtil.toBean(resultJson, CreateTagResponse.class);
        return response;
    }
863105
public function createTags($name)
    {
        $url = "https://api.weixin.qq.com/cgi-bin/tags/create?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, ['tag' => ['name' => $name]]);
    }
1236405
def get_tag(self, tagname, tagidx):
        
        return '%s=%s' % (tagname, decode(getattr(self, tagname)[tagidx]))
963687
private TagList createTagList(ObjectName name) {
    Map<String, String> props = name.getKeyPropertyList();
    SmallTagMap.Builder tagsBuilder = SmallTagMap.builder();
    for (Map.Entry<String, String> e : props.entrySet()) {
      String key = PROP_KEY_PREFIX + "." + e.getKey();
      tagsBuilder.add(Tags.newTag(key, e.getValue()));
    }
    tagsBuilder.add(Tags.newTag(DOMAIN_KEY, name.getDomain()));
    tagsBuilder.add(CLASS_TAG);
    if (defaultTags != null) {
      defaultTags.forEach(tagsBuilder::add);
    }
    return new BasicTagList(tagsBuilder.result());
  }
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
1207609
def update(self, tag_id, name):
        
        name = to_text(name)
        return self._post(
            'tags/update',
            data={
                'tag': {
                    'id': int(tag_id),
                    'name': name
                }
            }
        )
929711
def get_tag_json(self, namespace, repository, tag):
        """"""
        return self._http_call(self.TAGS + '/' + tag + '/json', get,
                               namespace=namespace, repository=repository)
368069
function createTagWithClass (className, tagName) {
  tagName = tagName || 'div'
  let tag = document.createElement(tagName)
  tag.className = className || ''
  return tag
}
446481
def tags(self, extra_params=None):
        "
        return self.api._get_json(
            Tag,
            space=self,
            rel_path=self._build_rel_path('tags'),
            extra_params=extra_params,
        )
784225
def tag_id(self, name):
        
        return self._store.get(self.tag_key(name)) or self.reset_tag(name)
701185
def tag(name, tag_name):
    

    with LOCK:
        # just to check if <name> exists
        metric(name)

        TAGS.setdefault(tag_name, set()).add(name)
211194
def _create_json(self):
        
        data_json = {
            "name": self.name,
            "description": self.description,
            "autoJoin": self.autoJoin,
            "realm": self.realm,
        }
        return data_json
992362
def create_snapshot(self, name, tag):
        
        source = self.local_location
        logger.debug("Create Snapshot: %s -> %s" % (source, name))
        # FIXME: actually create the snapshot via clone command
        if name and tag:
            output_tag = "{}:{}".format(name, tag)
        else:
            output_tag = name or tag
        return self.__class__(repository=source, tag=output_tag)
1278967
def get_tag(self, name):
        """"""
        res = self.get_request('/tag/' + name)
        return Tag(cloud_manager=self, **res['tag'])
1212099
def get_tag(self, tag_id):
        
        url = self._generate_url('tags/{0}'.format(tag_id))
        return self.get(url)
1357115
def new
      @tag = Tag.new

      respond_to do |format|
        format.html # new.html.erb
        format.json { render json: @tag }
      end
    end