|
| 1 | +/* |
| 2 | + * Zed Attack Proxy (ZAP) and its related class files. |
| 3 | + * |
| 4 | + * ZAP is an HTTP/HTTPS proxy for assessing web application security. |
| 5 | + * |
| 6 | + * Copyright 2018 The ZAP Development Team |
| 7 | + * |
| 8 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 9 | + * you may not use this file except in compliance with the License. |
| 10 | + * You may obtain a copy of the License at |
| 11 | + * |
| 12 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | + * |
| 14 | + * Unless required by applicable law or agreed to in writing, software |
| 15 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 16 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 | + * See the License for the specific language governing permissions and |
| 18 | + * limitations under the License. |
| 19 | + */ |
| 20 | +package org.zaproxy.clientapi.gen; |
| 21 | + |
| 22 | +import java.util.HashMap; |
| 23 | +import java.util.Map; |
| 24 | +import org.zaproxy.clientapi.core.ApiResponse; |
| 25 | +import org.zaproxy.clientapi.core.ClientApi; |
| 26 | +import org.zaproxy.clientapi.core.ClientApiException; |
| 27 | + |
| 28 | +/** This file was automatically generated. */ |
| 29 | +@SuppressWarnings("javadoc") |
| 30 | +public class Websocket { |
| 31 | + |
| 32 | + private final ClientApi api; |
| 33 | + |
| 34 | + public Websocket(ClientApi api) { |
| 35 | + this.api = api; |
| 36 | + } |
| 37 | + |
| 38 | + /** |
| 39 | + * Returns all of the registered web socket channels |
| 40 | + * |
| 41 | + * <p>This component is optional and therefore the API will only work if it is installed |
| 42 | + */ |
| 43 | + public ApiResponse channels() throws ClientApiException { |
| 44 | + return api.callApi("websocket", "view", "channels", null); |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * Returns full details of the message specified by the channelId and messageId |
| 49 | + * |
| 50 | + * <p>This component is optional and therefore the API will only work if it is installed |
| 51 | + */ |
| 52 | + public ApiResponse message(String channelid, String messageid) throws ClientApiException { |
| 53 | + Map<String, String> map = new HashMap<>(); |
| 54 | + map.put("channelId", channelid); |
| 55 | + map.put("messageId", messageid); |
| 56 | + return api.callApi("websocket", "view", "message", map); |
| 57 | + } |
| 58 | + |
| 59 | + /** |
| 60 | + * Returns a list of all of the messages that meet the given criteria (all optional), where |
| 61 | + * channelId is a channel identifier, start is the offset to start returning messages from |
| 62 | + * (starting from 0), count is the number of messages to return (default no limit) and |
| 63 | + * payloadPreviewLength is the maximum number bytes to return for the payload contents |
| 64 | + * |
| 65 | + * <p>This component is optional and therefore the API will only work if it is installed |
| 66 | + */ |
| 67 | + public ApiResponse messages( |
| 68 | + String channelid, String start, String count, String payloadpreviewlength) |
| 69 | + throws ClientApiException { |
| 70 | + Map<String, String> map = new HashMap<>(); |
| 71 | + if (channelid != null) { |
| 72 | + map.put("channelId", channelid); |
| 73 | + } |
| 74 | + if (start != null) { |
| 75 | + map.put("start", start); |
| 76 | + } |
| 77 | + if (count != null) { |
| 78 | + map.put("count", count); |
| 79 | + } |
| 80 | + if (payloadpreviewlength != null) { |
| 81 | + map.put("payloadPreviewLength", payloadpreviewlength); |
| 82 | + } |
| 83 | + return api.callApi("websocket", "view", "messages", map); |
| 84 | + } |
| 85 | + |
| 86 | + /** |
| 87 | + * Sends the specified message on the channel specified by channelId, if outgoing is 'True' then |
| 88 | + * the message will be sent to the server and if it is 'False' then it will be sent to the |
| 89 | + * client |
| 90 | + * |
| 91 | + * <p>This component is optional and therefore the API will only work if it is installed |
| 92 | + */ |
| 93 | + public ApiResponse sendTextMessage(String channelid, String outgoing, String message) |
| 94 | + throws ClientApiException { |
| 95 | + Map<String, String> map = new HashMap<>(); |
| 96 | + map.put("channelId", channelid); |
| 97 | + map.put("outgoing", outgoing); |
| 98 | + map.put("message", message); |
| 99 | + return api.callApi("websocket", "action", "sendTextMessage", map); |
| 100 | + } |
| 101 | +} |
0 commit comments