github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/protocol/stellar1/notify.go (about) 1 // Auto-generated to Go types and interfaces using avdl-compiler v1.4.10 (https://github.com/keybase/node-avdl-compiler) 2 // Input file: avdl/stellar1/notify.avdl 3 4 package stellar1 5 6 import ( 7 "github.com/keybase/go-framed-msgpack-rpc/rpc" 8 context "golang.org/x/net/context" 9 "time" 10 ) 11 12 type PaymentNotificationArg struct { 13 AccountID AccountID `codec:"accountID" json:"accountID"` 14 PaymentID PaymentID `codec:"paymentID" json:"paymentID"` 15 } 16 17 type PaymentStatusNotificationArg struct { 18 AccountID AccountID `codec:"accountID" json:"accountID"` 19 PaymentID PaymentID `codec:"paymentID" json:"paymentID"` 20 } 21 22 type RequestStatusNotificationArg struct { 23 ReqID KeybaseRequestID `codec:"reqID" json:"reqID"` 24 } 25 26 type AccountDetailsUpdateArg struct { 27 AccountID AccountID `codec:"accountID" json:"accountID"` 28 Account WalletAccountLocal `codec:"account" json:"account"` 29 } 30 31 type AccountsUpdateArg struct { 32 Accounts []WalletAccountLocal `codec:"accounts" json:"accounts"` 33 } 34 35 type PendingPaymentsUpdateArg struct { 36 AccountID AccountID `codec:"accountID" json:"accountID"` 37 Pending []PaymentOrErrorLocal `codec:"pending" json:"pending"` 38 } 39 40 type RecentPaymentsUpdateArg struct { 41 AccountID AccountID `codec:"accountID" json:"accountID"` 42 FirstPage PaymentsPageLocal `codec:"firstPage" json:"firstPage"` 43 } 44 45 type NotifyInterface interface { 46 PaymentNotification(context.Context, PaymentNotificationArg) error 47 PaymentStatusNotification(context.Context, PaymentStatusNotificationArg) error 48 RequestStatusNotification(context.Context, KeybaseRequestID) error 49 AccountDetailsUpdate(context.Context, AccountDetailsUpdateArg) error 50 AccountsUpdate(context.Context, []WalletAccountLocal) error 51 PendingPaymentsUpdate(context.Context, PendingPaymentsUpdateArg) error 52 RecentPaymentsUpdate(context.Context, RecentPaymentsUpdateArg) error 53 } 54 55 func NotifyProtocol(i NotifyInterface) rpc.Protocol { 56 return rpc.Protocol{ 57 Name: "stellar.1.notify", 58 Methods: map[string]rpc.ServeHandlerDescription{ 59 "paymentNotification": { 60 MakeArg: func() interface{} { 61 var ret [1]PaymentNotificationArg 62 return &ret 63 }, 64 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 65 typedArgs, ok := args.(*[1]PaymentNotificationArg) 66 if !ok { 67 err = rpc.NewTypeError((*[1]PaymentNotificationArg)(nil), args) 68 return 69 } 70 err = i.PaymentNotification(ctx, typedArgs[0]) 71 return 72 }, 73 }, 74 "paymentStatusNotification": { 75 MakeArg: func() interface{} { 76 var ret [1]PaymentStatusNotificationArg 77 return &ret 78 }, 79 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 80 typedArgs, ok := args.(*[1]PaymentStatusNotificationArg) 81 if !ok { 82 err = rpc.NewTypeError((*[1]PaymentStatusNotificationArg)(nil), args) 83 return 84 } 85 err = i.PaymentStatusNotification(ctx, typedArgs[0]) 86 return 87 }, 88 }, 89 "requestStatusNotification": { 90 MakeArg: func() interface{} { 91 var ret [1]RequestStatusNotificationArg 92 return &ret 93 }, 94 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 95 typedArgs, ok := args.(*[1]RequestStatusNotificationArg) 96 if !ok { 97 err = rpc.NewTypeError((*[1]RequestStatusNotificationArg)(nil), args) 98 return 99 } 100 err = i.RequestStatusNotification(ctx, typedArgs[0].ReqID) 101 return 102 }, 103 }, 104 "accountDetailsUpdate": { 105 MakeArg: func() interface{} { 106 var ret [1]AccountDetailsUpdateArg 107 return &ret 108 }, 109 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 110 typedArgs, ok := args.(*[1]AccountDetailsUpdateArg) 111 if !ok { 112 err = rpc.NewTypeError((*[1]AccountDetailsUpdateArg)(nil), args) 113 return 114 } 115 err = i.AccountDetailsUpdate(ctx, typedArgs[0]) 116 return 117 }, 118 }, 119 "accountsUpdate": { 120 MakeArg: func() interface{} { 121 var ret [1]AccountsUpdateArg 122 return &ret 123 }, 124 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 125 typedArgs, ok := args.(*[1]AccountsUpdateArg) 126 if !ok { 127 err = rpc.NewTypeError((*[1]AccountsUpdateArg)(nil), args) 128 return 129 } 130 err = i.AccountsUpdate(ctx, typedArgs[0].Accounts) 131 return 132 }, 133 }, 134 "pendingPaymentsUpdate": { 135 MakeArg: func() interface{} { 136 var ret [1]PendingPaymentsUpdateArg 137 return &ret 138 }, 139 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 140 typedArgs, ok := args.(*[1]PendingPaymentsUpdateArg) 141 if !ok { 142 err = rpc.NewTypeError((*[1]PendingPaymentsUpdateArg)(nil), args) 143 return 144 } 145 err = i.PendingPaymentsUpdate(ctx, typedArgs[0]) 146 return 147 }, 148 }, 149 "recentPaymentsUpdate": { 150 MakeArg: func() interface{} { 151 var ret [1]RecentPaymentsUpdateArg 152 return &ret 153 }, 154 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 155 typedArgs, ok := args.(*[1]RecentPaymentsUpdateArg) 156 if !ok { 157 err = rpc.NewTypeError((*[1]RecentPaymentsUpdateArg)(nil), args) 158 return 159 } 160 err = i.RecentPaymentsUpdate(ctx, typedArgs[0]) 161 return 162 }, 163 }, 164 }, 165 } 166 } 167 168 type NotifyClient struct { 169 Cli rpc.GenericClient 170 } 171 172 func (c NotifyClient) PaymentNotification(ctx context.Context, __arg PaymentNotificationArg) (err error) { 173 err = c.Cli.Notify(ctx, "stellar.1.notify.paymentNotification", []interface{}{__arg}, 0*time.Millisecond) 174 return 175 } 176 177 func (c NotifyClient) PaymentStatusNotification(ctx context.Context, __arg PaymentStatusNotificationArg) (err error) { 178 err = c.Cli.Notify(ctx, "stellar.1.notify.paymentStatusNotification", []interface{}{__arg}, 0*time.Millisecond) 179 return 180 } 181 182 func (c NotifyClient) RequestStatusNotification(ctx context.Context, reqID KeybaseRequestID) (err error) { 183 __arg := RequestStatusNotificationArg{ReqID: reqID} 184 err = c.Cli.Notify(ctx, "stellar.1.notify.requestStatusNotification", []interface{}{__arg}, 0*time.Millisecond) 185 return 186 } 187 188 func (c NotifyClient) AccountDetailsUpdate(ctx context.Context, __arg AccountDetailsUpdateArg) (err error) { 189 err = c.Cli.Notify(ctx, "stellar.1.notify.accountDetailsUpdate", []interface{}{__arg}, 0*time.Millisecond) 190 return 191 } 192 193 func (c NotifyClient) AccountsUpdate(ctx context.Context, accounts []WalletAccountLocal) (err error) { 194 __arg := AccountsUpdateArg{Accounts: accounts} 195 err = c.Cli.Notify(ctx, "stellar.1.notify.accountsUpdate", []interface{}{__arg}, 0*time.Millisecond) 196 return 197 } 198 199 func (c NotifyClient) PendingPaymentsUpdate(ctx context.Context, __arg PendingPaymentsUpdateArg) (err error) { 200 err = c.Cli.Notify(ctx, "stellar.1.notify.pendingPaymentsUpdate", []interface{}{__arg}, 0*time.Millisecond) 201 return 202 } 203 204 func (c NotifyClient) RecentPaymentsUpdate(ctx context.Context, __arg RecentPaymentsUpdateArg) (err error) { 205 err = c.Cli.Notify(ctx, "stellar.1.notify.recentPaymentsUpdate", []interface{}{__arg}, 0*time.Millisecond) 206 return 207 }