Skip to content

Commit ed66669

Browse files
feat: Automated regeneration of Forms client (#13133)
Auto-created at 2025-03-11 13:16:39 +0000 using the toys pull request generator.
1 parent ac15abf commit ed66669

File tree

7 files changed

+261
-1
lines changed

7 files changed

+261
-1
lines changed

clients/forms/lib/google_api/forms/v1/api/forms.ex

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ defmodule GoogleApi.Forms.V1.Api.Forms do
105105
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
106106
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
107107
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
108+
* `:unpublished` (*type:* `boolean()`) - Optional. Whether the form is unpublished. If set to `true`, the form doesn't accept responses. If set to `false` or unset, the form is published and accepts responses.
108109
* `:body` (*type:* `GoogleApi.Forms.V1.Model.Form.t`) -
109110
* `opts` (*type:* `keyword()`) - Call options
110111
@@ -131,6 +132,7 @@ defmodule GoogleApi.Forms.V1.Api.Forms do
131132
:quotaUser => :query,
132133
:uploadType => :query,
133134
:upload_protocol => :query,
135+
:unpublished => :query,
134136
:body => :body
135137
}
136138

@@ -206,6 +208,68 @@ defmodule GoogleApi.Forms.V1.Api.Forms do
206208
|> Response.decode(opts ++ [struct: %GoogleApi.Forms.V1.Model.Form{}])
207209
end
208210

