Example #1
0
    def __init__(self, *args, **kwargs):
        super(App, self).__init__(*args, **kwargs)
        LOG.info('API Server is starting')

        self.add_route('/', base.BaseResource())
        self.add_route('/v1/users', users.Collection())
        self.add_route('/v1/users/{id}', users.Item())
        self.add_route('/v1/countries', countries.Collection())
        self.add_route('/v1/countries/{id}', countries.Item())
        self.add_route('/v1/provinces', provinces.Collection())
        self.add_route('/v1/provinces/{id}', provinces.Item())
        self.add_route('/v1/cities', cities.Collection())
        self.add_route('/v1/cities/{id}', cities.Item())
        self.add_route('/v1/roles', roles.Collection())
        self.add_route('/v1/roles/{id}', roles.Item())
        self.add_route('/v1/vendors', vendors.Collection())
        self.add_route('/v1/vendors/{id}', vendors.Item())
        self.add_route('/v1/devices', devices.Collection())
        self.add_route('/v1/devices/{id}', devices.Item())
        self.add_route('/v1/product_types', product_types.Collection())
        self.add_route('/v1/product_types/{id}', product_types.Item())
        self.add_route('/v1/products', products.Collection())
        self.add_route('/v1/products/{id}', products.Item())
        self.add_route('/v1/transaction_types', transaction_types.Collection())
        self.add_route('/v1/transaction_types/{id}', transaction_types.Item())
        self.add_route('/v1/users/self/login', users.Self())

        self.add_error_handler(AppError, AppError.handle)
    def __init__(self, *args, **kwargs):
        super(API, self).__init__(*args, **kwargs)

        self.add_route('/', base.BaseResource())
        self.add_route('/v1/users', users.Collection())
        self.add_route('/v1/users/{user_id}', users.Item())
        self.add_route('/v1/users/self/login', users.Self())

        self.add_error_handler(AppError, AppError.handle)
Example #3
0
    def __init__(self, *args, **kwargs):
        super(App, self).__init__(*args, **kwargs)
        LOG.info("API Server is starting")

        self.add_route("/", base.BaseResource())
        self.add_route("/api/v1/users", users.Collection())
        self.add_route("/api/v1/user/sign_in", users.Self())
        self.add_route("/api/v1/metrics", metrics.Collection())

        self.add_error_handler(AppError, AppError.handle)
Example #4
0
    def __init__(self, *args, **kwargs):
        super(App, self).__init__(*args, **kwargs)
        LOG.info("API Server is starting")

        self.add_route("/", base.BaseResource())
        self.add_route("/v1/users", users.Collection())
        self.add_route("/v1/users/{user_id}", users.Item())
        self.add_route("/v1/users/self/login", users.Self())

        self.add_error_handler(AppError, AppError.handle)
Example #5
0
    def __init__(self, *args, **kwargs):
        super(App, self).__init__(*args, **kwargs)
        LOG.info("API Server is starting")

        # Simple endpoint for base
        self.add_route("/", base.BaseResource())

        # Register a provider manually
        self.add_route("/v1/providers/create", providers.CreateProvider())
        # Retrieves all providers
        self.add_route("/v1/providers", providers.ProvidersCollection())
        # Retrieves providers from validation type
        self.add_route("/v1/providers/validationType/{validation_type}",
                       providers.ProvidersFromValidationTypeCollection())

        # Retrieves all services by provider did
        self.add_route("/v1/services/provider_did/{provider_did}",
                       services.ServicesFromProviderDid())

        # Creates a new transaction
        self.add_route("/v1/validationtx/create",
                       validationtx.CreateValidationTx())
        # Retrieves all transactions according to did
        self.add_route("/v1/validationtx/did/{did}",
                       validationtx.ValidationTxFromDid())
        # Retrieves all transactions according to provider id
        self.add_route("/v1/validationtx/provider_id/{provider_id}",
                       validationtx.ValidationTxFromProviderId())
        # Retrieves all transactions according to provider did
        self.add_route("/v1/validationtx/provider_did/{provider_did}",
                       validationtx.ValidationTxFromProviderDid())
        # Retrieves transaction according to confirmation ID
        self.add_route("/v1/validationtx/confirmation_id/{confirmation_id}",
                       validationtx.ValidationTxFromConfirmationId())
        # Retrieves transaction count according to provider ID
        self.add_route("/v1/validationtx/count/provider_id/{provider_id}",
                       validationtx.ValidationTxCountFromProviderId())
        # Update isSavedOnProfile information
        self.add_route(
            "/v1/validationtx/is_saved/confirmation_id/{confirmation_id}",
            validationtx.SetIsSavedValidationTx())
        # Approve validation by manual validator
        self.add_route(
            "/v1/validationtx/approve/confirmation_id/{confirmation_id}",
            validationtx.ApproveValidationTx())
        # Reject validation by manual validator
        self.add_route(
            "/v1/validationtx/reject/confirmation_id/{confirmation_id}",
            validationtx.RejectValidationTx())
        # Cancel validation
        self.add_route(
            "/v1/validationtx/cancel/confirmation_id/{confirmation_id}",
            validationtx.CancelValidationTx())

        self.add_error_handler(AppError, AppError.handle)
    def __init__(self, *args, **kwargs):
        super(App, self).__init__(*args, **kwargs)
        LOG.info('API Server is starting')

        self.add_route('/', base.BaseResource())
        self.add_route('/v1/users', users.Collection())
        self.add_route('/v1/users/{user_id}', users.Item())
        self.add_route('/v1/users/self/login', users.Self())
        self.add_route('/v1/examples', examples.ExampleResource())

        self.add_error_handler(AppError, AppError.handle)
Example #7
0
    def __init__(self, *args, **kwargs):
        super(App, self).__init__(*args, **kwargs)
        LOG.info("API Server is starting")

        # Simple endpoint for base
        self.add_route("/", base.BaseResource())

        # Receive callback from elastOS
        self.add_route("/v1/validation/callback",
                       validation.EmailConfirmation())

        self.add_error_handler(AppError, AppError.handle)
    def __init__(self, *args, **kwargs):
        super(App, self).__init__(*args, **kwargs)
        LOG.info("API Server is starting")

        # Simple endpoint for base
        self.add_route("/", base.BaseResource())

        # Creates a new row
        self.add_route("/v1/didtx/create", didtx.Create())
        # Creates a new row V2
        self.add_route("/v2/didtx/create", didtxv2.Create())

        # Retrieves the row according to confirmation ID
        self.add_route("/v1/didtx/confirmation_id/{confirmation_id}",
                       didtx.ItemFromConfirmationId())
        # Retrieves the row according to confirmation ID v2
        self.add_route("/v2/didtx/confirmation_id/{confirmation_id}",
                       didtxv2.ItemFromConfirmationId())

        # Retreives all rows belonging to a particular DID
        self.add_route("/v1/didtx/did/{did}", didtx.ItemFromDid())
        # Retreives all rows belonging to a particular DID V2
        self.add_route("/v2/didtx/did/{did}", didtxv2.ItemFromDid())

        # Retreives recent 5 rows belonging to a particular DID
        self.add_route("/v1/didtx/recent/did/{did}",
                       didtx.RecentItemsFromDid())
        # Retreives recent 5 rows belonging to a particular DID v2
        self.add_route("/v2/didtx/recent/did/{did}",
                       didtxv2.RecentItemsFromDid())

        # Retrieves the last 5 DID documents published for a particular DID
        self.add_route("/v1/documents/did/{did}",
                       did_document.GetDidDocumentsFromDid())
        # Retrieves the last 5 DID documents published for a particular DID from a cryptoname
        self.add_route("/v1/documents/crypto_name/{crypto_name}",
                       did_document.GetDidDocumentsFromCryptoname())

        # Retrieves the service count for a particular DID
        self.add_route("/v1/service_count/{service}/{did}",
                       servicecount.GetServiceCountSpecificDidAndService())
        # Retrieves service statistics
        self.add_route("/v1/service_count/statistics",
                       servicecount.GetServiceCountAllServices())

        self.add_error_handler(AppError, AppError.handle)
