Creates a new message to be sent or stored

        :param str resource: Custom resource to be used in this message
         (Defaults to parent main_resource)
        :return: New empty message
        :rtype: Message
542732
def new_message(self, resource=None):
        
        return Message(parent=self, main_resource=resource, is_draft=True)
1186253
def new_message(self):
        
        msg = {}
        msg['data'] = []
        msg['type'] = self.plugin_type
        msg['source'] = self.name
        msg['ts'] = (datetime.datetime.utcnow() - datetime.datetime(1970, 1, 1)).total_seconds()
        return msg
1015446
def create_message(data)
      message = Discordrb::Message.new(data, self)
      return message if message.from_bot? && !@should_parse_self
      return message if message.webhook? && !@attributes[:webhook_commands]

      unless message.author
        Discordrb::LOGGER.warn("Received a message (#{message.inspect}) with nil author! Ignoring, please report this if you can")
        return
      end

      event = CommandEvent.new(message, self)

      chain = trigger?(message)
      return message unless chain

      # Don't allow spaces between the prefix and the command
      if chain.start_with?(' ') && !@attributes[:spaces_allowed]
        debug('Chain starts with a space')
        return message
      end

      if chain.strip.empty?
        debug('Chain is empty')
        return message
      end

      execute_chain(chain, event)

      # Return the message so it doesn't get parsed again during the rest of the dispatch handling
      message
    end
1084271
def create(data=None, id=None, message=None):
        

        return Error(
            data=data,
            id=id,
            message=message,
        )
891960
def create(self, project, title, href, **attrs):
        
        attrs.update({'project': project, 'title': title, 'href': href})
        return self._new_resource(payload=attrs)
998002
def new_message(self, body=''):
        
        m = self.message_class(self, body)
        m.queue = self
        return m
1183357
def send_empty(self, message):
        
        host, port = message.destination
        key_token = hash(str(host) + str(port) + str(message.token))
        if key_token in self._relations and message.type == defines.Types["RST"]:
            del self._relations[key_token]
        return message
193622
def create_message(self, channel_id, text):
        

        baseurl = self.rest_baseurl + \
            '/channels/{}/messages'.format(channel_id)
        requests.post(baseurl,
                      headers=self.headers,
                      data=json.dumps({'content': text}))
509987
def create(self, create_missing=None):
        
        return Media(
            self._server_config,
            id=self.create_json(create_missing)['id'],
        ).read()
326454
def add(self, resource):
        
        if isinstance(resource, collections.Iterable):
            for r in resource:
                self.resources.append(r)
        else:
            self.resources.append(resource)
628889
def resource_created_response(resource):
    
    if _get_acceptable_response_type() == JSON:
        response = _single_resource_json_response(resource)
    else:
        response = _single_resource_html_response(resource)
    response.status_code = 201
    response.headers['Location'] = 'http://localhost:5000/{}'.format(
        resource.resource_uri())
    return response
209272
public static BaseMessage createMessage(String strMessageClassName, BaseMessageHeader messageHeader, Object data)
    {
       BaseMessage message = null;
       
       if ((strMessageClassName == null)
           && (messageHeader != null))
       {
           strMessageClassName = (String)messageHeader.get(BaseMessageHeader.INTERNAL_MESSAGE_CLASS);
           if ((strMessageClassName == null) || (strMessageClassName.length() == 0))
           {
//?               String strRequestType = (String)messageHeader.get(TrxMessageHeader.MESSAGE_REQUEST_TYPE);
//?               if ((strRequestType == null) || (strRequestType.length() == 0) || (RequestType.MANUAL.equalsIgnoreCase(strRequestType)))
//?                   strMessageClass = ManualMessage.class.getName();
           }
       }
       if ((strMessageClassName != null) && (strMessageClassName.length() > 0))
       {
           strMessageClassName = ClassServiceUtility.getFullClassName(strMessageClassName);
           Object obj = ClassServiceUtility.getClassService().makeObjectFromClassName(strMessageClassName);
           if (obj instanceof BaseMessage)
           {
               message = (BaseMessage)obj;
               message.init(messageHeader, null);
           }
           else if  (obj instanceof MessageRecordDesc)
           {
               message = new TreeMessage(messageHeader, null);
               ((MessageRecordDesc)obj).init(message, null);
           }
       }
       return message;
   }
877174
def open_resource(self, resource, *mode):
        
        return self.open(self.resource_name(resource), *mode)
725367
def handle_resource_not_found(resource):
    
    resource.set_erred()
    resource.runtime_state = ''
    message = 'Does not exist at backend.'
    if message not in resource.error_message:
        if not resource.error_message:
            resource.error_message = message
        else:
            resource.error_message += ' (%s)' % message
    resource.save()
    logger.warning('%s %s (PK: %s) does not exist at backend.' % (
        resource.__class__.__name__, resource, resource.pk))
181197
def create(self, attributes=None, **kwargs):
        

        return super(WebhooksProxy, self).create(resource_id=None, attributes=attributes)
335336
def create(self, **kwargs):
        
        resource = self.resource.create(kwargs)
        if 'admin_token' in kwargs:
            resource.context.authorize('Gem-Application',
                                       api_token=resource.api_token,
                                       admin_token=kwargs['admin_token'])
        app = self.wrap(resource)
        return self.add(app)
64733
def create_payload(self):
        
        doc = etree.fromstring(self.message)
        self.payload = etree.tostring(doc, encoding="utf-8")
        self.payload = urlsafe_b64encode(self.payload).decode("ascii")
        return self.payload