File size: 858 Bytes
83a59ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package requests

import (
	"strings"

	"github.com/NdoleStudio/httpsms/pkg/repositories"
)

// BillingUsageHistory is the payload for fetching the entities.BillingUsage history
type BillingUsageHistory struct {
	request
	Skip  string `json:"skip" query:"skip"`
	Limit string `json:"limit" query:"limit"`
}

// Sanitize sets defaults to MessageOutstanding
func (input *BillingUsageHistory) Sanitize() BillingUsageHistory {
	if strings.TrimSpace(input.Limit) == "" {
		input.Limit = "12"
	}
	input.Skip = strings.TrimSpace(input.Skip)
	if input.Skip == "" {
		input.Skip = "0"
	}
	return *input
}

// ToIndexParams converts BillingUsageHistory to repositories.IndexParams
func (input *BillingUsageHistory) ToIndexParams() repositories.IndexParams {
	return repositories.IndexParams{
		Skip:  input.getInt(input.Skip),
		Limit: input.getInt(input.Limit),
	}
}