UNPKG

synapse-react-client

Version:

[![Build Status](https://travis-ci.com/Sage-Bionetworks/Synapse-React-Client.svg?branch=main)](https://travis-ci.com/Sage-Bionetworks/Synapse-React-Client) [![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synaps

662 lines (661 loc) 38.7 kB
import { JSONSchema7 } from 'json-schema'; import { BackendDestinationEnum } from './functions/getEndpoint'; import { AccessApproval, AccessCodeResponse, AccessControlList, AccessRequirement, AccessRequirementStatus, ACTSubmissionStatus, AddFilesToDownloadListRequest, AddFilesToDownloadListResponse, BatchFileRequest, BatchFileResult, BulkFileDownloadRequest, BulkFileDownloadResponse, DownloadFromTableRequest, DownloadFromTableResult, DownloadList, DownloadOrder, Entity, EntityBundle, EntityBundleRequest, EntityHeader, EntityId, EntityJson, EntityLookupRequest, EntityPath, Evaluation, EvaluationRound, FileEntity, FileHandle, FileHandleAssociateType, FileHandleAssociation, FileHandleResults, FileResult, FileUploadComplete, FormData, FormGroup, ListRequest, ListResponse, LoginResponse, MultipartUploadRequest, MultipartUploadStatus, OAuthClientPublic, OAuthConsentGrantedResponse, ObjectType, OIDCAuthorizationRequest, OIDCAuthorizationRequestDescription, PaginatedResults, ProjectFilesStatisticsRequest, ProjectFilesStatisticsResponse, ProjectHeaderList, QueryBundleRequest, QueryResultBundle, QueryTableResults, ReferenceList, RestrictionInformationRequest, RestrictionInformationResponse, Submission, SynapseVersion, UserBundle, UserGroupHeaderResponsePage, UserProfile, WikiPage, WikiPageKey } from './synapseTypes/'; import { ACCESS_TYPE, CreateSubmissionRequest, ManagedACTAccessRequirementStatus, RequestInterface } from './synapseTypes/AccessRequirement'; import { RenewalInterface } from './synapseTypes/AccessRequirement/RenewalInterface'; import { AccessTokenGenerationRequest } from './synapseTypes/AccessToken/AccessTokenGenerationRequest'; import { AccessTokenGenerationResponse } from './synapseTypes/AccessToken/AccessTokenGenerationResponse'; import { AccessTokenRecordList } from './synapseTypes/AccessToken/AccessTokenRecord'; import { AuthenticatedOn } from './synapseTypes/AuthenticatedOn'; import { ChallengePagedResults } from './synapseTypes/ChallengePagedResults'; import { AddBatchOfFilesToDownloadListResponse } from './synapseTypes/DownloadListV2/AddBatchOfFilesToDownloadListResponse'; import { AddToDownloadListRequest } from './synapseTypes/DownloadListV2/AddToDownloadListRequest'; import { AddToDownloadListResponse } from './synapseTypes/DownloadListV2/AddToDownloadListResponse'; import { DownloadListItem } from './synapseTypes/DownloadListV2/DownloadListItem'; import { DownloadListManifestResponse } from './synapseTypes/DownloadListV2/DownloadListManifestResponse'; import { DownloadListPackageResponse } from './synapseTypes/DownloadListV2/DownloadListPackageResponse'; import { ActionRequiredRequest, AvailableFilesRequest } from './synapseTypes/DownloadListV2/QueryRequestDetails'; import { ActionRequiredResponse, AvailableFilesResponse, FilesStatisticsResponse } from './synapseTypes/DownloadListV2/QueryResponseDetails'; import { RemoveBatchOfFilesFromDownloadListResponse } from './synapseTypes/DownloadListV2/RemoveBatchOfFilesFromDownloadListResponse'; import { EntityChildrenRequest, EntityChildrenResponse } from './synapseTypes/EntityChildren'; import { EvaluationRoundListRequest } from './synapseTypes/Evaluation/EvaluationRoundListRequest'; import { EvaluationRoundListResponse } from './synapseTypes/Evaluation/EvaluationRoundListResponse'; import { UserEvaluationPermissions } from './synapseTypes/Evaluation/UserEvaluationPermissions'; import { GetProjectsParameters } from './synapseTypes/GetProjectsParams'; import { HasAccessResponse } from './synapseTypes/HasAccessResponse'; import { ResearchProject } from './synapseTypes/ResearchProject'; import { JsonSchemaObjectBinding } from './synapseTypes/Schema/JsonSchemaObjectBinding'; import { ValidationResults } from './synapseTypes/Schema/ValidationResults'; import { SearchQuery, SearchResults } from './synapseTypes/Search'; import { TableUpdateTransactionRequest } from './synapseTypes/Table/TableUpdate'; import { SqlTransformResponse, TransformSqlWithFacetsRequest } from './synapseTypes/Table/TransformSqlWithFacetsRequest'; import { Team } from './synapseTypes/Team'; import { VersionInfo } from './synapseTypes/VersionInfo'; export declare const IS_OUTSIDE_SYNAPSE_ORG: boolean; export declare const ACCESS_TOKEN_COOKIE_KEY = "org.sagebionetworks.security.user.login.token"; export declare const SYNAPSE_STORAGE_LOCATION_ID = 1; export declare const getRootURL: () => string; /** * Waits t number of milliseconds * * @export * @param {number} t milliseconds * @returns after t milliseconds */ export declare function delay(t: number): Promise<unknown>; export declare type SynapseClientError = { reason: string; status: number; }; export declare const doPost: <T>(url: string, requestJsonObject: any, accessToken: string | undefined, initCredentials: RequestInit['credentials'], endpoint: BackendDestinationEnum) => Promise<T>; export declare const doGet: <T>(url: string, accessToken: string | undefined, initCredentials: RequestInit['credentials'], endpoint: BackendDestinationEnum) => Promise<T>; export declare const doDelete: (url: string, accessToken: string | undefined, initCredentials: RequestInit['credentials'], endpoint: BackendDestinationEnum) => Promise<void>; export declare const doPut: <T>(url: string, requestJsonObject: any, accessToken: string | undefined, initCredentials: RequestInit['credentials'], endpoint: BackendDestinationEnum) => Promise<T>; export declare const getVersion: () => Promise<SynapseVersion>; /** * https://rest-docs.synapse.org/rest/POST/download/list/add/async/start.html */ export declare const addFilesToDownloadList: (request: AddFilesToDownloadListRequest, accessToken: string, updateParentState?: any) => Promise<AddFilesToDownloadListResponse>; /** * https://rest-docs.synapse.org/rest/POST/entity/id/table/download/csv/async/start.html */ export declare const getDownloadFromTableRequest: (request: DownloadFromTableRequest, accessToken?: string | undefined, updateParentState?: any) => Promise<DownloadFromTableResult>; /** * https://rest-docs.synapse.org/rest/GET/fileHandle/handleId.html * Get a FileHandle using its ID. * Note: Only the user that created the FileHandle can access it directly. * @return FileHandle **/ export declare const getFileHandleById: (handleId: string, accessToken?: string | undefined) => Promise<FileHandle>; /** * http://rest-docs.synapse.org/rest/GET/file/id.html * Get the actual URL of the file from with an associated object . * @return a short lived presignedURL to be redirected with **/ export declare const getActualFileHandleByIdURL: (handleId: string, accessToken: string | undefined, fileAssociateType: FileHandleAssociateType, fileAssociateId: string, redirect?: boolean) => Promise<string>; /** * https://rest-docs.synapse.org/rest/GET/fileHandle/handleId/url.html * Note: Only the user that created the FileHandle can use this method for download. * @return a short lived presignedURL to be redirected with **/ export declare const getFileHandleByIdURL: (handleId: string, accessToken?: string | undefined) => Promise<string>; export declare const getAsyncResultFromJobId: <T>(urlRequest: string, accessToken?: string | undefined, updateParentState?: any) => Promise<T>; /** * https://rest-docs.synapse.org/rest/POST/entity/id/table/query/nextPage/async/start.html * @param {*} queryBundleRequest * @param {*} accessToken * @param {*} endpoint */ export declare const getQueryTableResults: (queryBundleRequest: QueryBundleRequest, accessToken?: string | undefined, updateParentState?: any) => Promise<QueryResultBundle>; /** * Run and return results from queryBundleRequest, queryBundle request must be of the * form: * { * concreteType: String, * query: { * sql: String, * partMask: Number * } * } * @param {*} queryBundleRequest * @param {*} [accessToken=undefined] * @param {boolean} [onlyGetFacets=false] Specify if the query only needs facets and no * data-- (internally this limits the row count to 1 on the request) * @returns Full dataset from synapse table query */ export declare const getFullQueryTableResults: (queryBundleRequest: QueryBundleRequest, accessToken?: string | undefined) => Promise<QueryResultBundle>; /** * Log-in using the given username and password. Will return a access token that must be used in * authenticated requests. * https://rest-docs.synapse.org/rest/POST/login2.html */ export declare const login: (username: string, password: string, authenticationReceipt: string | null, endpoint?: BackendDestinationEnum) => Promise<LoginResponse>; /** * Get redirect url * https://rest-docs.synapse.org/rest/POST/oauth2/authurl.html * @param {*} provider * @param {*} redirectUrl * @param {*} endpoint */ export declare const oAuthUrlRequest: (provider: string, redirectUrl: string, endpoint?: BackendDestinationEnum) => Promise<unknown>; /** * Get access token from SSO * https://rest-docs.synapse.org/rest/POST/oauth2/session2.html * @param {*} provider * @param {*} authenticationCode * @param {*} redirectUrl * @param {*} endpoint */ export declare const oAuthSessionRequest: (provider: string, authenticationCode: string | number, redirectUrl: string, endpoint?: any) => Promise<unknown>; /** * Create an entity (Project, Folder, File, Table, View) * https://rest-docs.synapse.org/rest/POST/entity.html */ export declare const createEntity: <T extends Entity>(entity: T, accessToken: string | undefined) => Promise<T>; /** * Create a project with the given name. * https://rest-docs.synapse.org/rest/POST/entity.html */ export declare const createProject: (name: string, accessToken: string | undefined) => Promise<Entity>; /** * Return this user's UserProfile * https://rest-docs.synapse.org/rest/GET/userProfile.html */ export declare const getUserProfile: (accessToken: string | undefined) => Promise<UserProfile>; /** * Return any user's UserProfile * https://rest-docs.synapse.org/rest/GET/userProfile.html */ export declare const getUserProfileById: (accessToken: string | undefined, ownerId: string) => Promise<UserProfile>; /** * Return this user's profile bundle * https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/UserBundle.html */ export declare const getUserBundle: (id: string, mask: number, accessToken: string | undefined) => Promise<UserBundle>; /** * Get Users and Groups that match the given prefix. * http://rest-docs.synapse.org/rest/GET/userGroupHeaders.html */ export declare const getUserGroupHeaders: (prefix?: string, typeFilter?: string, offset?: number, limit?: number) => Promise<UserGroupHeaderResponsePage>; /** * Return batch of user group headers * https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/UserGroupHeaderResponsePage.html */ export declare const getGroupHeadersBatch: (ids: string[], accessToken: string | undefined) => Promise<UserGroupHeaderResponsePage>; export declare type UserProfileList = { list: UserProfile[]; }; /** * Return the User Profiles for the given list of user IDs * https://rest-docs.synapse.org/rest/POST/userProfile.html */ export declare const getUserProfiles: (list: string[], accessToken?: string | undefined) => Promise<UserProfileList>; /** * Return the children (Files/Folders) of the given entity (Project or Folder). * https://rest-docs.synapse.org/rest/POST/entity/children.html */ export declare const getEntityChildren: (request: EntityChildrenRequest, accessToken?: string | undefined) => Promise<EntityChildrenResponse>; /** * Retrieve an entityId for a given parent ID and entity name. * https://rest-docs.synapse.org/rest/POST/entity/child.html */ export declare const lookupChildEntity: (request: EntityLookupRequest, accessToken?: string | undefined) => Promise<EntityId>; /** * Get a batch of pre-signed URLs and/or FileHandles for the given list of FileHandleAssociations. * https://rest-docs.synapse.org/rest/POST/fileHandle/batch.html */ export declare const getFiles: (request: BatchFileRequest, accessToken?: string | undefined) => Promise<BatchFileResult>; /** * Get a batch of pre-signed URLs and/or FileHandles for the given list of FileHandleAssociations. * https://rest-docs.synapse.org/rest/POST/fileHandle/batch.html */ export declare const getBulkFiles: (bulkFileDownloadRequest: BulkFileDownloadRequest, accessToken?: string | undefined) => Promise<BulkFileDownloadResponse>; /** * Bundled access to Entity and related data components. * An EntityBundle can be used to create, fetch, or update an Entity and associated * objects with a single web service request. * See SynapseClient.test.js for an example partsMask. * https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/Entity.html */ declare type GetEntity = <T extends Entity>(accessToken: string | undefined, entityId: string, versionNumber?: string) => Promise<T>; export declare const getEntity: GetEntity; /** * Get a list of entity headers given by entity ids * http://rest-docs.synapse.org/rest/GET/entity/type.html */ export declare const getEntityHeadersByIds: <T extends PaginatedResults<EntityHeader>>(entityIds: string[], accessToken?: string | undefined) => Promise<T>; /** * Get the EntityHeader for a list of references with a POST. * If any item in the batch fails (e.g., with a 404) it will be EXCLUDED in the result set. * https://rest-docs.synapse.org/rest/POST/entity/header.html */ export declare const getEntityHeaders: (references: ReferenceList, accessToken?: string | undefined) => Promise<PaginatedResults<EntityHeader>>; /** * Get the EntityHeader for a single entity * https://rest-docs.synapse.org/rest/GET/entity/id/type.html */ export declare const getEntityHeader: (entityId: string, accessToken?: string | undefined) => Promise<EntityHeader>; export declare const updateEntity: <T extends Entity>(entity: T, accessToken?: string | undefined) => Promise<T>; export declare const deleteEntity: (accessToken: string | undefined, entityId: string | number) => Promise<void>; export declare const getEntityBundleV2: (entityId: string | number, requestObject: EntityBundleRequest, version?: number | undefined, accessToken?: string | undefined) => Promise<EntityBundle>; /** * Get Wiki page contents, call is of the form: * https://rest-docs.synapse.org/rest/GET/entity/ownerId/wiki.html */ export declare const getEntityWiki: (accessToken: string | undefined, ownerId: string | undefined, wikiId?: string | undefined, objectType?: ObjectType) => Promise<WikiPage>; /** * Returns synapse user favorites list given their access token * https://rest-docs.synapse.org/rest/GET/favorite.html */ export declare const getUserFavorites: (accessToken: string | undefined, offset?: number, limit?: number) => Promise<PaginatedResults<EntityHeader>>; /** * Remove a favorite * http://rest-docs.synapse.org/rest/DELETE/favorite/id.html */ export declare const removeUserFavorite: (entityId: string, accessToken: string | undefined) => Promise<void>; /** * Get a list of challenges for which the given user is registered. * see http://rest-docs.synapse.org/rest/GET/challenge.html */ export declare const getUserChallenges: (accessToken: string | undefined, userId: string | number, offset?: string | number, limit?: string | number) => Promise<ChallengePagedResults>; /** * Get the user's list of teams they are on * * @param {*} id ownerID of the synapse user see - https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/UserProfile.html */ export declare const getUserTeamList: (accessToken: string | undefined, userId: string | number, offset?: string | number, limit?: string | number) => Promise<PaginatedResults<Team>>; /** * Get the user's list of teams they are on * * @param {*} id ownerID of the synapse user see -https://rest-docs.synapse.org/rest/GET/teamMembers/id.html * @param {*} fragment (optional) a prefix of the user's first or last name or email address (optional) * @param {*} limit (optional) the maximum number of members to return (default 10, max limit 50) * @param {*} offset (optional) the starting index of the returned results (default 0) * */ export declare const getTeamList: (accessToken: string | undefined, id: string | number, fragment?: string, limit?: number, offset?: number) => Promise<unknown>; /** * https://rest-docs.synapse.org/rest/GET/entity/ownerId/wikikey.html * Get the root WikiPageKey for an Entity. * Note: The caller must be granted the ACCESS_TYPE.READ permission on the owner. * @return WikiPageKey **/ export declare const getWikiPageKeyForEntity: (accessToken: string | undefined, ownerId: string | number) => Promise<WikiPageKey>; /** * https://rest-docs.synapse.org/rest/GET/access_requirement/ownerId/wikikey.html * Get the root WikiPageKey for an Access Requirement. * Note: The caller must be granted the ACCESS_TYPE.READ permission on the owner. * @return WikiPageKey **/ export declare const getWikiPageKeyForAccessRequirement: (accessToken: string | undefined, ownerId: string | number) => Promise<WikiPageKey>; export declare const getWikiAttachmentsFromEntity: (accessToken: string | undefined, id: string | number, wikiId: string | number, objectType?: ObjectType) => Promise<FileHandleResults>; export declare const getWikiAttachmentsFromEvaluation: (accessToken: string | undefined, id: string | number, wikiId: string | number) => Promise<unknown>; export declare const getPresignedUrlForWikiAttachment: (accessToken: string | undefined, id: string | number, wikiId: string | number, fileName: string, objectType?: ObjectType) => Promise<string>; export declare const isInSynapseExperimentalMode: () => boolean; /** * Set the access token cookie. Note that this will only succeed if your app is running on * a .synapse.org subdomain. * * @param {*} token Access token. If undefined, then call should instruct the browser to delete the cookie. */ export declare const setAccessTokenCookie: (token: string | undefined, sessionCallback: () => void) => Promise<void>; /** * Get the current access token from a cookie. Note that this will only succeed if your app is running on * a .synapse.org subdomain. */ export declare const getAccessTokenFromCookie: () => Promise<any>; export declare const getUseUtcTimeFromCookie: () => boolean; export declare const getPrincipalAliasRequest: (accessToken: string | undefined, alias: string, type: string) => Promise<{ principalId: number; }>; export declare const detectSSOCode: () => void; export declare const signOut: (sessionCallback: () => void) => Promise<void>; /** * Upload file. Note that this currently only supports Synapse storage (Sage s3 bucket) * @param accessToken * @param file * @param endpoint */ export declare const uploadFile: (accessToken: string | undefined, filename: string, file: Blob) => Promise<FileUploadComplete>; export declare const checkUploadComplete: (status: MultipartUploadStatus, fileHandleName: string, accessToken: string | undefined, fileUploadResolve: (fileUpload: FileUploadComplete) => void, fileUploadReject: (reason: any) => void) => void; export declare const startMultipartUpload: (accessToken: string | undefined, fileName: string, file: Blob, request: MultipartUploadRequest, fileUploadResolve: (fileUpload: FileUploadComplete) => void, fileUploadReject: (reason: any) => void) => void; export declare const getFileHandleContentFromID: (fileHandleId: string, accessToken: string) => Promise<string>; export declare const getFileHandleContent: (fileHandle: FileHandle, presignedUrl: string) => Promise<string>; /** * Return the FileHandle of the file associated to the given FileEntity. * * @param fileEntity: FileEntity * @param accessToken * @param endpoint */ export declare const getFileResult: (fileEntity: FileEntity, accessToken?: string | undefined, includeFileHandles?: boolean | undefined, includePreSignedURLs?: boolean | undefined, includePreviewPreSignedURLs?: boolean | undefined) => Promise<FileResult>; /** * Add a file to the user's download list. * Uses http://rest-docs.synapse.org/rest/POST/download/list/add.html * @param fileEntityId * @param versionNumber */ export declare const addFileToDownloadListV2: (fileEntityId: string, versionNumber?: number | undefined, accessToken?: string | undefined) => Promise<AddBatchOfFilesToDownloadListResponse>; /** * http://rest-docs.synapse.org/rest/POST/download/list/package/async/start.html */ export declare const createPackageFromDownloadListV2: (zipFileName?: string | undefined, accessToken?: string | undefined, updateParentState?: any) => Promise<DownloadListPackageResponse>; /** * http://rest-docs.synapse.org/rest/POST/download/list/package/async/start.html */ export declare const createManifestFromDownloadListV2: (accessToken?: string | undefined, updateParentState?: any) => Promise<DownloadListManifestResponse>; /** * http://rest-docs.synapse.org/rest/POST/download/list/add/async/start.html * Start an asynchronous job to add files to a user's download list from either a view query or a folder. Use GET /download/list/add/async/get/{asyncToken} to get both the job status and job results. */ export declare const addFilesToDownloadListV2: (request: AddToDownloadListRequest, accessToken?: string | undefined, updateParentState?: any) => Promise<AddToDownloadListResponse>; /** * Create an ACL * https://rest-docs.synapse.org/rest/POST/entity/id/acl.html */ export declare const createACL: (entityId: string, acl: AccessControlList, accessToken: string | undefined) => Promise<unknown>; /** * Submit an entity to an evaluation queue * https://rest-docs.synapse.org/rest/POST/evaluation/submission.html */ export declare const submitToEvaluation: (submission: Submission, etag: string, accessToken: string | undefined) => Promise<unknown>; export declare const getEvaluationPermissions: (evalId: string, accessToken: string | undefined) => Promise<UserEvaluationPermissions>; /** * Get an evaluation queue * https://rest-docs.synapse.org/rest/GET/evaluation/evalId.html */ export declare const getEvaluation: (evalId: string, accessToken: string | undefined) => Promise<Evaluation>; /** * Update an existing evaluation queue * https://rest-docs.synapse.org/rest/PUT/evaluation/evalId.html */ export declare const updateEvaluation: (evaluation: Evaluation, accessToken: string | undefined) => Promise<Evaluation>; /** * Create an evaluation queue * https://rest-docs.synapse.org/rest/POST/evaluation.html */ export declare const createEvaluation: (evaluation: Evaluation, accessToken: string | undefined) => Promise<Evaluation>; /** * Delete an existing evaluation queue * https://rest-docs.synapse.org/rest/PUT/evaluation/evalId.html */ export declare const deleteEvaluation: (evalId: string, accessToken: string | undefined) => Promise<void>; /** * Get an evaluation round * https://rest-docs.synapse.org/rest/GET/evaluation/evalId/round/evalRoundId.html */ export declare const getEvaluationRound: (evalId: string, evalRoundId: string, accessToken: string | undefined) => Promise<EvaluationRound>; /** * Get all evaluation rounds * https://rest-docs.synapse.org/rest/GET/evaluation/evalId/round/list.html */ export declare const getEvaluationRoundsList: (evalId: string, evaluationRoundListRequest: EvaluationRoundListRequest | undefined, accessToken: string | undefined) => Promise<EvaluationRoundListResponse>; /** * Create an evaluation round * https://rest-docs.synapse.org/rest/POST/evaluation/evalId/round/evalRoundId.html */ export declare const createEvaluationRound: (evaluationRound: EvaluationRound, accessToken: string | undefined) => Promise<EvaluationRound>; /** * Update an evaluation round * https://rest-docs.synapse.org/rest/PUT/evaluation/evalId/round/evalRoundId.html */ export declare const updateEvaluationRound: (evaluationRound: EvaluationRound, accessToken: string | undefined) => Promise<EvaluationRound>; /** * Delete an evaluation round * https://rest-docs.synapse.org/rest/DELETE/evaluation/evalId/round/evalRoundId.html */ export declare const deleteEvaluationRound: (evalId: string, evalRoundId: string, accessToken: string | undefined) => Promise<void>; /** * Executes a user-defined query over the Submissions of a specific Evaluation. * https://rest-docs.synapse.org/rest/GET/evaluation/submission/query.html */ export declare const getEvaluationSubmissions: (query: string, accessToken: string | undefined) => Promise<QueryTableResults>; /** * Get user-friendly OAuth2 request information (to present to the user so they can choose if they want to give consent). * http://rest-docs.synapse.org/rest/POST/oauth2/description.html */ export declare const getOAuth2RequestDescription: (oidcAuthRequest: OIDCAuthorizationRequest) => Promise<OIDCAuthorizationRequestDescription>; /** * Check whether user has already granted consent for the given OAuth client, scope, and claims. * Consent persists for one year. */ export declare const hasUserAuthorizedOAuthClient: (oidcAuthRequest: OIDCAuthorizationRequest, accessToken: string) => Promise<OAuthConsentGrantedResponse>; /** * Get OAuth2 Client information (available to the public) */ export declare const getOAuth2Client: (clientId: string) => Promise<OAuthClientPublic>; /** * Get OAuth2 Client information (available to the public) */ export declare const getAuthenticatedOn: (accessToken: string) => Promise<AuthenticatedOn>; /** * User consents to the given OIDCAuthorizationRequest (after being presented with all information returned by getOAuth2RequestDescription()) * @param oidcAuthRequest * @param accessToken * @param endpoint */ export declare const consentToOAuth2Request: (oidcAuthRequest: OIDCAuthorizationRequest, accessToken: string | undefined) => Promise<AccessCodeResponse>; /*********************** * FORM SERVICES * https://rest-docs.synapse.org/rest/#org.sagebionetworks.repo.web.controller.FormController *************************/ /** * Create a FormGroup * https://rest-docs.synapse.org/rest/POST/form/group.html * @param name * @param accessToken * @param endpoint */ export declare const createFormGroup: (name: string, accessToken: string) => Promise<FormGroup>; /** * Get FormGroup ACL * https://rest-docs.synapse.org/rest/GET/form/group/id/acl.html */ export declare const getFormACL: (formGroupId: string, accessToken: string | undefined) => Promise<AccessControlList>; /** * Update FormGroup ACL * https://rest-docs.synapse.org/rest/PUT/form/group/id/acl.html */ export declare const updateFormACL: (formGroupId: string, newAcl: AccessControlList, accessToken: string | undefined) => Promise<AccessControlList>; /** * Create a new FormData object * https://rest-docs.synapse.org/rest/POST/form/data.html * @param formGroupId * @param name * @param accessToken * @param endpoint */ export declare const createFormData: (formGroupId: string, name: string, dataFileHandleId: string, accessToken: string) => Promise<FormData>; /** * Update FormData object * https://rest-docs.synapse.org/rest/PUT/form/data.html */ export declare const updateFormData: (formDataId: string, name: string, dataFileHandleId: string, accessToken: string) => Promise<FormData>; /** * Delete FormData object * https://rest-docs.synapse.org/rest/DELETE/form/data.html */ export declare const deleteFormData: (formDataId: string, accessToken: string | undefined) => Promise<void>; /** * Submit the identified FormData for review. * https://rest-docs.synapse.org/rest/POST/form/data/id/submit.html */ export declare const submitFormData: (formDataId: string, accessToken: string | undefined) => Promise<FormData>; /** * List FormData objects and their associated status that match the filters of the provided request that are * owned by the caller. Note: Only objects owned by the caller will be returned. * https://rest-docs.synapse.org/rest/POST/form/data/list.html */ export declare const listFormData: (request: ListRequest, accessToken: string | undefined) => Promise<ListResponse>; /** * List FormData objects and their associated status that match the filters of the provided request for the entire * group. This is used by service accounts to process submissions. * https://rest-docs.synapse.org/rest/POST/form/data/list/reviewer.html */ export declare const listFormDataAsFormAdmin: (request: ListRequest, accessToken: string | undefined) => Promise<ListResponse>; /** * Called by the form processing service to accept a submitted data. * https://rest-docs.synapse.org/rest/PUT/form/data/id/accept.html */ export declare const acceptFormData: (formDataId: string, accessToken: string | undefined) => Promise<FormData>; /** * Called by the form processing service to reject a submitted data. * https://rest-docs.synapse.org/rest/PUT/form/data/id/reject.html */ export declare const rejectFormData: (formDataId: string, reason: string, accessToken: string | undefined) => Promise<FormData>; /** * Get Statistics * https://rest-docs.synapse.org/rest/POST/statistics.html * Generic endpoint to retrieve statistics about objects. The user should have VIEW_STATISTICS access on the object referenced by the objectId in the request. */ export declare const getProjectStatistics: (request: ProjectFilesStatisticsRequest, accessToken: string | undefined) => Promise<ProjectFilesStatisticsResponse>; export declare const getRestrictionInformation: (request: RestrictionInformationRequest, accessToken: string | undefined) => Promise<RestrictionInformationResponse>; /** * Returns a paginated result of access requirements associated for an entity * * See https://rest-docs.synapse.org/rest/GET/entity/id/accessRequirement.html * * @param {(string | undefined)} accessToken token of user * @param {string} id id of entity * @param {number} [limit=50] * @param {number} [offset=0] * @returns {Promise<PaginatedResults<AccessRequirement>>} */ export declare const getAccessRequirement: (accessToken: string | undefined, id: string, limit?: number, offset?: number) => Promise<PaginatedResults<AccessRequirement>>; /** * Returns the Access Requirement with the given AR_ID * * See http://rest-docs.synapse.org/rest/GET/accessRequirement/requirementId.html * * @param {(string | undefined)} accessToken token of user * @param {number} id id of the access requirement * @returns {Promise<AccessRequirement>} */ export declare const getAccessRequirementById: (accessToken: string | undefined, id: number) => Promise<AccessRequirement>; /** * Retrieve an access requirement status for a given access requirement ID. * * @param {string} requirementId id of entity to lookup * @returns {AccessRequirementStatus} */ export declare const getAccessRequirementStatus: (accessToken: string | undefined, requirementId: string | number) => Promise<AccessRequirementStatus | ManagedACTAccessRequirementStatus>; /** * Returns all the access requirements associated to an entity {id}, calling the * paginated getAccessRequirement service until all results are returned. * * @param {(string | undefined)} accessToken token of user * @param {string} id id of entity to lookup * @returns {Promise<Array<AccessRequirement>>} */ export declare const getAllAccessRequirements: (accessToken: string | undefined, id: string) => Promise<Array<AccessRequirement>>; /** * * * @param {(string | undefined)} accessToken user access token * @param {(number | undefined)} id the unique immutable ID * @returns {AccessApproval} */ export declare const getAccessApproval: (accessToken: string | undefined, approvalId: number | undefined) => Promise<AccessApproval>; /** * * * @param {(string | undefined)} accessToken user access token * @param {AccessApproval} accessApproval access approval request object * @returns {AccessApproval} */ export declare const postAccessApproval: (accessToken: string | undefined, accessApproval: AccessApproval) => Promise<AccessApproval>; export declare const getDownloadList: (accessToken: string | undefined) => Promise<DownloadList>; export declare const getDownloadOrder: (zipFileName: string | undefined, accessToken: string | undefined) => Promise<DownloadOrder>; export declare type FunctionReturningPaginatedResults<T> = (limit: number, offset: number) => Promise<PaginatedResults<T>>; /** * Utility function to get all the results of a paginated service * * @template T Type of paginated service * @param {FunctionReturningPaginatedResults<T>} fn Function that returns a paginated synapse object, accepts a limit and offset * @returns */ export declare const getAllOfPaginatedService: <T>(fn: FunctionReturningPaginatedResults<T>) => Promise<T[]>; export declare const deleteDownloadListFiles: (list: FileHandleAssociation[], accessToken: string | undefined) => Promise<DownloadList>; export declare const deleteDownloadList: (accessToken: string | undefined) => Promise<void>; /** * http://rest-docs.synapse.org/rest/POST/entity/id/table/transaction/async/start.html * @param {*} tableUpdateRequest * @param {*} accessToken * @param {*} endpoint * // technically returns a TableUpdateTransactionResponse, but I don't see any reason we need this */ export declare const updateTable: (tableUpdateRequest: TableUpdateTransactionRequest, accessToken?: string | undefined, updateParentState?: any) => Promise<any>; export declare const getTransformSqlWithFacetsRequest: (transformSqlWithFacetsRequest: TransformSqlWithFacetsRequest) => Promise<SqlTransformResponse>; export declare const createPersonalAccessToken: (accessTokenGenerationRequest: AccessTokenGenerationRequest, accessToken: string | undefined) => Promise<AccessTokenGenerationResponse>; export declare const getPersonalAccessTokenRecords: (accessToken: string | undefined, nextPageToken: string | undefined) => Promise<AccessTokenRecordList>; export declare const deletePersonalAccessToken: (accessTokenId: string, accessToken: string | undefined) => Promise<void>; export declare const getMyProjects: (accessToken: string, params?: GetProjectsParameters) => Promise<ProjectHeaderList>; export declare const getUserProjects: (userId: string, params?: GetProjectsParameters, accessToken?: string | undefined) => Promise<ProjectHeaderList>; export declare const getEntityPath: (entityId: string, accessToken?: string | undefined) => Promise<EntityPath>; export declare const getEntityVersions: (entityId: string, accessToken?: string | undefined, offset?: number, limit?: number) => Promise<PaginatedResults<VersionInfo>>; export declare const searchEntities: (query: SearchQuery, accessToken?: string | undefined) => Promise<SearchResults>; /** * Clear all files from the user's Download List v2. * http://rest-docs.synapse.org/rest/DELETE/download/list.html */ export declare const clearDownloadListV2: (accessToken: string | undefined) => Promise<void>; /** * Get Download List v2 available files to download * http://rest-docs.synapse.org/rest/POST/download/list/query/async/start.html */ export declare const getAvailableFilesToDownload: (request: AvailableFilesRequest, accessToken?: string | undefined) => Promise<AvailableFilesResponse>; /** * Get Download List v2 statistics * http://rest-docs.synapse.org/rest/POST/download/list/query/async/start.html */ export declare const getDownloadListStatistics: (accessToken?: string | undefined) => Promise<FilesStatisticsResponse>; /** * Get Download List v2 actions required * http://rest-docs.synapse.org/rest/POST/download/list/query/async/start.html */ export declare const getDownloadListActionsRequired: (request: ActionRequiredRequest, accessToken?: string | undefined) => Promise<ActionRequiredResponse>; /** * Remove item from Download List v2 * http://rest-docs.synapse.org/rest/POST/download/list/remove.html */ export declare const removeItemFromDownloadListV2: (item: DownloadListItem, accessToken?: string | undefined) => Promise<RemoveBatchOfFilesFromDownloadListResponse>; export declare const updateResearchProject: (requestObj: ResearchProject, accessToken: string) => Promise<ResearchProject>; export declare const getResearchProject: (requirementId: string, accessToken: string) => Promise<ResearchProject>; export declare const getDataAccessRequestForUpdate: (requirementId: string, accessToken: string) => Promise<RequestInterface | RenewalInterface>; export declare const updateDataAccessRequest: (requestObj: RequestInterface, accessToken: string) => Promise<RequestInterface>; export declare const submitDataAccessRequest: (requestObj: CreateSubmissionRequest, accessToken: string) => Promise<ACTSubmissionStatus>; export declare const cancelDataAccessRequest: (submissionId: string, accessToken: string) => Promise<ACTSubmissionStatus>; /** * Get the schema bound to an entity. * https://docs.synapse.org/rest/GET/entity/id/schema/binding.html * @param entityId * @param accessToken * @returns */ export declare const getSchemaBinding: (entityId: string, accessToken?: string | undefined) => Promise<JsonSchemaObjectBinding>; /** * Get the schema bound to an entity. * https://docs.synapse.org/rest/GET/entity/id/schema/binding.html * @param entityId * @param accessToken * @returns */ export declare const getSchemaValidationResults: (entityId: string, accessToken?: string | undefined) => Promise<ValidationResults>; /** * Get a schema by its $id. * https://docs.synapse.org/rest/GET/entity/id/schema/binding.html * @returns */ export declare const getSchema: (schema$id: string) => Promise<JSONSchema7>; /** * Retrieve a "validation" schema--all references are resolved and dereferenced. * @param schema$id * @returns */ export declare const getValidationSchema: (schema$id: string, accessToken?: string | undefined) => Promise<{ validationSchema: JSONSchema7; }>; /** * Determine if the caller has a particular access type on an entity * https://docs.synapse.org/rest/GET/entity/id/access.html * @param entityId * @param accessToken * @returns */ export declare const hasAccessToEntity: (entityId: string, accessType: ACCESS_TYPE, accessToken?: string | undefined) => Promise<HasAccessResponse>; /** * Get the entity and its annotations as a JSON object * https://docs.synapse.org/rest/GET/entity/id/json.html * @param entityId * @param accessToken * @returns */ export declare const getEntityJson: (entityId: string, accessToken?: string | undefined) => Promise<EntityJson>; /** * Update an entity and its annotations using a JSON object * https://docs.synapse.org/rest/PUT/entity/id/json.html * @param entityId * @param accessToken * @returns */ export declare const updateEntityJson: (entityId: string, json: EntityJson, accessToken?: string | undefined) => Promise<EntityJson>; export {};