Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | 1x | import { authenticatedInstance, unAuthenticatedInstance } from "../../api"; import { Organisation, EditableOrganisationFields, OrgMember } from "./types"; import { buildPartialSearchQuery, CUSTOM_VALIDATION_SCHEMA } from "../../utils"; const api = { organisations: { retrieve: { public: (organisationUrl: string, q: string = "", limit = 20, page = 1) => unAuthenticatedInstance.get(organisationUrl, { params: { limit, page, verbose: true, q: buildPartialSearchQuery(q), customValidationSchema: CUSTOM_VALIDATION_SCHEMA, sortAsc: "name", timestamp: new Date().getTime() } }), private: (username: string, q: string = "", limit = 20, page = 1) => authenticatedInstance.get(`/users/${username}/orgs/`, { params: { limit, page, verbose: true, q: buildPartialSearchQuery(q), customValidationSchema: CUSTOM_VALIDATION_SCHEMA, sortAsc: "name", timestamp: new Date().getTime() // work around seemingly unhelpful caching } }) } }, create: (data: Organisation) => authenticatedInstance.post(`/orgs/`, data), organisation: { retrieve: (url: string) => authenticatedInstance.get(url), update: (orgUrl: string, data: EditableOrganisationFields) => authenticatedInstance.put(orgUrl, data), delete: (orgUrl: string) => authenticatedInstance.delete(orgUrl), retrieveSources: (orgUrl: string) => authenticatedInstance.get(`${orgUrl}sources/`), retrieveCollections: (orgUrl: string) => authenticatedInstance.get(`${orgUrl}collections/`), retrieveMembers: (orgUrl: string) => authenticatedInstance.get(`${orgUrl}members/`), addMember: (orgUrl: string, member: OrgMember) => authenticatedInstance.put(`${orgUrl}members/${member.username}/`), deleteMember: (orgUrl: string, user: string) => authenticatedInstance.delete(`${orgUrl}members/${user}/`) } }; export default api; |