
"""
    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
from mozurestsdk.apicontext import ApiContext;

class PublishingScope(object):
	def __init__(self, apiContext: ApiContext = None, dataViewMode="Live", mozuClient = None):
		if (apiContext is not None and apiContext.dataViewMode is None):
			apiContext.dataViewMode = dataViewMode;
		else:
			apiContext = ApiContext(dataViewMode = dataViewMode);
		self.client = mozuClient or default_client();
		self.client.withApiContext(apiContext);
	
	def getPublishSet(self,publishSetCode, responseFields = None):
		""" Retrieves the details of the specified product publish set.
		
		Args:
			| publishSetCode (string) - The unique identifier of the publish set.
			| 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:
			| PublishSet 
		
		Raises:
			| ApiException
		
		"""

		url = MozuUrl("/api/commerce/catalog/admin/publishing/publishsets/{publishSetCode}?responseFields={responseFields}", "GET", UrlLocation.TenantPod, False);
		url.formatUrl("publishSetCode", publishSetCode);
		url.formatUrl("responseFields", responseFields);
		self.client.withResourceUrl(url).execute();
		return self.client.result();

	
		
	def getPublishSets(self,responseFields = None):
		""" Retrieves a list of product publish sets and their properties, including the amount of pending product changes that are included in each one.
		
		Args:
			| 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:
			| PublishSetCollection 
		
		Raises:
			| ApiException
		
		"""

		url = MozuUrl("/api/commerce/catalog/admin/publishing/publishsets?responseFields={responseFields}", "GET", UrlLocation.TenantPod, False);
		url.formatUrl("responseFields", responseFields);
		self.client.withResourceUrl(url).execute();
		return self.client.result();

	
		
	def discardDrafts(self,publishScope):
		""" Deletes the draft version of product changes (pending product changes) for each product code specified in the request.
		
		Args:
			| publishScope(publishScope) - Describes the scope of the product publishing update, which can include individual product codes or all pending changes.
		
		Raises:
			| ApiException
		
		"""

		url = MozuUrl("/api/commerce/catalog/admin/publishing/discarddrafts", "POST", UrlLocation.TenantPod, False);
		self.client.withResourceUrl(url).withBody(publishScope).execute();

	
		
	def publishDrafts(self,publishScope):
		""" Publishes the draft version of product changes (pending product changes) for each product code specified in the request, and changes the product publish state to "live".
		
		Args:
			| publishScope(publishScope) - Describes the scope of the product publishing update, which can include individual product codes or all pending changes.
		
		Raises:
			| ApiException
		
		"""

		url = MozuUrl("/api/commerce/catalog/admin/publishing/publishdrafts", "POST", UrlLocation.TenantPod, False);
		self.client.withResourceUrl(url).withBody(publishScope).execute();

	
		
	def assignProductsToPublishSet(self,publishSet, responseFields = None):
		""" Assigns pending product changes to a specified product publish set. Use the code field to specify the product publish set.
		
		Args:
			| publishSet(publishSet) - The details of the publish to which you want to assign products.
			| 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:
			| PublishSet 
		
		Raises:
			| ApiException
		
		"""

		url = MozuUrl("/api/commerce/catalog/admin/publishing/publishsets?responseFields={responseFields}", "POST", UrlLocation.TenantPod, False);
		url.formatUrl("responseFields", responseFields);
		self.client.withResourceUrl(url).withBody(publishSet).execute();
		return self.client.result();

	
		
	def deletePublishSet(self,publishSetCode, discardDrafts = False):
		""" Deletes the specified product publish set. If you set the discardDrafts parameter to true, this operation also deletes the product drafts assigned to the publish set.
		
		Args:
			| publishSetCode (string) - The unique identifier of the publish set.
			| discardDrafts (bool) - Specifies whether to discard all the drafts assigned to the publish set when the publish set is deleted.
		
		Raises:
			| ApiException
		
		"""

		url = MozuUrl("/api/commerce/catalog/admin/publishing/publishsets/{publishSetCode}?discardDrafts={discardDrafts}", "DELETE", UrlLocation.TenantPod, False);
		url.formatUrl("discardDrafts", discardDrafts);
		url.formatUrl("publishSetCode", publishSetCode);
		self.client.withResourceUrl(url).execute();

	
	
	