2017-05-20 5 views
0

Ich dokumentiere eine API. Die API besteht aus dem Senden von JSON-Daten in einem bestimmten Format über eine Websocket-Verbindung. Ein Beispiel ist unten.Link zu Definitionen von Strings

Meine Frage ist, gibt es eine Möglichkeit, von jedem dieser Nachrichtentypen als Objekte in Sphinx aufweist, die verknüpft werden, die gleiche Art, wie ich mit einer Klasse oder Funktion würde, wie mit

:py:func:`json.dumps` 

der würde automatisch einen Link für mich generieren?

The client must be able to handle all of these sorts of messages. 
It should fail gracefully without making any changes if the format of the data is not correct. 

display_message 
    Display a message string to the user:: 

     'data' : {'message' : 'Message text'} 

game_list 
    Sends a list of games that the logged in user is participating in. 
    The client should display this, get the user to choose one and then respond with a *choose_game* message.:: 

     'data' : { 
     'id' : 'white' 
     'id' : 'black' ...} 

set_square_piece 
    This is the main message for dealing with the board:: 

     'data' : { 
     'piece_colour' : str, #must be either 'white' or 'black' 
     'square_name' : str, #from 'a1' to 'h8' 
     'piece_type' : str, # e.g 'queen' 
     } 

Antwort