Skip to content

Commit

Permalink
Merge pull request #434 from MuckRock/svue-docs
Browse files Browse the repository at this point in the history
Add notes on src/structure files
  • Loading branch information
eyeseast authored Feb 5, 2024
2 parents f07c675 + bd82287 commit dc91c49
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/structure/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,41 @@
# Structure

Classes to represent data like documents and projects

## `document.js`

`Document` wraps a document API response, like this: https://api.www.documentcloud.org/api/documents/1/. It's used extensively throughout the codebase. Most API functions return `Document` instances.

The `Document` class renames some fields to use camel case and has some convenience methods.

The `documents.js` module contains functions that operate on one or more documents.

## `entity.js`

`Entity` wraps a single entity returned by the entities endpoint: https://www.documentcloud.org/help/api#entities

`Entities` is a list of `Entity` instances.

## `note.js`

`Note` wraps the `notes` subresource on documents: https://api.www.documentcloud.org/api/documents/24028981/notes/2408726/

## `project.js`

`Project` wraps the `projects` endpoint and adds helper methods to add, remove and check membership of users. It renames some API fields to use camel case.

## `rectangle.js`

Unused. Can delete.

## `results.js`

Wraps a generic API list response. `Entities` extends this. Some API functions in `src/api` use this to wrap lists of results.

## `searchParams.js`

`SearchParams` is complicated. It wraps a string of search params and extracts parts. I'm not sure this needs to be a store. There are tests, at least.

## `section.js`

Wraps a document section, like this https://api.www.documentcloud.org/api/documents/24028981/sections/.

0 comments on commit dc91c49

Please sign in to comment.