|
| 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.AIPlatform.V1.Api.Media do |
| 19 | + @moduledoc """ |
| 20 | + API calls for all endpoints tagged `Media`. |
| 21 | + """ |
| 22 | + |
| 23 | + alias GoogleApi.AIPlatform.V1.Connection |
| 24 | + alias GoogleApi.Gax.{Request, Response} |
| 25 | + |
| 26 | + @library_version Mix.Project.config() |> Keyword.get(:version, "") |
| 27 | + |
| 28 | + @doc """ |
| 29 | + Upload a file into a RagCorpus. |
| 30 | +
|
| 31 | + ## Parameters |
| 32 | +
|
| 33 | + * `connection` (*type:* `GoogleApi.AIPlatform.V1.Connection.t`) - Connection to server |
| 34 | + * `parent` (*type:* `String.t`) - Required. The name of the RagCorpus resource into which to upload the file. Format: `projects/{project}/locations/{location}/ragCorpora/{rag_corpus}` |
| 35 | + * `optional_params` (*type:* `keyword()`) - Optional parameters |
| 36 | + * `:"$.xgafv"` (*type:* `String.t`) - V1 error format. |
| 37 | + * `:access_token` (*type:* `String.t`) - OAuth access token. |
| 38 | + * `:alt` (*type:* `String.t`) - Data format for response. |
| 39 | + * `:callback` (*type:* `String.t`) - JSONP |
| 40 | + * `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response. |
| 41 | + * `: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. |
| 42 | + * `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user. |
| 43 | + * `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks. |
| 44 | + * `: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. |
| 45 | + * `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart"). |
| 46 | + * `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart"). |
| 47 | + * `:body` (*type:* `GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1UploadRagFileRequest.t`) - |
| 48 | + * `opts` (*type:* `keyword()`) - Call options |
| 49 | +
|
| 50 | + ## Returns |
| 51 | +
|
| 52 | + * `{:ok, %GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1UploadRagFileResponse{}}` on success |
| 53 | + * `{:error, info}` on failure |
| 54 | + """ |
| 55 | + @spec aiplatform_media_upload(Tesla.Env.client(), String.t(), keyword(), keyword()) :: |
| 56 | + {:ok, GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1UploadRagFileResponse.t()} |
| 57 | + | {:ok, Tesla.Env.t()} |
| 58 | + | {:ok, list()} |
| 59 | + | {:error, any()} |
| 60 | + def aiplatform_media_upload(connection, parent, optional_params \\ [], opts \\ []) do |
| 61 | + optional_params_config = %{ |
| 62 | + :"$.xgafv" => :query, |
| 63 | + :access_token => :query, |
| 64 | + :alt => :query, |
| 65 | + :callback => :query, |
| 66 | + :fields => :query, |
| 67 | + :key => :query, |
| 68 | + :oauth_token => :query, |
| 69 | + :prettyPrint => :query, |
| 70 | + :quotaUser => :query, |
| 71 | + :uploadType => :query, |
| 72 | + :upload_protocol => :query, |
| 73 | + :body => :body |
| 74 | + } |
| 75 | + |
| 76 | + request = |
| 77 | + Request.new() |
| 78 | + |> Request.method(:post) |
| 79 | + |> Request.url("/v1/{+parent}/ragFiles:upload", %{ |
| 80 | + "parent" => URI.encode(parent, &URI.char_unreserved?/1) |
| 81 | + }) |
| 82 | + |> Request.add_optional_params(optional_params_config, optional_params) |
| 83 | + |> Request.library_version(@library_version) |
| 84 | + |
| 85 | + connection |
| 86 | + |> Connection.execute(request) |
| 87 | + |> Response.decode( |
| 88 | + opts ++ |
| 89 | + [struct: %GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1UploadRagFileResponse{}] |
| 90 | + ) |
| 91 | + end |
| 92 | + |
| 93 | + @doc """ |
| 94 | + Upload a file into a RagCorpus. |
| 95 | +
|
| 96 | + ## Parameters |
| 97 | +
|
| 98 | + * `connection` (*type:* `GoogleApi.AIPlatform.V1.Connection.t`) - Connection to server |
| 99 | + * `parent` (*type:* `String.t`) - Required. The name of the RagCorpus resource into which to upload the file. Format: `projects/{project}/locations/{location}/ragCorpora/{rag_corpus}` |
| 100 | + * `upload_type` (*type:* `String.t`) - Upload type. Must be "multipart". |
| 101 | + * `metadata` (*type:* `GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1UploadRagFileRequest.t`) - object metadata |
| 102 | + * `data` (*type:* `iodata`) - Content to upload, as a string or iolist |
| 103 | + * `optional_params` (*type:* `keyword()`) - Optional parameters |
| 104 | + * `:"$.xgafv"` (*type:* `String.t`) - V1 error format. |
| 105 | + * `:access_token` (*type:* `String.t`) - OAuth access token. |
| 106 | + * `:alt` (*type:* `String.t`) - Data format for response. |
| 107 | + * `:callback` (*type:* `String.t`) - JSONP |
| 108 | + * `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response. |
| 109 | + * `: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. |
| 110 | + * `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user. |
| 111 | + * `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks. |
| 112 | + * `: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. |
| 113 | + * `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart"). |
| 114 | + * `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart"). |
| 115 | + * `opts` (*type:* `keyword()`) - Call options |
| 116 | +
|
| 117 | + ## Returns |
| 118 | +
|
| 119 | + * `{:ok, %GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1UploadRagFileResponse{}}` on success |
| 120 | + * `{:error, info}` on failure |
| 121 | + """ |
| 122 | + @spec aiplatform_media_upload_iodata( |
| 123 | + Tesla.Env.client(), |
| 124 | + String.t(), |
| 125 | + String.t(), |
| 126 | + GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1UploadRagFileRequest.t(), |
| 127 | + iodata, |
| 128 | + keyword(), |
| 129 | + keyword() |
| 130 | + ) :: |
| 131 | + {:ok, GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1UploadRagFileResponse.t()} |
| 132 | + | {:ok, Tesla.Env.t()} |
| 133 | + | {:ok, list()} |
| 134 | + | {:error, any()} |
| 135 | + def aiplatform_media_upload_iodata( |
| 136 | + connection, |
| 137 | + parent, |
| 138 | + upload_type, |
| 139 | + metadata, |
| 140 | + data, |
| 141 | + optional_params \\ [], |
| 142 | + opts \\ [] |
| 143 | + ) do |
| 144 | + optional_params_config = %{ |
| 145 | + :"$.xgafv" => :query, |
| 146 | + :access_token => :query, |
| 147 | + :alt => :query, |
| 148 | + :callback => :query, |
| 149 | + :fields => :query, |
| 150 | + :key => :query, |
| 151 | + :oauth_token => :query, |
| 152 | + :prettyPrint => :query, |
| 153 | + :quotaUser => :query, |
| 154 | + :uploadType => :query, |
| 155 | + :upload_protocol => :query |
| 156 | + } |
| 157 | + |
| 158 | + request = |
| 159 | + Request.new() |
| 160 | + |> Request.method(:post) |
| 161 | + |> Request.url("/upload/v1/{+parent}/ragFiles:upload", %{ |
| 162 | + "parent" => URI.encode(parent, &URI.char_unreserved?/1) |
| 163 | + }) |
| 164 | + |> Request.add_param(:query, :uploadType, upload_type) |
| 165 | + |> Request.add_param(:body, :metadata, metadata) |
| 166 | + |> Request.add_param(:body, :data, data) |
| 167 | + |> Request.add_optional_params(optional_params_config, optional_params) |
| 168 | + |> Request.library_version(@library_version) |
| 169 | + |
| 170 | + connection |
| 171 | + |> Connection.execute(request) |
| 172 | + |> Response.decode( |
| 173 | + opts ++ |
| 174 | + [struct: %GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1UploadRagFileResponse{}] |
| 175 | + ) |
| 176 | + end |
| 177 | + |
| 178 | + @doc """ |
| 179 | + Upload a file into a RagCorpus. |
| 180 | +
|
| 181 | + ## Parameters |
| 182 | +
|
| 183 | + * `connection` (*type:* `GoogleApi.AIPlatform.V1.Connection.t`) - Connection to server |
| 184 | + * `parent` (*type:* `String.t`) - Required. The name of the RagCorpus resource into which to upload the file. Format: `projects/{project}/locations/{location}/ragCorpora/{rag_corpus}` |
| 185 | + * `upload_type` (*type:* `String.t`) - Upload type. Must be "multipart". |
| 186 | + * `metadata` (*type:* `GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1UploadRagFileRequest.t`) - object metadata |
| 187 | + * `data` (*type:* `String.t`) - Path to file containing content to upload |
| 188 | + * `optional_params` (*type:* `keyword()`) - Optional parameters |
| 189 | + * `:"$.xgafv"` (*type:* `String.t`) - V1 error format. |
| 190 | + * `:access_token` (*type:* `String.t`) - OAuth access token. |
| 191 | + * `:alt` (*type:* `String.t`) - Data format for response. |
| 192 | + * `:callback` (*type:* `String.t`) - JSONP |
| 193 | + * `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response. |
| 194 | + * `: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. |
| 195 | + * `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user. |
| 196 | + * `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks. |
| 197 | + * `: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. |
| 198 | + * `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart"). |
| 199 | + * `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart"). |
| 200 | + * `opts` (*type:* `keyword()`) - Call options |
| 201 | +
|
| 202 | + ## Returns |
| 203 | +
|
| 204 | + * `{:ok, %GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1UploadRagFileResponse{}}` on success |
| 205 | + * `{:error, info}` on failure |
| 206 | + """ |
| 207 | + @spec aiplatform_media_upload_simple( |
| 208 | + Tesla.Env.client(), |
| 209 | + String.t(), |
| 210 | + String.t(), |
| 211 | + GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1UploadRagFileRequest.t(), |
| 212 | + String.t(), |
| 213 | + keyword(), |
| 214 | + keyword() |
| 215 | + ) :: |
| 216 | + {:ok, GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1UploadRagFileResponse.t()} |
| 217 | + | {:ok, Tesla.Env.t()} |
| 218 | + | {:ok, list()} |
| 219 | + | {:error, any()} |
| 220 | + def aiplatform_media_upload_simple( |
| 221 | + connection, |
| 222 | + parent, |
| 223 | + upload_type, |
| 224 | + metadata, |
| 225 | + data, |
| 226 | + optional_params \\ [], |
| 227 | + opts \\ [] |
| 228 | + ) do |
| 229 | + optional_params_config = %{ |
| 230 | + :"$.xgafv" => :query, |
| 231 | + :access_token => :query, |
| 232 | + :alt => :query, |
| 233 | + :callback => :query, |
| 234 | + :fields => :query, |
| 235 | + :key => :query, |
| 236 | + :oauth_token => :query, |
| 237 | + :prettyPrint => :query, |
| 238 | + :quotaUser => :query, |
| 239 | + :uploadType => :query, |
| 240 | + :upload_protocol => :query |
| 241 | + } |
| 242 | + |
| 243 | + request = |
| 244 | + Request.new() |
| 245 | + |> Request.method(:post) |
| 246 | + |> Request.url("/upload/v1/{+parent}/ragFiles:upload", %{ |
| 247 | + "parent" => URI.encode(parent, &URI.char_unreserved?/1) |
| 248 | + }) |
| 249 | + |> Request.add_param(:query, :uploadType, upload_type) |
| 250 | + |> Request.add_param(:body, :metadata, metadata) |
| 251 | + |> Request.add_param(:file, :data, data) |
| 252 | + |> Request.add_optional_params(optional_params_config, optional_params) |
| 253 | + |> Request.library_version(@library_version) |
| 254 | + |
| 255 | + connection |
| 256 | + |> Connection.execute(request) |
| 257 | + |> Response.decode( |
| 258 | + opts ++ |
| 259 | + [struct: %GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1UploadRagFileResponse{}] |
| 260 | + ) |
| 261 | + end |
| 262 | +end |
0 commit comments