Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package googleapis.bigquery
import cats.effect.Concurrent
import org.http4s._
import org.http4s.implicits._
import org.http4s.client.Client
class TablesClient[F[_]: Concurrent](client: Client[F]) extends AbstractClient[F](client) {
val baseUri = uri"https://bigquery.googleapis.com/bigquery/v2"
def testIamPermissions(
/** REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
*/
resource: String
)(input: TestIamPermissionsRequest): F[TestIamPermissionsResponse] =
expectJson[TestIamPermissionsResponse](
requestWithBody(method = Method.POST, uri = baseUri / s"${resource}")(input)
)
def insert(
/** Required. Project ID of the new table
*/
projectId: String,
/** Required. Dataset ID of the new table
*/
datasetId: String,
)(input: Table): F[Table] = expectJson[Table](
requestWithBody(
method = Method.POST,
uri = baseUri / "projects" / s"${projectId}" / "datasets" / s"${datasetId}" / "tables",
)(input)
)
def setIamPolicy(
/** REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
*/
resource: String
)(input: SetIamPolicyRequest): F[Policy] =
expectJson[Policy](requestWithBody(method = Method.POST, uri = baseUri / s"${resource}")(input))
def getIamPolicy(
/** REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
*/
resource: String
)(input: GetIamPolicyRequest): F[Policy] =
expectJson[Policy](requestWithBody(method = Method.POST, uri = baseUri / s"${resource}")(input))
def delete(
/** Required. Project ID of the table to delete
*/
projectId: String,
/** Required. Dataset ID of the table to delete
*/
datasetId: String,
/** Required. Table ID of the table to delete
*/
tableId: String,
): F[Status] = client.status(
request(
method = Method.DELETE,
uri =
baseUri / "projects" / s"${projectId}" / "datasets" / s"${datasetId}" / "tables" / s"${tableId}",
)
)
def get(
/** Required. Project ID of the requested table
*/
projectId: String,
/** Required. Dataset ID of the requested table
*/
datasetId: String,
/** Required. Table ID of the requested table
*/
tableId: String,
query: TablesClient.GetParams = TablesClient.GetParams(),
): F[Table] = expectJson[Table](
request(
method = Method.GET,
uri =
(baseUri / "projects" / s"${projectId}" / "datasets" / s"${datasetId}" / "tables" / s"${tableId}")
.copy(query =
Query.fromVector(
Vector(
List("selectedFields" -> query.selectedFields).flatMap { case (k, v) =>
v.map(vv => k -> Option(vv))
},
List("view" -> query.view).flatMap { case (k, v) => v.map(vv => k -> Option(vv)) },
).flatten
)
),
)
)
def update(
/** Required. Project ID of the table to update
*/
projectId: String,
/** Required. Dataset ID of the table to update
*/
datasetId: String,
/** Required. Table ID of the table to update
*/
tableId: String,
query: TablesClient.UpdateParams = TablesClient.UpdateParams(),
)(input: Table): F[Table] = expectJson[Table](
requestWithBody(
method = Method.PUT,
uri =
(baseUri / "projects" / s"${projectId}" / "datasets" / s"${datasetId}" / "tables" / s"${tableId}")
.copy(query =
Query.fromVector(
Vector(
List(
"autodetect_schema" -> query.autodetect_schema.map(s =>
QueryParamEncoder[Boolean].encode(s).value
)
).flatMap { case (k, v) => v.map(vv => k -> Option(vv)) }
).flatten
)
),
)(input)
)
def patch(
/** Required. Project ID of the table to update
*/
projectId: String,
/** Required. Dataset ID of the table to update
*/
datasetId: String,
/** Required. Table ID of the table to update
*/
tableId: String,
query: TablesClient.PatchParams = TablesClient.PatchParams(),
)(input: Table): F[Table] = expectJson[Table](
requestWithBody(
method = Method.PATCH,
uri =
(baseUri / "projects" / s"${projectId}" / "datasets" / s"${datasetId}" / "tables" / s"${tableId}")
.copy(query =
Query.fromVector(
Vector(
List(
"autodetect_schema" -> query.autodetect_schema.map(s =>
QueryParamEncoder[Boolean].encode(s).value
)
).flatMap { case (k, v) => v.map(vv => k -> Option(vv)) }
).flatten
)
),
)(input)
)
def list(
/** Required. Project ID of the tables to list
*/
projectId: String,
/** Required. Dataset ID of the tables to list
*/
datasetId: String,
query: TablesClient.ListParams = TablesClient.ListParams(),
): F[TableList] = expectJson[TableList](
request(
method = Method.GET,
uri = (baseUri / "projects" / s"${projectId}" / "datasets" / s"${datasetId}" / "tables")
.copy(query =
Query.fromVector(
Vector(
List(
"maxResults" -> query.maxResults.map(s => QueryParamEncoder[Int].encode(s).value)
).flatMap { case (k, v) => v.map(vv => k -> Option(vv)) },
List("pageToken" -> query.pageToken).flatMap { case (k, v) =>
v.map(vv => k -> Option(vv))
},
).flatten
)
),
)
)
}
object TablesClient {
final case class GetParams(
/** List of table schema fields to return (comma-separated). If unspecified, all fields are returned. A fieldMask cannot be used here because the fields will automatically be converted from camelCase to snake_case and the conversion will fail if there are underscores. Since these are fields in BigQuery table schemas, underscores are allowed.
*/
selectedFields: Option[String] = None,
/** Optional. Specifies the view that determines which table information is returned. By default, basic table information and storage statistics (STORAGE_STATS) are returned.
*/
view: Option[String] = None,
)
final case class UpdateParams(
/** Optional. When true will autodetect schema, else will keep original schema
*/
autodetect_schema: Option[Boolean] = None
)
final case class PatchParams(
/** Optional. When true will autodetect schema, else will keep original schema
*/
autodetect_schema: Option[Boolean] = None
)
final case class ListParams(
/** The maximum number of results to return in a single response page. Leverage the page tokens to iterate through the entire collection.
*/
maxResults: Option[Int] = None,
/** Page token, returned by a previous call, to request the next page of results
*/
pageToken: Option[String] = None,
)
}