feat(ModemAuthentication): add pin
This commit is contained in:
@@ -366,20 +366,29 @@ func (o *Operations) SetBaseCorrections(ctx context.Context, funcs ...protocol.S
|
||||
func (o *Operations) SetModem(ctx context.Context, funcs ...protocol.SetModemOptionsFunc) error {
|
||||
opts := protocol.NewSetModemOptions(funcs...)
|
||||
modem := &model.ModemAuthentication{}
|
||||
if opts.Apn != nil {
|
||||
modem.Authentication.Apn = *opts.Apn
|
||||
if opts.Pin != nil {
|
||||
modem.Pin = *opts.Pin
|
||||
}
|
||||
|
||||
if opts.Type != nil {
|
||||
modem.Authentication.Type = *opts.Type
|
||||
}
|
||||
|
||||
if opts.Password != nil {
|
||||
modem.Authentication.Password = *opts.Password
|
||||
}
|
||||
|
||||
if opts.Username != nil {
|
||||
modem.Authentication.Username = *opts.Username
|
||||
if opts.Apn != nil || opts.Type != nil || opts.Username != nil || opts.Password != nil {
|
||||
modem.Authentication = &struct {
|
||||
Apn string `json:"apn,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Username string `json:"username,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
}{}
|
||||
if opts.Apn != nil {
|
||||
modem.Authentication.Apn = *opts.Apn
|
||||
}
|
||||
if opts.Type != nil {
|
||||
modem.Authentication.Type = *opts.Type
|
||||
}
|
||||
if opts.Username != nil {
|
||||
modem.Authentication.Username = *opts.Username
|
||||
}
|
||||
if opts.Password != nil {
|
||||
modem.Authentication.Password = *opts.Password
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := o.PostModem(ctx, modem); err != nil {
|
||||
|
Reference in New Issue
Block a user