apiURLS.ts 4.77 KB
Newer Older
1
2
const origin = typeof window !== 'undefined' ? window.location.origin : 'http://localhost:3000';
const clientUrl = `${origin}/proxy`;
markchkhotua's avatar
markchkhotua committed
3

Matija Obreza's avatar
Matija Obreza committed
4
5
6
7
export const LOGIN_URL = `${clientUrl}/oauth/token`;
export const LOGOUT_URL = `${clientUrl}/token`;
export const CHECK_TOKEN_URL = `${clientUrl}/oauth/check_token`;
export const VERIFY_GOOGLE_TOKEN_URL = `${clientUrl}/google/verify-token`;
8

Matija Obreza's avatar
Matija Obreza committed
9
10
export const API_BASE_URL = `${clientUrl}/api/v0`;
export const SERVER_INFO_URL = `${API_BASE_URL}/info/version`;
11
12

// Me API
Matija Obreza's avatar
Matija Obreza committed
13
14
15
16
17
const ME_API = `${API_BASE_URL}/me`;
export const MY_PARTNERS_LIST_URL = `${ME_API}/partners`;
export const MY_DATASETS_LIST_URL = `${ME_API}/datasets`;
export const MY_DESCRIPTORS_LIST_URL = `${ME_API}/descriptors`;
export const MY_LIST_DESCRIPTORSLISTS_URL = `${ME_API}/descriptorlists`;
Maxym Borodenko's avatar
Maxym Borodenko committed
18
19
export const GET_USER_PROFILE_URL = `${ME_API}/profile`;
export const CHANGE_USER_PASSWORD_URL = `${ME_API}/password`;
Matija Obreza's avatar
Matija Obreza committed
20

21
// Descriptor List API
Matija Obreza's avatar
Matija Obreza committed
22
const DESCRIPTORLIST_API = `${API_BASE_URL}/descriptorlist`;
23
export const AUTOCOMPLETE_DESCRIPTORLIST_URL = `${DESCRIPTORLIST_API}/autocomplete`;
Matija Obreza's avatar
Matija Obreza committed
24
25
export const GET_DESCRIPTORLIST_URL = DESCRIPTORLIST_API;
export const LIST_DESCRIPTORLISTS_URL = `${DESCRIPTORLIST_API}/list`;
26
// -- these require proper permissions
Matija Obreza's avatar
Matija Obreza committed
27
28
29
30
31
export const REMOVE_DESCRIPTORLIST_URL = DESCRIPTORLIST_API;
export const CREATE_DESCRIPTORLIST_URL = `${DESCRIPTORLIST_API}/create`;
export const UPDATE_DESCRIPTORLIST_URL = `${DESCRIPTORLIST_API}/update`;
export const PUBLISH_DESCRIPTORLIST_URL = `${DESCRIPTORLIST_API}/publish`;
export const ADD_DESCRIPTORLIST_DESCRIPTOR_URL = `${DESCRIPTORLIST_API}/add-descriptors`;
32
export const SET_DESCRIPTORLIST_DESCRIPTORS_URL = `${DESCRIPTORLIST_API}/set-descriptors`;
Matija Obreza's avatar
Matija Obreza committed
33
export const REMOVE_DESCRIPTORLIST_DESCRIPTOR_URL = `${DESCRIPTORLIST_API}/remove-descriptors`;
34

35
// Descriptors API
Matija Obreza's avatar
Matija Obreza committed
36
37
38
39
40
const DESCRIPTOR_API = `${API_BASE_URL}/descriptor`;
export const GET_DESCRIPTOR_URL = DESCRIPTOR_API;
export const LIST_DESCRIPTORS_URL = `${DESCRIPTOR_API}/list`;
export const GET_DESCRIPTOR_CATEGORIES_URL = `${DESCRIPTOR_API}/categories`;
export const CREATE_DESCRIPTOR_URL = `${DESCRIPTOR_API}/create`;
41
export const COPY_DESCRIPTOR_URL = `${DESCRIPTOR_API}/copy`;
Matija Obreza's avatar
Matija Obreza committed
42
export const UPDATE_DESCRIPTOR_URL = `${DESCRIPTOR_API}/update`;
43
export const REMOVE_DESCRIPTOR_URL = `${DESCRIPTOR_API}`;
Matija Obreza's avatar
Matija Obreza committed
44
export const PUBLISH_DESCRIPTOR_URL = `${DESCRIPTOR_API}/publish`;
45

