Skip to content
  • Kevin Morris's avatar
    change(fastapi): rework /rpc (get) · 7c4fb539
    Kevin Morris authored
    
    
    This reworks the base implementation of the RPC to use a
    class called RPC for handling of requests. Took a bit of
    a different approach than PHP in terms of exposed methods,
    but it does end up achieving the same goal, with one additional
    error: "Request type '{type}' is not yet implemented."
    
    For FastAPI development, we'll stick with:
    
    - If the supplied 'type' argument has an alias mapping in
      RPC.ALIASES, we convert the type argument over to its alias
      before doing anything. Example: 'info' is aliased to 'multiinfo',
      so when a user requests type=info, it is converted to type=multiinfo.
    - If the type does not exist in RPC.EXPOSED_TYPES, the following
      error is produced: "No request type/data specified."
    - If the type **does** exist in RPC.EXPOSED_TYPES, but does not
      have an implemented `RPC._handle_{type}_type` function, the
      following error is produced: "Request type '{type}' is not yet
      implemented."
    
    Signed-off-by: Kevin Morris's avatarKevin Morris <kevr@0cost.org>
    7c4fb539