GroupApi. Android
Api to manipulate with camera groups.
Get group list
Get list of camera groups. Specify page for request. For the first request set page = 0
.
If request was successful you'll get paginated response of groups.
@GET(GROUPS)
suspend fun getGroups(@Query(PAGE) page: String): VMSApiResponseGroups
Create group
Create new group of cameras with specified name. Initially the group is empty.
If request was successful, the response would be VMSCreateGroupResponse
.
@POST(GROUPS)
suspend fun createGroup(@Body name: VMSSimpleName): VMSCreateGroupResponse
Rename group
Rename specific group by it's id with new name.
If request was successful, the response would be VMSChildGroup
.
@PUT(GROUP_CRUD)
suspend fun renameGroup(@Path(ID) id: String, @Body name: VMSSimpleName): VMSChildGroup
Delete group
Delete specific group by it's id.
If request was successful, the response would be VMSStatusResponse
.
@DELETE(GROUP_CRUD)
suspend fun deleteGroup(@Path(ID) id: Int): VMSStatusResponse
Update group
Update group with specified information.
If request was successful, the response would be VMSChildGroup
.
@PUT(GROUP_CRUD)
suspend fun updateGroup(@Path(ID) id: String, @Body group: VMSUpdateGroupRequest): VMSChildGroup
@Path(ID) id
- id of the group to specify needed group.
VMSUpdateGroupRequest
Object with needed information to update a group.
name
- new name of the group If you don't' want to change group name set old name in this parameter.
items
- list of cameras ids you want to add to this group.
Sync groups
This request will sync specified camera with all user's groups. The request require a list of groups where this camera will belong to. Camera will be deleted from other groups.
If request was successful, the response would be VMSGroupSync
object.
@POST(GROUPS_SYNC)
suspend fun syncGroups(@Path(ID) id: String, @Body groups: VMSGroupSyncRequest): VMSGroupSync
@Path(ID) id
- specify camera by it's id.
groups
- specify the list of group ids where camera will be presented (camera will be added to a group if it wasn't there before).
VMSGroupSync
Information about the way of syncing on server side.
@Parcelize
data class VMSGroupSync(
@SerializedName("type") val type: String = ""
): Parcelable
sync
- you will get this type, if the syncing was done
async
- you will get this type, if user has more than 50 group the backend request will run asynchronously. After process is done you'll receive socket message you can handle. See VMSPusherApi
for more details.