Gallections - danopia/deviantart-difi GitHub Wiki

This method is used to create, remove and otherwise manipulate the contents of user gallections (i.e. "gallery collections" or "favourite collections")

List of Collection types

Here's a list of known folder types:

Name Value Constant
undefined 0 MYSTERY
Deviation Page 1 RESOURCE_DEVIATION
User Gallery 20 RESOURCE_GALLERIES
Favourite Collections 21 RESOURCE_FAVCOLLECTIONS

For more resource types, refer to Resource Types.

create

Creates a new gallection (e.g. add a folder in your gallery or favourites.)

NOTE: If a folder with the same name already exists, a number (e.g. 2) is appended to the end of new folder name.

Usage

  • When adding a deviation to a new collection with the +favourite drop-down button
  • When clicking the ➕ button in the collections drop header

Params

  • userid: number
  • gallerytype: number (e.g. 20 for Gallery and 21 for Favourites)
  • name: string (e.g. "test dir")

Response

  • On success, returns the new collection data, e.g.:

    • gallectionid: number (e.g. 78397318)
    • name: string (e.g. "test dir")
    • url: string (e.g. https://username.deviantart.com/favourites/78397318/test-dir)
  • On error:

    • error: "No gallections of the supplied resource type () are supported."
    • error: "Not authorized"

create_featured

REMOVED – This call seems to have been removed and not used anymore.

Appears to create a "Featured" gallery for the current user if he doesn't have one already?

The actual purpose is kinda unknown.

See also Aggregations::get_galleries_initial (both methods are typically called together)

Usage

  • Pretty sure we found this when initiating a drag-and-drop action.

Params

  • deviantid (?): number
  • gallerytype (?): number (20 or 21)

NOTE: It seems to take the current user as a param, but you wouldn't be able to create galleries for other users.
The second param appears to indicate a Favorites gallery.

Response

Returns the new/existing gallery ID in galleryid. Used to also return a list of deviations, but that is apparently no more.

get_gallections_info_by_username

REMOVED – This call seems to have been removed and not used anymore.

Appears to return the gallery id of each item in a users gallery.

Params

  • deviantid: number
  • gallerytype: number (20 or 21)

Response

Returns an array of ids for each item in a users gallery

remove_resource

Removes a "resource" (i.e. Deviation) from a Gallection folder.

This method can be used to remove a Deviation from either a gallery or favourites folder.

Usage

  • When removing a certain deviation from a favourite collection

Params

  • userid: number, the folder owner's userid
  • gallerytype: number (e.g. 20 for Gallery and 21 for Favourites)
  • galleryid: number, the destination folder id
  • resourcetype: number (e.g. 1 for a Deviation)
  • resourceid: number (e.g. deviationid when the resource type is 1)

Response

Returns null on success

add_resource

Puts a "resource" (such as a Deviation) into a Gallection folder (e.g. Favourites)

Usage

  • Drag-and-drop actions between folders.
  • Re-ordering deviations in a collection.
  • Copying deviations using the context menu.

Params

  • userid: number, the folder owner's userid
  • foldertype: number (20 for Gallery, 21 for Favorites)
  • folderid: int (e.g. 42231485)
  • resourcetype: number, i.e. (e.g. 1 for RESOURCE_DEVIATION)
  • resourceid: number, i.e. deviationid (e.g. 196838222)
  • position: number, i.e. the resource position in the folder (starting from 0) (e.g. 0 or 20)

NOTE: rid stands for resourceid, and is often found in the collect_rid attribute of HTML elements.
It usually is a two-element array, such that rid = [resourcetype, resourceid]
e.g. rid[0] should be 1 for Deviations, and rid[1] refers to a deviation id.

Example

The following request is called when a user adds a deviation to a favourite gallection:

"Gallections","add_resource",["{userid}","{foldertype}","{gallectionid}","1","{deviationid}","0"]

Couple of notes:

  • Here, {foldertype} is 21 for favourites
  • The third to last number (1) indicates that we are adding a deviation
  • The last number (0) means that the deviation is added to the top of favourite folder

Response

Return true on success.

move_resource

Moves a "resource" such as a Deviation into another Gallection folder (e.g. favourites)

Usage

  • Drag-and-drop actions between folders.
  • Moving deviations using the context menu.

Params

  • userid: number, the folder owner's userid
  • foldertype: number (20 for Gallery, 21 for Favorites)
  • source_folderid: number, the source folder id
  • destination_folderid: number, the destination folder id
  • resourcetype: number (e.g. 1 for RESOURCE_DEVIATION)
  • resourceid: number, i.e. deviation_id for Deviations (e.g. 196838222)
  • position: number, i.e. the resource position in the new folder (starting from 0) (e.g. 0 or 20)

Response

Return true on success.

get_gallections_with_permissions

Returns a list of user's all collections you can move something into

Usage

  • When moving Faves from one folder to another using "Move to" from context menu

Params

  • userid: number, the folder owner's userid
  • foldertype: number, (e.g. 20 for Gallery, 21 for Favorites)
  • folderid: number, presumably the parent folder id

Response

  • On success, an array containing an object for each folder
    • attributes: number
    • collectionid: int
    • galleryid: int
    • is_root_folder: boolean (e.g. false)
    • name: string (e.g. "Featured")
    • parentid: number, e.g. null
    • position: number, e.g. 0
    • resource_typeid: number, e.g. 21 for favourites
    • title: string (e.g. "Featured")
    • cover_deviationid: number
    • behavior: object containing boolean properties
      • arrange_folders
      • arrange_resources
      • blue_buttons
      • contribute
      • contribute_deviations
      • create_folder
      • delete
      • delete_folder
      • drop_resources
      • edit_button
      • edit_folder
      • log
      • options_button
      • recommend
      • recommend_deviations
      • rename
      • view
      • view_folder

rename

Renames a gallection (e.g. a folder in your gallery or favourites.)

Usage

  • When renaming a folder using the context menu.

Params

  • userid: number, the folder owner's user id.
  • typeid: number (e.g. 20 for Gallery, 21 for Favourites)
  • setid: number i.e. folder_id
  • name: string, the new folder name

Response

Returns null on success.

get_collections_for_lub

Returns the list of gallections (i.e. gallery and favourite collections) for a user.

Usage

  • When drag-and-dropping a deviation into a favourite folder in the slide menu

Params

  • userid: number

Response

  • On success, an array containing user gallections, e.g.: [ {...}, {...}, {...} ].
    "galleryid": <id>,
    "type": 21,
    "position": 0,
    "parentid": null,
    "title": "Featured",
    "url": "https:\/\/www.deviantart.com\/<username>\/favourites\/<id>\/Featured",
    "approx_total": 143,
    "attributes": "0",
    "behavior": {
        "create_folder": true,
        "delete_folder": true,
        "edit_folder": true,
        "view_folder": true,
        "contribute_deviations": true,
        "recommend_deviations": true,
        "delete": true,
        "view": true,
        "log": true,
        "options_button": true,
        "arrange_folders": true,
        "edit_button": true,
        "blue_buttons": true,
        "drop_resources": true,
        "arrange_resources": true,
        "rename": true,
        "contribute": true,
        "recommend": true
    },
    "ids": [
        [1, <id>, 0],
        [1, <id>, 0],
        [1, <id>, 0]
    ],
    "top_resources": [
        [1, <id>, ". . . ."],
        [1, <id>, ". . . ."],
        [1, <id>, ". . . ."]
    ]
  • On error:
    • error: "Not a valid user"

toggle_watch

Turns watch settings for a folder on or off.

Usage

  • When watching a user's collections (e.g. gallery or favourites).

Params

  • userid: number, the folder owner's user id. (e.g. "11555439")
  • typeid: number (e.g. 20 for Gallery, 21 for Favourites)
  • collectionid: number, i.e. the gallery to watch (e.g. "50016531")
  • is_watched: boolean (true means watch, false means unwatch)

Response

Returns null on success

move_under

Moves a gallection folder into another folder

Usage

  • When moving a gallery folder using the context menu

Params

  • userid: number, the folder owner's user id.
  • typeid: number (e.g. 20 for Gallery, 21 for Favourites)
  • folder_id: number, i.e. the selected folder which will be moved
  • destination_id: number, i.e. the target destination

Response

Returns the destination's folder id on success.

delete

Removes a gallection (e.g. delete a folder in your gallery or favourites.)

Usage

  • When removing a favourite folder

Params

  • userid: string
  • foldertype: number (20 for Gallery, 21 for Favorites)
  • folderid: number

Response

Returns null on success.

reposition

This method will reposition a gallection folder.

Usage

  • When drag-and-dropping a gallery folder to re-order it.

Params

  • userid: number
  • foldertype: number (e.g. 20 is for gallery and 21 is for favourites)
  • folderid: int (e.g. 42231485)
  • position: number, i.e. the folder's new position in the gallection (starting from 0) (e.g. 0 or 20)

Response

Returns null on success.

get_gallections

This method returns a user's list of gallections (such as favourite folders).

Usage

  • Called when hovering the mouse on the add to favourite button of a deviation to display possible destination favourite folders.

Params

  • userid: number
  • foldertype: number (e.g. 20 is for gallery and 21 is for favourites)

Response

An array containing an object for each gallection.

attributes: "0",
gallectionid: "<id>",
parentid: null,
position: 0,
title: "Featured"

oembed

undocumented

Usage

Purpose unknown.

Params

  • string
  • id
  • id
  • string
⚠️ **GitHub.com Fallback** ⚠️