1// Copyright Materialize, Inc. and contributors. All rights reserved.
2//
3// Use of this software is governed by the Business Source License
4// included in the LICENSE file.
5//
6// As of the Change Date specified in that file, in accordance with
7// the Business Source License, use of this software will be governed
8// by the Apache License, Version 2.0.
910use serde::{Deserialize, Deserializer};
1112/// The pagination wrapper type for API calls that are paginated.
13#[derive(Debug, Clone, Deserialize)]
14#[serde(rename_all = "camelCase")]
15pub struct Paginated<T> {
16pub items: Vec<T>,
17#[serde(rename = "_metadata")]
18pub metadata: PaginatedMetadata,
19}
2021#[derive(Debug, Clone, Deserialize)]
22#[serde(rename_all = "camelCase")]
23pub struct PaginatedMetadata {
24pub total_pages: u64,
25}
2627/// A struct that deserializes nothing.
28///
29/// Useful for deserializing empty response bodies.
30pub struct Empty;
3132impl<'de> Deserialize<'de> for Empty {
33fn deserialize<D>(_: D) -> Result<Empty, D::Error>
34where
35D: Deserializer<'de>,
36 {
37Ok(Empty)
38 }
39}