# Path: syncano_cli/parse_to_syncano/parse/rest_map.py
# PARSE_API_MAP = {
#     'schemas': '1/schemas/',
#     'classes': '1/classes/{class_name}',
#     'installations': '1/installations/'
# }


import json
import requests
from syncano_cli.parse_to_syncano.parse.rest_map import PARSE_API_MAP
# -*- coding: utf-8 -*-



class ParseConnection(object):

    BASE_URL = 'https://api.parse.com/{url}/'

    def __init__(self, application_id, master_key):
        self.application_id = application_id
        self.master_key = master_key

    def request(self, url, params=None, headers=None):
        params = params or {}
        headers = headers or {}
        url = self.BASE_URL.format(url=url)
        headers.update({
            'X-Parse-Application-Id': self.application_id,
            'X-Parse-Master-Key': self.master_key,
            'Content-Type': 'application/json'
        })
        response = requests.get(url, params=params, headers=headers)
        return response.json()

    def get_schemas(self):

# Path: syncano_cli/parse_to_syncano/parse/rest_map.py
# PARSE_API_MAP = {
#     'schemas': '1/schemas/',
#     'classes': '1/classes/{class_name}',
#     'installations': '1/installations/'
# }


# Path: syncano_cli/parse_to_syncano/parse/connection.py
import json
import requests
from syncano_cli.parse_to_syncano.parse.rest_map import PARSE_API_MAP

# -*- coding: utf-8 -*-



class ParseConnection(object):

    BASE_URL = 'https://api.parse.com/{url}/'

    def __init__(self, application_id, master_key):
        self.application_id = application_id
        self.master_key = master_key

    def request(self, url, params=None, headers=None):
        params = params or {}
        headers = headers or {}
        url = self.BASE_URL.format(url=url)
        headers.update({
            'X-Parse-Application-Id': self.application_id,
            'X-Parse-Master-Key': self.master_key,
            'Content-Type': 'application/json'
        })
        response = requests.get(url, params=params, headers=headers)
        return response.json()

    def get_schemas(self):

        return self.request(PARSE_API_MAP['schemas'])['results']