Skip to content

Commit 963177c

Browse files
committed
add blocking feature to certain SDK calls
1 parent b444d28 commit 963177c

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

extras/jsonrpc/daemon.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,13 @@ func (d *Client) ChannelCreate(name string, bid float64, options ChannelCreateOp
259259
FilePath string `json:"file_path,omitempty"`
260260
IncludeProtoBuf bool `json:"include_protobuf"`
261261
ChannelCreateOptions `json:",flatten"`
262+
Blocking bool `json:"blocking"`
262263
}{
263264
Name: name,
264265
Bid: fmt.Sprintf("%.6f", bid),
265266
IncludeProtoBuf: true,
266267
ChannelCreateOptions: options,
268+
Blocking: true,
267269
}
268270
structs.DefaultTagName = "json"
269271
return response, d.call(response, "channel_create", structs.Map(args))
@@ -284,10 +286,12 @@ func (d *Client) ChannelUpdate(claimID string, options ChannelUpdateOptions) (*T
284286
ClaimID string `json:"claim_id"`
285287
IncludeProtoBuf bool `json:"include_protobuf"`
286288
*ChannelUpdateOptions `json:",flatten"`
289+
Blocking bool `json:"blocking"`
287290
}{
288291
ClaimID: claimID,
289292
IncludeProtoBuf: true,
290293
ChannelUpdateOptions: &options,
294+
Blocking: true,
291295
}
292296
structs.DefaultTagName = "json"
293297
return response, d.call(response, "channel_update", structs.Map(args))
@@ -319,12 +323,14 @@ func (d *Client) StreamCreate(name, filePath string, bid float64, options Stream
319323
FilePath string `json:"file_path,omitempty"`
320324
FileSize *string `json:"file_size,omitempty"`
321325
IncludeProtoBuf bool `json:"include_protobuf"`
326+
Blocking bool `json:"blocking"`
322327
*StreamCreateOptions `json:",flatten"`
323328
}{
324329
Name: name,
325330
FilePath: filePath,
326331
Bid: fmt.Sprintf("%.6f", bid),
327332
IncludeProtoBuf: true,
333+
Blocking: true,
328334
StreamCreateOptions: &options,
329335
}
330336
structs.DefaultTagName = "json"
@@ -338,6 +344,7 @@ func (d *Client) StreamAbandon(txID string, nOut uint64, accountID *string, bloc
338344
"nout": nOut,
339345
"account_id": accountID,
340346
"include_protobuf": true,
347+
"blocking": true,
341348
})
342349
if err != nil {
343350
return nil, err
@@ -363,10 +370,12 @@ func (d *Client) StreamUpdate(claimID string, options StreamUpdateOptions) (*Tra
363370
ClaimID string `json:"claim_id"`
364371
IncludeProtoBuf bool `json:"include_protobuf"`
365372
*StreamUpdateOptions `json:",flatten"`
373+
Blocking bool `json:"blocking"`
366374
}{
367375
ClaimID: claimID,
368376
IncludeProtoBuf: true,
369377
StreamUpdateOptions: &options,
378+
Blocking: true,
370379
}
371380
structs.DefaultTagName = "json"
372381
return response, d.call(response, "stream_update", structs.Map(args))
@@ -379,6 +388,7 @@ func (d *Client) ChannelAbandon(txID string, nOut uint64, accountID *string, blo
379388
"nout": nOut,
380389
"account_id": accountID,
381390
"include_protobuf": true,
391+
"blocking": true,
382392
})
383393
if err != nil {
384394
return nil, err

extras/jsonrpc/daemon_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ func TestClient_StreamCreate(t *testing.T) {
111111
address := string(*addressResponse)
112112
got, err := d.StreamCreate("test"+fmt.Sprintf("%d", time.Now().Unix()), "/home/niko/Downloads/IMG_20171012_205120.jpg", 14.37, StreamCreateOptions{
113113
ClaimCreateOptions: ClaimCreateOptions{
114-
Title: "This is a Test Title" + fmt.Sprintf("%d", time.Now().Unix()),
115-
Description: "My Special Description",
114+
Title: util.PtrToString("This is a Test Title" + fmt.Sprintf("%d", time.Now().Unix())),
115+
Description: util.PtrToString("My Special Description"),
116116
Tags: []string{"nsfw", "test"},
117117
Languages: []string{"en-US", "fr-CH"},
118118
Locations: []Location{{
@@ -142,7 +142,7 @@ func TestClient_StreamCreate(t *testing.T) {
142142
Preview: nil,
143143
AllowDuplicateName: nil,
144144
ChannelName: nil,
145-
ChannelID: util.PtrToString("253ca42da47ad8a430e18d52860cb499c50eff25"),
145+
ChannelID: util.PtrToString("dd0b559b4f17a7af984f173efb5438534eb6ab27"),
146146
ChannelAccountID: nil,
147147
})
148148
if err != nil {
@@ -156,8 +156,8 @@ func TestClient_ChannelCreate(t *testing.T) {
156156
d := NewClient("")
157157
got, err := d.ChannelCreate("@Test"+fmt.Sprintf("%d", time.Now().Unix()), 13.37, ChannelCreateOptions{
158158
ClaimCreateOptions: ClaimCreateOptions{
159-
Title: "Mess with the channels",
160-
Description: "And you'll get what you deserve",
159+
Title: util.PtrToString("Mess with the channels"),
160+
Description: util.PtrToString("And you'll get what you deserve"),
161161
Tags: []string{"we", "got", "tags"},
162162
Languages: []string{"en-US"},
163163
Locations: []Location{{
@@ -186,8 +186,8 @@ func TestClient_ChannelUpdate(t *testing.T) {
186186
ClearTags: util.PtrToBool(true),
187187
ChannelCreateOptions: ChannelCreateOptions{
188188
ClaimCreateOptions: ClaimCreateOptions{
189-
Title: "Mess with the channels",
190-
Description: "And you'll get what you deserve",
189+
Title: util.PtrToString("Mess with the channels"),
190+
Description: util.PtrToString("And you'll get what you deserve"),
191191
Tags: []string{"we", "got", "more", "tags"},
192192
Languages: []string{"en-US"},
193193
Locations: []Location{{
@@ -213,8 +213,8 @@ func TestClient_ChannelAbandon(t *testing.T) {
213213
channelName := "@TestToDelete" + fmt.Sprintf("%d", time.Now().Unix())
214214
channelResponse, err := d.ChannelCreate(channelName, 13.37, ChannelCreateOptions{
215215
ClaimCreateOptions: ClaimCreateOptions{
216-
Title: "Mess with the channels",
217-
Description: "And you'll get what you deserve",
216+
Title: util.PtrToString("Mess with the channels"),
217+
Description: util.PtrToString("And you'll get what you deserve"),
218218
Tags: []string{"we", "got", "tags"},
219219
Languages: []string{"en-US"},
220220
Locations: []Location{{

0 commit comments

Comments
 (0)