Marshal CallDuration as ms

This commit is contained in:
Daniel Ponte 2025-01-04 11:00:41 -05:00
parent 16a0606e4c
commit 59513572ba

View file

@ -1,6 +1,7 @@
package calls
import (
"encoding/json"
"fmt"
"time"
@ -29,6 +30,10 @@ func (d CallDuration) MsInt32Ptr() *int32 {
return &i
}
func (d CallDuration) MarshalJSON() ([]byte, error) {
return json.Marshal(d.Duration().Milliseconds())
}
func (d CallDuration) Seconds() int32 {
return int32(time.Duration(d).Seconds())
}