scala.googleapis.storage.NotificationsClient.scala Maven / Gradle / Ivy
The newest version!
package googleapis.storage
import cats.effect.Concurrent
import org.http4s._
import org.http4s.implicits._
import org.http4s.client.Client
class NotificationsClient[F[_]: Concurrent](client: Client[F]) extends AbstractClient[F](client) {
val baseUri = uri"https://storage.googleapis.com/storage/v1"
def delete(
/** The parent bucket of the notification.
*/
bucket: String,
/** ID of the notification to delete.
*/
notification: String,
query: NotificationsClient.DeleteParams = NotificationsClient.DeleteParams(),
): F[Status] = client.status(
request(
method = Method.DELETE,
uri = (baseUri / "b" / s"${bucket}" / "notificationConfigs" / s"${notification}")
.copy(query = Query("userProject" -> query.userProject)),
)
)
def get(
/** The parent bucket of the notification.
*/
bucket: String,
/** Notification ID
*/
notification: String,
query: NotificationsClient.GetParams = NotificationsClient.GetParams(),
): F[Notification] = expectJson[Notification](
request(
method = Method.GET,
uri = (baseUri / "b" / s"${bucket}" / "notificationConfigs" / s"${notification}")
.copy(query = Query("userProject" -> query.userProject)),
)
)
def insert(
/** The parent bucket of the notification.
*/
bucket: String,
query: NotificationsClient.InsertParams = NotificationsClient.InsertParams(),
)(input: Notification): F[Notification] = expectJson[Notification](
requestWithBody(
method = Method.POST,
uri = (baseUri / "b" / s"${bucket}" / "notificationConfigs")
.copy(query = Query("userProject" -> query.userProject)),
)(input)
)
def list(
/** Name of a Google Cloud Storage bucket.
*/
bucket: String,
query: NotificationsClient.ListParams = NotificationsClient.ListParams(),
): F[Notifications] = expectJson[Notifications](
request(
method = Method.GET,
uri = (baseUri / "b" / s"${bucket}" / "notificationConfigs")
.copy(query = Query("userProject" -> query.userProject)),
)
)
}
object NotificationsClient {
final case class DeleteParams(
/** The project to be billed for this request. Required for Requester Pays buckets.
*/
userProject: Option[String] = None
)
final case class GetParams(
/** The project to be billed for this request. Required for Requester Pays buckets.
*/
userProject: Option[String] = None
)
final case class InsertParams(
/** The project to be billed for this request. Required for Requester Pays buckets.
*/
userProject: Option[String] = None
)
final case class ListParams(
/** The project to be billed for this request. Required for Requester Pays buckets.
*/
userProject: Option[String] = None
)
}