Skip to content

Commit

Permalink
docs: use {@link} and @typeparam
Browse files Browse the repository at this point in the history
  • Loading branch information
angeloashmore committed May 13, 2021
1 parent 96f1e1e commit 2d2a2c5
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 28 deletions.
15 changes: 15 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ export class Client {
/**
* Queries content from the Prismic repository.
*
* @typeParam TDocument Type of Prismic documents returned.
* @param params Parameters to filter, sort, and paginate results.
*
* @returns A paginated response containing the result of the query.
Expand All @@ -287,6 +288,7 @@ export class Client {
/**
* Queries content from the Prismic repository and returns only the first result, if any.
*
* @typeParam TDocument Type of the Prismic document returned.
* @param params Parameters to filter, sort, and paginate results.
*
* @returns The first result of the query, if any.
Expand Down Expand Up @@ -314,6 +316,7 @@ export class Client {
*
* This method may make multiple network requests to query all matching content.
*
* @typeParam TDocument Type of Prismic documents returned.
* @param params Parameters to filter, sort, and paginate results.
*
* @returns A list of documents matching the query.
Expand Down Expand Up @@ -350,6 +353,7 @@ export class Client {
*
* A document's UID is different from its ID. An ID is automatically generated for all documents and is made available on its `id` property. A UID is provided in the Prismic editor and is unique among all documents of its Custom Type.
*
* @typeParam TDocument Type of the Prismic document returned.
* @param id ID of the document.
* @param params Parameters to filter, sort, and paginate the results.
*
Expand All @@ -376,6 +380,7 @@ export class Client {
*
* A document's UID is different from its ID. An ID is automatically generated for all documents and is made available on its `id` property. A UID is provided in the Prismic editor and is unique among all documents of its Custom Type.
*
* @typeParam TDocument Type of Prismic documents returned.
* @param ids A list of document IDs.
* @param params Parameters to filter, sort, and paginate the results.
*
Expand Down Expand Up @@ -404,6 +409,7 @@ export class Client {
*
* A document's UID is different from its ID. An ID is automatically generated for all documents and is made available on its `id` property. A UID is provided in the Prismic editor and is unique among all documents of its Custom Type.
*
* @typeParam TDocument Type of Prismic documents returned.
* @param ids A list of document IDs.
* @param params Parameters to filter, sort, and paginate the results.
*
Expand All @@ -430,6 +436,7 @@ export class Client {
*
* A document's UID is different from its ID. An ID is automatically generated for all documents and is made available on its `id` property. A UID is provided in the Prismic editor and is unique among all documents of its Custom Type.
*
* @typeParam TDocument Type of the Prismic document returned.
* @param documentType The API ID of the document's Custom Type.
* @param uid UID of the document.
* @param params Parameters to filter, sort, and paginate the results.
Expand Down Expand Up @@ -461,6 +468,7 @@ export class Client {
*
* A singleton document is one that is configured in Prismic to only allow one instance. For example, a repository may be configured to contain just one Settings document. This is in contrast to a repeatable Custom Type which allows multiple instances of itself.
*
* @typeParam TDocument Type of the Prismic document returned.
* @param documentType The API ID of the singleton Custom Type.
* @param params Parameters to filter, sort, and paginate the results.
*
Expand All @@ -485,6 +493,7 @@ export class Client {
*
* Use `getAllByType` instead if you need to query all documents for a specific Custom Type.
*
* @typeParam TDocument Type of Prismic documents returned.
* @param documentType The API ID of the Custom Type.
* @param params Parameters to filter, sort, and paginate the results.
*
Expand All @@ -509,6 +518,7 @@ export class Client {
*
* This method may make multiple network requests to query all matching content.
*
* @typeParam TDocument Type of Prismic documents returned.
* @param documentType The API ID of the Custom Type.
* @param params Parameters to filter, sort, and paginate the results.
*
Expand All @@ -533,6 +543,7 @@ export class Client {
*
* Use `getAllByTag` instead if you need to query all documents with a specific tag.
*
* @typeParam TDocument Type of Prismic documents returned.
* @param tag The tag that must be included on a document.
* @param params Parameters to filter, sort, and paginate the results.
*
Expand All @@ -557,6 +568,7 @@ export class Client {
*
* This method may make multiple network requests to query all matching content.
*
* @typeParam TDocument Type of Prismic documents returned.
* @param tag The tag that must be included on a document.
* @param params Parameters to filter, sort, and paginate the results.
*
Expand All @@ -579,6 +591,7 @@ export class Client {
/**
* Queries documents from the Prismic repository with a specific tag.
*
* @typeParam TDocument Type of Prismic documents returned.
* @param tags A list of tags that must be included on a document.
* @param params Parameters to filter, sort, and paginate the results.
*
Expand All @@ -603,6 +616,7 @@ export class Client {
*
* This method may make multiple network requests to query all matching content.
*
* @typeParam TDocument Type of Prismic documents returned.
* @param tags A list of tags that must be included on a document.
* @param params Parameters to filter, sort, and paginate the results.
*
Expand Down Expand Up @@ -823,6 +837,7 @@ export class Client {
/**
* Performs a network request using the configured `fetch` function. It assumes all successful responses will have a JSON content type. It also normalizes unsuccessful network requests.
*
* @typeParam T The JSON response.
* @param url URL to the resource to fetch.
* @param params Prismic REST API parameters for the network request.
*
Expand Down
1 change: 1 addition & 0 deletions src/getEndpoint.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* Get a repository's Prismic REST API V2 endpoint.
*
* @typeParam RepositoryName Name of the Prismic repository.
* @param repositoryName Name of the repository.
*
* @returns The repository's Prismic REST API V2 endpoint
Expand Down
1 change: 1 addition & 0 deletions src/lib/appendPredicates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ interface WithPredicates {
/**
* Adds one or more predicates to an object with a `predicates` property. Appended predicates are added to the end of the existing list.
*
* @typeParam T Object to which predicates will be append.
* @param predicates One or more predicates to append.
*
* @returns A function that accepts an object with a `predicates` property. The `predicates` list will be appended to that object.
Expand Down
1 change: 1 addition & 0 deletions src/lib/castArray.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* Ensures that a value is an array. If it is already an array, it is returned as is. If it is not an array, it is converted to an array with itself as its only element.
*
* @typeParam A Element of the array.
* @param a Value to ensure is an array.
*
* @returns `a` as an array.
Expand Down
1 change: 1 addition & 0 deletions src/lib/orElseThrow.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* Throws an error if a given value is nullish.
*
* @typeParam Nullable value to check.
* @param a Nullable value to check.
* @param error Error to throw if `a` is nullish.
*
Expand Down

0 comments on commit 2d2a2c5

Please sign in to comment.