Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ hs_err_pid*
/.gitignore
/target
/.settings
*.iml
131 changes: 131 additions & 0 deletions src/main/java/multichain/command/StreamCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,137 @@ public List<StreamKeyItem> listStreamKeyItems(String streamName, String key) thr
return listStreamKeyItems(streamName, key, false, 10);
}

/**
* liststreamkeyitems "stream-identifier" ( verbose count start
* local-ordering )
*
* Returns stream items.
*
* Arguments: 1. "stream-identifier"(string, required) Stream identifier - one
* of the following: stream txid, stream reference, stream name. 2. verbose (boolean, optional, default=false)
* If true, returns information about item transaction 3. count (number,
* optional, default=10) The number of items to display 4. start (number,
* optional, default=-count - last) Start from specific item, 0 based, if
* negative - from the end 5. local-ordering (boolean, optional, default=false)
* If true, items appear in the order they were processed by the wallet, if
* false - in the order they appear in blockchain
*
* Result: "stream-items" (array) List of stream items.
*
* @param streamName
* @param verbose
* @param count
* @param start
* @return
* @throws MultichainException
*/
@SuppressWarnings("unchecked")
public List<StreamKeyItem> listStreamItems(String streamName, boolean verbose, int count, int start)
throws MultichainException {
List<StreamKeyItem> streamKeyItems = new ArrayList<StreamKeyItem>();

Object objectStreamKeyItems = executeListStreamItems(streamName, verbose, count, start);
if (verifyInstance(objectStreamKeyItems, ArrayList.class)
&& verifyInstanceofList((ArrayList<Object>) objectStreamKeyItems, StreamKeyItem.class)) {
streamKeyItems = StreamFormatter.formatStreamKeyItems((ArrayList<Object>) objectStreamKeyItems);
}

return streamKeyItems;
}

/**
* liststreamkeyitems "stream-identifier" ( verbose count start
* local-ordering )
*
* Returns stream items.
*
* Arguments: 1. "stream-identifier"(string, required) Stream identifier - one
* of the following: stream txid, stream reference, stream name. 2. verbose (boolean, optional, default=false)
* If true, returns information about item transaction 3. count (number,
* optional, default=10) The number of items to display 4. start (number,
* optional, default=-count - last) Start from specific item, 0 based, if
* negative - from the end 5. local-ordering (boolean, optional, default=false)
* If true, items appear in the order they were processed by the wallet, if
* false - in the order they appear in blockchain
*
* Result: "stream-items" (array) List of stream items.
*
* @param streamName
* @param verbose
* @param count
* * @return
* @throws MultichainException
*/
@SuppressWarnings("unchecked")
public List<StreamKeyItem> listStreamItems(String streamName, boolean verbose, int count)
throws MultichainException {
List<StreamKeyItem> streamKeyItems = new ArrayList<StreamKeyItem>();

Object objectStreamKeyItems = executeListStreamItems(streamName, verbose, count);
if (verifyInstance(objectStreamKeyItems, ArrayList.class)
&& verifyInstanceofList((ArrayList<Object>) objectStreamKeyItems, StreamKeyItem.class)) {
streamKeyItems = StreamFormatter.formatStreamKeyItems((ArrayList<Object>) objectStreamKeyItems);
}

return streamKeyItems;
}

/**
* liststreamkeyitems "stream-identifier" ( verbose count start
* local-ordering )
*
* Returns stream items.
*
* Arguments: 1. "stream-identifier"(string, required) Stream identifier - one
* of the following: stream txid, stream reference, stream name. 2. verbose (boolean, optional, default=false)
* If true, returns information about item transaction 3. count (number,
* optional, default=10) The number of items to display 4. start (number,
* optional, default=-count - last) Start from specific item, 0 based, if
* negative - from the end 5. local-ordering (boolean, optional, default=false)
* If true, items appear in the order they were processed by the wallet, if
* false - in the order they appear in blockchain
*
* Result: "stream-items" (array) List of stream items.
*
* @param streamName
* @param verbose
* @param count
* = 10 * @return
* @throws MultichainException
*/
public List<StreamKeyItem> listStreamItems(String streamName, boolean verbose)
throws MultichainException {
return listStreamItems(streamName, verbose, 10);
}

/**
* liststreamkeyitems "stream-identifier" ( verbose count start
* local-ordering )
*
* Returns stream items.
*
* Arguments: 1. "stream-identifier"(string, required) Stream identifier - one
* of the following: stream txid, stream reference, stream name. 2. verbose (boolean, optional, default=false)
* If true, returns information about item transaction 3. count (number,
* optional, default=10) The number of items to display 4. start (number,
* optional, default=-count - last) Start from specific item, 0 based, if
* negative - from the end 5. local-ordering (boolean, optional, default=false)
* If true, items appear in the order they were processed by the wallet, if
* false - in the order they appear in blockchain
*
* Result: "stream-items" (array) List of stream items.
*
* @param streamName
* @param verbose
* = false
* @param count
* = 10 * @return
* @throws MultichainException
*/
public List<StreamKeyItem> listStreamItems(String streamName) throws MultichainException {
return listStreamItems(streamName, false, 10);
}

/**
* publish "stream-identifier" "key" data-hex
*
Expand Down
63 changes: 63 additions & 0 deletions src/main/java/multichain/command/builders/QueryBuilderStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,69 @@ protected Object executeListStreamKeyItems(String streamName, String key, boolea
return execute(CommandEnum.LISTSTREAMKEYITEMS, streamName, key, verbose, count);
}

/**
* liststreamitems "stream-identifier" ( verbose count start
* local-ordering )
*
* Returns stream items.
*
* Arguments: 1. "stream-identifier"(string, required) Stream identifier - one
* of the following: stream txid, stream reference, stream name. 2. verbose (boolean, optional, default=false)
* If true, returns information about item transaction 3. count (number,
* optional, default=10) The number of items to display 4. start (number,
* optional, default=-count - last) Start from specific item, 0 based, if
* negative - from the end 5. local-ordering (boolean, optional, default=false)
* If true, items appear in the order they were processed by the wallet, if
* false - in the order they appear in blockchain
*
* Result: "stream-items" (array) List of stream items for specific key.
*
* @param streamName
* @param verbose
* @param count
* @param start
* @return
* @throws MultichainException
*/
protected Object executeListStreamItems(String streamName, boolean verbose, int count, int start)
throws MultichainException {
MultichainTestParameter.isNotNullOrEmpty("streamName", streamName);
MultichainTestParameter.valueIsPositive("count", count);

return execute(CommandEnum.LISTSTREAMITEMS, streamName, verbose, count, start);
}

/**
* liststreamitems "stream-identifier" ( verbose count start
* local-ordering )
*
* Returns stream items.
*
* Arguments: 1. "stream-identifier"(string, required) Stream identifier - one
* of the following: stream txid, stream reference, stream name. 2. verbose (boolean, optional, default=false)
* If true, returns information about item transaction 3. count (number,
* optional, default=10) The number of items to display 4. start (number,
* optional, default=-count - last) Start from specific item, 0 based, if
* negative - from the end 5. local-ordering (boolean, optional, default=false)
* If true, items appear in the order they were processed by the wallet, if
* false - in the order they appear in blockchain
*
* Result: "stream-items" (array) List of stream items for specific key.
*
* @param streamName
* @param verbose
* @param count
* @return
* @throws MultichainException
*/
protected Object executeListStreamItems(String streamName, boolean verbose, int count)
throws MultichainException {
MultichainTestParameter.isNotNullOrEmpty("streamName", streamName);
MultichainTestParameter.valueIsPositive("count", count);

return execute(CommandEnum.LISTSTREAMITEMS, streamName, verbose, count);
}

/**
* publish "stream-identifier" "key" data-hex
*
Expand Down