Skip to content

Instantly share code, notes, and snippets.

@getjump
Last active November 16, 2019 10:52
Show Gist options
  • Select an option

  • Save getjump/7688ca392eeb1137e18b to your computer and use it in GitHub Desktop.

Select an option

Save getjump/7688ca392eeb1137e18b to your computer and use it in GitHub Desktop.

Serialization: ?

Special Data Types:

  • Error { int code; string message }
  • ApiResponse { T object; Error? error; }
  • GeoPoint { double lat, long; }
  • Token { string token; }
  • FailableAction { bool sucess; }
  • Lockbox { .. }

? - means Optional, so object could be null!, and should be asked for null before job [] - is array

EX:

  • /:namespace/:method

    • HTTP_METHOD:methodName(type :paramName...) -> ReturnType SO request : HTTP_METHOD /:namespace/:methodName(?):paramName=(type)$(:paramName)
  • /phone/ // for auth logics and stuff

    • GET:sendCode(string phoneNumber) -> ApiResponse // hard-code 'code' for some number
    • GET:validateCode(string code, Token token) -> ApiResponse // on server token should be moved to properly authorized
  • /settings/ // for user specific settings

  • /user/ // for some user related info

  • /lockbox/ // for lockboxes

    • GET:list(GeoPoint? userPosition, GeoPoint? prefferedPosition...) -> ApiResponse<Lockbox[]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment