/*
 * DO NOT EDIT.  THIS FILE IS GENERATED FROM flockIWebServiceAPI.idl
 */

#ifndef __gen_flockIWebServiceAPI_h__
#define __gen_flockIWebServiceAPI_h__


#ifndef __gen_flockIError_h__
#include "flockIError.h"
#endif

#ifndef __gen_flockIListener_h__
#include "flockIListener.h"
#endif

#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif

#ifndef __gen_nsILoginInfo_h__
#include "nsILoginInfo.h"
#endif

/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif

/* starting interface:    flockIWebServiceAPI */
#define FLOCKIWEBSERVICEAPI_IID_STR "ea6e9ce2-ae22-4708-a27a-6750efcd8cfc"

#define FLOCKIWEBSERVICEAPI_IID \
  {0xea6e9ce2, 0xae22, 0x4708, \
    { 0xa2, 0x7a, 0x67, 0x50, 0xef, 0xcd, 0x8c, 0xfc }}

/**
 * Represents a web service API.  When implementing calls to an API, the code
 * should be encapsulated in a separate XPCOM component... *not* an XPCOM service,
 * because we may want multple instances of it.
 *
 * Generally the web service component will hold a copy of the API as a private
 * member varible.
 *
 * @see flockIWebService
 */
class NS_NO_VTABLE NS_SCRIPTABLE flockIWebServiceAPI : public nsISupports {
 public: 

  NS_DECLARE_STATIC_IID_ACCESSOR(FLOCKIWEBSERVICEAPI_IID)

  /**
   * Call the aMethod, supplying the parameters in aParams.  In the case of
   * authenticated APIs, this is generally an authenticated call whenever
   * possible.  If the call fails for any reason, including invalid
   * authentication, then aFlockListener.onError() will be called with the details.
   *
   * @param aApiMethod Name of the API method to be called.
   * @param aParams aParams.wrappedJSObject is an associative array of
   *                parameters.
   * @param aPostVars aPostVars.wrappedJSObject is an associative array of
   *                  parameters.
   * @param aRequestMethod Request method (GET, POST, PUT, etc.) indicated by
   *                       constants.
   * @param aFlockListener Listener to respond to success or failure events.
   * @see GET
   * @see PUT
   * @see POST
   */
  /* void call (in AString aApiMethod, in nsISupports aParams, in nsISupports aPostVars, in long aRequestMethod, in flockIListener aFlockListener); */
  NS_SCRIPTABLE NS_IMETHOD Call(const nsAString & aApiMethod, nsISupports *aParams, nsISupports *aPostVars, PRInt32 aRequestMethod, flockIListener *aFlockListener) = 0;

  enum { GET = 0 };

  enum { PUT = 1 };

  enum { POST = 2 };

  /**
   * Maps above constants to strings that nsIXMLHttpRequest can understand.
   *
   * @param aRequestType using constants.
   * @return AString of the request method that nsIXMLHttpRequest understands.
   * @see nsIXMLHttpRequest
   * @see GET
   * @see PUT
   * @see POST
   */
  /* AString getRequestMethod (in long aRequestMethod); */
  NS_SCRIPTABLE NS_IMETHOD GetRequestMethod(PRInt32 aRequestMethod, nsAString & _retval) = 0;

  /**
   * Maps API error codes to a flockIError object.
   *
   * @param aErrorCode (in) API error code.
   * @return an flockIError object.
   */
  /* flockIError getError (in AString aErrorCode); */
  NS_SCRIPTABLE NS_IMETHOD GetError(const nsAString & aErrorCode, flockIError **_retval) = 0;

  /**
   * Maps API HTTP error codes to flockIError object.
   *
   * @param aHttpErrorCode (in) API HTTP error code.
   * @return an flockIError object.
   */
  /* flockIError getHttpError (in AString aHttpErrorCode); */
  NS_SCRIPTABLE NS_IMETHOD GetHttpError(const nsAString & aHttpErrorCode, flockIError **_retval) = 0;

};

  NS_DEFINE_STATIC_IID_ACCESSOR(flockIWebServiceAPI, FLOCKIWEBSERVICEAPI_IID)

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_FLOCKIWEBSERVICEAPI \
  NS_SCRIPTABLE NS_IMETHOD Call(const nsAString & aApiMethod, nsISupports *aParams, nsISupports *aPostVars, PRInt32 aRequestMethod, flockIListener *aFlockListener); \
  NS_SCRIPTABLE NS_IMETHOD GetRequestMethod(PRInt32 aRequestMethod, nsAString & _retval); \
  NS_SCRIPTABLE NS_IMETHOD GetError(const nsAString & aErrorCode, flockIError **_retval); \
  NS_SCRIPTABLE NS_IMETHOD GetHttpError(const nsAString & aHttpErrorCode, flockIError **_retval); 

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_FLOCKIWEBSERVICEAPI(_to) \
  NS_SCRIPTABLE NS_IMETHOD Call(const nsAString & aApiMethod, nsISupports *aParams, nsISupports *aPostVars, PRInt32 aRequestMethod, flockIListener *aFlockListener) { return _to Call(aApiMethod, aParams, aPostVars, aRequestMethod, aFlockListener); } \
  NS_SCRIPTABLE NS_IMETHOD GetRequestMethod(PRInt32 aRequestMethod, nsAString & _retval) { return _to GetRequestMethod(aRequestMethod, _retval); } \
  NS_SCRIPTABLE NS_IMETHOD GetError(const nsAString & aErrorCode, flockIError **_retval) { return _to GetError(aErrorCode, _retval); } \
  NS_SCRIPTABLE NS_IMETHOD GetHttpError(const nsAString & aHttpErrorCode, flockIError **_retval) { return _to GetHttpError(aHttpErrorCode, _retval); } 

