MCPcopy Create free account
hub / github.com/EsperoTech/yaade / Collection

Class Collection

server/src/main/java/com/postman/collection/Collection.java:49–890  ·  view source on GitHub ↗

Encapsulates a Postman collection Postman SDK analog: Collection Ingest a collection file Collection myCollection = pmcFactory(new File("example-cat-facts-with-tests

Source from the content-addressed store, hash-verified

47 * <p><code>String myCode = preReq.getSourceCode();</code></p>
48 */
49public class Collection extends ItemGroup {
50
51
52 private RequestAuth auth = null;
53 private HashMap<String, String> info;
54 private PropertyList<Property> variable = null;
55
56
57 /**
58 * Moves an item in the array of items contained by this collection from one parent to another.
59 *
60 * @param itemToMoveKey
61 * @param parentKey
62 * @throws InvalidCollectionActionException If either the parent or item to be moved aren't present in the <code>item</code> array
63 */
64 public void moveItem(String itemToMoveKey, String parentKey) throws RecursiveItemAddException, InvalidCollectionActionException {
65 Item itemToMove = this.getItem(itemToMoveKey);
66 Folder parent = this.getFolder(parentKey);
67
68 if (itemToMove == null || parent == null) {
69 throw new InvalidCollectionActionException("Attempt to move a null item, or an item to a null parent");
70 }
71
72
73 this.moveItem(itemToMove, parent);
74
75 }
76
77
78 /**
79 * Convenience method to add an item with no child items to this collection.
80 *
81 * @param name The name for the new item
82 * @throws RecursiveItemAddException
83 * @throws IllegalPropertyAccessException
84 */
85 public Folder addFolder(String name) throws RecursiveItemAddException, IllegalPropertyAccessException {
86 Folder newFolder = new Folder(name);
87 this.addItem(newFolder);
88 return newFolder;
89
90 }
91
92 /**
93 * Convenience method to add an item with no child items to this collection.
94 *
95 * @param name The name for the new item
96 * @throws RecursiveItemAddException
97 * @throws IllegalPropertyAccessException
98 */
99 public Folder addFolder(String name, int index) throws RecursiveItemAddException, IllegalPropertyAccessException {
100 Folder newFolder = new Folder(name);
101 this.addItem(newFolder, index);
102 return newFolder;
103
104 }
105
106

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected