Skip to content

Commit

Permalink
Add /external/agencyid/catalog/holdingsLogistics/v1 to FBS adapter
Browse files Browse the repository at this point in the history
This is necessary because some of the libraries use that system instead of `/external/agencyid/catalog/holdings/v3`.

https://reload.atlassian.net/browse/DDFHER-83
  • Loading branch information
kasperbirch1 committed Sep 19, 2024
1 parent 3d2fc45 commit ce9fb42
Show file tree
Hide file tree
Showing 8 changed files with 272 additions and 0 deletions.
86 changes: 86 additions & 0 deletions src/core/fbs/fbs-adapter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,36 @@ paths:
description: "\n Returns an array of holdings for each bibliographical record.\n The holdings lists the materials on each placement, and whether they are available on-shelf or lent out."
operationId: getHoldingsV3
summary: "Get placement holdings for bibliographical records."
/external/agencyid/catalog/holdingsLogistics/v1:
get:
summary: "Get placement holdings for bibliographical records."
description: "Returns an array of holdings for each bibliographical record. The holdings list the materials on each placement, and whether they are available on-shelf or lent out."
parameters:
- name: recordid
in: query
description: "Identifies the bibliographical records - The FAUST number."
required: true
type: array
items:
type: string
- name: exclude
in: query
description: "Identifies the branchIds which are excluded from the result."
required: false
type: array
items:
type: string
responses:
200:
description: "An array of holdings with updated logistics placement."
schema:
type: array
items:
$ref: "#/definitions/HoldingsForBibliographicalRecordLogisticsV1"
400:
description: "Bad request"
401:
description: "Unauthorized"
/external/agencyid/patron/patronid/fees/v2:
get:
parameters:
Expand Down Expand Up @@ -869,6 +899,62 @@ definitions:
- reservations
- reservable
- holdings
HoldingsForBibliographicalRecordLogisticsV1:
type: object
properties:
recordId:
type: string
description: "Identifies the bibliographical record for the available materials, The FAUST number"
reservations:
type: integer
description: "Total number of current active reservations for the bibliographical record"
reservable:
type: boolean
description: "True if there is any reservable materials"
holdings:
type: array
items:
$ref: "#/definitions/HoldingsLogisticsV1"
required:
- recordId
- holdings
HoldingsLogisticsV1:
properties:
branch:
$ref: "#/definitions/AgencyBranch"
lmsPlacement:
$ref: "#/definitions/PlacementV1"
logisticsPlacement:
type: array
items:
type: string
description: "Logistics placement information in an array of strings."
materials:
type: array
items:
$ref: "#/definitions/MaterialV3"
required:
- branch
- materials
PlacementV1:
properties:
section:
$ref: "#/definitions/AgencySection"
location:
$ref: "#/definitions/AgencyLocation"
sublocation:
$ref: "#/definitions/AgencySublocation"
department:
$ref: "#/definitions/AgencyDepartment"

AgencySection:
properties:
sectionId:
type: string
description: "Section identifier"
title:
type: string
description: "Name of the section"
HoldingsV3:
properties:
branch:
Expand Down
100 changes: 100 additions & 0 deletions src/core/fbs/fbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ import type {
FeeV2,
GetAvailabilityV3Params,
GetBranchesParams,
GetExternalAgencyidCatalogHoldingsLogisticsV1Params,
GetFeesV2Params,
GetHoldingsV3Params,
HoldingsForBibliographicalRecordLogisticsV1,
HoldingsForBibliographicalRecordV3,
LoanV2,
PatronWithGuardianRequest,
Expand Down Expand Up @@ -878,6 +880,104 @@ export const useGetHoldingsV3 = <
return query;
};

/**
* Returns an array of holdings for each bibliographical record. The holdings list the materials on each placement, and whether they are available on-shelf or lent out.
* @summary Get placement holdings for bibliographical records.
*/
export const getExternalAgencyidCatalogHoldingsLogisticsV1 = (
params: GetExternalAgencyidCatalogHoldingsLogisticsV1Params,
signal?: AbortSignal
) => {
return fetcher<HoldingsForBibliographicalRecordLogisticsV1[]>({
url: `/external/agencyid/catalog/holdingsLogistics/v1`,
method: "GET",
params,
signal
});
};

export const getGetExternalAgencyidCatalogHoldingsLogisticsV1QueryKey = (
params: GetExternalAgencyidCatalogHoldingsLogisticsV1Params
) => {
return [
`/external/agencyid/catalog/holdingsLogistics/v1`,
...(params ? [params] : [])
] as const;
};

export const getGetExternalAgencyidCatalogHoldingsLogisticsV1QueryOptions = <
TData = Awaited<
ReturnType<typeof getExternalAgencyidCatalogHoldingsLogisticsV1>
>,
TError = ErrorType<void>
>(
params: GetExternalAgencyidCatalogHoldingsLogisticsV1Params,
options?: {
query?: UseQueryOptions<
Awaited<ReturnType<typeof getExternalAgencyidCatalogHoldingsLogisticsV1>>,
TError,
TData
>;
}
) => {
const { query: queryOptions } = options ?? {};

const queryKey =
queryOptions?.queryKey ??
getGetExternalAgencyidCatalogHoldingsLogisticsV1QueryKey(params);

const queryFn: QueryFunction<
Awaited<ReturnType<typeof getExternalAgencyidCatalogHoldingsLogisticsV1>>
> = ({ signal }) =>
getExternalAgencyidCatalogHoldingsLogisticsV1(params, signal);

return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
Awaited<ReturnType<typeof getExternalAgencyidCatalogHoldingsLogisticsV1>>,
TError,
TData
> & { queryKey: QueryKey };
};

export type GetExternalAgencyidCatalogHoldingsLogisticsV1QueryResult =
NonNullable<
Awaited<ReturnType<typeof getExternalAgencyidCatalogHoldingsLogisticsV1>>
>;
export type GetExternalAgencyidCatalogHoldingsLogisticsV1QueryError =
ErrorType<void>;

/**
* @summary Get placement holdings for bibliographical records.
*/
export const useGetExternalAgencyidCatalogHoldingsLogisticsV1 = <
TData = Awaited<
ReturnType<typeof getExternalAgencyidCatalogHoldingsLogisticsV1>
>,
TError = ErrorType<void>
>(
params: GetExternalAgencyidCatalogHoldingsLogisticsV1Params,
options?: {
query?: UseQueryOptions<
Awaited<ReturnType<typeof getExternalAgencyidCatalogHoldingsLogisticsV1>>,
TError,
TData
>;
}
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
const queryOptions =
getGetExternalAgencyidCatalogHoldingsLogisticsV1QueryOptions(
params,
options
);

const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
queryKey: QueryKey;
};

query.queryKey = queryOptions.queryKey;

return query;
};

/**
*
Returns array of fees.
Expand Down
13 changes: 13 additions & 0 deletions src/core/fbs/model/agencySection.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Generated by orval v6.26.0 🍺
* Do not edit manually.
* FBS Adapter
* OpenAPI spec version: 1.0
*/

export interface AgencySection {
/** Section identifier */
sectionId?: string;
/** Name of the section */
title?: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Generated by orval v6.26.0 🍺
* Do not edit manually.
* FBS Adapter
* OpenAPI spec version: 1.0
*/

export type GetExternalAgencyidCatalogHoldingsLogisticsV1Params = {
/**
* Identifies the bibliographical records - The FAUST number.
*/
recordid: string[];
/**
* Identifies the branchIds which are excluded from the result.
*/
exclude?: string[];
};
17 changes: 17 additions & 0 deletions src/core/fbs/model/holdingsForBibliographicalRecordLogisticsV1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Generated by orval v6.26.0 🍺
* Do not edit manually.
* FBS Adapter
* OpenAPI spec version: 1.0
*/
import type { HoldingsLogisticsV1 } from "./holdingsLogisticsV1";

export interface HoldingsForBibliographicalRecordLogisticsV1 {
holdings: HoldingsLogisticsV1[];
/** Identifies the bibliographical record for the available materials, The FAUST number */
recordId: string;
/** True if there is any reservable materials */
reservable?: boolean;
/** Total number of current active reservations for the bibliographical record */
reservations?: number;
}
17 changes: 17 additions & 0 deletions src/core/fbs/model/holdingsLogisticsV1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Generated by orval v6.26.0 🍺
* Do not edit manually.
* FBS Adapter
* OpenAPI spec version: 1.0
*/
import type { AgencyBranch } from "./agencyBranch";
import type { PlacementV1 } from "./placementV1";
import type { MaterialV3 } from "./materialV3";

export interface HoldingsLogisticsV1 {
branch: AgencyBranch;
lmsPlacement?: PlacementV1;
/** Logistics placement information in an array of strings. */
logisticsPlacement?: string[];
materials: MaterialV3[];
}
5 changes: 5 additions & 0 deletions src/core/fbs/model/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export * from "./addressV2";
export * from "./agencyBranch";
export * from "./agencyDepartment";
export * from "./agencyLocation";
export * from "./agencySection";
export * from "./agencySublocation";
export * from "./authenticatedPatronV4";
export * from "./authenticatedPatronV6";
Expand All @@ -29,11 +30,14 @@ export * from "./feeMaterialV2";
export * from "./feeV2";
export * from "./getAvailabilityV3Params";
export * from "./getBranchesParams";
export * from "./getExternalAgencyidCatalogHoldingsLogisticsV1Params";
export * from "./getFeesV2Params";
export * from "./getHoldingsV3Params";
export * from "./guardian";
export * from "./holdings";
export * from "./holdingsForBibliographicalRecordLogisticsV1";
export * from "./holdingsForBibliographicalRecordV3";
export * from "./holdingsLogisticsV1";
export * from "./holdingsV3";
export * from "./iLLBibliographicRecord";
export * from "./loanDetails";
Expand All @@ -55,6 +59,7 @@ export * from "./period";
export * from "./periodical";
export * from "./periodicalReservation";
export * from "./pincodeChange";
export * from "./placementV1";
export * from "./renewedLoanV2";
export * from "./reservationDetails";
export * from "./reservationDetailsV2";
Expand Down
17 changes: 17 additions & 0 deletions src/core/fbs/model/placementV1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Generated by orval v6.26.0 🍺
* Do not edit manually.
* FBS Adapter
* OpenAPI spec version: 1.0
*/
import type { AgencyDepartment } from "./agencyDepartment";
import type { AgencyLocation } from "./agencyLocation";
import type { AgencySection } from "./agencySection";
import type { AgencySublocation } from "./agencySublocation";

export interface PlacementV1 {
department?: AgencyDepartment;
location?: AgencyLocation;
section?: AgencySection;
sublocation?: AgencySublocation;
}

0 comments on commit ce9fb42

Please sign in to comment.