api net - SAP-archive/xsk GitHub Wiki

$.net API

Represents the network namespace with its fields.

Reference

  • SAP Help

https://help.sap.com/doc/3de842783af24336b6305a3c0223a369/2.0.03/en-US/$.net.html

  • Module

https://github.com/SAP/xsk/tree/main/modules/api/api-xsjs/src/main/resources/META-INF/dirigible/xsk/net

  • Sample usage:
let net = $.net;

// Create a mail Object
let mail = new net.Mail({
   sender: {address: "[email protected]"},
   to: [{ name: "John Doe", address: "[email protected]"}, {name: "Jane Doe", address: "[email protected]"}],
   cc: [{address: "[email protected]"}, {address: "[email protected]"}],
   bcc: [{ name: "Jonnie Doe", address: "[email protected]"}],
   subject: "subject",
   subjectEncoding: "UTF-8",
   parts: [ new net.Mail.Part({
       type: net.Mail.Part.TYPE_TEXT,
       text: "The body of the mail.",
       contentType: "text/plain",
       encoding: "UTF-8",
   })]
});

// Set mail server configuration.
let mailConfig = {
    "mail.user": "<your-user>",
    "mail.password": "<your-password>",
    "mail.transport.protocol": "smtps",
    "mail.smtps.host": "<your-mail-provider-host>",
    "mail.smtps.port": "465",
    "mail.smtps.auth": "true"
};

let smtp = new net.SMTPConnection(mailConfig);
// Send the mail Object with SMPT
smtp.send(mail);

// Send the mail Object from the built-in mail send method.
let returnValue = mail.send(mailConfig);

$.response.setBody(JSON.stringify(returnValue));
  • Coverage
Classes Description Status
Mail Class for constructing and sending multipart emails. ✅
SMTPConnection Class for sending $.net.Mail objects via SMTP connection. ✅
Destination Contains metadata, for example, host name and port number. ✅
Members Description Status
http Provides access to the http API. ✅
  • Namespaces -> htttp

  • HTTP constants for methods

Members Type Default Description Status
OPTIONS number 0 HTTP Method OPTIONS. ✅
GET number 1 HTTP Method GET. ✅
HEAD number 2 HTTP Method HEAD. ✅
POST number 3 HTTP Method POST. ✅
PUT number 4 HTTP Method PUT. ✅
DEL number 5 HTTP Method DEL. ✅
TRACE number 6 HTTP Method TRACE. ✅
CONNECT number 7 HTTP Method CONNECT. ✅
PATCH number 8 HTTP Method PATCH. ✅
  • HTTP constants for status codes
Members Type Default Status
CONTINUE number 100 ✅
SWITCH_PROTOCOL number 101 ✅
OK number 200 ✅
CREATED number 201 ✅
ACCEPTED number 202 ✅
NON_AUTHORITATIVE number 203 ✅
NO_CONTENT number 204 ✅
RESET_CONTENT number 205 ✅
PARTIAL_CONTENT number 206 ✅
MULTIPLE_CHOICES number 300 ✅
MOVED_PERMANENTLY number 301 ✅
FOUND number 302 ✅
SEE_OTHER number 303 ✅
NOT_MODIFIED number 304 ✅
USE_PROXY number 305 ✅
TEMPORARY_REDIRECT number 307 ✅
BAD_REQUEST number 400 ✅
UNAUTHORIZED number 401 ✅
PAYMENT_REQUIRED number 402 ✅
FORBIDDEN number 403 ✅
NOT_FOUND number 404 ✅
METHOD_NOT_ALLOWED number 405 ✅
NOT_ACCEPTABLE number 406 ✅
PROXY_AUTH_REQUIRED number 407 ✅
REQUEST_TIMEOUT number 408 ✅
CONFLICT number 409 ✅
GONE number 410 ✅
LENGTH_REQUIRED number 411 ✅
PRECONDITION_FAILED number 412 ✅
REQUEST_ENTITY_TOO_LARGE number 413 ✅
REQUEST_URI_TOO_LONG number 414 ✅
UNSUPPORTED_MEDIA_TYPE number 415 ✅
REQUESTED_RANGE_NOT_SATISFIABLE number 416 ✅
EXPECTATION_FAILED number 417 ✅
INTERNAL_SERVER_ERROR number 500 ✅
NOT_YET_IMPLEMENTED number 501 ✅
BAD_GATEWAY number 502 ✅
SERVICE_UNAVAILABLE number 503 ✅
GATEWAY_TIMEOUT number 504 ✅
HTTP_VERSION_NOT_SUPPORTED number 505 ✅
  • Issues

https://github.com/SAP/xsk/issues/19

  • Unit Tests

https://github.com/SAP/xsk/tree/main/modules/engines/engine-xsjs/src/test/resources/test/xsk/net/net.xsjs

  • Integration Tests ❌

Wiki icons legend

✅ - Feature implemented and working as supposed.
⚠️ - Feature partially implemented and needs to be finished.
❌ - Feature not implemented yet.

⚠️ **GitHub.com Fallback** ⚠️