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

Class Event

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

Encapsulates members of the event array object. Events contain pre-request and test scripts for Folders, Requests, and Collections Postman SDK analog: event . "event": [ { "liste

Source from the content-addressed store, hash-verified

47 *
48 */
49public class Event extends CollectionElement {
50
51 private String listen = ""; // basically the name
52 private PostmanScript script = null;
53
54 /**
55 *
56 * Create a new Event object with the specified EventType (eg., pre-request or test) and source code. The <code>type</code> property is excluded because it is always 'text/javascript',
57 * although the schema does theoretically allow for different values
58 *
59 *
60 * @param evtType Enumerated value of the event type, eg. pre-request or test
61 * @param sourceCode Source code for the script
62 * @param evtType Content type of the script, always "text/javascript"
63 *
64 */
65 public Event(enumEventType evtType, String sourceCode) {
66 this.setEventType(evtType);
67 this.setScript(new PostmanScript(this.getScriptType(), sourceCode));
68 }
69
70
71 /**
72 *
73 * Unimplemented because type is always text/javascript
74 /*
75 public void setScriptType(String scriptType) {
76 this.script.setType(scriptType);
77 }
78 */
79
80
81 /**
82 * @return String
83 */
84 public String getScriptType() {
85 //return this.script.getType();
86 return "text/javascript";
87 }
88
89
90 /**
91 *
92 * Returns the type of this script, eg., pre-request or test, as an enumerated value.
93 *
94 * @return enumEventType The event type
95 */
96 public enumEventType getEventType() {
97 if (this.getListen().equals("test")) {
98 return enumEventType.TEST;
99 } else if (this.getListen().equals("prerequest")) {
100 return enumEventType.PRE_REQUEST;
101 } else {
102 return null;
103 }
104 }
105
106

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected