[DO-1648] add new method (!67)

Co-authored-by: Rustam Tagaev <rustam.tagaev@avroid.tech>
Co-authored-by: Denis Patrakeev <denis.patrakeev@avroid.team>
Reviewed-on: https://git.avroid.tech/DevOps/jenkins-shared-lib/pulls/67
Reviewed-by: Vasiliy Chipizhin <vasiliy.chipizhin@avroid.team>
Reviewed-by: Denis Patrakeev <denis.patrakeev@avroid.team>
Co-authored-by: Rustam Tagaev <rustam.tagaev@avroid.team>
Co-committed-by: Rustam Tagaev <rustam.tagaev@avroid.team>
This commit is contained in:
Rustam Tagaev
2025-02-27 18:57:42 +03:00
committed by Denis Patrakeev
parent 9acb0056ef
commit c42d689696

View File

@@ -69,11 +69,12 @@ class Eva implements Serializable {
}
/**
* Getting Eva task information
* Getting Eva task information @Deprecated use getTaskInfo
* @param filterValue String - value for search task
* @param filterParam String - type of filter for search task. Default value - "code"
* @return String - id of task
*/
@Deprecated
private String getTask(String filterValue, String filterParam = "code") {
Map body = [
jsonrpc: "1.2",
@@ -93,4 +94,30 @@ class Eva implements Serializable {
).content.toString()
}
}
/**
* Getting Eva task information
* @param filterValue String - value for search task
* @param filterParam String - type of filter for search task. Default value - "code"
* @return Map - fields' task
*/
public Map getTaskInfo(String filterValue, String filterParam = "code") {
Map body = [
jsonrpc: "1.2",
method: "CmfTask.get",
kwargs: [
filter: [filterParam, "==", filterValue],
]]
script.withCredentials([script.string(credentialsId: creds, variable: 'token')]) {
return script.readJSON( text: script.httpRequest(
url: "$host/api/",
contentType: 'APPLICATION_JSON',
httpMode: 'POST',
customHeaders: [[name: 'Authorization', value: "Bearer $script.token"]],
validResponseCodes: '200',
requestBody: JsonOutput.toJson(body)
).content.toString())['result']
}
}
}