Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

READY: FIX GSPREAD #1519

Open
wants to merge 110 commits into
base: alpha
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
afc69d6
added: error handling and nice output for cell set
Dec 12, 2024
9a0921b
fixed: cell get
Dec 13, 2024
aea57b0
fixed: error handling for all actions
Dec 13, 2024
6516d0a
added: help description
Dec 13, 2024
afb293c
fixed gspread_cell_set action returning value
Dec 20, 2024
fcb2f10
fixed: sheet name in description
Dec 20, 2024
b319241
fixed: commands examples
Dec 20, 2024
4e20ccf
added mock for oauth2
Dec 24, 2024
782c744
with_online added to tests
Dec 24, 2024
aa1ca66
added third oauth2 endpoint
Dec 24, 2024
118819a
feature with_online
Dec 24, 2024
556bd63
added mock tests
Dec 24, 2024
780c761
with_online fixed
Dec 24, 2024
efbb875
fixed gspread_cells_set return type
Dec 24, 2024
5a839cf
Merge branch 'alpha' of github.com:Wandalen/wTools into alpha
Dec 25, 2024
0d453a3
fixed display
Dec 25, 2024
19bd3c3
draft wrap_function
Dec 28, 2024
450328f
something bad
Dec 28, 2024
bc30e7a
update_row function and documentation for some functions and structur…
Dec 28, 2024
6f2180d
added hub to update_row
Jan 8, 2025
7780a0e
update_row: fixed documentation; added get_geader function
Jan 8, 2025
041c63b
added get_cell
Jan 8, 2025
71607ae
added set_cell
Jan 8, 2025
1d267f2
added documentation to code
Jan 8, 2025
85c6570
removed duplicated code
Jan 8, 2025
e242ec6
added documentation to code; changed report structure for header; cha…
Jan 9, 2025
aa81271
added documentation for secret.rs
Jan 9, 2025
f026a54
modified secret.rs
Jan 9, 2025
a7d726c
added documentation to commands.rs
Jan 9, 2025
7800614
modified client.rs
Jan 9, 2025
127aa4b
fixed display_table.rs
Jan 9, 2025
1953df9
modified row_wrapper.rs
Jan 9, 2025
90dddbd
updated documentation for commands::gspread.rs
Jan 9, 2025
7a4dd9d
updated documentation for commands::gspread_header.rs
Jan 9, 2025
578e027
updated documentation for commands::gspread_rows.rs
Jan 9, 2025
c59d440
updated documentation for commands::gspread_cells.rs
Jan 9, 2025
389d415
updated documentation for commands::gspread_cell.rs
Jan 9, 2025
e43a5b1
added documentation for actions
Jan 9, 2025
fdcac56
modifed with json!
Jan 9, 2025
ef8df69
removed some code
Jan 9, 2025
95a84db
removed some code
Jan 9, 2025
5cbc8d3
fixed Result<T>
Jan 16, 2025
b2907f7
added GspreadHub structure
Jan 16, 2025
f3a5f74
remove core module
Jan 16, 2025
d082cfa
created GspredClientBuilder; created GspreadClient in init state
Jan 16, 2025
bb051f0
fixed client builder
Jan 16, 2025
7668c7b
added mockclient; change project structures; added 3 working and 2 no…
Jan 17, 2025
0425680
added client; not fully working
Jan 19, 2025
b631426
removed old client
Jan 19, 2025
4cf3fb6
working client
Jan 19, 2025
8cfc603
added documentation to tests; changed project structure
Jan 19, 2025
29b8f71
added documentation; changed imports
Jan 19, 2025
8d1d85d
working with_online; added tests
Jan 19, 2025
a3e3eff
fixed header range
Jan 20, 2025
632d40d
working new function
Jan 20, 2025
d7bd3be
working tests
Jan 20, 2025
5029a97
working append_row
Jan 20, 2025
b471ebf
fixed update_row_by_custom_key
Jan 21, 2025
048e6a9
added GOOGLE_API_URL constant
Jan 21, 2025
a2bd965
removed hardcode constants to constantc.rx file
Jan 21, 2025
0532d59
added common tests
Jan 21, 2025
7b26210
added header_tests
Jan 21, 2025
faf445b
added rows_tests
Jan 21, 2025
7b83792
feat: variation in configuration
SRetip Jan 21, 2025
3a9316c
fixed append row; added append_row tests; fixed rows_tests
Jan 21, 2025
5df73c7
added tests for append row
Jan 21, 2025
a14dff3
fixed append_row description
Jan 21, 2025
7589a69
changed files name
Jan 21, 2025
98a521e
added updating tests
Jan 21, 2025
123718c
added all mock tests
Jan 21, 2025
09b4d3d
added row append command
Jan 21, 2025
85f041c
cli working
Jan 21, 2025
4e8d55d
added documentation
Jan 21, 2025
0679152
added documentation
Jan 21, 2025
3a05e72
fixed get_header return value
Jan 21, 2025
daaf45a
added all tests
Jan 22, 2025
7b64bf8
added tests
Jan 22, 2025
068ac8a
fixed documentation
Jan 22, 2025
0a7603e
Merge branch 'fix-gspread2' into config_variation
sevabakutov Jan 22, 2025
887738b
Merge pull request #1 from SRetip/config_variation
sevabakutov Jan 22, 2025
152fbc9
fixed build
Jan 22, 2025
2135b8d
fixed docs
Jan 22, 2025
f74bc07
fixed display
Jan 22, 2025
883236f
fixed display
Jan 22, 2025
39ba192
fixed readme file
Jan 22, 2025
79cd823
Merge branch 'fix-gspread2' into alpha
Jan 23, 2025
195ced7
Merge branch 'alpha' of github.com:Wandalen/wTools into alpha
Jan 23, 2025
4d1692a
fixed merge; removed unused dependencies
Jan 23, 2025
b62c959
comment wirh online tests
Jan 23, 2025
62bfa94
uncomment with_online
Jan 23, 2025
a954312
removed inc tests
Jan 24, 2025
5b522c6
removed tests; added value_get_batch method
Jan 24, 2025
d5ba76f
added new command; writed test for the command; added documentation;
Jan 24, 2025
46e9200
added row get command
Jan 29, 2025
541fdad
added tests for get_row
Jan 29, 2025
7d27c03
added ValuesClearMethod and ValuesClearResponse
Jan 29, 2025
c154461
added clear(); action for clear command
Jan 29, 2025
874b738
workin clear; added tests for clear
Jan 29, 2025
64bbde9
added clear_by_custom_row_key command; added tests for the command
Jan 29, 2025
6f260a8
added copy_to function
Jan 29, 2025
caa22c4
fixed description; fixed client;
Jan 30, 2025
b2a7d37
fixe append_row
Jan 31, 2025
0f7256b
command description added
Jan 31, 2025
99e6511
fixed imports
Feb 3, 2025
85d273f
token save working
Feb 3, 2025
228edbb
fixed imports; added documentatiom for Auth structure
Feb 3, 2025
4e7f9b4
fixed append_row
Feb 11, 2025
69e001f
changed append row function
Feb 12, 2025
1c15993
fixed running
Feb 12, 2025
98d6aed
fixed append_row function
Feb 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added get_cell
  • Loading branch information
