@@ -79,6 +79,19 @@ pub struct FetchUserMfaMethodsParams {
7979 pub user_id : String ,
8080}
8181
82+ /// struct for passing parameters to the method [`fetch_user_oauth_tokens`]
83+ #[ derive( Clone , Debug , Default ) ]
84+ pub struct FetchUserOAuthTokensParams {
85+ pub user_id : String ,
86+ }
87+
88+ /// struct for passing parameters to the method [`fetch_fresh_token_from_provider`]
89+ #[ derive( Clone , Debug ) ]
90+ pub struct FetchFreshTokenFromProviderParams {
91+ pub user_id : String ,
92+ pub provider : crate :: models:: SocialLoginTokenProvider ,
93+ }
94+
8295/// struct for passing parameters to the method [`fetch_user_by_username`]
8396#[ derive( Clone , Debug , Default ) ]
8497pub struct FetchUserByUsernameParams {
@@ -247,6 +260,24 @@ pub enum FetchUserByIdError {
247260 UnknownValue ( serde_json:: Value ) ,
248261}
249262
263+ /// struct for typed errors of method [`fetch_user_oauth_tokens`]
264+ #[ derive( Debug , Clone , Serialize , Deserialize ) ]
265+ #[ serde( untagged) ]
266+ pub enum FetchUserOAuthTokensError {
267+ Status401 ( serde_json:: Value ) ,
268+ Status404 ( serde_json:: Value ) ,
269+ UnknownValue ( serde_json:: Value ) ,
270+ }
271+
272+ /// struct for typed errors of method [`fetch_fresh_token_from_provider`]
273+ #[ derive( Debug , Clone , Serialize , Deserialize ) ]
274+ #[ serde( untagged) ]
275+ pub enum FetchFreshTokenFromProviderError {
276+ Status401 ( serde_json:: Value ) ,
277+ Status404 ( serde_json:: Value ) ,
278+ UnknownValue ( serde_json:: Value ) ,
279+ }
280+
250281/// struct for typed errors of method [`fetch_user_by_username`]
251282#[ derive( Debug , Clone , Serialize , Deserialize ) ]
252283#[ serde( untagged) ]
@@ -1744,4 +1775,106 @@ pub async fn fetch_user_mfa_methods(
17441775 } ;
17451776 Err ( Error :: ResponseError ( local_var_error) )
17461777 }
1778+ }
1779+
1780+ pub async fn fetch_user_oauth_tokens (
1781+ configuration : & configuration:: Configuration ,
1782+ params : FetchUserOAuthTokensParams ,
1783+ ) -> Result < crate :: models:: SocialLoginTokensResponse , Error < FetchUserOAuthTokensError > > {
1784+ let local_var_configuration = configuration;
1785+
1786+ let user_id = params. user_id ;
1787+
1788+ let local_var_client = & local_var_configuration. client ;
1789+
1790+ let local_var_uri_str = format ! (
1791+ "{}/api/backend/v1/user/{user_id}/oauth_token" ,
1792+ local_var_configuration. base_path,
1793+ user_id = crate :: apis:: urlencode( user_id)
1794+ ) ;
1795+ let mut local_var_req_builder =
1796+ local_var_client. request ( reqwest:: Method :: GET , local_var_uri_str. as_str ( ) ) ;
1797+
1798+ if let Some ( ref local_var_user_agent) = local_var_configuration. user_agent {
1799+ local_var_req_builder =
1800+ local_var_req_builder. header ( reqwest:: header:: USER_AGENT , local_var_user_agent. clone ( ) ) ;
1801+ }
1802+ if let Some ( ref local_var_token) = local_var_configuration. bearer_access_token {
1803+ local_var_req_builder = local_var_req_builder. bearer_auth ( local_var_token. to_owned ( ) ) ;
1804+ } ;
1805+ local_var_req_builder = local_var_req_builder. header (
1806+ AUTH_HOSTNAME_HEADER ,
1807+ local_var_configuration. auth_hostname . to_owned ( ) ,
1808+ ) ;
1809+
1810+ let local_var_req = local_var_req_builder. build ( ) ?;
1811+ let local_var_resp = local_var_client. execute ( local_var_req) . await ?;
1812+
1813+ let local_var_status = local_var_resp. status ( ) ;
1814+ let local_var_content = local_var_resp. text ( ) . await ?;
1815+
1816+ if !local_var_status. is_client_error ( ) && !local_var_status. is_server_error ( ) {
1817+ serde_json:: from_str ( & local_var_content) . map_err ( Error :: from)
1818+ } else {
1819+ let local_var_entity: Option < FetchUserOAuthTokensError > =
1820+ serde_json:: from_str ( & local_var_content) . ok ( ) ;
1821+ let local_var_error = ResponseContent {
1822+ status : local_var_status,
1823+ content : local_var_content,
1824+ entity : local_var_entity,
1825+ } ;
1826+ Err ( Error :: ResponseError ( local_var_error) )
1827+ }
1828+ }
1829+
1830+ pub async fn fetch_fresh_token_from_provider (
1831+ configuration : & configuration:: Configuration ,
1832+ params : FetchFreshTokenFromProviderParams ,
1833+ ) -> Result < crate :: models:: SocialLoginToken , Error < FetchFreshTokenFromProviderError > > {
1834+ let local_var_configuration = configuration;
1835+
1836+ let user_id = params. user_id ;
1837+ let provider = params. provider ;
1838+
1839+ let local_var_client = & local_var_configuration. client ;
1840+
1841+ let local_var_uri_str = format ! (
1842+ "{}/api/backend/v1/user/{user_id}/{provider}/fresh_token" ,
1843+ local_var_configuration. base_path,
1844+ user_id = crate :: apis:: urlencode( user_id) ,
1845+ provider = crate :: apis:: urlencode( provider. to_string( ) ) ,
1846+ ) ;
1847+ let mut local_var_req_builder =
1848+ local_var_client. request ( reqwest:: Method :: GET , local_var_uri_str. as_str ( ) ) ;
1849+
1850+ if let Some ( ref local_var_user_agent) = local_var_configuration. user_agent {
1851+ local_var_req_builder =
1852+ local_var_req_builder. header ( reqwest:: header:: USER_AGENT , local_var_user_agent. clone ( ) ) ;
1853+ }
1854+ if let Some ( ref local_var_token) = local_var_configuration. bearer_access_token {
1855+ local_var_req_builder = local_var_req_builder. bearer_auth ( local_var_token. to_owned ( ) ) ;
1856+ } ;
1857+ local_var_req_builder = local_var_req_builder. header (
1858+ AUTH_HOSTNAME_HEADER ,
1859+ local_var_configuration. auth_hostname . to_owned ( ) ,
1860+ ) ;
1861+
1862+ let local_var_req = local_var_req_builder. build ( ) ?;
1863+ let local_var_resp = local_var_client. execute ( local_var_req) . await ?;
1864+
1865+ let local_var_status = local_var_resp. status ( ) ;
1866+ let local_var_content = local_var_resp. text ( ) . await ?;
1867+
1868+ if !local_var_status. is_client_error ( ) && !local_var_status. is_server_error ( ) {
1869+ serde_json:: from_str ( & local_var_content) . map_err ( Error :: from)
1870+ } else {
1871+ let local_var_entity: Option < FetchFreshTokenFromProviderError > =
1872+ serde_json:: from_str ( & local_var_content) . ok ( ) ;
1873+ let local_var_error = ResponseContent {
1874+ status : local_var_status,
1875+ content : local_var_content,
1876+ entity : local_var_entity,
1877+ } ;
1878+ Err ( Error :: ResponseError ( local_var_error) )
1879+ }
17471880}
0 commit comments