You are here

README.txt in User Relationships 5.2

Author scottgifford http://drupal.org/user/245699

= RPC calls for relationship management =

This module allows relationships to be requested, approved, deleted,
and listed via Drupal RPC calls.

Errors will be returned via the RPC handler's standard error reporting
mechanism. In the case of XML-RPC, they will be returned as XML-RPC faults
with an error number as described below; for JSON the error number will
be the first number preceded by a pound sign.  The errors also include
an error string describing the error in a human-readable way.

== user_relationships.types ==

The "user_relationships.types" call gets a list of all relationship types
currently recognized by the system.  It takes the following arguments:

  1. version: API version in use, currently always 1

On success, it will return an array of structures containing these fields:

  * rtid: The ID of theis relationship types.
  * name: Name of relationship type.
  * plural_name: Properly pluralized name of relationship type, for user display

The structures may also contain other fields, which are subject to change
and should not be relied on.

On failure, it may return one of these errors:
  * A general error, containing a human-readable message

== user_relationships.search ==

The "user_relationships.mine" call gets a list of all the currently
logged in user's relationships, both active and pending.

It takes the following arguments:

  1. version: API version in use, currently always 1
  2. query: Query, as described below.

On success, it will return an array of structures containing these fields:

  * rid: ID of this particular relationship
  * initiator: Who initiated this request, always either "me" or "otherguy".  For approved relationships, it will always be "me".
  * otherguy: ID of the other user in this relationship, regardless of whether they were requester or requestee.
  * requester_id: ID of the user that requested this relationship
  * requestee_id: ID of the user this relationship was requested of
  * rtid: Relationship Type ID; see user_relationships.types
  * approved: Approved flag.  If this is "1", both users have approved this relationship.  If it is 0, the relationship has not been approved; if the "requester_id" is the same as the current UID, it is awaiting approval from the other party, while if the "requestee_id" is the same as the current UID it is awaiting approval from this user.
  * created_at: Unix timestamp of time when relationship was first requested
  * updated_at: Unix timestamp of time when relationship was last modified
  * name: Name of this relationship type
  * plural_name: Properly pluralized name of this relationship type

The structures may also contain other fields, which are subject to change
and should not be relied on.

If there are no results, an empty array will be returned, not an error.

On failure, it may return one of these errors:

  * A general error, containing a human-readable message


== user_relationships.mine ==

The "user_relationships.mine" call gets a list of all the currently
logged in user's relationships, both active and pending.

It takes the following arguments:

  1. version: API version in use, currently always 1

On success, it will return an array of structures like those in
user_relationships.search.

On failure, it may return one of these errors:

  * A general error, containing a human-readable message

== user_relationships.delete ==

The "user_relationships.delete" call deletes an existing or pending
relationship.  It should be used to remove existing relationships with
users, cancel an outstanding relationship requests from the current user,
or decline another user's relationship request.

It takes the following arguments:

  1. version: API version in use, currently always 1
  2. rid: Relationship ID, as returned by user_relationships.mine
  3. reason: Reason for deleting the relationship ("cancel", "disapprove", or "remove")

On success, it will return a structure with a bunch of random stuff in it.

On failure, it may return one of these errors:

  * A general error, containing a human-readable message

== user_relationships.delete.matching ==

The "user_relationships.delete.matching" call deletes existing or pending
relationship according to the given query.  It can be used to remove
existing relationships with users, cancel an outstanding relationship
requests from the current user, or decline another user's relationship
request.

It takes the following arguments:
  1. version: API version in use, currently always 1
  2. query: Query, as described below.
  3. reason: Reason for deleting the relationship ("cancel", "disapprove", or "remove")

On success, it will return the deleted relationships, in the same
format as for user_relationships.search.  If there were no matching
relationships, an empty array will be returned, not an error.

On failure, it may return one of these errors:

  * A general error, containing a human-readable message

== user_relationships.approve ==

The "user_relationships.approve" call approves a pending relationship
request from another user.

It takes the following arguments:
  1. version: API version in use, currently always 1
  2. rid: Relationship ID, as returned by user_relationships.mine

On success, it will return a structure with a bunch of random stuff in it.

On failure, it may return one of these errors:
  * A general error, containing a human-readable message

== user_relationships.request ==

The "user_relationships.request" call requests a new relationship with
another user.  Drupal will automatically send an email to that user
notifying them of the request.

It takes the following arguments:
  1. version: API version in use, currently always 1
  2. uid: UID of the other user
  3. type: Relationship type name; see user_relationships.types

On success, it will return a structure with a bunch of random stuff in it.

On failure, it may return one of these errors:

  * A general error, containing a human-readable message

= Queries =

The query for a relationship search is an array of structures. Each
structure has two fields.  "search" contains the field that's being
searched, and "value" contains something to search for.

For searching fields, you can simply use the field name for search,
and an exact value for the value.  Only exact matches are supported,
and the query will always have an implicit clause limiting results to
your own relationships.

All parts of the query must be true for a result to match.  Pattern
matching and subqueries are not supported.

Currently, all fields are searchable except "created_at" and "updated_at".

= Examples =

To search for any pending relationship requests initiated by others, search for:

    approved=0
    initaitor=otherguy

To remove all relationships with the user with UID 1, delete with the query:

    otherguy=1

To delete only the friend relationship, instead use:

    otherguy=1
    name=friend

File

