// getSlackCreatePayload composes Slack payload for create new branch or tag.
764849
func getSlackCreatePayload(p *api.CreatePayload) (*SlackPayload, error) {
	refName := git.RefEndName(p.Ref)
	repoLink := SlackLinkFormatter(p.Repo.HTMLURL, p.Repo.Name)
	refLink := SlackLinkFormatter(p.Repo.HTMLURL+"/src/"+refName, refName)
	text := fmt.Sprintf("[%s:%s] %s created by %s", repoLink, refLink, p.RefType, p.Sender.UserName)
	return &SlackPayload{
		Text: text,
	}, nil
}
197989
func GetDingtalkPayload(p api.Payloader, event HookEventType) (payload *DingtalkPayload, err error) {
	switch event {
	case HOOK_EVENT_CREATE:
		payload, err = getDingtalkCreatePayload(p.(*api.CreatePayload))
	case HOOK_EVENT_DELETE:
		payload, err = getDingtalkDeletePayload(p.(*api.DeletePayload))
	case HOOK_EVENT_FORK:
		payload, err = getDingtalkForkPayload(p.(*api.ForkPayload))
	case HOOK_EVENT_PUSH:
		payload, err = getDingtalkPushPayload(p.(*api.PushPayload))
	case HOOK_EVENT_ISSUES:
		payload, err = getDingtalkIssuesPayload(p.(*api.IssuesPayload))
	case HOOK_EVENT_ISSUE_COMMENT:
		payload, err = getDingtalkIssueCommentPayload(p.(*api.IssueCommentPayload))
	case HOOK_EVENT_PULL_REQUEST:
		payload, err = getDingtalkPullRequestPayload(p.(*api.PullRequestPayload))
	case HOOK_EVENT_RELEASE:
		payload, err = getDingtalkReleasePayload(p.(*api.ReleasePayload))
	}

	if err != nil {
		return nil, fmt.Errorf("event '%s': %v", event, err)
	}

	return payload, nil
}
238815
func (o *PostIPAMCreated) WithPayload(payload *models.IPAMResponse) *PostIPAMCreated {
	o.Payload = payload
	return o
}
681706
func (o *GetIDOK) WithPayload(payload *models.Customer) *GetIDOK {
	o.Payload = payload
	return o
}
487543
func (o *GetAccountDefault) WithPayload(payload *models.Error) *GetAccountDefault {
	o.Payload = payload
	return o
}
358924
func NewPayloadList(body io.ReadCloser) (PayloadList, error) {
	parser := xml.NewDecoder(body)

	// return a composite result and offer walk/close options
	pl := PayloadList{
		body:   body,
		parser: parser,
		delim:  CompactDefaultDelim,
	}
	for {
		token, err := parser.Token()
		if err != nil {
			return pl, err
		}
		switch t := token.(type) {
		case xml.StartElement:
			switch t.Name.Local {
			case XMLElemRETS, XMLElemRETSStatus:
				rets, er := ResponseTag(t).Parse()
				if err != nil {
					return pl, er
				}
				pl.Response = *rets
				return pl, nil
			case "DELIMITER":
				pl.delim, err = DelimiterTag(t).Parse()
				if err != nil {
					return pl, err
				}
			}
		}
	}
}
328731
func (o *GetLoginOK) WithPayload(payload *GetLoginOKBody) *GetLoginOK {
	o.Payload = payload
	return o
}
1100062
func (o *ListTasksDefault) WithPayload(payload *models.Error) *ListTasksDefault {
	o.Payload = payload
	return o
}
850976
func (o *GetServiceOK) WithPayload(payload []*models.Service) *GetServiceOK {
	o.Payload = payload
	return o
}
236140
func (o *GetUserByNameOK) WithPayload(payload *models.User) *GetUserByNameOK {
	o.Payload = payload
	return o
}
129202
func (o *InventoryGetOK) WithPayload(payload map[string]int32) *InventoryGetOK {
	o.Payload = payload
	return o
}
556748
func NewPayload(location string) (*Payload, error) {
	if _, err := os.Stat(filepath.Clean(location)); os.IsNotExist(err) {
		return nil, fmt.Errorf("Payload directory does not exist! Returned: %v", err)
	}
	p := new(Payload)
	p.dir = filepath.Clean(location)
	return p, nil
}
178230
func (o *GetOrderByIDOK) WithPayload(payload *models.Order) *GetOrderByIDOK {
	o.Payload = payload
	return o
}
901122
func (o *FindOK) WithPayload(payload []*models.Item) *FindOK {
	o.Payload = payload
	return o
}
216716
func (o *GetMapOK) WithPayload(payload *models.BPFMapList) *GetMapOK {
	o.Payload = payload
	return o
}
878269
func (w *WebHookPayload) GetCreated() bool {
	if w == nil || w.Created == nil {
		return false
	}
	return *w.Created
}
222639
func GetBytesPayload(payl *common.Payload) ([]byte, error) {
	bytes, err := proto.Marshal(payl)
	return bytes, errors.Wrap(err, "error marshaling Payload")
}