211+
@doc """
212+
Updates the publish settings of a form. Legacy forms aren't supported because they don't have the `publish_settings` field.
213+
214+
## Parameters
215+
216+
* `connection` (*type:* `GoogleApi.Forms.V1.Connection.t`) - Connection to server
217+
* `form_id` (*type:* `String.t`) - Required. The ID of the form. You can get the id from `Form.form_id` field.
218+
* `optional_params` (*type:* `keyword()`) - Optional parameters
219+
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
220+
* `:access_token` (*type:* `String.t`) - OAuth access token.
221+
* `:alt` (*type:* `String.t`) - Data format for response.
222+
* `:callback` (*type:* `String.t`) - JSONP
223+
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
224+
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
225+
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
226+
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
227+
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
228+
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
229+
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
230+
* `:body` (*type:* `GoogleApi.Forms.V1.Model.SetPublishSettingsRequest.t`) -
231+
* `opts` (*type:* `keyword()`) - Call options
232+
233+
## Returns
234+
235+
* `{:ok, %GoogleApi.Forms.V1.Model.SetPublishSettingsResponse{}}` on success
236+
* `{:error, info}` on failure
237+
"""
238+
@spec forms_forms_set_publish_settings(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
239+
{:ok, GoogleApi.Forms.V1.Model.SetPublishSettingsResponse.t()}
240+
| {:ok, Tesla.Env.t()}
241+
| {:ok, list()}
242+
| {:error, any()}
243+
def forms_forms_set_publish_settings(connection, form_id, optional_params \\ [], opts \\ []) do
244+
optional_params_config = %{
245+
:"$.xgafv" => :query,
246+
:access_token => :query,
247+
:alt => :query,
248+
:callback => :query,
249+
:fields => :query,
250+
:key => :query,
251+
:oauth_token => :query,
252+
:prettyPrint => :query,
253+
:quotaUser => :query,
254+
:uploadType => :query,
255+
:upload_protocol => :query,
256+
:body => :body
257+
}
258+
259+
request =
260+
Request.new()
261+
|> Request.method(:post)
262+
|> Request.url("/v1/forms/{formId}:setPublishSettings", %{
263+
"formId" => URI.encode(form_id, &URI.char_unreserved?/1)
264+
})
265+
|> Request.add_optional_params(optional_params_config, optional_params)
266+
|> Request.library_version(@library_version)
267+
268+
connection
269+
|> Connection.execute(request)
270+
|> Response.decode(opts ++ [struct: %GoogleApi.Forms.V1.Model.SetPublishSettingsResponse{}])
271+
end
272+
209273
@doc """
210274
Get one response from the form.
211275

clients/forms/lib/google_api/forms/v1/metadata.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ defmodule GoogleApi.Forms.V1 do
2020
API client metadata for GoogleApi.Forms.V1.
2121
"""
2222

23-
@discovery_revision "20250218"
23+
@discovery_revision "20250304"
2424

2525
def discovery_revision(), do: @discovery_revision
2626
end

clients/forms/lib/google_api/forms/v1/model/form.ex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ defmodule GoogleApi.Forms.V1.Model.Form do
2525
* `info` (*type:* `GoogleApi.Forms.V1.Model.Info.t`, *default:* `nil`) - Required. The title and description of the form.
2626
* `items` (*type:* `list(GoogleApi.Forms.V1.Model.Item.t)`, *default:* `nil`) - Required. A list of the form's items, which can include section headers, questions, embedded media, etc.
2727
* `linkedSheetId` (*type:* `String.t`, *default:* `nil`) - Output only. The ID of the linked Google Sheet which is accumulating responses from this Form (if such a Sheet exists).
28+
* `publishSettings` (*type:* `GoogleApi.Forms.V1.Model.PublishSettings.t`, *default:* `nil`) - Output only. The publishing settings for a form. This field isn't set for legacy forms because they don't have the `publish_settings` field. All newly created forms support publish settings. Forms with `publish_settings` value set can call UpdatePublishSettings API to publish or unpublish the form.
2829
* `responderUri` (*type:* `String.t`, *default:* `nil`) - Output only. The form URI to share with responders. This opens a page that allows the user to submit responses but not edit the questions.
2930
* `revisionId` (*type:* `String.t`, *default:* `nil`) - Output only. The revision ID of the form. Used in the WriteControl in update requests to identify the revision on which the changes are based. The format of the revision ID may change over time, so it should be treated opaquely. A returned revision ID is only guaranteed to be valid for 24 hours after it has been returned and cannot be shared across users. If the revision ID is unchanged between calls, then the form has not changed. Conversely, a changed ID (for the same form and user) usually means the form has been updated; however, a changed ID can also be due to internal factors such as ID format changes.
3031
* `settings` (*type:* `GoogleApi.Forms.V1.Model.FormSettings.t`, *default:* `nil`) - The form's settings. This must be updated with UpdateSettingsRequest; it is ignored during `forms.create` and UpdateFormInfoRequest.
@@ -37,6 +38,7 @@ defmodule GoogleApi.Forms.V1.Model.Form do
3738
:info => GoogleApi.Forms.V1.Model.Info.t() | nil,
3839
:items => list(GoogleApi.Forms.V1.Model.Item.t()) | nil,
3940
:linkedSheetId => String.t() | nil,
41+
:publishSettings => GoogleApi.Forms.V1.Model.PublishSettings.t() | nil,
4042
:responderUri => String.t() | nil,
4143
:revisionId => String.t() | nil,
4244
:settings => GoogleApi.Forms.V1.Model.FormSettings.t() | nil
@@ -46,6 +48,7 @@ defmodule GoogleApi.Forms.V1.Model.Form do
4648
field(:info, as: GoogleApi.Forms.V1.Model.Info)
4749
field(:items, as: GoogleApi.Forms.V1.Model.Item, type: :list)
4850
field(:linkedSheetId)
51+
field(:publishSettings, as: GoogleApi.Forms.V1.Model.PublishSettings)
4952
field(:responderUri)
5053
field(:revisionId)
5154
field(:settings, as: GoogleApi.Forms.V1.Model.FormSettings)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright 2019 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# NOTE: This file is auto generated by the elixir code generator program.
16+
# Do not edit this file manually.
17+
18+
defmodule GoogleApi.Forms.V1.Model.PublishSettings do
19+
@moduledoc """
20+
The publishing settings of a form.
21+
22+
## Attributes
23+
24+
* `publishState` (*type:* `GoogleApi.Forms.V1.Model.PublishState.t`, *default:* `nil`) - Optional. The publishing state of a form. When updating `publish_state`, both `is_published` and `is_accepting_responses` must be set. However, setting `is_accepting_responses` to `true` and `is_published` to `false` isn't supported and returns an error.
25+
"""
26+
27+
use GoogleApi.Gax.ModelBase
28+
29+
@type t :: %__MODULE__{
30+
:publishState => GoogleApi.Forms.V1.Model.PublishState.t() | nil
31+
}
32+
33+
field(:publishState, as: GoogleApi.Forms.V1.Model.PublishState)
34+
end
35+
36+
defimpl Poison.Decoder, for: GoogleApi.Forms.V1.Model.PublishSettings do
37+
def decode(value, options) do
38+
GoogleApi.Forms.V1.Model.PublishSettings.decode(value, options)
39+
end
40+
end
41+
42+
defimpl Poison.Encoder, for: GoogleApi.Forms.V1.Model.PublishSettings do
43+
def encode(value, options) do
44+
GoogleApi.Gax.ModelBase.encode(value, options)
45+
end
46+
end
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Copyright 2019 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# NOTE: This file is auto generated by the elixir code generator program.
16+
# Do not edit this file manually.
17+
18+
defmodule GoogleApi.Forms.V1.Model.PublishState do
19+
@moduledoc """
20+
The publishing state of a form.
21+
22+
## Attributes
23+
24+
* `isAcceptingResponses` (*type:* `boolean()`, *default:* `nil`) - Required. Whether the form accepts responses. If `is_published` is set to `false`, this field is forced to `false`.
25+
* `isPublished` (*type:* `boolean()`, *default:* `nil`) - Required. Whether the form is published and visible to others.
26+
"""
27+
28+
use GoogleApi.Gax.ModelBase
29+
30+
@type t :: %__MODULE__{
31+
:isAcceptingResponses => boolean() | nil,
32+
:isPublished => boolean() | nil
33+
}
34+
35+
field(:isAcceptingResponses)
36+
field(:isPublished)
37+
end
38+
39+
defimpl Poison.Decoder, for: GoogleApi.Forms.V1.Model.PublishState do
40+
def decode(value, options) do
41+
GoogleApi.Forms.V1.Model.PublishState.decode(value, options)
42+
end
43+
end
44+
45+
defimpl Poison.Encoder, for: GoogleApi.Forms.V1.Model.PublishState do
46+
def encode(value, options) do
47+
GoogleApi.Gax.ModelBase.encode(value, options)
48+
end
49+
end
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Copyright 2019 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# NOTE: This file is auto generated by the elixir code generator program.
16+
# Do not edit this file manually.
17+
18+
defmodule GoogleApi.Forms.V1.Model.SetPublishSettingsRequest do
19+
@moduledoc """
20+
Updates the publish settings of a Form.
21+
22+
## Attributes
23+
24+
* `publishSettings` (*type:* `GoogleApi.Forms.V1.Model.PublishSettings.t`, *default:* `nil`) - Required. The desired publish settings to apply to the form.
25+
* `updateMask` (*type:* `String.t`, *default:* `nil`) - Optional. The `publish_settings` fields to update. This field mask accepts the following values: * `publish_state`: Updates or replaces all `publish_state` settings. * `"*"`: Updates or replaces all `publish_settings` fields.
26+
"""
27+
28+
use GoogleApi.Gax.ModelBase
29+
30+
@type t :: %__MODULE__{
31+
:publishSettings => GoogleApi.Forms.V1.Model.PublishSettings.t() | nil,
32+
:updateMask => String.t() | nil
33+
}
34+
35+
field(:publishSettings, as: GoogleApi.Forms.V1.Model.PublishSettings)
36+
field(:updateMask)
37+
end
38+
39+
defimpl Poison.Decoder, for: GoogleApi.Forms.V1.Model.SetPublishSettingsRequest do
40+
def decode(value, options) do
41+
GoogleApi.Forms.V1.Model.SetPublishSettingsRequest.decode(value, options)
42+
end
43+
end
44+
45+
defimpl Poison.Encoder, for: GoogleApi.Forms.V1.Model.SetPublishSettingsRequest do
46+
def encode(value, options) do
47+
GoogleApi.Gax.ModelBase.encode(value, options)
48+
end
49+
end
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Copyright 2019 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# NOTE: This file is auto generated by the elixir code generator program.
16+
# Do not edit this file manually.
17+
18+
defmodule GoogleApi.Forms.V1.Model.SetPublishSettingsResponse do
19+
@moduledoc """
20+
The response of a `SetPublishSettings` request.
21+
22+
## Attributes
23+
24+
* `formId` (*type:* `String.t`, *default:* `nil`) - Required. The ID of the Form. This is same as the `Form.form_id` field.
25+
* `publishSettings` (*type:* `GoogleApi.Forms.V1.Model.PublishSettings.t`, *default:* `nil`) - The publish settings of the form.
26+
"""
27+
28+
use GoogleApi.Gax.ModelBase
29+
30+
@type t :: %__MODULE__{
31+
:formId => String.t() | nil,
32+
:publishSettings => GoogleApi.Forms.V1.Model.PublishSettings.t() | nil
33+
}
34+
35+
field(:formId)
36+
field(:publishSettings, as: GoogleApi.Forms.V1.Model.PublishSettings)
37+
end
38+
39+
defimpl Poison.Decoder, for: GoogleApi.Forms.V1.Model.SetPublishSettingsResponse do
40+
def decode(value, options) do
41+
GoogleApi.Forms.V1.Model.SetPublishSettingsResponse.decode(value, options)
42+
end
43+
end
44+
45+
defimpl Poison.Encoder, for: GoogleApi.Forms.V1.Model.SetPublishSettingsResponse do
46+
def encode(value, options) do
47+
GoogleApi.Gax.ModelBase.encode(value, options)
48+
end
49+
end

0 commit comments

Comments
 (0)