plugins/user_relationship_service/README.txt
View source
  1. Author scottgifford http://drupal.org/user/245699
  2. = RPC calls for relationship management =
  3. This module allows relationships to be requested, approved, deleted,
  4. and listed via Drupal RPC calls.
  5. Errors will be returned via the RPC handler's standard error reporting
  6. mechanism. In the case of XML-RPC, they will be returned as XML-RPC faults
  7. with an error number as described below; for JSON the error number will
  8. be the first number preceded by a pound sign. The errors also include
  9. an error string describing the error in a human-readable way.
  10. == user_relationships.types ==
  11. The "user_relationships.types" call gets a list of all relationship types
  12. currently recognized by the system. It takes the following arguments:
  13. 1. version: API version in use, currently always 1
  14. On success, it will return an array of structures containing these fields:
  15. * rtid: The ID of theis relationship types.
  16. * name: Name of relationship type.
  17. * plural_name: Properly pluralized name of relationship type, for user display
  18. The structures may also contain other fields, which are subject to change
  19. and should not be relied on.
  20. On failure, it may return one of these errors:
  21. * A general error, containing a human-readable message
  22. == user_relationships.search ==
  23. The "user_relationships.mine" call gets a list of all the currently
  24. logged in user's relationships, both active and pending.
  25. It takes the following arguments:
  26. 1. version: API version in use, currently always 1
  27. 2. query: Query, as described below.
  28. On success, it will return an array of structures containing these fields:
  29. * rid: ID of this particular relationship
  30. * initiator: Who initiated this request, always either "me" or "otherguy". For approved relationships, it will always be "me".
  31. * otherguy: ID of the other user in this relationship, regardless of whether they were requester or requestee.
  32. * requester_id: ID of the user that requested this relationship
  33. * requestee_id: ID of the user this relationship was requested of
  34. * rtid: Relationship Type ID; see user_relationships.types
  35. * approved: Approved flag. If this is "1", both users have approved this relationship. If it is 0, the relationship has not been approved; if the "requester_id" is the same as the current UID, it is awaiting approval from the other party, while if the "requestee_id" is the same as the current UID it is awaiting approval from this user.
  36. * created_at: Unix timestamp of time when relationship was first requested
  37. * updated_at: Unix timestamp of time when relationship was last modified
  38. * name: Name of this relationship type
  39. * plural_name: Properly pluralized name of this relationship type
  40. The structures may also contain other fields, which are subject to change
  41. and should not be relied on.
  42. If there are no results, an empty array will be returned, not an error.
  43. On failure, it may return one of these errors:
  44. * A general error, containing a human-readable message
  45. == user_relationships.mine ==
  46. The "user_relationships.mine" call gets a list of all the currently
  47. logged in user's relationships, both active and pending.
  48. It takes the following arguments:
  49. 1. version: API version in use, currently always 1
  50. On success, it will return an array of structures like those in
  51. user_relationships.search.
  52. On failure, it may return one of these errors:
  53. * A general error, containing a human-readable message
  54. == user_relationships.delete ==
  55. The "user_relationships.delete" call deletes an existing or pending
  56. relationship. It should be used to remove existing relationships with
  57. users, cancel an outstanding relationship requests from the current user,
  58. or decline another user's relationship request.
  59. It takes the following arguments:
  60. 1. version: API version in use, currently always 1
  61. 2. rid: Relationship ID, as returned by user_relationships.mine
  62. 3. reason: Reason for deleting the relationship ("cancel", "disapprove", or "remove")
  63. On success, it will return a structure with a bunch of random stuff in it.
  64. On failure, it may return one of these errors:
  65. * A general error, containing a human-readable message
  66. == user_relationships.delete.matching ==
  67. The "user_relationships.delete.matching" call deletes existing or pending
  68. relationship according to the given query. It can be used to remove
  69. existing relationships with users, cancel an outstanding relationship
  70. requests from the current user, or decline another user's relationship
  71. request.
  72. It takes the following arguments:
  73. 1. version: API version in use, currently always 1
  74. 2. query: Query, as described below.
  75. 3. reason: Reason for deleting the relationship ("cancel", "disapprove", or "remove")
  76. On success, it will return the deleted relationships, in the same
  77. format as for user_relationships.search. If there were no matching
  78. relationships, an empty array will be returned, not an error.
  79. On failure, it may return one of these errors:
  80. * A general error, containing a human-readable message
  81. == user_relationships.approve ==
  82. The "user_relationships.approve" call approves a pending relationship
  83. request from another user.
  84. It takes the following arguments:
  85. 1. version: API version in use, currently always 1
  86. 2. rid: Relationship ID, as returned by user_relationships.mine
  87. On success, it will return a structure with a bunch of random stuff in it.
  88. On failure, it may return one of these errors:
  89. * A general error, containing a human-readable message
  90. == user_relationships.request ==
  91. The "user_relationships.request" call requests a new relationship with
  92. another user. Drupal will automatically send an email to that user
  93. notifying them of the request.
  94. It takes the following arguments:
  95. 1. version: API version in use, currently always 1
  96. 2. uid: UID of the other user
  97. 3. type: Relationship type name; see user_relationships.types
  98. On success, it will return a structure with a bunch of random stuff in it.
  99. On failure, it may return one of these errors:
  100. * A general error, containing a human-readable message
  101. = Queries =
  102. The query for a relationship search is an array of structures. Each
  103. structure has two fields. "search" contains the field that's being
  104. searched, and "value" contains something to search for.
  105. For searching fields, you can simply use the field name for search,
  106. and an exact value for the value. Only exact matches are supported,
  107. and the query will always have an implicit clause limiting results to
  108. your own relationships.
  109. All parts of the query must be true for a result to match. Pattern
  110. matching and subqueries are not supported.
  111. Currently, all fields are searchable except "created_at" and "updated_at".
  112. = Examples =
  113. To search for any pending relationship requests initiated by others, search for:
  114. approved=0
  115. initaitor=otherguy
  116. To remove all relationships with the user with UID 1, delete with the query:
  117. otherguy=1
  118. To delete only the friend relationship, instead use:
  119. otherguy=1
  120. name=friend