// bindPageSize binds and validates parameter PageSize from query.
352160
func (o *ListTasksParams) bindPageSize(rawData []string, hasKey bool, formats strfmt.Registry) error {
	var raw string
	if len(rawData) > 0 {
		raw = rawData[len(rawData)-1]
	}

	// Required: false
	// AllowEmptyValue: false
	if raw == "" { // empty values pass all other validations
		// Default values have been previously initialized by NewListTasksParams()
		return nil
	}

	value, err := swag.ConvertInt32(raw)
	if err != nil {
		return errors.InvalidType("pageSize", "query", "int32", raw)
	}
	o.PageSize = &value

	return nil
}
605954
func (p *WebPage) PaperSize() (PaperSize, error) {
	var resp struct {
		Value paperSizeJSON `json:"value"`
	}
	if err := p.ref.process.doJSON("POST", "/webpage/PaperSize", map[string]interface{}{"ref": p.ref.id}, &resp); err != nil {
		return PaperSize{}, err
	}
	return decodePaperSizeJSON(resp.Value), nil
}
525004
func (s *ListPoliciesInput) SetPageSize(v int64) *ListPoliciesInput {
	s.PageSize = &v
	return s
}
885690
func (s *GetDedicatedIpsInput) SetPageSize(v int64) *GetDedicatedIpsInput {
	s.PageSize = &v
	return s
}
132495
func (r *Redis) DBSize() (int64, error) {
	rp, err := r.ExecuteCommand("DBSIZE")
	if err != nil {
		return 0, err
	}
	return rp.IntegerValue()
}
260614
func (s *PollForDecisionTaskInput) SetMaximumPageSize(v int64) *PollForDecisionTaskInput {
	s.MaximumPageSize = &v
	return s
}
159527
func (s *ListPortfoliosInput) SetPageSize(v int64) *ListPortfoliosInput {
	s.PageSize = &v
	return s
}
1371049
func (s *ListWorkflowTypesInput) SetMaximumPageSize(v int64) *ListWorkflowTypesInput {
	s.MaximumPageSize = &v
	return s
}
1241926
func (p *PageLayoutPaperSize) getPageLayout(ps *xlsxPageSetUp) {
	// Excel default: 1
	if ps == nil || ps.PaperSize == 0 {
		*p = 1
		return
	}
	*p = PageLayoutPaperSize(ps.PaperSize)
}
498030
func (o *GetTaskCommentsParams) WithPageSize(pageSize *int32) *GetTaskCommentsParams {
	o.SetPageSize(pageSize)
	return o
}
1238247
func paginate(page int, choices []string, sel int) ([]string, int) {
	// the number of elements to show in a single page
	var pageSize int
	// if the select has a specific page size
	if page != 0 {
		// use the specified one
		pageSize = page
		// otherwise the select does not have a page size
	} else {
		// use the package default
		pageSize = PageSize
	}

	var start, end, cursor int

	if len(choices) < pageSize {
		// if we dont have enough options to fill a page
		start = 0
		end = len(choices)
		cursor = sel

	} else if sel < pageSize/2 {
		// if we are in the first half page
		start = 0
		end = pageSize
		cursor = sel

	} else if len(choices)-sel-1 < pageSize/2 {
		// if we are in the last half page
		start = len(choices) - pageSize
		end = len(choices)
		cursor = sel - start

	} else {
		// somewhere in the middle
		above := pageSize / 2
		below := pageSize - above

		cursor = pageSize / 2
		start = sel - above
		end = sel + below
	}

	// return the subset we care about and the index
	return choices[start:end], cursor
}
1201023
func (s *DescribeTargetGroupsInput) SetPageSize(v int64) *DescribeTargetGroupsInput {
	s.PageSize = &v
	return s
}
39638
func (s *ListCertificatesByCAInput) SetPageSize(v int64) *ListCertificatesByCAInput {
	s.PageSize = &v
	return s
}
804611
func (s *ListDeliverabilityTestReportsInput) SetPageSize(v int64) *ListDeliverabilityTestReportsInput {
	s.PageSize = &v
	return s
}
1253810
func (s *ListOpenWorkflowExecutionsInput) SetMaximumPageSize(v int64) *ListOpenWorkflowExecutionsInput {
	s.MaximumPageSize = &v
	return s
}
763724
func (q *Query) Paginate(page int, perPage int) *Query {
	q.Paginator = NewPaginator(page, perPage)
	return q
}
1179463
func (s *DescribeListenerCertificatesInput) SetPageSize(v int64) *DescribeListenerCertificatesInput {
	s.PageSize = &v
	return s
}