triggeraction method
- TriggerActionPayload request,
- String merchantId, {
- String? languageCode,
- String? $fields,
Start an action.
The action can be requested by merchants in third-party application.
Before merchants can request the action, the third-party application needs
to show them action specific content and display a user input form. The
action can be successfully started only once all required
inputs are
provided. If any required
input is missing, or invalid value was
provided, the service will return 400 error. Validation errors will
contain Ids for all problematic field together with translated, human
readable error messages that can be shown to the user.
request
- The metadata request object.
Request parameters:
merchantId
- Required. The ID of the merchant's account.
languageCode
- Optional. Language code
IETF BCP 47 syntax used to localize
the response. If not set, the result will be in default language en-US
.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a TriggerActionResponse.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<TriggerActionResponse> triggeraction(
TriggerActionPayload request,
core.String merchantId, {
core.String? languageCode,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if (languageCode != null) 'languageCode': [languageCode],
if ($fields != null) 'fields': [$fields],
};
final url_ = commons.escapeVariable('$merchantId') +
'/merchantsupport/triggeraction';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return TriggerActionResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}