# Path: aetros/api.py
# class ApiError(Exception):
# class ApiConnectionError(ApiError):
#     def __init__(self, message, error):
#     def __str__(self):
# def http_request(path, query='', json_body=None, method='get', config=None, handle_common_errors=True):
# def request(path, query=None, body=None, method='get', config=None):
# def raise_response_exception(message, response):
# def parse_json(content):
# def model(model_name):
# def user():
# def create_job(model_name, config_path, local=False, parameters=None, dataset_id=None, config=None):
# def create_model(model_name, organisation=None, space=None, private = False):


import argparse
import sys
        import aetros.const
from aetros import api
from __future__ import absolute_import
from __future__ import print_function



class ApiCommand:
    def __init__(self, logger):
        self.logger = logger
        self.client = None
        self.registered = False
        self.active = True

    def main(self, args):

        parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter,
                description="You can provide json in stdin to issue a POST call", prog=aetros.const.__prog__ + ' api')
        parser.add_argument('path', nargs='?', help="Request path + query, e.g. model/settings?name=owner/name")
        parser.add_argument('--method', nargs='?', help="Per default GET, if stdin data is given a POST. Alternatively provide a HTTP verb.")

        parsed_args = parser.parse_args(args)

        if not parsed_args.path:
            parser.print_help()
            sys.exit(1)


# Path: aetros/api.py
# class ApiError(Exception):
# class ApiConnectionError(ApiError):
#     def __init__(self, message, error):
#     def __str__(self):
# def http_request(path, query='', json_body=None, method='get', config=None, handle_common_errors=True):
# def request(path, query=None, body=None, method='get', config=None):
# def raise_response_exception(message, response):
# def parse_json(content):
# def model(model_name):
# def user():
# def create_job(model_name, config_path, local=False, parameters=None, dataset_id=None, config=None):
# def create_model(model_name, organisation=None, space=None, private = False):


# Path: aetros/commands/ApiCommand.py
import argparse
import sys
        import aetros.const
from aetros import api

from __future__ import absolute_import
from __future__ import print_function



class ApiCommand:
    def __init__(self, logger):
        self.logger = logger
        self.client = None
        self.registered = False
        self.active = True

    def main(self, args):

        parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter,
                description="You can provide json in stdin to issue a POST call", prog=aetros.const.__prog__ + ' api')
        parser.add_argument('path', nargs='?', help="Request path + query, e.g. model/settings?name=owner/name")
        parser.add_argument('--method', nargs='?', help="Per default GET, if stdin data is given a POST. Alternatively provide a HTTP verb.")

        parsed_args = parser.parse_args(args)

        if not parsed_args.path:
            parser.print_help()
            sys.exit(1)


        sys.stdout.write(api.request(parsed_args.path))