GW2GetIdInfo
Glasswall engine द्वारा पहचानी और रिपोर्ट की गई प्रत्येक समस्या से एक अद्वितीय issue ID जुड़ी होती है। यह API किसी दिए गए Issue ID संख्या के लिए एक विवरण प्रदान करता है।
- C++
- C#
- Java
- Python
- JavaScript
सारांश
सत्र session के लिए, GW2GetIdInfo, outputBuffer द्वारा इंगित ऑब्जेक्ट में, Glasswall Issue ID issueId के विवरण के लिए एक pointer रखता है। विवरण की लंबाई, bytes में, bufferLength द्वारा इंगित size_t ऑब्जेक्ट में रखी जाती है।
#include "glasswall.core2.api.h"
int GW2GetIdInfo(
Session session,
size_t issueId,
size_t *bufferLength,
char **outputBuffer);
रिटर्न
एक integer GW2_RetStatus enum मान लौटाता है। Negative numbers विफलता को दर्शाते हैं। सफल होने पर, output buffer को Issue Description से भर दिया जाता है।
उदाहरण
#include "glasswall.core2.api.h"
char *outbuf = NULL;
size_t buflen = 0;
if (GW2OpenSession() < 0)
/* error opening session */
else
{
int status = GW2GetIdInfo(session, issueId, &buflen, &outbuf);
/* outbuf points to a buffer containing the XML file.
* Either process the data pointed to, or copy the data and process it
* after GW2CloseSession is called
*/
if (GW2CloseSession() < 0)
/* error closing session */
}
सारांश
public int GetIdInfo(
int session,
uint IssueID,
ref UIntPtr bufferLength,
out IntPtr outputBuffer)
रिटर्न
एक integer GW2_RetStatus enum मान लौटाता है। Negative numbers विफलता को दर्शाते हैं। सफल होने पर, output buffer को Issue Description से भर दिया जाता है।
उदाहरण
using glasswall_core2;
...
Glasswall glasswall = new Glasswall(); // Instance of the Glasswall wrapper
int session = glasswall.OpenSession();
int returnStatus = glasswall.GetIdInfo(session, 96, ref bufferLength, out buffer);
if (bufferLength >= 0)
{
byte[] msgArray = glasswall.CreateArrayFromBuffer(buffer, bufferLength);
// Error description for issue ID 96 now stored in a byte array
}
if (glasswall.CloseSession(session))
{
// Error Handling
}
सारांश
import com.glasswall.core2javabridge.*;
public String GW2GetIdInfoString(int session, int issueId) throws GlasswallException
विवरण
इस functionality के लिए पहले ID डेटा प्राप्त करने हेतु दो अलग-अलग function calls की आवश्यकता होती थी। अब इसे सुव्यवस्थित करके settings को String के रूप में लौटाया जाता है। मूल दो functions को deprecated कर दिया गया है।
रिटर्न
The GW2GetIdInfoString function returns a String containing a description of the given issueId
A GlasswallException exception will be thrown if session is invalid, or if the issueId description could not be retrieved.
सारांश - अप्रचलित फ़ंक्शन
import com.glasswall.core2javabridge.*;
(Deprecated)
public int GW2GetIdInfo(int session, int issueId) throws GlasswallException
public byte[] GetIDBuffer(int session) throws GlasswallException
विवरण - Deprecated Functions
The GW2GetIdInfo function outputs the description of a given issueId for a given session to the internal ID Buffer. Retrieve this data through use of GetIDBuffer function.
रिटर्न्स - अप्रचलित फ़ंक्शन
GW2GetIdInfo फ़ंक्शन GW2_RetStatus enumeration को int में convert करके लौटाता है। यदि कोई त्रुटि हुई है, तो मान negative होगा। 0 सफलता को दर्शाता है। विवरण के लिए API Overview/Return types देखें।
GetIDBuffer ID विवरण वाला एक byte[] लौटाता है। यदि GetIDBuffer को call नहीं किया गया है, तो यह null होगा।
A GlasswallException exception will be thrown if session is invalid, or if the issue description could not be retrieved.
सारांश
दिए गए Issue ID के लिए समूह विवरण प्राप्त करता है।
def get_id_info(self, issue_id: int, raise_unsupported: bool = True):
""" Retrieves the group description for the given Issue ID. e.g. issue_id 96 returns "Document Processing Instances"
Args:
issue_id (int): The issue id.
raise_unsupported (bool, optional): Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
Returns:
id_info (str): The group description for the given Issue ID.
"""
रिटर्न
एक string, दिए गए Issue ID के लिए समूह विवरण।
सारांश
यह function किसी निर्दिष्ट स्थान पर निर्दिष्ट IssueID के विवरण के लिए एक pointer रखता है।
/**
*
* @param {number} session The ID of the session.
* @param {number} issueId The ID of the issue.
* @param {number} bufferLength The length of the buffer.
* @param {string} outputBuffer The location of the output buffer.
*/
GW2GetIdInfo(
session,
issueId,
bufferLength,
outputBuffer)
रिटर्न
एक integer GW2_RetStatus enum मान लौटाता है। Negative numbers विफलता को दर्शाते हैं। सफल होने पर, output buffer को Issue Description से भर दिया जाता है।
उदाहरण
const ref = require('ref-napi');
...
function buffer_to_string(buffer, buffer_size) {
if (!buffer.isNull() && ref.deref(buffer_size) > 0) {
return Buffer.from(ref.reinterpret(ref.deref(buffer), ref.deref(buffer_size), 0)).toString();
}
else {
return "";
}
}
...
output_file_buffer = ref.alloc(ref.refType(ref.types.CString));
output_buffer_size = ref.alloc(ref.types.size_t, 0);
return_status = gw.GW2GetIdInfo(session_id, 96, output_buffer_size, output_file_buffer);
let error_description = buffer_to_string(output_file_buffer, output_buffer_size);
...