Class: MacarteAPI

MacarteAPI

Class to access Macarte data through the API


new MacarteAPI(apiURL)

Constructor

Parameters:
Name Type Description
apiURL string
Source:
api/MacarteApi.js
Fires:
  • event:login
  • event:logout
  • event:disconnect
  • event:me

Members


<static, constant> api

Singleton API object to access the API

Source:
api/api.js

Methods


deleteMap(id, success)

Delete map and file

Parameters:
Name Type Description
id string

map id

success function

callback

Source:
api/MacarteApi.js

deleteMedia(id, callback)

Delete Media

Parameters:
Name Type Description
id string

media to delete

callback function

when done

Source:
api/MacarteApi.js

dispatchEvent(event)

Dipatch an event

Parameters:
Name Type Description
event Object | string

an object with a type property or an event type

Source:
api/MacarteApi.js

getArticleCategories(type, callback)

Get editorial categories

Parameters:
Name Type Description
type string
callback function
Source:
api/MacarteApi.js

getArticles(category, callback)

Get articles of an editorial category

Parameters:
Name Type Description
category string

followers|megamenu

callback function
Source:
api/MacarteApi.js

getEditMap(id, success)

Get map information for a given id

Parameters:
Name Type Description
id string

map id

success function

callback

Source:
api/MacarteApi.js

getEditorial(type, callback)

Get editorial

Parameters:
Name Type Description
type string
callback function
Source:
api/MacarteApi.js

getMap(id, success)

Get map information for a given id

Parameters:
Name Type Description
id string

map id

success function

callback

Source:
api/MacarteApi.js

getMapFile(id, success)

Get map file

Parameters:
Name Type Description
id sting

map id

success function

callback

Source:
api/MacarteApi.js

getMaps(options)

Get the list of maps

Parameters:
Name Type Description
options *
Properties
Name Type Argument Default Description
context string <optional>
profile

search context atlas|profile|admin, default profile

query string <optional>

Query string

theme string <optional>
premium string <optional>
'default'

Premium 'default' or 'edugeo')

user string <optional>

User public name

sort string <optional>
'date'

'date', 'rank' or 'views'

limit number | string <optional>

maximum responses returned, an integer or 'all' to get all maps, default 'all' in context profile, 25 otherwise

offset number <optional>
callback function <optional>

callback function

Source:
api/MacarteApi.js

getMe()

Get current user

Source:
api/MacarteApi.js

getMedias(options, callback)

Get user media

Parameters:
Name Type Description
options Object

search options

callback function
Source:
api/MacarteApi.js

getMediasFolders(callback)

Get user media folders

Parameters:
Name Type Description
callback function
Source:
api/MacarteApi.js

getNotifications(callback)

Get Notifications

Parameters:
Name Type Description
callback function
Source:
api/MacarteApi.js

getPremium(edugeo)

Get user premium

Parameters:
Name Type Description
edugeo string

or default

Source:
api/MacarteApi.js

getRememberMe()

Are the credentials stored?

Source:
api/MacarteApi.js
Returns:
Type
boolean

getThemes(callback)

Get Themes

Parameters:
Name Type Description
callback function
Source:
api/MacarteApi.js

getUser(public_id, success)

Get user info

Parameters:
Name Type Description
public_id string

user id

success function

callback

Source:
api/MacarteApi.js

isConnected()

Check connection

Source:
api/MacarteApi.js

login(user, pwd, callback)

Login: log the user and get user info Dispatch a login event

Parameters:
Name Type Description
user string
pwd string
callback function

a function that returns the user info or an error

Source:
api/MacarteApi.js

logout(callback)

Logout

Parameters:
Name Type Description
callback function

callback function

Source:
api/MacarteApi.js

on(type, listener)

Add an event listener

Parameters:
Name Type Description
type string | Array.<string>

an event type or an array of event type to listen to

listener function

a function that takes an event

Source:
api/MacarteApi.js

postMap(carte, data, success)

Save a new map

Parameters:
Name Type Description
carte Object
Properties
Name Type Argument Default Description
type string
title string
description string
theme_id number
premium string

'default' or 'edugeo'

active boolean true
share string private
bbox Array.<number>
img_url string <optional>
data Object

carte data

success function

callback

Source:
api/MacarteApi.js

postMedia(img, folder, name, callback)

Post a new user media

Parameters:
Name Type Description
img File

image file

folder string
name string
callback function
Source:
api/MacarteApi.js

refreshToken(callback)

Refresh current token

Parameters:
Name Type Description
callback function
Source:
api/MacarteApi.js

rememberMe(b)

Store current token

Parameters:
Name Type Description
b boolean
Source:
api/MacarteApi.js

searchUsers(name, options [, public_name] [, theme] [, limit], callback)

Search for users

Parameters:
Name Type Argument Default Description
name string

user name

options Object
public_name string <optional>

string contains in the public user name

theme number <optional>
limit number <optional>
15
callback function
Source:
api/MacarteApi.js

setToken(token [, refreshToken])

Set the current token

Parameters:
Name Type Argument Description
token string

if none remove the current one

refreshToken string <optional>
Source:
api/MacarteApi.js

un(type, listener)

Remove an event listener

Parameters:
Name Type Description
type string | Array.<string>

an event type or an array of event type to listen to

listener function

a function that takes an event

Source:
api/MacarteApi.js

updateMap(id, info, success)

Update map information for a given id

Parameters:
Name Type Description
id string

map id

info Object

list of info to update

success function

callback

Source:
api/MacarteApi.js

updateMapFile(id, data, callback)

Post a file media

Parameters:
Name Type Description
id string

map edit id

data Object

carte data

callback function

when done

Source:
api/MacarteApi.js

updateMe(value, callback)

Update current user info

Parameters:
Name Type Description
value Object

key value info

callback function
Source:
api/MacarteApi.js

updateMediaFile(id, img, callback)

Post a file media

Parameters:
Name Type Description
id string

media to update

img File

image file

callback function

when done

Source:
api/MacarteApi.js

updateMediaFolder(id, folder, callback)

Update media folder

Parameters:
Name Type Description
id string

media to update

folder string
callback function

when done

Source:
api/MacarteApi.js

updateMediaName(id, name, callback)

Update media name

Parameters:
Name Type Description
id string

media to update

name string
callback function

when done

Source:
api/MacarteApi.js

whoami(callback [, refresh])

Who is connected

Parameters:
Name Type Argument Default Description
callback function
refresh boolean <optional>
true

refresh token before send

Source:
api/MacarteApi.js