/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_FLOCKIWEBSERVICEAPI(_to) \
  NS_SCRIPTABLE NS_IMETHOD Call(const nsAString & aApiMethod, nsISupports *aParams, nsISupports *aPostVars, PRInt32 aRequestMethod, flockIListener *aFlockListener) { return !_to ? NS_ERROR_NULL_POINTER : _to->Call(aApiMethod, aParams, aPostVars, aRequestMethod, aFlockListener); } \
  NS_SCRIPTABLE NS_IMETHOD GetRequestMethod(PRInt32 aRequestMethod, nsAString & _retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetRequestMethod(aRequestMethod, _retval); } \
  NS_SCRIPTABLE NS_IMETHOD GetError(const nsAString & aErrorCode, flockIError **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetError(aErrorCode, _retval); } \
  NS_SCRIPTABLE NS_IMETHOD GetHttpError(const nsAString & aHttpErrorCode, flockIError **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetHttpError(aHttpErrorCode, _retval); } 

#if 0
/* Use the code below as a template for the implementation class for this interface. */

/* Header file */
class _MYCLASS_ : public flockIWebServiceAPI
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_FLOCKIWEBSERVICEAPI

  _MYCLASS_();

private:
  ~_MYCLASS_();

protected:
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS1(_MYCLASS_, flockIWebServiceAPI)

_MYCLASS_::_MYCLASS_()
{
  /* member initializers and constructor code */
}

_MYCLASS_::~_MYCLASS_()
{
  /* destructor code */
}

/* void call (in AString aApiMethod, in nsISupports aParams, in nsISupports aPostVars, in long aRequestMethod, in flockIListener aFlockListener); */
NS_IMETHODIMP _MYCLASS_::Call(const nsAString & aApiMethod, nsISupports *aParams, nsISupports *aPostVars, PRInt32 aRequestMethod, flockIListener *aFlockListener)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* AString getRequestMethod (in long aRequestMethod); */
NS_IMETHODIMP _MYCLASS_::GetRequestMethod(PRInt32 aRequestMethod, nsAString & _retval)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* flockIError getError (in AString aErrorCode); */
NS_IMETHODIMP _MYCLASS_::GetError(const nsAString & aErrorCode, flockIError **_retval)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* flockIError getHttpError (in AString aHttpErrorCode); */
NS_IMETHODIMP _MYCLASS_::GetHttpError(const nsAString & aHttpErrorCode, flockIError **_retval)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* End of implementation class template. */
#endif


/* starting interface:    flockIAuthenticatedAPI */
#define FLOCKIAUTHENTICATEDAPI_IID_STR "824ca3ca-e555-4c63-af3c-15db59923379"

#define FLOCKIAUTHENTICATEDAPI_IID \
  {0x824ca3ca, 0xe555, 0x4c63, \
    { 0xaf, 0x3c, 0x15, 0xdb, 0x59, 0x92, 0x33, 0x79 }}

/**
 * A web service API that supports authentication and authenticated calls.
 */
class NS_NO_VTABLE NS_SCRIPTABLE flockIAuthenticatedAPI : public flockIWebServiceAPI {
 public: 

  NS_DECLARE_STATIC_IID_ACCESSOR(FLOCKIAUTHENTICATEDAPI_IID)

  /**
   * Authenticate the API.
   * @param aLoginInfo (in) Username and password to authenticate with the
   *        API.  The API component may not actually use it if, for example, a
   *        valid token is still held.  In cases where the password is not
   *        required, null is an acceptable input.  Some APIs may hold the
   *        credentials and pass them with every authenticated call.
   * @param aFlockListener (in) Listener to respond to success or failure events.
   */
  /* void authenticate (in nsILoginInfo aLoginInfo, in flockIListener aFlockListener); */
  NS_SCRIPTABLE NS_IMETHOD Authenticate(nsILoginInfo *aLoginInfo, flockIListener *aFlockListener) = 0;