Example #9
0
    def __init__(self, *args, **kwargs):
        super(App, self).__init__(*args, **kwargs)
        LOG.info("API Server is starting")

        self.add_route("/", base.BaseResource())
        self.add_route("/v1/users", users.Collection())
        self.add_route("/v1/users/{user_id}", users.Item())
        self.add_route("/v1/users/self/login", users.Self())
        self.add_route("/users", users.GetUsers())
        self.add_route("/api/companies", company.CompanyCollection())
        self.add_route("/api/company_create", company.CompanyCreate())  # 
        self.add_route("/api/company/{id}", company.CompanyCollect())
        self.add_route("/api/company_update/{id}", company.CompanyUpdate())
        self.add_route("/api/company_destroy/{id}", company.CompanyDelete())
        self.add_route("/api/companies_search", company.CompanyFilter())

        self.add_error_handler(AppError, AppError.handle)
Example #10
0
from app.api.v1 import booking
from app.api.v1 import feedback
from app.service.search.search_handler import SearchHandler

logger = log.get_logger()

application = falcon.API(middleware=[CorsMiddleware()])

# setup db
db = connection.connect(db=config.DB_NAME, port=int(config.DB_PORT))

cred = credentials.Certificate('conf/firebase_adminsdk_credentials.json')
default_app = firebase_admin.initialize_app(cred)

""" base endpoint """
application.add_route('/v1/welcome', base.BaseResource())

""" . """
# on_get get user info
application.add_route('/v1/user/{user_id}', user.UserItem())
# on_get get info of a vehicle of user
application.add_route('/v1/user/vehicle/{vehicle_id}', user.VehicleItem())
# on_get get all vehicle of current user
# on_post create new vehicle
application.add_route('/v1/user/vehicle', user.VehicleCollection())

""" . """
# on get - get all vehicle for public search
application.add_route('/v1/vehicle', vehicle.Collection(SearchHandler()))

# on_get for get vehicle detail by vehicle_id
Example #11
0
 def __init__(self, *args, **kwargs):
     super(App, self).__init__(*args, **kwargs)
     self.add_route('/', base.BaseResource())
     self.add_route('/v1/users', users.Collection())
