Reblog a given post
@param blogName the name of the blog to post to
@param postId the id of the post
@param reblogKey the reblog_key of the post
@return The created reblog Post or null
13603
public Post postReblog(String blogName, Long postId, String reblogKey) {
        return this.postReblog(blogName, postId, reblogKey, null);
    }
1294050
public function getAction(Request $request, Blog $blog, $postId)
    {
        $this->checkPermission('OPEN', $blog->getResourceNode(), [], true);
        $post = $this->postManager->getPostByIdOrSlug($blog, $postId);

        if (is_null($post)) {
            throw new NotFoundHttpException('Post not found');
        }

        $this->trackingManager->dispatchPostReadEvent($post);

        $session = $request->getSession();
        $sessionViewCounterKey = 'blog_post_view_counter_'.$post->getId();
        $now = time();

        if ($now >= ($session->get($sessionViewCounterKey) + $this->logThreshold)) {
            $session->set($sessionViewCounterKey, $now);
            $this->postManager->updatePostViewCount($post);
        }

        return new JsonResponse($this->postSerializer->serialize($post));
    }
1365633
def delete_post(self, blogname, id):
        
        url = "/v2/blog/{}/post/delete".format(blogname)
        return self.send_api_request('post', url, {'id': id}, ['id'])
227699
public function createComment(Blog $blog, Post $post, Comment $comment, $forcePublication = false)
    {
        $published = false;
        if ($blog->isAutoPublishComment()
            || $forcePublication
            || (BlogOptions::COMMENT_MODERATION_PRIOR_ONCE === $blog->getOptions()->getCommentModerationMode()
                && null !== $comment->getAuthor()
                && count($this->memberRepo->getTrustedMember($blog, $comment->getAuthor())) >= 1)) {
            $published = true;
        }

        $comment
            ->setPost($post)
            ->setStatus($published ? Comment::STATUS_PUBLISHED : Comment::STATUS_UNPUBLISHED);

        if (null === $comment->getCreationDate()) {
            $comment->setCreationDate(new \DateTime());
        }

        $this->om->persist($comment);
        $this->om->flush();

        $this->trackingManager->dispatchCommentCreateEvent($post, $comment);

        if (null !== $comment->getAuthor()) {
            $this->trackingManager->updateResourceTracking($blog->getResourceNode(), $comment->getAuthor(), new \DateTime());
        }

        return $comment;
    }
348429
def create_post(post_uid, post_data):
        '''
        
        '''
        title = post_data['title'].strip()
        if len(title) < 2:
            return False


        cur_rec = MPost.get_by_uid(post_uid)
        if cur_rec:
            return False

        entry = TabPost.create(
            title=title,
            date=datetime.now(),
            cnt_md=tornado.escape.xhtml_escape(post_data['cnt_md'].strip()),
            cnt_html=tools.markdown2html(post_data['cnt_md']),
            uid=post_uid,
            time_create=post_data.get('time_create', tools.timestamp()),
            time_update=post_data.get('time_update', tools.timestamp()),
            user_name=post_data['user_name'],
            view_count=post_data['view_count'] if 'view_count' in post_data else 1,
            logo=post_data['logo'],
            memo=post_data['memo'] if 'memo' in post_data else '',
            order=post_data['order'] if 'order' in post_data else '',
            keywords=post_data['keywords'] if 'keywords' in post_data else '',
            extinfo=post_data['extinfo'] if 'extinfo' in post_data else {},
            kind=post_data['kind'] if 'kind' in post_data else '1',
            valid=post_data.get('valid', 1)
        )
        return entry.uid
418120
public function update($blogId, $postId, Google_Post $postBody, $optParams = array()) {
      $params = array('blogId' => $blogId, 'postId' => $postId, 'postBody' => $postBody);
      $params = array_merge($params, $optParams);
      $data = $this->__call('update', array($params));
      if ($this->useObjects()) {
        return new Google_Post($data);
      } else {
        return $data;
      }
    }
178223
protected static function switch_to_blog( $site_name_or_id ) {
		if ( $site_name_or_id === null ) {
			$site_name_or_id = get_current_blog_id();
		}
		$info = get_blog_details($site_name_or_id);
		switch_to_blog($info->blog_id);
		return $info->blog_id;
	}