Vsevolod committed Jan 8, 2025
commit 041c63b68fc2973ec3e4b5952710d340c6182310
77 changes: 75 additions & 2 deletions module/move/gspread/src/actions/gspread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,9 @@ mod private
}
}


/// Function to get header of a specific sheet
///
/// It sends HTTP request to Google Sheets API and rettrive header.
/// It sends HTTP request to Google Sheets API and retrive header.
///
/// **Params**
/// - `hub` : Configured hub.
Expand Down Expand Up @@ -229,6 +228,78 @@ mod private
}
}

/// Function to get rows of a specific sheet
///
/// It sends HTTP request to Google Sheets API and retrive all rows but not header.
///
/// **Params**
/// - `hub` : Configured hub.
/// - `spreadsheet_id` : Spreadsheet identifire.
/// - `sheet_name` : Sheet name.
///
/// **Returns**
/// - `Result`
pub async fn get_rows
(
hub : &SheetsType,
spreadsheet_id : &str,
sheet_name : &str,
) -> Result< Vec< Vec< JsonValue > > >
{
match hub
.spreadsheets()
.values_get( spreadsheet_id, format!( "{}!A2:Z", sheet_name ).as_str() )
.doit()
.await
{
Ok( ( _, response ) ) =>
{
match response.values
{
Some( values ) => Ok( values ),
None => Ok( Vec::new() )
}
},
Err( error ) => Err( Error::ApiError( error ) )
}
}

/// Function to get a cell of a specific sheet
///
/// It sends HTTP request to Google Sheets API and retrive cell.
///
/// **Params**
/// - `hub` : Configured hub.
/// - `spreadsheet_id` : Spreadsheet identifire.
/// - `sheet_name` : Sheet name.
/// - `cell_id` : Cell id.
///
/// **Returns**
/// - `Result`
pub async fn get_cell
(
hub : &SheetsType,
spreadsheet_id : &str,
sheet_name : &str,
cell_id : &str
) -> Result< JsonValue >
{
match hub
.spreadsheets()
.values_get( spreadsheet_id, format!( "{}!{}", sheet_name, cell_id ).as_str() )
.doit()
.await
{
Ok( ( _, response ) ) =>
match response.values
{
Some( values ) => Ok( values.get( 0 ).unwrap().get( 0 ).unwrap().clone() ),
None => Ok( JsonValue::Null.clone() )
}
Err( error ) => Err( Error::ApiError( error ) )
}
}

pub type Result< T > = core::result::Result< T, Error >;
}

Expand All @@ -238,6 +309,8 @@ crate::mod_interface!
{
Error,
Result,
get_cell,
get_rows,
update_row,
get_header,
get_spreadsheet_id_from_url,
Expand Down
21 changes: 5 additions & 16 deletions module/move/gspread/src/actions/gspread_cell_get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ mod private
use crate::*;
use actions::gspread::
{
Error,
Result
get_cell, Result
};
use client::SheetsType;
use ser::JsonValue;
Expand All @@ -21,25 +20,15 @@ mod private
(
hub : &SheetsType,
spreadsheet_id : &str,
table_name : &str,
sheet_name : &str,
cell_id : &str,
) -> Result< JsonValue >
{
match hub
.spreadsheets()
.values_get( spreadsheet_id, format!( "{}!{}", table_name, cell_id ).as_str() )
.doit()
.await
match get_cell( hub, spreadsheet_id, sheet_name, cell_id ).await
{
Ok( (_, response ) ) =>
match response.values
{
Some( values ) => Ok( values.get( 0 ).unwrap().get( 0 ).unwrap().clone() ),
None => Ok( JsonValue::Null.clone() )
}
Err( error ) => Err( Error::ApiError( error ) )
Ok( value ) => Ok( value ),
Err( error ) => Err( error )
}

}
}

Expand Down
2 changes: 1 addition & 1 deletion module/move/gspread/src/actions/gspread_get_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mod private
use client::SheetsType;
use actions::gspread::
{
get_header, Error, Result
get_header, Result
};
use format_tools::AsTable;
use util::display_table::display_header;
Expand Down
22 changes: 5 additions & 17 deletions module/move/gspread/src/actions/gspread_get_rows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,21 @@ mod private
use client::SheetsType;
use actions::gspread::
{
Error,
Result
get_rows, Result
};
use ser::JsonValue;

pub async fn action
(
hub : &SheetsType,
spreadsheet_id : &str,
table_name : &str
sheet_name : &str
) -> Result< Vec< Vec < JsonValue > > >
{
match hub
.spreadsheets()
.values_get( spreadsheet_id, format!( "{}!A2:Z", table_name ).as_str() )
.doit()
.await
match get_rows( hub, spreadsheet_id, sheet_name ).await
{
Ok( ( _, response ) ) =>
{
match response.values
{
Some( values ) => Ok( values ),
None => Ok( Vec::new() )
}
},
Err( error ) => Err( Error::ApiError( error ) )
Ok( rows ) => Ok( rows ),
Err( error ) => Err( error )
}
}
}
Expand Down