def main(self):
     """
     Retrieve the files in a dataset from Citrination.
     """
     url = determine_url(self.params.host, self.params.project)
     client = citrination_client.CitrinationClient(self.params.api_key, url)
     directory_name = 'citrination-files-' + str(time.time()).split(".")[0]        
     if self.params.latest:
         files = client.get_dataset_files(self.params.dataset_id, True)
     else:
         files = client.get_dataset_files(self.params.dataset_id)
     if files and self.params.latest:
         files_arr = files['files']
         if not make_directory(directory_name): return false             
         for file in files_arr:
             download_file(file['url'], file['filename'], directory_name)
     elif files:
         if not make_directory(directory_name): return false
         versions_arr = files['versions']
         for version in versions_arr:
             files_arr = version['files']
             versioned_dir_name = directory_name + "/version_" + str(version['id'])
             make_directory(versioned_dir_name)
             for file in files_arr:
                 download_file(file['url'], file['filename'], versioned_dir_name)
 def main(self):
     """
     Retrieve a PIF from Citrination.
     """
     url = determine_url(self.params.host, self.params.project)
     client = citrination_client.CitrinationClient(self.params.api_key, url)
     if self.params.set_version != None:
         pif = client.get_pif(self.params.dataset_id, self.params.pif_id, self.params.set_version)
     else:
         pif = client.get_pif(self.params.dataset_id, self.params.pif_id)
     print str(pif)
 def main(self):
     """
     Upload a document.
     """
     url = determine_url(self.params.host, self.params.project)
     client = citrination_client.CitrinationClient(self.params.api_key, url)
     message = client.upload_file(self.params.file, self.params.data_set_id)
     if message is not None:
         print message
     else:
         print("Upload failed due to API server being unable to resolve the upload location.")
 def main(self):
     """
     Create a Citrination dataset.
     """
     url = determine_url(self.params.host, self.params.project)
     client = citrination_client.CitrinationClient(self.params.api_key, url)
     response = client.create_data_set()
     if response.status_code == 200:
         print("Data set has been created.")
         print(response.content)
     else:
         print("Data set creation failed: " + response.reason)
 def main(self):
     """
     Version a Citrination dataset.
     """
     url = determine_url(self.params.host, self.params.project)
     client = citrination_client.CitrinationClient(self.params.api_key, url)
     response = client.create_data_set_version(self.params.dataset)
     if response.status_code == 200:
         print("Data set version has been created.")
         print response.content
     else:
         print("Data set version creation failed.")
    def main(self):
        """
        Update a Citrination dataset.
        """
        url = determine_url(self.params.host, self.params.project)
        client = citrination_client.CitrinationClient(self.params.api_key, url)

        response = client.update_data_set(self.params.dataset, self.params.name, self.params.description, self.params.share)
        if response.status_code == 200:
            print("Data set has been updated.")
            print(response.content)
        else:
            print("Data set update failed: " + response.reason)
 def main(self):
     """
     Retrieve a file from a dataset from Citrination.
     """
     url = determine_url(self.params.host, self.params.project)
     client = citrination_client.CitrinationClient(self.params.api_key, url)
     if self.params.set_version != None:
         file = client.get_dataset_file(self.params.dataset_id, self.params.file_path, self.params.set_version)
     else:
         file = client.get_dataset_file(self.params.dataset_id, self.params.file_path)
     if file:
         file = file['file']
         directory_name = 'citrination-files-' + str(time.time()).split(".")[0]
         make_directory(directory_name)
         download_file(file['url'], file['filename'], directory_name)