setPublishSettings method

Future<SetPublishSettingsResponse> setPublishSettings(
  1. SetPublishSettingsRequest request,
  2. String formId, {
  3. String? $fields,
})

Updates the publish settings of a form.

Legacy forms aren't supported because they don't have the publish_settings field.

request - The metadata request object.

Request parameters:

formId - Required. The ID of the form. You can get the id from Form.form_id field.

$fields - Selector specifying which fields to include in a partial response.

Completes with a SetPublishSettingsResponse.

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<SetPublishSettingsResponse> setPublishSettings(
  SetPublishSettingsRequest request,
  core.String formId, {
  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_ =
      'v1/forms/' + commons.escapeVariable('$formId') + ':setPublishSettings';

  final response_ = await _requester.request(
    url_,
    'POST',
    body: body_,
    queryParams: queryParams_,
  );
  return SetPublishSettingsResponse.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}