insert method
Inserts a LfpInventory
resource for the given target merchant account.
If the resource already exists, it will be replaced. The inventory automatically expires after 30 days.
request
- The metadata request object.
Request parameters:
parent
- Required. The LFP provider account. Format:
accounts/{account}
Value must have pattern ^accounts/\[^/\]+$
.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a LfpInventory.
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<LfpInventory> insert(
LfpInventory request,
core.String parent, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if ($fields != null) 'fields': [$fields],
};
final url_ =
'lfp/v1/' + core.Uri.encodeFull('$parent') + '/lfpInventories:insert';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return LfpInventory.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}