46
// Partner API
Matija Obreza's avatar
Matija Obreza committed
47
const PARTNER_API = `${API_BASE_URL}/partner`;
48
49
export const GET_PARTNER_URL = `${PARTNER_API}`;
export const REMOVE_PARTNER_URL = `${PARTNER_API}`;
Matija Obreza's avatar
Matija Obreza committed
50
51
52
export const CREATE_PARTNER_URL = `${PARTNER_API}/create`;
export const UPDATE_PARTNER_URL = `${PARTNER_API}/update`;
export const LIST_PARTNER_URL = `${PARTNER_API}/list`;
53
54

// Dataset API
Matija Obreza's avatar
Matija Obreza committed
55
56
57
58
const DATASET_API = `${API_BASE_URL}/dataset`;
export const GET_DATASET_URL = `${DATASET_API}`;
export const CREATE_DATASET_URL = `${DATASET_API}/create`;
export const UPDATE_DATASET_URL = `${DATASET_API}/update`;
59
export const DELETE_DATASET_URL = `${DATASET_API}`;
Matija Obreza's avatar
Matija Obreza committed
60
61
62
63
export const LIST_DATASET_URL = `${DATASET_API}/list`;
export const PUBLISH_DATASET_URL = `${DATASET_API}/publish`;
export const UPDATE_DATASET_ACCESSIONS_URL = `${DATASET_API}/upsertaccessions`;
export const ADD_DESCRIPTORS_TO_DATASET_URL = `${DATASET_API}/add-descriptors`;
64
export const SET_DESCRIPTORS_TO_DATASET_URL = `${DATASET_API}/set-descriptors`;
Matija Obreza's avatar
Matija Obreza committed
65
export const REMOVE_DESCRIPTORS_FROM_DATASET_URL = `${DATASET_API}/remove-descriptors`;
66
67

// RepositoryFile API. Note: starts from 'GET_DATASET_URL'
Matija Obreza's avatar
Matija Obreza committed
68
// FIXME base on DATASET_API
Valeriy Panov's avatar
Valeriy Panov committed
69
70
export const UPLOAD_REPOSITORY_FILE_URL = '/files/add';
export const UPDATE_REPOSITORY_FILE_URL = '/files/update';
71
72
73
export const LIST_REPOSITORY_FILE_URL = '/files/list';
export const REMOVE_REPOSITORY_FILE_URL = '/files/delete';

74
75
76
77
78
const REPOSITORY_API_URL = `${API_BASE_URL}/repository`;
export const REPOSITORY_ADDFILE_URL = `${REPOSITORY_API_URL}/add`;
export const REPOSITORY_GETFILE_URL = `${REPOSITORY_API_URL}`;
export const REPOSITORY_DOWNLOADFILE_URL = `/proxy/uploads`;

79
// Location API. Note: starts from 'GET_DATASET_URL'
Matija Obreza's avatar
Matija Obreza committed
80
// FIXME base on DATASET_API
81
82
83
84
85
export const GET_LOCATION_URL = '/location';
export const LIST_LOCATION_URL = '/location/list';
export const CREATE_LOCATION_URL = '/location/create';
export const UPDATE_LOCATION_URL = '/location/update';
export const REMOVE_LOCATION_URL = '/location/delete';
86
87
88
89
// Geonames API.
export const API_GEONAMES = `${origin}/api/geonames`;
export const GET_GEONAMES_COUNTRY_URL = `${API_GEONAMES}/countryCodeJSON`;
export const GET_GEONAMES_DETAIL_INFO_URL = `${API_GEONAMES}/findNearbyPlaceNameJSON`;
90
91

// Dataset CREATOR API
Matija Obreza's avatar
Matija Obreza committed
92
93
// FIXME base on DATASET_API
export const MAIN_URL_PART_CREATOR_URL = `${DATASET_API}`;
94
95
96
export const CREATE_CREATOR_URL = '/datasetcreator/create';
export const DELETE_CREATOR_URL = '/datasetcreator/delete';
export const UPDTATE_CREATOR_URL = '/datasetcreator/update';