Example #12
0
    def __init__(self, *args, **kwargs):
        super(App, self).__init__(*args, **kwargs)
        LOG.info('API Server is starting')

        self.add_route('/', base.BaseResource())

        """
        Version 2
        """

        # System Environment Settings
        self.add_route('/v2/Admin/Tokens', v2_admin.Tokens())
        self.add_route('/v2/Admin/Tokens/Type', v2_admin.TokenType())
        self.add_route('/v2/Admin/Token/{contract_address}', v2_admin.Token())

        # Blockchain Transactions
        self.add_route('/v2/Eth/TransactionCount/{eth_address}', v2_eth.GetTransactionCount())
        self.add_route('/v2/Eth/SendRawTransaction', v2_eth.SendRawTransaction())
        self.add_route('/v2/Eth/SendRawTransactionNoWait', v2_eth.SendRawTransactionNoWait())
        self.add_route('/v2/Eth/WaitForTransactionReceipt', v2_eth.WaitForTransactionReceipt())

        # Blockchain Node Information
        self.add_route('/v2/NodeInfo', v2_nodeInfo.NodeInfo())
        self.add_route('/v2/NodeInfo/BlockSyncStatus', v2_nodeInfo.BlockSyncStatus())

        # Contract ABIs
        self.add_route('/v2/ABI/StraightBond', v2_token_abi.StraightBondABI())
        self.add_route('/v2/ABI/Share', v2_token_abi.ShareABI())
        self.add_route('/v2/ABI/Membership', v2_token_abi.MembershipABI())
        self.add_route('/v2/ABI/Coupon', v2_token_abi.CouponABI())

        # Companies
        self.add_route('/v2/Company/{eth_address}', v2_company.CompanyInfo())
        self.add_route('/v2/Companies', v2_company.CompanyInfoList())
        self.add_route('/v2/Company/{eth_address}/Tokens', v2_company.CompanyTokenList())
        self.add_route('/v2/PaymentAgent/{eth_address}', v2_company.PaymentAgentInfo())

        # Tokens
        self.add_route('/v2/Token/StraightBond', v2_token.StraightBondTokens())
        self.add_route('/v2/Token/StraightBond/Address', v2_token.StraightBondTokenAddresses())
        self.add_route('/v2/Token/StraightBond/{contract_address}', v2_token.StraightBondTokenDetails())
        self.add_route('/v2/Token/Share', v2_token.ShareTokens())
        self.add_route('/v2/Token/Share/Address', v2_token.ShareTokenAddresses())
        self.add_route('/v2/Token/Share/{contract_address}', v2_token.ShareTokenDetails())
        self.add_route('/v2/Token/Membership', v2_token.MembershipTokens())
        self.add_route('/v2/Token/Membership/Address', v2_token.MembershipTokenAddresses())
        self.add_route('/v2/Token/Membership/{contract_address}', v2_token.MembershipTokenDetails())
        self.add_route('/v2/Token/Coupon', v2_token.CouponTokens())
        self.add_route('/v2/Token/Coupon/Address', v2_token.CouponTokenAddresses())
        self.add_route('/v2/Token/Coupon/{contract_address}', v2_token.CouponTokenDetails())
        self.add_route('/v2/Token/{contract_address}/Status', v2_token.TokenStatus())
        self.add_route('/v2/Token/{contract_address}/Holders', v2_token.TokenHolders())
        self.add_route('/v2/Token/{contract_address}/TransferHistory', v2_token.TransferHistory())
        self.add_route('/v2/Token/{contract_address}/TransferApprovalHistory', v2_token.TransferApprovalHistory())

        # Market Data
        self.add_route('/v2/Market/OrderBook/StraightBond', v2_market_information.StraightBondOrderBook())
        self.add_route('/v2/Market/OrderBook/Membership', v2_market_information.MembershipOrderBook())
        self.add_route('/v2/Market/OrderBook/Coupon', v2_market_information.CouponOrderBook())
        self.add_route('/v2/Market/LastPrice/StraightBond', v2_market_information.StraightBondLastPrice())
        self.add_route('/v2/Market/LastPrice/Membership', v2_market_information.MembershipLastPrice())
        self.add_route('/v2/Market/LastPrice/Coupon', v2_market_information.CouponLastPrice())
        self.add_route('/v2/Market/Tick/StraightBond', v2_market_information.StraightBondTick())
        self.add_route('/v2/Market/Tick/Membership', v2_market_information.MembershipTick())
        self.add_route('/v2/Market/Tick/Coupon', v2_market_information.CouponTick())
        self.add_route('/v2/Market/Agreement', v2_market_information.GetAgreement())

        # Position
        self.add_route('/v2/Position/StraightBond', v2_position.StraightBondMyTokens())
        self.add_route('/v2/Position/Share', v2_position.ShareMyTokens())
        self.add_route('/v2/Position/Membership', v2_position.MembershipMyTokens())
        self.add_route('/v2/Position/Coupon', v2_position.CouponMyTokens())
        self.add_route('/v2/Position/Coupon/Consumptions', v2_position.CouponConsumptions())

        # Orders
        self.add_route('/v2/OrderList/{token_address}', v2_order_list.OrderList())
        self.add_route('/v2/OrderList/StraightBond', v2_order_list.StraightBondOrderList())
        self.add_route('/v2/OrderList/Share', v2_order_list.ShareOrderList())
        self.add_route('/v2/OrderList/Membership', v2_order_list.MembershipOrderList())
        self.add_route('/v2/OrderList/Coupon', v2_order_list.CouponOrderList())

        # Notifications
        self.add_route('/v2/Notifications', v2_notification.Notifications())
        self.add_route('/v2/Notifications/Read', v2_notification.NotificationsRead())
        self.add_route('/v2/NotificationCount', v2_notification.NotificationCount())
        self.add_route('/v3/Notifications', v2_notification.Notifications())

        # User Information
        self.add_route('/v2/User/PaymentAccount', v2_user.PaymentAccount())
        self.add_route('/v2/User/PersonalInfo', v2_user.PersonalInfo())

        # Statistics
        self.add_route('/v2/Statistics/Token/{contract_address}', v2_statistics.Token())

        """
        Version 3
        """

        # Notifications
        self.add_route('/v3/Notifications', v3_notification.Notifications())
        self.add_route('/v3/Notifications/{id}', v3_notification.NotificationsId())

        """
        Error Handler
        """

        self.add_error_handler(AppError, AppError.handle)