There are several vertical interfaces:
renren_request
sina_request.
tencent_request.
- SQLite.
sql_request('query string with param placeholder', (param1, param2, etc)) (conceptually here; will be reflected later)
Facts about vertical interfaces:
- They are a unified RAW entry to this particular platform.
- They can be very different across platforms.
- SNSAPI's horizontal methods are derived from those vertical interfaces (of course, more dirty works are done to unify them).
- With the manual of a platform and vertical interface, one can readily perform other operations on it. e.g. get the friend list; get messages sorted by length from DB.
Style 1:
xx_request(path, method, params={...})
Style2:
xx_request(path, method, param1=?, param2=?)
Problem of style2: (when the param of the API is not a valid Python identifier)
$cat t.py
def f(**kwargs):
print kwargs
f(a=1, b=3)
f(a=1, **{'a.b': 3})
$python t.py
{'a': 1, 'b': 3}
{'a': 1, 'a.b': 3}
Although the vertical interfaces are mainly there to support horizontal interfaces (the major use case), some users want to use vertical interfaces directly to extend the function. We can not unify the data structures but we can make the invocation style coherent.
Call for discussion. pros/ cons with cases.