Skip to content

Commit

Permalink
fix tabledata.list return type (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
enricozb committed Oct 12, 2023
1 parent 6a31b30 commit 8d43b7e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
29 changes: 29 additions & 0 deletions src/model/table_data_list_response.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
use serde::{Deserialize, Serialize};

use crate::model::table_row::TableRow;

#[derive(Debug, Default, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct TableDataListResponse {
/// The resource type of the response.
#[serde(skip_serializing_if = "Option::is_none")]
pub kind: Option<String>,

/// Etag to the response.
#[serde(skip_serializing_if = "Option::is_none")]
pub etag: Option<String>,

/// Total rows of the entire table. In order to show default value "0", we have to present it as string.
#[serde(skip_serializing_if = "Option::is_none")]
pub total_rows: Option<String>,

/// When this field is non-empty, it indicates that additional results are available.
/// To request the next page of data, set the pageToken field of your next tabledata.list
/// call to the string returned in this field.
#[serde(skip_serializing_if = "Option::is_none")]
pub page_token: Option<String>,

/// Repeated rows as result.
#[serde(skip_serializing_if = "Option::is_none")]
pub rows: Option<Vec<TableRow>>,
}
3 changes: 2 additions & 1 deletion src/tabledata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::error::BQError;
use crate::model::data_format_options::DataFormatOptions;
use crate::model::table_data_insert_all_request::TableDataInsertAllRequest;
use crate::model::table_data_insert_all_response::TableDataInsertAllResponse;
use crate::model::table_data_list_response::TableDataListResponse;

Check failure on line 9 in src/tabledata.rs

View workflow job for this annotation

GitHub Actions / clippy

unresolved import `crate::model::table_data_list_response`

error[E0432]: unresolved import `crate::model::table_data_list_response` --> src/tabledata.rs:9:19 | 9 | use crate::model::table_data_list_response::TableDataListResponse; | ^^^^^^^^^^^^^^^^^^^^^^^^ could not find `table_data_list_response` in `model`
use crate::{process_response, urlencode, BIG_QUERY_V2_URL};
use reqwest::Client;

Expand Down Expand Up @@ -79,7 +80,7 @@ impl TableDataApi {
dataset_id: &str,
table_id: &str,
parameters: ListQueryParameters,
) -> Result<TableDataInsertAllResponse, BQError> {
) -> Result<TableDataListResponse, BQError> {
let req_url = format!(
"{base_url}/projects/{project_id}/datasets/{dataset_id}/tables/{table_id}/data",
base_url = self.base_url,
Expand Down

0 comments on commit 8d43b7e

Please sign in to comment.