API > Base

Basic JavaScript object

Membership.api.base

sendReport

Send notification to the site administrator.

Parameters

  • message
    Message text.
  • type
    Type of notification

    Available types:

    • activity
    • user
  • objectId
    ID of the object about which administrator should be notified.

Result

After success returns object which contains request status in success property and message in a case of error.

  • success
    Request status true if successful or false in a case of error.
  • message
    Error message in a case of unsuccessful request.

Example

Membership.api.users.sendReport({
    message: 'Report message',
    type: 'activity',
    objectId: 1
});

uploadImage

Uploads image to the temporary directory.

Parameters

  • image
    Object of type File

    Available types of file extentions:

    • jpg
    • jpeg
    • gif
    • png

Result

After success returns object which contains request status in success property, image parameters in property attachment and message in a case or error.

  • success
    Request status true if successful or false in a case of error.
  • attachment
    Object with properties

    • id – image ID in a temporary table.
    • width – image width.
    • height – image height.
    • src – image link.
  • message
    Error message in a case of unsuccessful request.

Example

Membership.api.users.uploadImage({
    image: document.getElementById('fileItem').files[0]
});

getImages

Gets list of images.

Parameters

  • imageId
    ID of images. Consists of connected with . id of image and id of “activity” post to which they are linked.
  • direction
    If the parameter is equal to -1 request will return images in descending order, if +1 in ascending order regarding to specified in imageId.
  • offset
    Offset which is needed for selecting certain subset of images.

Result

After success returns object which contains request status in success property.
If parameters direction and offset are not specified, then properties total, offset, images will be returned.

  • success
    Request status true if successful or false in a case of error.
  • total
    General amount of images which is connected to activity.
  • offset
    Position of requested image in general image flow.
  • images

    Image array with such properties.

    • id image ID.
    • height image height.
    • width image width.
    • source link to this image.
    • user_id ID of a user who uploaded an image.
  • message
    Error message in a case of unsuccessful request.

Example

Membership.api.base.getImages({
    imageId: '103.152'
});

Categories
Latest Articles