github.com/status-im/status-go@v1.1.0/protocol/wakusync/response.go (about)

     1  package wakusync
     2  
     3  import (
     4  	"encoding/json"
     5  
     6  	"github.com/status-im/status-go/multiaccounts/accounts"
     7  	"github.com/status-im/status-go/multiaccounts/settings"
     8  	"github.com/status-im/status-go/protocol/protobuf"
     9  )
    10  
    11  type WakuBackedUpDataResponse struct {
    12  	Clock                uint64
    13  	FetchingDataProgress map[string]*protobuf.FetchingBackedUpDataDetails // key represents the data/section backup details refer to
    14  	Profile              *BackedUpProfile
    15  	Setting              *settings.SyncSettingField
    16  	Keypair              *accounts.Keypair
    17  	WatchOnlyAccount     *accounts.Account
    18  }
    19  
    20  func (sfwr *WakuBackedUpDataResponse) MarshalJSON() ([]byte, error) {
    21  	responseItem := struct {
    22  		Clock                uint64                                 `json:"clock,omitempty"`
    23  		FetchingDataProgress map[string]FetchingBackupedDataDetails `json:"fetchingBackedUpDataProgress,omitempty"`
    24  		Profile              *BackedUpProfile                       `json:"backedUpProfile,omitempty"`
    25  		Setting              *settings.SyncSettingField             `json:"backedUpSettings,omitempty"`
    26  		Keypair              *accounts.Keypair                      `json:"backedUpKeypair,omitempty"`
    27  		WatchOnlyAccount     *accounts.Account                      `json:"backedUpWatchOnlyAccount,omitempty"`
    28  	}{
    29  		Clock:            sfwr.Clock,
    30  		Profile:          sfwr.Profile,
    31  		Setting:          sfwr.Setting,
    32  		Keypair:          sfwr.Keypair,
    33  		WatchOnlyAccount: sfwr.WatchOnlyAccount,
    34  	}
    35  
    36  	responseItem.FetchingDataProgress = sfwr.FetchingBackedUpDataDetails()
    37  
    38  	return json.Marshal(responseItem)
    39  }