Organization

Operations for managing own drive canister

Overview

chevron-righthashtag
const organizationRoutes: FastifyPluginAsync = async (
  fastify,
  opts
): Promise<void> => {
  // GET /v1/drive/:org_id/organization/about
  // use to get info about the org
  fastify.get<{ Params: OrgIdParams; Reply: IAboutDriveResponseData }>(
    `/about`,
    { preHandler: [driveRateLimitPreHandler] },
    aboutDriveHandler
  );

  // GET /v1/drive/:org_id/organization/snapshot
  // developer route for debugging. disabled in prod
  fastify.get<{ Params: OrgIdParams }>(
    `/snapshot`,
    { preHandler: [driveRateLimitPreHandler] },
    snapshotDriveHandler
  );

  // POST /v1/drive/:org_id/organization/replay
  // can skip this one, its for auditable time travel
  fastify.post<{ Params: OrgIdParams; Body: IRequestReplayDrive }>(
    `/replay`,
    { preHandler: [driveRateLimitPreHandler] },
    replayDriveHandler
  );

  // POST /v1/drive/:org_id/organization/search
  // to search across organization by string
  fastify.post<{ Params: OrgIdParams; Body: IRequestSearchDrive }>(
    `/search`,
    { preHandler: [driveRateLimitPreHandler] },
    searchDriveHandler
  );

  // POST /v1/drive/:org_id/organization/reindex
  // to reindex the search universe
  fastify.post<{ Params: OrgIdParams; Body: IRequestReindexDrive }>(
    `/reindex`,
    { preHandler: [driveRateLimitPreHandler] },
    reindexDriveHandler
  );

  // POST /v1/drive/:org_id/organization/transfer_ownership
  // transfer ownership to another user
  fastify.post<{ Params: OrgIdParams; Body: IRequestTransferDriveOwnership }>(
    `/transfer_ownership`,
    { preHandler: [driveRateLimitPreHandler] },
    transferOwnershipDriveHandler
  );

  // POST /v1/drive/:org_id/organization/update_allowed_domains
  // Skip this one, full custom domains coming soon
  fastify.post(
    `/update_allowed_domains`,
  
    updateAllowedDomainsDriveHandler
  );

  // GET /v1/drive/:org_id/organization/whoami
  // Checks who an api key is
  fastify.get<{ Params: OrgIdParams; Reply: IResponseWhoAmI }>(
    `/whoami`,
    { preHandler: [driveRateLimitPreHandler] },
    whoAmIDriveHandler
  );

  // POST /v1/drive/:org_id/organization/superswap_user
  // Swaps a user completely throughout entire database, used to redeem placeholder contacts
  // ONLY superswaps in your database, not others
  fastify.post<{ Params: OrgIdParams; Body: IRequestSuperswapUser }>(
    `/superswap_user`,
    { preHandler: [driveRateLimitPreHandler] },
    superswapUserIdDriveHandler
  );

  // POST /v1/drive/:org_id/organization/redeem
  // Activate a fresh new organization
  fastify.post<{ Params: OrgIdParams; Body: IRequestRedeemOrg }>(
    `/redeem`,
    { preHandler: [driveRateLimitPreHandler] },
    redeemOrganizationDriveHandler
  );

  // POST /v1/drive/:org_id/organization/inbox
  // Webhook endpoint that can be programmed on
  fastify.post<{ Params: OrgIdParams; Body: IRequestInboxOrg }>(
    `/inbox`,
    { preHandler: [driveRateLimitPreHandler] },
    inboxDriveHandler
  );

  // POST /v1/drive/:org_id/organization/shortlink
  // built-in url shortener
  fastify.post<{ Params: OrgIdParams; Body: IRequestShortLink }>(
    `/shortlink`,
    { preHandler: [driveRateLimitPreHandler] },
    shortlinkHandler
  );
};

export default organizationRoutes;

Get Snapshot

Developer route for debugging. disabled in prod

GET

https://dev.officex.app/v1/drive/{organization_id}/organization/snapshot

Run In Postman

chevron-rightPath Parameterhashtag

organization_id (required)

string (DriveID)

Unique identifier for a drive

DriveID_abc123

chevron-rightHeader Parametershashtag

Authorization (required)

stringBearer TOKEN Bearer token for authentication

Bearer eyJhbGciOiJIUz...

Responses

chevron-rightsuccesshashtag

chevron-righterrorhashtag

Search Drive

Search within drives

POST

Run In Postman

chevron-rightHeader Parametershashtag

Authorization (required)

stringBearer TOKEN Bearer token for authentication

Bearer eyJhbGciOiJIUz...

chevron-rightPath Parameterhashtag

organization_id (required)

string (DriveID)

Unique identifier for a drive

DriveID_abc123

chevron-rightRequest Body schema:hashtag

query (required)

string <= 256 characters Search query

mine aws

categories

Array of strings Items Enum: "FILES" "FOLDERS" "METADATA" Categories to search in

FOLDERS

page_size

integer [ 1 .. 1000 ] Default: 50 Number of items per page

50

cursor_up

string or null <= 256 characters Cursor for pagination (previous page)

string

cursor_down

string or null <= 256 characters Cursor for pagination (next page)

string

sort_by

string

Default: "UPDATED_AT" Enum: "CREATED_AT" "UPDATED_AT"

Field to sort by

CREATED_AT

direction

string

Default: "ASC"

Enum: "ASC" "DESC"

Sort direction

ASC

Responses

chevron-rightsuccesshashtag

chevron-righterrorhashtag

Typescript Types


Get Current User Info

Get information about the current authenticated user

GET

Run In Postman

chevron-rightPath Parameterhashtag

organization_id (required)

string (DriveID)

Unique identifier for a drive

DriveID_abc123

chevron-rightHeader Parametershashtag

Authorization (required)

stringBearer TOKEN Bearer token for authentication

Bearer eyJhbGciOiJIUz...

Responses

chevron-rightsuccesshashtag

chevron-righterrorhashtag

Typescript Types


Built-in url shortener for filesharing convenience

POST

Run In Postman

chevron-rightHeader Parametershashtag

Authorization (required)

stringBearer TOKEN Bearer token for authentication

Bearer eyJhbGciOiJIUz...

chevron-rightPath Parameterhashtag

organization_id (required)

string (DriveID)

Unique identifier for a drive

DriveID_abc123

chevron-rightRequest Body schema:hashtag

original_url (required)

string original url

Responses

chevron-rightsuccesshashtag

chevron-righterrorhashtag

Typescript Types

Last updated