// SetPullRequestEventType sets the PullRequestEventType field's value.
540276
func (s *PullRequestEvent) SetPullRequestEventType(v string) *PullRequestEvent {
	s.PullRequestEventType = &v
	return s
}
605270
func (s *ViolationEvent) SetViolationEventType(v string) *ViolationEvent {
	s.ViolationEventType = &v
	return s
}
571110
func (c *ClientupdateCountCall) EventType(eventType string) *ClientupdateCountCall {
	c.urlParams_.Set("eventType", eventType)
	return c
}
1246004
func (s *PullRequestEvent) SetEventDate(v time.Time) *PullRequestEvent {
	s.EventDate = &v
	return s
}
451295
func (s *GetCommentsForPullRequestInput) SetPullRequestId(v string) *GetCommentsForPullRequestInput {
	s.PullRequestId = &v
	return s
}
1166544
func (s *Endpoint) SetEndpointType(v string) *Endpoint {
	s.EndpointType = &v
	return s
}
715040
func (client Client) MergePullRequest(projectKey, repositorySlug string, pullRequestID, version int) error {
	retry := retry.New(3, retry.DefaultBackoffFunc)
	work := func() error {
		req, err := http.NewRequest(
			"POST",
			fmt.Sprintf("%s/rest/api/1.0/projects/%s/repos/%s/pull-requests/%d/merge?version=%d", client.baseURL.String(), projectKey, repositorySlug, pullRequestID, version),
			nil,
		)
		if err != nil {
			return err
		}
		req.Header.Set("Accept", "application/json")

		// https://confluence.atlassian.com/cloudkb/xsrf-check-failed-when-calling-cloud-apis-826874382.html
		req.Header.Set("X-Atlassian-Token", "no-check")

		req.SetBasicAuth(client.userName, client.password)

		responseCode, _, err := client.consumeResponse(req)
		if err != nil {
			return err
		}

		if responseCode != http.StatusOK {
			reason := "unhandled reason"
			switch {
			case responseCode == http.StatusUnauthorized:
				reason = "Unauthorized"
			case responseCode == http.StatusNotFound:
				reason = "Not found"
			case responseCode == http.StatusConflict:
				reason = "Conflict"
			}
			return errorResponse{StatusCode: responseCode, Reason: reason}
		}

		return nil
	}

	return retry.Try(work)
}
992179
func (s *UpdateGatewayResponseInput) SetResponseType(v string) *UpdateGatewayResponseInput {
	s.ResponseType = &v
	return s
}
151855
func (s *Record) SetEventVersion(v string) *Record {
	s.EventVersion = &v
	return s
}
65915
func (s *UpdatePullRequestTitleOutput) SetPullRequest(v *PullRequest) *UpdatePullRequestTitleOutput {
	s.PullRequest = v
	return s
}
1213890
func (s *PutEventsInput) SetEventsRequest(v *EventsRequest) *PutEventsInput {
	s.EventsRequest = v
	return s
}
929345
func (s *PullRequestEvent) SetPullRequestStatusChangedEventMetadata(v *PullRequestStatusChangedEventMetadata) *PullRequestEvent {
	s.PullRequestStatusChangedEventMetadata = v
	return s
}
422782
func (s *UpdateSecretInput) SetClientRequestToken(v string) *UpdateSecretInput {
	s.ClientRequestToken = &v
	return s
}
406958
func (s *Event) SetEventType(v string) *Event {
	s.EventType = &v
	return s
}
710618
func (s *Service) SetLaunchType(v string) *Service {
	s.LaunchType = &v
	return s
}
1177789
func SetContentType(contentType ContentType) func(next http.Handler) http.Handler {
	return func(next http.Handler) http.Handler {
		fn := func(w http.ResponseWriter, r *http.Request) {
			r = r.WithContext(context.WithValue(r.Context(), ContentTypeCtxKey, contentType))
			next.ServeHTTP(w, r)
		}
		return http.HandlerFunc(fn)
	}
}
1158185
func (s *GetPullRequestOutput) SetPullRequest(v *PullRequest) *GetPullRequestOutput {
	s.PullRequest = v
	return s
}