77 deal_status ,
88 get_uploads as getUploads ,
99 download as _download ,
10- ipns_generate_key as ipnsGenerateKey ,
11- ipns_publish_record as ipnsPublishRecord ,
12- get_ipns_record as getIpnsRecord ,
13- remove_ipns_record as removeIpnsRecord ,
10+ get_file_info as getFileInfo ,
11+ get_balance as getBalance ,
12+ get_api_key as getApiKey
1413)
1514
1615
@@ -48,51 +47,14 @@ def uploadBlob(self, source: io.BufferedReader, filename: str, tag: str = ''):
4847 except Exception as e :
4948 raise e
5049
51- def generateKey (self ):
50+ def getBalance (self ):
5251 """
53- Generate a new IPNS key for the authenticated user.
54- :return: dict, The generated IPNS key information.
52+ Retrieve the balance information of a user from the Lighthouse.
53+ :param publicKey: str, The public key of the user.
54+ :return: dict[str, any], A dictionary containing the data usage and data limit details.
5555 """
5656 try :
57- return ipnsGenerateKey .ipns_generate_key (self .token )
58- except Exception as e :
59- raise e
60-
61- def publishRecord (self , cid : str , keyName : str ):
62- """
63- Publish an IPNS record for a given CID and key name.
64-
65- :param cid: str, Content Identifier to publish
66- :param keyName: str, Name of the IPNS key to use
67- :return: dict, The published IPNS record information
68- """
69- try :
70- return ipnsPublishRecord .ipns_publish_record (self .token , cid , keyName )
71- except Exception as e :
72- raise e
73-
74- def getAllKeys (self ):
75- """
76- Retrieves all IPNS records associated with the current token.
77-
78- return: list A list of IPNS records retrieved using the provided token.
79- """
80-
81- try :
82- return getIpnsRecord .get_ipns_records (self .token )
83- except Exception as e :
84- raise e
85-
86- def removeKey (self , keyName : str ):
87- """
88- Remove IPNS record of the given keyName
89-
90- :param keyName: str, Name of the IPNS key to use
91- :return: dict, A dict of removed IPNS record.
92- """
93-
94- try :
95- return removeIpnsRecord .remove_ipns_record (self .token , keyName )
57+ return getBalance .get_balance (self .token )
9658 except Exception as e :
9759 raise e
9860
@@ -125,18 +87,16 @@ def getDealStatus(cid: str):
12587 return deal_status .get_deal_status (cid )
12688 except Exception as e :
12789 raise e
128-
129- @staticmethod
130- def getUploads (publicKey : str , pageNo : int = 1 ):
90+
91+ def getUploads (self , lastKey : str = None ):
13192 """
13293 Get uploads from the Lighthouse.
13394
134- :param publicKey: str, public key
135- :param pageNo: int, page number (default: 1)
95+ :param lastKey: To navigate to different pages of results
13696 :return: List[t.DealData], list of deal data
13797 """
13898 try :
139- return getUploads .get_uploads (publicKey , pageNo )
99+ return getUploads .get_uploads (self . token , lastKey )
140100 except Exception as e :
141101 raise e
142102
@@ -153,6 +113,34 @@ def download(cid: str):
153113 return _download .get_file (cid )
154114 except Exception as e :
155115 raise e
116+
117+ @staticmethod
118+ def getFileInfo (cid : str ):
119+ """
120+ Retrieves information about a file using its CID (Content Identifier).
121+ :param cid: str, Content Identifier for the data to be downloaded
122+ returns: dict, A dictionary containing file information.
123+ """
124+
125+ try :
126+ return getFileInfo .get_file_info (cid )
127+ except Exception as e :
128+ raise e
129+
130+ @staticmethod
131+ def getApiKey (publicKey : str , signedMessage : str ):
132+ """
133+ Generates and returns an API key for the given public key and signed message.
134+ :param publicKey: str, The public key associated with the user.
135+ :param signedMessage: str, The message signed by the user's private key.
136+ :return: dict, A dict with generated API key.
137+ """
138+
139+
140+ try :
141+ return getApiKey .get_api_key (publicKey , signedMessage )
142+ except Exception as e :
143+ raise e
156144
157145 def getTagged (self , tag : str ):
158146 """
0 commit comments