// PostComment handles the request and returns the single comment required
481915
func PostComment() echo.HandlerFunc {

	// swagger:route GET /me/posts/{pid}/comments/{cid} me post comment GetMePostComment
	//
	// Shows selected comment on specified post, filtered by some parameters.
	//
	// You can personalize the request via query string parameters
	//
	//	Produces:
	//	- application/json
	//
	//	Security:
	//		oauth: profile_comments:read
	//
	//	Responses:
	//		default: MePostsPidCommentsCid

	return func(c echo.Context) error {
		return user.PostComment()(c)
	}
}
787027
func (s *OriginAccessIdentityConfig) SetComment(v string) *OriginAccessIdentityConfig {
	s.Comment = &v
	return s
}
143295
func (s *FieldLevelEncryptionConfig) SetComment(v string) *FieldLevelEncryptionConfig {
	s.Comment = &v
	return s
}
1277453
func (s *PullRequestsService) GetComment(ctx context.Context, owner string, repo string, commentID int64) (*PullRequestComment, *Response, error) {
	u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID)
	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	// TODO: remove custom Accept header when this API fully launches.
	req.Header.Set("Accept", mediaTypeReactionsPreview)

	comment := new(PullRequestComment)
	resp, err := s.client.Do(ctx, req, comment)
	if err != nil {
		return nil, resp, err
	}

	return comment, resp, nil
}
2795
func (s *Column) SetComment(v string) *Column {
	s.Comment = &v
	return s
}
1042594
func PostCommentVotes() echo.HandlerFunc {

	// swagger:route GET /me/posts/{pid}/comments/{cid}/votes me post comments votes GetMePostCommentsVotes
	//
	// List the votes on the comment
	//
	//	Produces:
	//	- application/json
	//
	//	Security:
	//		oauth: profile_comments:read
	//
	//	Responses:
	//		default: MePostsPidCommentsCidVotes

	return func(c echo.Context) error {
		return user.PostCommentVotes()(c)
	}
}
386444
func (s *Statement) Comment(str string) *Statement {
	c := comment{
		comment: str,
	}
	*s = append(*s, c)
	return s
}
1237647
func (s *HostedZoneConfig) SetComment(v string) *HostedZoneConfig {
	s.Comment = &v
	return s
}
1143241
func (s *PublicKeySummary) SetComment(v string) *PublicKeySummary {
	s.Comment = &v
	return s
}
186429
func (operation *Operation) ParseRouterComment(commentLine string) error {
	var matches []string

	if matches = routerPattern.FindStringSubmatch(commentLine); len(matches) != 3 {
		return fmt.Errorf("can not parse router comment \"%s\"", commentLine)
	}
	path := matches[1]
	httpMethod := matches[2]

	operation.Path = path
	operation.HTTPMethod = strings.ToUpper(httpMethod)

	return nil
}
481247
func (u *User) RequestComment() {
	packet := MumbleProto.RequestBlob{
		SessionComment: []uint32{u.Session},
	}
	u.client.Conn.WriteProto(&packet)
}
73874
func (s *RepositoriesService) CreateComment(ctx context.Context, owner, repo, sha string, comment *RepositoryComment) (*RepositoryComment, *Response, error) {
	u := fmt.Sprintf("repos/%v/%v/commits/%v/comments", owner, repo, sha)
	req, err := s.client.NewRequest("POST", u, comment)
	if err != nil {
		return nil, nil, err
	}

	c := new(RepositoryComment)
	resp, err := s.client.Do(ctx, req, c)
	if err != nil {
		return nil, resp, err
	}

	return c, resp, nil
}
201714
func ConvertComment(request *http.Request, comment comment.Comment, additional ...CommentConvertFunc) *app.Comment {
	relatedURL := rest.AbsoluteURL(request, app.CommentsHref(comment.ID))
	relatedCreatorLink := rest.AbsoluteURL(request, fmt.Sprintf("%s/%s", usersEndpoint, comment.Creator))
	c := &app.Comment{
		Type: APIStringTypeComments,
		ID:   &comment.ID,
		Attributes: &app.CommentAttributes{
			Body:         &comment.Body,
			BodyRendered: ptr.String(rendering.RenderMarkupToHTML(comment.Body, comment.Markup)),
			Markup:       ptr.String(rendering.NilSafeGetMarkup(&comment.Markup)),
			CreatedAt:    &comment.CreatedAt,
			UpdatedAt:    &comment.UpdatedAt,
		},
		Relationships: &app.CommentRelations{
			Creator: &app.RelationGeneric{
				Data: &app.GenericData{
					Type: ptr.String(APIStringTypeUser),
					ID:   ptr.String(comment.Creator.String()),
					Links: &app.GenericLinks{
						Related: &relatedCreatorLink,
					},
				},
			},
			CreatedBy: &app.CommentCreatedBy{ // Keep old API style until all cients are updated
				Data: &app.IdentityRelationData{
					Type: APIStringTypeUser,
					ID:   &comment.Creator,
				},
				Links: &app.GenericLinks{
					Related: &relatedCreatorLink,
				},
			},
		},
		Links: &app.GenericLinks{
			Self:    &relatedURL,
			Related: &relatedURL,
		},
	}
	if comment.ParentCommentID.Valid == true {
		c.Relationships.ParentComment = &app.RelationGeneric{
			Data: &app.GenericData{
				Type: ptr.String(APIStringTypeComments),
				ID:   ptr.String(comment.ParentCommentID.UUID.String()),
			},
		}
	}
	for _, add := range additional {
		add(request, &comment, c)
	}
	return c
}
1259334
func (s *StreamingDistributionSummary) SetComment(v string) *StreamingDistributionSummary {
	s.Comment = &v
	return s
}
541139
func PostComments() echo.HandlerFunc {

	// swagger:route GET /users/{id}/posts/{pid}/comments users post comments GetUserPostComments
	//
	// List comments on specified post, filtered by some parameters.
	//
	// This will show the last posts on the user board by default.
	// You can personalize the request via query string parameters
	//
	//	Produces:
	//	- application/json
	//
	//	Security:
	//		oauth: profile_comments:read
	//
	//	Responses:
	//		default: UsersIdPostsPidComments

	return func(c echo.Context) error {
		if !rest.IsGranted("profile_comments:read", c) {
			return rest.InvalidScopeResponse("profile_comments:read", c)
		}
		comments := c.Get("post").(*nerdz.UserPost).Comments(*(c.Get("commentlistOptions").(*nerdz.CommentlistOptions)))
		if comments == nil {
			errstr := "Unable to fetch comment list for the specified post"
			c.JSON(http.StatusBadRequest, &rest.Response{
				HumanMessage: errstr,
				Message:      "UserPost.Comments(options) error",
				Status:       http.StatusBadRequest,
				Success:      false,
			})
			return errors.New(errstr)
		}

		var commentsAPI []*nerdz.UserPostCommentTO
		me := c.Get("me").(*nerdz.User)
		for _, p := range *comments {
			// comments contains ExistingPost elements
			// we need to convert back to a UserPostComment in order to get a correct UserPostCommentTO
			if userPostComment := p.(*nerdz.UserPostComment); userPostComment != nil {
				commentsAPI = append(commentsAPI, userPostComment.GetTO(me))
			}
		}
		return rest.SelectFields(commentsAPI, c)
	}
}
93090
func (post *ProjectPost) Comments(options CommentlistOptions) *[]ExistingComment {
	var comments []ProjectPostComment

	query := Db().Where(&ProjectPostComment{Hpid: post.ID()})
	query = commentlistQueryBuilder(query, options)
	query.Scan(&comments)

	comments = utils.ReverseSlice(comments).([]ProjectPostComment)

	var ret []ExistingComment
	for _, c := range comments {
		comment := c
		ret = append(ret, ExistingComment(&comment))
	}
	return &ret
}
800205
func Comment(prefix string) Option {
	return func(ini *INI) error {
		ini.comment = []byte(prefix)
		return nil
	}
}