Skip to content

dealnews Private API (experimental)

billspeir edited this page Apr 19, 2013 · 5 revisions

Response Commands

The response body in any API call can contain an "cmd" node that contains an array of commands that the application should perform. Furthermore the response will contain any data necessary to perform the action.

Sample api call's response body

...
cmd: [
    {
        type:"UserLogout"
    },
    {
        type:"Alert",
        title: "Hi There!",
        alertLog: "logout_login_again",
        message: "We had to log you out since your account password has changed. Please log in again.",
        okTitle: "Ok",
        onOk: "ShowLogin",
        cancelTitle: "Maybe Later",
    },
    ...
],
...

Note: If at any point the server cannot deliver content or otherwise does not perform as expected, the response shall be to Log the message (currently, flurry) and to present nothing to the user.

Commands

Common Parameters

  • type: string, uniquely identifies the type of action to perform
  • log: string. The message that will get logged to Flurry.

Alert

Command to perform

When receiving the Alert command, the app will create and show a UIAlertView window with the specified parameters.

Parameters

  • title: The title of the UIAlertView. Optional.
  • alertLog: The message that will get logged to Flurry. Includes ok or cancel selection choice. Optional.
  • message: The message that will get displayed. Required.
  • okTitle: The text in the Ok Button. Optional.
  • onOk The action to perform if Ok is clicked. Optional.
  • cancelTitle: The text in the Cancel Button. Required.

NoticeScreen

Command to perform

When receiving the NoticeScreen command, the app will create a customizable window. It can have a title, a text message, an image as well as ok and cancel buttons. The Title area can have a background color and or image as can the message area and the two buttons.

On iOS, a close button will be overlaid in the upper right hand corner. On android, the system back button shall be used.

Parameters

  • noticeLog The message that will get logged (currently to Flurry). Includes ok or cancel selection choice. Optional.
  • title The text title to display. If not specified, the title view will not be displayed. Optional.
  • titleBg The background color (RGBA) to color the title view. Optional.
  • mainBg The background color (RGBA) of the body view. Optional.
  • mainMessage The main text to display. If not specified, the message label will not be displayed. Optional.
  • mainImage The main image to display. If not specified, the Image view will not be displayed. Optional.
  • okTitle: The text in the Ok Button. Optional.
  • okImage: The background image to use for the button. Optional.
  • onOk The action to perform if Ok is clicked. Optional.
  • cancelTitle: The text in the Cancel Button. Required.
  • cancelImage: The background image to use for the button. Optional. /** titleRect (x,y,w,h) of the title rect. Optional./ /** mainMessageRect (x,y,w,h) of the message rectangle. Optional./

UserLogout

Command to Perform

The app should immediately log the user out.