  /** Deauthenticate the API.  */
  /* void deauthenticate (); */
  NS_SCRIPTABLE NS_IMETHOD Deauthenticate(void) = 0;

};

  NS_DEFINE_STATIC_IID_ACCESSOR(flockIAuthenticatedAPI, FLOCKIAUTHENTICATEDAPI_IID)

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_FLOCKIAUTHENTICATEDAPI \
  NS_SCRIPTABLE NS_IMETHOD Authenticate(nsILoginInfo *aLoginInfo, flockIListener *aFlockListener); \
  NS_SCRIPTABLE NS_IMETHOD Deauthenticate(void); 

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_FLOCKIAUTHENTICATEDAPI(_to) \
  NS_SCRIPTABLE NS_IMETHOD Authenticate(nsILoginInfo *aLoginInfo, flockIListener *aFlockListener) { return _to Authenticate(aLoginInfo, aFlockListener); } \
  NS_SCRIPTABLE NS_IMETHOD Deauthenticate(void) { return _to Deauthenticate(); } 

/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_FLOCKIAUTHENTICATEDAPI(_to) \
  NS_SCRIPTABLE NS_IMETHOD Authenticate(nsILoginInfo *aLoginInfo, flockIListener *aFlockListener) { return !_to ? NS_ERROR_NULL_POINTER : _to->Authenticate(aLoginInfo, aFlockListener); } \
  NS_SCRIPTABLE NS_IMETHOD Deauthenticate(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Deauthenticate(); } 

#if 0
/* Use the code below as a template for the implementation class for this interface. */

/* Header file */
class _MYCLASS_ : public flockIAuthenticatedAPI
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_FLOCKIAUTHENTICATEDAPI

  _MYCLASS_();

private:
  ~_MYCLASS_();

protected:
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS1(_MYCLASS_, flockIAuthenticatedAPI)

_MYCLASS_::_MYCLASS_()
{
  /* member initializers and constructor code */
}

_MYCLASS_::~_MYCLASS_()
{
  /* destructor code */
}

/* void authenticate (in nsILoginInfo aLoginInfo, in flockIListener aFlockListener); */
NS_IMETHODIMP _MYCLASS_::Authenticate(nsILoginInfo *aLoginInfo, flockIListener *aFlockListener)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void deauthenticate (); */
NS_IMETHODIMP _MYCLASS_::Deauthenticate()
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* End of implementation class template. */
#endif


/* starting interface:    flockITokenAPI */
#define FLOCKITOKENAPI_IID_STR "922cb12e-e49a-4737-a2c2-9ecc993c1b2e"

#define FLOCKITOKENAPI_IID \
  {0x922cb12e, 0xe49a, 0x4737, \
    { 0xa2, 0xc2, 0x9e, 0xcc, 0x99, 0x3c, 0x1b, 0x2e }}

/**
 * Token-based authentication API.
 */
class NS_NO_VTABLE NS_SCRIPTABLE flockITokenAPI : public flockIAuthenticatedAPI {
 public: 

  NS_DECLARE_STATIC_IID_ACCESSOR(FLOCKITOKENAPI_IID)

  /** Token value used for authenticated calls */
  /* readonly attribute AString token; */
  NS_SCRIPTABLE NS_IMETHOD GetToken(nsAString & aToken) = 0;

  /** Token expiration date: the number of milliseconds since 01/01/1970. */
  /* readonly attribute PRUint32 expiresOn; */
  NS_SCRIPTABLE NS_IMETHOD GetExpiresOn(PRUint32 *aExpiresOn) = 0;

};

  NS_DEFINE_STATIC_IID_ACCESSOR(flockITokenAPI, FLOCKITOKENAPI_IID)

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_FLOCKITOKENAPI \
  NS_SCRIPTABLE NS_IMETHOD GetToken(nsAString & aToken); \
  NS_SCRIPTABLE NS_IMETHOD GetExpiresOn(PRUint32 *aExpiresOn); 

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_FLOCKITOKENAPI(_to) \
  NS_SCRIPTABLE NS_IMETHOD GetToken(nsAString & aToken) { return _to GetToken(aToken); } \
  NS_SCRIPTABLE NS_IMETHOD GetExpiresOn(PRUint32 *aExpiresOn) { return _to GetExpiresOn(aExpiresOn); } 

/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_FLOCKITOKENAPI(_to) \
  NS_SCRIPTABLE NS_IMETHOD GetToken(nsAString & aToken) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetToken(aToken); } \
  NS_SCRIPTABLE NS_IMETHOD GetExpiresOn(PRUint32 *aExpiresOn) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetExpiresOn(aExpiresOn); } 

#if 0
/* Use the code below as a template for the implementation class for this interface. */

/* Header file */
class _MYCLASS_ : public flockITokenAPI
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_FLOCKITOKENAPI

  _MYCLASS_();

private:
  ~_MYCLASS_();

protected:
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS1(_MYCLASS_, flockITokenAPI)

_MYCLASS_::_MYCLASS_()
{
  /* member initializers and constructor code */
}

_MYCLASS_::~_MYCLASS_()
{
  /* destructor code */
}

/* readonly attribute AString token; */
NS_IMETHODIMP _MYCLASS_::GetToken(nsAString & aToken)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* readonly attribute PRUint32 expiresOn; */
NS_IMETHODIMP _MYCLASS_::GetExpiresOn(PRUint32 *aExpiresOn)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* End of implementation class template. */
#endif


#endif /* __gen_flockIWebServiceAPI_h__ */
