@@ -18,14 +18,13 @@ mod tracker_api {
1818 use tokio:: task:: JoinHandle ;
1919 use torrust_tracker:: api:: resources:: auth_key:: AuthKey ;
2020 use torrust_tracker:: api:: resources:: stats:: Stats ;
21- use torrust_tracker:: api:: resources:: torrent_resource :: { TorrentListItemResource , TorrentPeerResource , TorrentResource } ;
21+ use torrust_tracker:: api:: resources:: torrent :: { self , Torrent } ;
2222 use torrust_tracker:: config:: Configuration ;
2323 use torrust_tracker:: jobs:: tracker_api;
2424 use torrust_tracker:: protocol:: clock:: DurationSinceUnixEpoch ;
2525 use torrust_tracker:: protocol:: info_hash:: InfoHash ;
26- use torrust_tracker:: tracker:: auth;
27- use torrust_tracker:: tracker:: peer:: { self , Peer } ;
2826 use torrust_tracker:: tracker:: statistics:: Keeper ;
27+ use torrust_tracker:: tracker:: { auth, peer} ;
2928 use torrust_tracker:: { ephemeral_instance_keys, logging, static_time, tracker} ;
3029
3130 use crate :: common:: ephemeral_random_port;
@@ -104,7 +103,7 @@ mod tracker_api {
104103
105104 assert_eq ! (
106105 torrent_resource,
107- TorrentResource {
106+ Torrent {
108107 info_hash: "9e0217d0fa71c87332cd8bf9dbeabcb2c2cf3c4d" . to_string( ) ,
109108 seeders: 1 ,
110109 completed: 0 ,
@@ -135,7 +134,7 @@ mod tracker_api {
135134
136135 assert_eq ! (
137136 torrent_resources,
138- vec![ TorrentListItemResource {
137+ vec![ torrent :: ListItem {
139138 info_hash: "9e0217d0fa71c87332cd8bf9dbeabcb2c2cf3c4d" . to_string( ) ,
140139 seeders: 1 ,
141140 completed: 0 ,
@@ -187,8 +186,8 @@ mod tracker_api {
187186 ) ;
188187 }
189188
190- fn sample_torrent_peer ( ) -> ( Peer , TorrentPeerResource ) {
191- let torrent_peer = Peer {
189+ fn sample_torrent_peer ( ) -> ( peer :: Peer , torrent :: Peer ) {
190+ let torrent_peer = peer :: Peer {
192191 peer_id : peer:: Id ( * b"-qB00000000000000000" ) ,
193192 peer_addr : SocketAddr :: new ( IpAddr :: V4 ( Ipv4Addr :: new ( 126 , 0 , 0 , 1 ) ) , 8080 ) ,
194193 updated : DurationSinceUnixEpoch :: new ( 1_669_397_478_934 , 0 ) ,
@@ -197,7 +196,7 @@ mod tracker_api {
197196 left : NumberOfBytes ( 0 ) ,
198197 event : AnnounceEvent :: Started ,
199198 } ;
200- let torrent_peer_resource = TorrentPeerResource :: from ( torrent_peer) ;
199+ let torrent_peer_resource = torrent :: Peer :: from ( torrent_peer) ;
201200
202201 ( torrent_peer, torrent_peer_resource)
203202 }
@@ -326,7 +325,7 @@ mod tracker_api {
326325 reqwest:: Client :: new ( ) . post ( url. clone ( ) ) . send ( ) . await . unwrap ( )
327326 }
328327
329- pub async fn get_torrent ( & self , info_hash : & str ) -> TorrentResource {
328+ pub async fn get_torrent ( & self , info_hash : & str ) -> Torrent {
330329 let url = format ! (
331330 "http://{}/api/torrent/{}?token={}" ,
332331 & self . connection_info. bind_address, & info_hash, & self . connection_info. api_token
@@ -338,12 +337,12 @@ mod tracker_api {
338337 . send ( )
339338 . await
340339 . unwrap ( )
341- . json :: < TorrentResource > ( )
340+ . json :: < Torrent > ( )
342341 . await
343342 . unwrap ( )
344343 }
345344
346- pub async fn get_torrents ( & self ) -> Vec < TorrentListItemResource > {
345+ pub async fn get_torrents ( & self ) -> Vec < torrent :: ListItem > {
347346 let url = format ! (
348347 "http://{}/api/torrents?token={}" ,
349348 & self . connection_info. bind_address, & self . connection_info. api_token
@@ -355,7 +354,7 @@ mod tracker_api {
355354 . send ( )
356355 . await
357356 . unwrap ( )
358- . json :: < Vec < TorrentListItemResource > > ( )
357+ . json :: < Vec < torrent :: ListItem > > ( )
359358 . await
360359 . unwrap ( )
361360 }
0 commit comments