import json, requests, datetime, time
from api_auth import APICredentials, APIParams

class CSLSlicer:
    def __init__(self):
        self.host = "https://services.uplynk.com"

    def run(self):
        """
        Update a hosted slicer.
        """
        self._update_hosted_slicer()

    def _update_hosted_slicer(self):
        csl_slicer_id = '2803da54cb8e47668f36908bef564fee'  # Replace with the desired CSL slicer ID.
        url = "{}{}{}".format(self.host, "/api/v4/managed-slicer/slicers", csl_slicer_id)

        payload = {
            'slicer_name': 'Basketball Slicer Courtside', # Replace with the hosted slicer's name.
            'slicer_id': 'basketball_slicer_courtside' # Replace with the hosted slicer's Slicer ID.
        }

        headers = {'Content-Type': 'application/json'}

        response = requests.patch(
            url, params=APIParams(APICredentials()).get_params({}), data=json.dumps(payload), headers=headers 
        )

        print(response.json())

CSLSlicer().run()