Class Service
Base class of Services.
A service represents a call-specific configuration. Any configuration set here is local to the currently executing call.
See Also:
FTPService, HTTPFormService, HTTPService, SOAPService
| Property | Description |
|---|---|
| URL: String | Returns the current URL, excluding any custom query parameters. |
configuration: ServiceConfig (read-only) | Returns the Service Configuration. |
| credentialID: String | Returns the ID of the currently associated Credential. |
| mock: Boolean | Returns the status of whether this service is executing in mock mode. |
requestData: Object (read-only) | Returns the property that stores the object returned by createRequest. |
response: Object (read-only) | Returns the property that stores the object returned by the service. |
| throwOnError: Boolean | Returns the status of whether this service will throw an error when encountering a problem. |
This class does not have a constructor, so you cannot create it directly.
| Method | Description |
|---|---|
| call(Object...) | Invokes the service. |
| getConfiguration() | Returns the Service Configuration. |
| getCredentialID() | Returns the ID of the currently associated Credential. |
| getRequestData() | Returns the property that stores the object returned by createRequest. |
| getResponse() | Returns the property that stores the object returned by the service. |
| getURL() | Returns the current URL, excluding any custom query parameters. |
| isMock() | Returns the status of whether this service is executing in mock mode. |
| isThrowOnError() | Returns the status of whether this service will throw an error when encountering a problem. |
| setCredentialID(String) | Override the Credential by the credential object with the given ID. |
| setMock() | Forces the mock mode to be enabled. |
| setThrowOnError() | Forces a Service to throw an error when there is a problem instead of returning a Result with non-OK status. |
| setURL(String) | Override the URL to the given value. |
assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values
- URL: String
Returns the current URL, excluding any custom query parameters.
- configuration: ServiceConfig
(read-only) Returns the Service Configuration.
- credentialID: String
Returns the ID of the currently associated Credential.
- mock: Boolean
Returns the status of whether this service is executing in mock mode.
- requestData: Object
(read-only) Returns the property that stores the object returned by createRequest.
- response: Object
(read-only) Returns the property that stores the object returned by the service.
This property is only useful after the service call(Object...) completes, and is the same as the object inside the Result.
- throwOnError: Boolean
Returns the status of whether this service will throw an error when encountering a problem.
- call(args: Object...): Result
Invokes the service.
Parameters:
- args - Arguments to pass. If there is a single argument and that argument is an array, then each item in the array will become a separate argument. For example, the following results in three separate arguments to the service:
- getConfiguration(): ServiceConfig
Returns the Service Configuration.
Returns:
- Service Configuration.
- getCredentialID(): String
Returns the ID of the currently associated Credential.
Returns:
- Credential Name.
- getRequestData(): Object
Returns the property that stores the object returned by createRequest.
Returns:
- Object returned by createRequest.
- getResponse(): Object
Returns the property that stores the object returned by the service.
This property is only useful after the service call(Object...) completes, and is the same as the object inside the Result.
Returns:
- Object returned by the service.
- getURL(): String
Returns the current URL, excluding any custom query parameters.
Returns:
- URL.
- isMock(): Boolean
Returns the status of whether this service is executing in mock mode.
Returns:
- true for mock mode, false otherwise.
- isThrowOnError(): Boolean
Returns the status of whether this service will throw an error when encountering a problem.
Returns:
- true to throw an error, false otherwise.
- setCredentialID(id: String): Service
Override the Credential by the credential object with the given ID.
If the URL is also overridden, that URL will continue to override the URL in this credential.
Parameters:
- id - Credential ID. It must exist.
Returns:
- this Service.
- setMock(): Service
Forces the mock mode to be enabled.
Returns:
- this Service.
- setThrowOnError(): Service
Forces a Service to throw an error when there is a problem instead of returning a Result with non-OK status.
Returns:
- this Service.
- setURL(url: String): Service
Override the URL to the given value. Any query parameters (if applicable) will be appended to this URL.
Parameters:
- url - Force the URL to the given value.
Returns:
- this Service.