257236
@Override
  public String getOrCreateForKey(String key) {
    return uuidsByKey.computeIfAbsent(key, k -> Uuids.create());
  }
1208856
public function postComment(string $authorName, EmailAddress $authorEmail, string $content, IClock $clock): BlogArticleComment
    {
        InvalidOperationException::verify($this->published, 'This blog article is not published');
        InvalidOperationException::verify($this->allowCommenting, 'This blog article does not allow comments');

        $comment = new BlogArticleComment(
            $this,
            $authorName,
            $authorEmail,
            $content,
            $clock
        );

        $this->comments[] = $comment;

        return $comment;
    }
1179991
def blog__sync_config_post_field(post, key, content)
      db_post_field = LatoBlog::PostField.find_by(
        key: key,
        lato_blog_post_id: post.id,
        lato_blog_post_field_id: nil
      )
      # check if post field can be created for the post
      if content[:categories] && !content[:categories].empty?
        db_categories = LatoBlog::Category.where(meta_permalink: content[:categories])
        return if (post.categories.pluck(:id) & db_categories.pluck(:id)).empty?
      end
      # run correct action for field
      if db_post_field
        blog__update_db_post_field(db_post_field, content)
      else
        blog__create_db_post_field(post, key, content)
      end
    end
29601
public function postComment(int $blogArticleId, string $authorName, EmailAddress $authorEmail, string $comment): BlogArticleComment
    {
        $blogArticle = $this->blogArticleRepo->get($blogArticleId);

        $comment = $blogArticle->postComment($authorName, $authorEmail, $comment, $this->clock);

        $this->blogArticleRepo->save($blogArticle);

        return $comment;
    }
1289305
public function createPost(Blog $blog, Post $post, User $user)
    {
        $post
        ->setBlog($blog)
        ->setAuthor($user)
        ->setStatus($blog->isAutoPublishPost() ? Post::STATUS_PUBLISHED : Post::STATUS_UNPUBLISHED)
        ->setCreationDate(new \DateTime())
        ->setModificationDate(new \DateTime());

        if (null === $post->getPublicationDate()) {
            $post->setPublicationDate(new \DateTime());
        }

        //tracking
        $this->trackingManager->dispatchPostCreateEvent($blog, $post);
        if ('anon.' !== $user) {
            $this->trackingManager->updateResourceTracking($blog->getResourceNode(), $user, new \DateTime());
        }

        $this->om->persist($post);
        $this->om->flush();

        return $post;
    }
923316
def status_unreblog(self, id):
        
        id = self.__unpack_id(id)
        url = '/api/v1/statuses/{0}/unreblog'.format(str(id))
        return self.__api_request('POST', url)
681602
def get_post_by_id(self, post_id):
        
        r = None
        post_id = _as_int(post_id)
        with self._engine.begin() as conn:
            try:
                post_statement = sqla.select([self._post_table]) \
                    .where(self._post_table.c.id == post_id) \
                    .alias('post')

                joined_statement = post_statement.join(self._tag_posts_table) \
                    .join(self._tag_table) \
                    .join(self._user_posts_table) \
                    .alias('join')

                # Note this will retrieve one row per tag
                all_rows = conn.execute(
                    sqla.select([joined_statement])
                ).fetchall()
                r = self._serialise_posts_and_tags_from_joined_rows(
                    all_rows
                )[0]

            except Exception as e:
                self._logger.exception(str(e))
                r = None
        return r
73122
func CreatePost(client ClientInterface, name string, params url.Values) (*PostRef, error) {
	return doPost(client, "/blog/%s/post", name, params)
}
1216612
public Post blogPost(String blogName, Long postId) {
        HashMap<String, String> options = new HashMap<String, String>();
        options.put("id", postId.toString());
        List<Post> posts = this.blogPosts(blogName, options);
        return posts.size() > 0 ? posts.get(0) : null;
    }
160211
public List<Blog> getBlogs() {
        if (blogs != null) {
            for (Blog blog : blogs) {
                blog.setClient(client);
            }
        }
        return this.blogs;
    }