
"""
    This code was generated by Codezu.     

    Changes to this file may cause incorrect behavior and will be lost if
    the code is regenerated.
"""


from mozurestsdk.mozuclient import default as default_client
from mozurestsdk.mozuurl import MozuUrl;
from mozurestsdk.urllocation import UrlLocation

class Application(object):
	def __init__(self, mozuClient = None):
		self.client = mozuClient or default_client();
	
	def getAppPackageNames(self,applicationKey, responseFields = None):
		""" Returns a collection of package names for the application specified in the request.
		
		Args:
			| applicationKey (string) - The application key uniquely identifies the developer namespace, application ID, version, and package in Dev Center. The format is {Dev Account namespace}.{Application ID}.{Application Version}.{Package name}.
			| responseFields (string) - Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
		
		Returns:
			| PackageNamesCollection 
		
		Raises:
			| ApiException
		
		"""

		url = MozuUrl("/api/platform/developer/applications/{applicationKey}/packagenames?responseFields={responseFields}", "GET", UrlLocation.HomePod, False);
		url.formatUrl("applicationKey", applicationKey);
		url.formatUrl("responseFields", responseFields);
		self.client.withResourceUrl(url).execute();
		return self.client.result();

	
		
	def getAppVersions(self,nsAndAppId, responseFields = None):
		""" Retrieves the available versions for the application specified in the request.
		
		Args:
			| nsAndAppId (string) - The application key uniquely identifies the developer namespace, application ID, version, and package in Dev Center. The format is {Dev Account namespace}.{Application ID}.{Application Version}.{Package name}.
			| responseFields (string) - Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
		
		Returns:
			| ApplicationVersionsCollection 
		
		Raises:
			| ApiException
		
		"""

		url = MozuUrl("/api/platform/developer/applications/versions/{nsAndAppId}?responseFields={responseFields}", "GET", UrlLocation.HomePod, False);
		url.formatUrl("nsAndAppId", nsAndAppId);
		url.formatUrl("responseFields", responseFields);
		self.client.withResourceUrl(url).execute();
		return self.client.result();

	
		
	def getPackageFileMetadata(self,applicationKey, filepath, responseFields = None):
		""" Retrieves the metadata for a file in an application package.
		
		Args:
			| applicationKey (string) - The application key uniquely identifies the developer namespace, application ID, version, and package in Dev Center. The format is {Dev Account namespace}.{Application ID}.{Application Version}.{Package name}.
			| filepath (string) - Represents the file name and location.
			| responseFields (string) - Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
		
		Returns:
			| FileMetadata 
		
		Raises:
			| ApiException
		
		"""

		url = MozuUrl("/api/platform/developer/packages/{applicationKey}/filemetadata/{*filepath}?responseFields={responseFields}", "GET", UrlLocation.HomePod, False);
		url.formatUrl("applicationKey", applicationKey);
		url.formatUrl("filepath", filepath);
		url.formatUrl("responseFields", responseFields);
		self.client.withResourceUrl(url).execute();
		return self.client.result();

	
		
	def getPackageMetadata(self,applicationKey, responseFields = None):
		""" Retrieves the metadata for a folder in an application package.
		
		Args:
			| applicationKey (string) - The application key uniquely identifies the developer namespace, application ID, version, and package in Dev Center. The format is {Dev Account namespace}.{Application ID}.{Application Version}.{Package name}.
			| responseFields (string) - Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
		
		Returns:
			| FolderMetadata 
		
		Raises:
			| ApiException
		
		"""

		url = MozuUrl("/api/platform/developer/packages/{applicationKey}/metadata?responseFields={responseFields}", "GET", UrlLocation.HomePod, False);
		url.formatUrl("applicationKey", applicationKey);
		url.formatUrl("responseFields", responseFields);
		self.client.withResourceUrl(url).execute();
		return self.client.result();

	
		
	def upsertPackageFile(self,stream, applicationKey, filepath, lastModifiedTime = None, responseFields = None, contentType = None):
		""" Insert or update the specified file into the specified application package.
		
		Args:
			| stream(stream) - Data stream that delivers information. Used to input and output data.
			| applicationKey (string) - The application key uniquely identifies the developer namespace, application ID, version, and package in Dev Center. The format is {Dev Account namespace}.{Application ID}.{Application Version}.{Package name}.
			| filepath (string) - The application key uniquely identifies the developer namespace, application ID, version, and package in Dev Center. The format is {Dev Account namespace}.{Application ID}.{Application Version}.{Package name}.
			| lastModifiedTime (string) - The date and time of the last file insert or update. This parameter is optional.
			| responseFields (string) - Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
			| contentType (string) - set content type of the data uploaded|
		
		Returns:
			| FileMetadata 
		
		Raises:
			| ApiException
		
		"""

		url = MozuUrl("/api/platform/developer/packages/{applicationKey}/files/{*filepath}?lastModifiedTime={lastModifiedTime}&responseFields={responseFields}", "POST", UrlLocation.HomePod, False);
		url.formatUrl("applicationKey", applicationKey);
		url.formatUrl("filepath", filepath);
		url.formatUrl("lastModifiedTime", lastModifiedTime);
		url.formatUrl("responseFields", responseFields);
		self.client.withResourceUrl(url).withBody(stream).withContentType(contentType).execute();
		return self.client.result();

	
		
	def renamePackageFile(self,renameInfo, applicationKey, responseFields = None):
		""" Renames a file in an application package.
		
		Args:
			| renameInfo(renameInfo) - Information required to update the name of a file in a package, which consists of the original name and the new name.
			| applicationKey (string) - The application key uniquely identifies the developer namespace, application ID, version, and package in Dev Center. The format is {Dev Account namespace}.{Application ID}.{Application Version}.{Package name}.
			| responseFields (string) - Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
		
		Returns:
			| FileMetadata 
		
		Raises:
			| ApiException
		
		"""

		url = MozuUrl("/api/platform/developer/packages/{applicationKey}/files_rename?responseFields={responseFields}", "POST", UrlLocation.HomePod, False);
		url.formatUrl("applicationKey", applicationKey);
		url.formatUrl("responseFields", responseFields);
		self.client.withResourceUrl(url).withBody(renameInfo).execute();
		return self.client.result();

	
		
	def deletePackageFile(self,applicationKey, filepath):
		""" Deletes the specified file from the specified application package.
		
		Args:
			| applicationKey (string) - The application key uniquely identifies the developer namespace, application ID, version, and package in Dev Center. The format is {Dev Account namespace}.{Application ID}.{Application Version}.{Package name}.
			| filepath (string) - Represents the file name and location.
		
		Raises:
			| ApiException
		
		"""

		url = MozuUrl("/api/platform/developer/packages/{applicationKey}/files/{*filepath}", "DELETE", UrlLocation.HomePod, False);
		url.formatUrl("applicationKey", applicationKey);
		url.formatUrl("filepath", filepath);
		self.client.withResourceUrl(url).execute();

	
	
	