smobilpay.WithRequestNonce   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
package smobilpay
2
3
import (
4
	"time"
5
)
6
7
// RequestOption is options for constructing an API request
8
type RequestOption interface {
9
	apply(config *requestConfig)
10
}
11
12
type requestOptionFunc func(config *requestConfig)
13
14
func (fn requestOptionFunc) apply(config *requestConfig) {
15
	fn(config)
16
}
17
18
// WithRequestTimestamp sets the timestamp in the s3pAuth_timestamp header
19
func WithRequestTimestamp(timestamp time.Time) RequestOption {
20
	return requestOptionFunc(func(config *requestConfig) {
21
		config.timestamp = timestamp
22
	})
23
}
24
25
// WithRequestNonce sets the nonce in the s3pAuth_nonce header
26
func WithRequestNonce(nonce string) RequestOption {
27
	return requestOptionFunc(func(config *requestConfig) {
28
		config.nonce = nonce
29
	})
30
}
31