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


activateTeamMember(id)

Ativate team user NB: user must be an inactive member

Parameters:
Name Type Description
id string

team id

Source:
api/MacarteApi.js

addTeamMember(id, userId, role)

Add members to the team

Parameters:
Name Type Argument Description
id string

team id

userId string

user id

role string

user role (editor, owner, member)

options.callback function <optional>

callback function

options.refresh boolean <optional>

get a refresh token

Source:
api/MacarteApi.js

checkTeam( [callback])

Check if current team is still valid (the user belong to it)

Parameters:
Name Type Argument Description
callback function <optional>

callback function that takes a boolean

Source:
api/MacarteApi.js

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

deleteTeam(id)

Create a new team

Parameters:
Name Type Argument Description
id string

team id

options.callback function <optional>

callback function

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>
organization 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

Properties
Name Type Argument Default Description
team boolean <optional>
true

use false to get user media (out of current team)

callback function
Source:
api/MacarteApi.js

getMediasFolders(callback [, useTeam])

Get user media folders

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

use false to get user media folder (out of teams)

Source:
api/MacarteApi.js

getNotifications(callback404)

Get Notifications

Parameters:
Name Type Description
callback404 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

getTeam(id)

Get team list NB: if not member, team members are not listed, only a count is returned

Parameters:
Name Type Argument Description
id string

team id

options.callback function <optional>

callback function

options.publi boolean <optional>

public information (no connection required)

Source:
api/MacarteApi.js

Get member links

Parameters:
Name Type Description
id string

team id

Source:
api/MacarteApi.js

getTeams()

Get my team list

Parameters:
Name Type Argument Description
options.callback function <optional>

callback function

Source:
api/MacarteApi.js

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

getUsers(name, callback)

Autocomplete users

Parameters:
Name Type Description
name string

public user name

callback function
Source:
api/MacarteApi.js

isConnected()

Check connection

Source:
api/MacarteApi.js

joinTeam(id)

Join a team using a link id

Parameters:
Name Type Description
id string

link id

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

newTeam(options)

Create a new team

Parameters:
Name Type Description
options Object
Properties
Name Type Argument Description
name string

team name

presentation string <optional>

team description

image string <optional>

image url for the team

callback function <optional>

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
organization_id 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 [, useTeam])

Post a new user media

Parameters:
Name Type Argument Default Description
img File

image file

folder string
name string
callback function
useTeam boolean <optional>
true
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

Remove the member link

Parameters:
Name Type Argument Description
id string

team id

type string

'member' or 'editor'

options.callback function <optional>

callback function

Source:
api/MacarteApi.js

removeTeamMember(id, userId [, callback])

Remove member from team

Parameters:
Name Type Argument Description
id string

team id

userId string

user id

callback function <optional>

callback function

Source:
api/MacarteApi.js

searchMapUsers(options, callback)

Search for users that publish a map

Parameters:
Name Type Description
options Object
Properties
Name Type Argument Default Description
public_name string <optional>

string contains in the public user name

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

setTeam(id, attr, value)

Set team attribute

Parameters:
Name Type Argument Description
id string

team id

attr string

attribute to change (name, presentation, image)

value string

attribute values

options.callback function <optional>

callback function

Source:
api/MacarteApi.js

Modify the member link

Parameters:
Name Type Argument Description
id string

team id

type string

'member' or 'editor'

options.callback function <optional>

callback function

Source:
api/MacarteApi.js

setTeamMemberRole(id, userId, role)

Modify member role in the team

Parameters:
Name Type Argument Description
id string

team id

userId string

user id

role string

user role (editor, owner, member)

options.callback function <optional>

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