@squonk/account-server-client 2.0.4 → 2.0.5-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/product/product.ts"],"names":[],"mappings":";;;;;AAUA,SAAS,UAAU,mBAAmB;AAqC/B,IAAM,kBAAkB,CAC7B,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iBAAiB,QAAQ,OAAO,OAAO;AAAA,IAC9C;AAAA,EACF;AACF;AAEO,IAAM,6BAA6B,MAAM,CAAC,sBAAsB,eAAe;AAE/E,IAAM,iCAAiC,CAG5C,YAW4B;AAC5B,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,2BAA2B;AAEtE,QAAM,UAAsE,CAAC;AAAA,IAC3E;AAAA,EACF,MAAM,gBAAgB,gBAAgB,MAAM;AAE5C,SAAO,EAAE,UAAU,SAAS,GAAG,aAAa;AAC9C;AAOO,IAAM,qBAAqB,CAGhC,YAO4D;AAC5D,QAAM,eAAe,+BAA+B,OAAO;AAE3D,QAAM,QAAQ,SAAS,YAAY;AAInC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;AAKO,IAAM,+BAA+B,CAC1C,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iCAAiC,QAAQ,OAAO,OAAO;AAAA,IAC9D;AAAA,EACF;AACF;AAEO,IAAM,0CAA0C,MACrD,CAAC,sBAAsB,+BAA+B;AAEjD,IAAM,8CAA8C,CAGzD,YAW4B;AAC5B,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YACJ,6CAAc,aAAY,wCAAwC;AAEpE,QAAM,UAEF,CAAC,EAAE,OAAO,MAAM,6BAA6B,gBAAgB,MAAM;AAEvE,SAAO,EAAE,UAAU,SAAS,GAAG,aAAa;AAC9C;AAOO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;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,QAAQ,SAAS,YAAY;AAInC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT","sourcesContent":["/**\n * Generated by orval v6.15.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 2.0\n */\nimport { useQuery, useMutation } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n ProductsGetTypesResponse,\n AsError,\n ProductsGetDefaultStorageCost,\n ProductsGetResponse,\n UnitProductPostResponse,\n UnitProductPostBodyBody,\n ProductUnitGetResponse,\n ProductPatchBodyBody,\n ProductChargesGetResponse,\n GetProductChargesParams,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Gets product types you can purchase\n\n * @summary Gets all Product Types\n */\nexport const getProductTypes = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetTypesResponse>(\n { url: `/product-type`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductTypesQueryKey = () => [\"account-server-api\", `/product-type`] as const;\n\nexport const getGetProductTypesQueryOptions = <\n TData = Awaited<ReturnType<typeof getProductTypes>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductTypes>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryOptions<\n Awaited<ReturnType<typeof getProductTypes>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductTypesQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductTypes>>> = ({\n signal,\n }) => getProductTypes(requestOptions, signal);\n\n return { queryKey, queryFn, ...queryOptions };\n};\n\nexport type GetProductTypesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductTypes>>\n>;\nexport type GetProductTypesQueryError = ErrorType<AsError | void>;\n\nexport const useGetProductTypes = <\n TData = Awaited<ReturnType<typeof getProductTypes>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductTypes>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductTypesQueryOptions(options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * @summary Gets the default cross-product storage cost\n */\nexport const getProductDefaultStorageCost = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetDefaultStorageCost>(\n { url: `/product-default-storage-cost`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductDefaultStorageCostQueryKey = () =>\n [\"account-server-api\", `/product-default-storage-cost`] as const;\n\nexport const getGetProductDefaultStorageCostQueryOptions = <\n TData = Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryOptions<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductDefaultStorageCostQueryKey();\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>\n > = ({ signal }) => getProductDefaultStorageCost(requestOptions, signal);\n\n return { queryKey, queryFn, ...queryOptions };\n};\n\nexport type GetProductDefaultStorageCostQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>\n>;\nexport type GetProductDefaultStorageCostQueryError = ErrorType<AsError | void>;\n\nexport const useGetProductDefaultStorageCost = <\n TData = Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductDefaultStorageCostQueryOptions(options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Gets products you have access to, across all Units and Organisations\n\n * @summary Gets all Products\n */\nexport const getProducts = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductsQueryKey = () => [\"account-server-api\", `/product`] as const;\n\nexport const getGetProductsQueryOptions = <\n TData = Awaited<ReturnType<typeof getProducts>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProducts>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryOptions<Awaited<ReturnType<typeof getProducts>>, TError, TData> & {\n queryKey: QueryKey;\n} => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductsQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProducts>>> = ({\n signal,\n }) => getProducts(requestOptions, signal);\n\n return { queryKey, queryFn, ...queryOptions };\n};\n\nexport type GetProductsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProducts>>\n>;\nexport type GetProductsQueryError = ErrorType<AsError | void>;\n\nexport const useGetProducts = <\n TData = Awaited<ReturnType<typeof getProducts>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProducts>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductsQueryOptions(options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Gets products you have access to based on an Organisation\n\n * @summary Gets Products for an Organisation\n */\nexport const getProductsForOrganisation = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product/organisation/${orgId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductsForOrganisationQueryKey = (orgId: string) =>\n [\"account-server-api\", `/product/organisation/${orgId}`] as const;\n\nexport const getGetProductsForOrganisationQueryOptions = <\n TData = Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductsForOrganisationQueryKey(orgId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductsForOrganisation>>\n > = ({ signal }) => getProductsForOrganisation(orgId, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!orgId, ...queryOptions };\n};\n\nexport type GetProductsForOrganisationQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductsForOrganisation>>\n>;\nexport type GetProductsForOrganisationQueryError = ErrorType<void | AsError>;\n\nexport const useGetProductsForOrganisation = <\n TData = Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductsForOrganisationQueryOptions(\n orgId,\n options\n );\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Products are **Subscriptions** that you create in a Unit and use **Merchant** services like the `DATA_MANAGER`.\n\nTypical subscriptions include `DATA_MANAGER_STORAGE_SUBSCRIPTION` and `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION`.\n\nSome subscriptions, like the `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION` are available i various **flavours** that influence their capabilities. Flavours are typically referred to using the names `BRONZE`, `SILVER` and `GOLD`\n\n * @summary Creates a Product for an Organisational Unit\n */\nexport const createUnitProduct = (\n unitId: string,\n unitProductPostBodyBody: UnitProductPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UnitProductPostResponse>(\n {\n url: `/product/unit/${unitId}`,\n method: \"post\",\n headers: { \"Content-Type\": \"application/json\" },\n data: unitProductPostBodyBody,\n },\n options\n );\n};\n\nexport const getCreateUnitProductMutationOptions = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createUnitProduct>>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof createUnitProduct>>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createUnitProduct>>,\n { unitId: string; data: UnitProductPostBodyBody }\n > = (props) => {\n const { unitId, data } = props ?? {};\n\n return createUnitProduct(unitId, data, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type CreateUnitProductMutationResult = NonNullable<\n Awaited<ReturnType<typeof createUnitProduct>>\n>;\nexport type CreateUnitProductMutationBody = UnitProductPostBodyBody;\nexport type CreateUnitProductMutationError = ErrorType<AsError | void>;\n\nexport const useCreateUnitProduct = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createUnitProduct>>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getCreateUnitProductMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Gets products you have access to based on an Organisational Unit\n\n * @summary Gets Products for an Organisational Unit\n */\nexport const getProductsForUnit = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product/unit/${unitId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductsForUnitQueryKey = (unitId: string) =>\n [\"account-server-api\", `/product/unit/${unitId}`] as const;\n\nexport const getGetProductsForUnitQueryOptions = <\n TData = Awaited<ReturnType<typeof getProductsForUnit>>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForUnit>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForUnit>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductsForUnitQueryKey(unitId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductsForUnit>>\n > = ({ signal }) => getProductsForUnit(unitId, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!unitId, ...queryOptions };\n};\n\nexport type GetProductsForUnitQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductsForUnit>>\n>;\nexport type GetProductsForUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetProductsForUnit = <\n TData = Awaited<ReturnType<typeof getProductsForUnit>>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForUnit>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductsForUnitQueryOptions(unitId, options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Gets a Product\n\n * @summary Gets a Product\n */\nexport const getProduct = (\n productId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductUnitGetResponse>(\n { url: `/product/${productId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductQueryKey = (productId: string) =>\n [\"account-server-api\", `/product/${productId}`] as const;\n\nexport const getGetProductQueryOptions = <\n TData = Awaited<ReturnType<typeof getProduct>>,\n TError = ErrorType<AsError | void>\n>(\n productId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProduct>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<Awaited<ReturnType<typeof getProduct>>, TError, TData> & {\n queryKey: QueryKey;\n} => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductQueryKey(productId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProduct>>> = ({\n signal,\n }) => getProduct(productId, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!productId, ...queryOptions };\n};\n\nexport type GetProductQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProduct>>\n>;\nexport type GetProductQueryError = ErrorType<AsError | void>;\n\nexport const useGetProduct = <\n TData = Awaited<ReturnType<typeof getProduct>>,\n TError = ErrorType<AsError | void>\n>(\n productId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProduct>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductQueryOptions(productId, options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * @summary Deletes an existing Product\n */\nexport const deleteProduct = (\n productId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/product/${productId}`, method: \"delete\" },\n options\n );\n};\n\nexport const getDeleteProductMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteProduct>>,\n TError,\n { productId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof deleteProduct>>,\n TError,\n { productId: string },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteProduct>>,\n { productId: string }\n > = (props) => {\n const { productId } = props ?? {};\n\n return deleteProduct(productId, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type DeleteProductMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteProduct>>\n>;\n\nexport type DeleteProductMutationError = ErrorType<AsError>;\n\nexport const useDeleteProduct = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteProduct>>,\n TError,\n { productId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getDeleteProductMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Used to update some adjustable parameters of a Product, i.e. to extend the Allowance or Limit. At the moment Data Manager products can be patched by changing the `name`, it's coin `allowance` or `limit`\n\n * @summary Adjust an existing Product\n */\nexport const patchProduct = (\n productId: string,\n productPatchBodyBody: ProductPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/product/${productId}`,\n method: \"patch\",\n headers: { \"Content-Type\": \"application/json\" },\n data: productPatchBodyBody,\n },\n options\n );\n};\n\nexport const getPatchProductMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchProduct>>,\n TError,\n { productId: string; data: ProductPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof patchProduct>>,\n TError,\n { productId: string; data: ProductPatchBodyBody },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof patchProduct>>,\n { productId: string; data: ProductPatchBodyBody }\n > = (props) => {\n const { productId, data } = props ?? {};\n\n return patchProduct(productId, data, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type PatchProductMutationResult = NonNullable<\n Awaited<ReturnType<typeof patchProduct>>\n>;\nexport type PatchProductMutationBody = ProductPatchBodyBody;\nexport type PatchProductMutationError = ErrorType<AsError>;\n\nexport const usePatchProduct = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchProduct>>,\n TError,\n { productId: string; data: ProductPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getPatchProductMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Get the charges made against a product with optional **from** (inclusive) and **until** (exclusive) dates. If no dates are provided, the charges for the current billing period are returned.\n\nDates are interpreted using the Python dateutil parser so the input strings are extremely flexible, i.e. `1 December 2021` is an acceptable format.\n\n**from** must be a date (day) prior to **until**. For example, to see the charges for the 11th July 2022 set **from** to `11 July 2022` and **until** to `12 July 2022`. As an alternative to **From** and **Until** you can provide a **Prior Billing Period**, a value that identifies the prior period to retrieve. A value of `-1` would indicate the *prior period* (month) with an oldest retrieval value of `-23` (approximately two years).\n\nYou need to be part of the **Unit** or **Organisation** to use this method\n * @summary Get charges made against a Product\n */\nexport const getProductCharges = (\n productId: string,\n params?: GetProductChargesParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductChargesGetResponse>(\n { url: `/product/${productId}/charges`, method: \"get\", params, signal },\n options\n );\n};\n\nexport const getGetProductChargesQueryKey = (\n productId: string,\n params?: GetProductChargesParams\n) => [\"account-server-api\", `/product/${productId}/charges`, ...(params ? [params] : [])] as const;\n\nexport const getGetProductChargesQueryOptions = <\n TData = Awaited<ReturnType<typeof getProductCharges>>,\n TError = ErrorType<AsError | void>\n>(\n productId: string,\n params?: GetProductChargesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductCharges>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<\n Awaited<ReturnType<typeof getProductCharges>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductChargesQueryKey(productId, params);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductCharges>>\n > = ({ signal }) =>\n getProductCharges(productId, params, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!productId, ...queryOptions };\n};\n\nexport type GetProductChargesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductCharges>>\n>;\nexport type GetProductChargesQueryError = ErrorType<AsError | void>;\n\nexport const useGetProductCharges = <\n TData = Awaited<ReturnType<typeof getProductCharges>>,\n TError = ErrorType<AsError | void>\n>(\n productId: string,\n params?: GetProductChargesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductCharges>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductChargesQueryOptions(\n productId,\n params,\n options\n );\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n"]}
1
+ {"version":3,"sources":["../../src/product/product.ts"],"names":[],"mappings":";;;;;AAUA,SAAS,UAAU,mBAAmB;AAqC/B,IAAM,kBAAkB,CAC7B,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iBAAiB,QAAQ,OAAO,OAAO;AAAA,IAC9C;AAAA,EACF;AACF;AAEO,IAAM,6BAA6B,MAAM,CAAC,sBAAsB,eAAe;AAE/E,IAAM,iCAAiC,CAG5C,YAW4B;AAC5B,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,2BAA2B;AAEtE,QAAM,UAAsE,CAAC;AAAA,IAC3E;AAAA,EACF,MAAM,gBAAgB,gBAAgB,MAAM;AAE5C,SAAO,EAAE,UAAU,SAAS,GAAG,aAAa;AAC9C;AAOO,IAAM,qBAAqB,CAGhC,YAO4D;AAC5D,QAAM,eAAe,+BAA+B,OAAO;AAE3D,QAAM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F;AAEO,IAAM,+BAA+B,CAC1C,WACA,WACG,CAAC,sBAAsB,YAAY,qBAAqB,GAAI,SAAS,CAAC,MAAM,IAAI,CAAC,CAAE;AAEjF,IAAM,mCAAmC,CAI9C,WACA,QACA,YAY4B;AAC5B,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YACJ,6CAAc,aAAY,6BAA6B,WAAW,MAAM;AAE1E,QAAM,UAEF,CAAC,EAAE,OAAO,MACZ,kBAAkB,WAAW,QAAQ,gBAAgB,MAAM;AAE7D,SAAO,EAAE,UAAU,SAAS,SAAS,CAAC,CAAC,WAAW,GAAG,aAAa;AACpE;AAOO,IAAM,uBAAuB,CAIlC,WACA,QACA,YAQ2D;AAC3D,QAAM,eAAe;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,QAAQ,SAAS,YAAY;AAInC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT","sourcesContent":["/**\n * Generated by orval v6.15.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.\n\n * OpenAPI spec version: 2.0\n */\nimport { useQuery, useMutation } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n ProductsGetTypesResponse,\n AsError,\n ProductsGetDefaultStorageCost,\n ProductsGetResponse,\n UnitProductPostResponse,\n UnitProductPostBodyBody,\n ProductUnitGetResponse,\n ProductPatchBodyBody,\n ProductChargesGetResponse,\n GetProductChargesParams,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Gets Product Types you can purchase (subscribe to)\n\n * @summary Gets all Product Types\n */\nexport const getProductTypes = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetTypesResponse>(\n { url: `/product-type`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductTypesQueryKey = () => [\"account-server-api\", `/product-type`] as const;\n\nexport const getGetProductTypesQueryOptions = <\n TData = Awaited<ReturnType<typeof getProductTypes>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductTypes>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryOptions<\n Awaited<ReturnType<typeof getProductTypes>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductTypesQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductTypes>>> = ({\n signal,\n }) => getProductTypes(requestOptions, signal);\n\n return { queryKey, queryFn, ...queryOptions };\n};\n\nexport type GetProductTypesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductTypes>>\n>;\nexport type GetProductTypesQueryError = ErrorType<AsError | void>;\n\nexport const useGetProductTypes = <\n TData = Awaited<ReturnType<typeof getProductTypes>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductTypes>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductTypesQueryOptions(options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * The storage cost is returned along with its measurement units, typically a Coin value based on the the peak storage that was measured on each billable day.\n\n * @summary Gets the default cross-product storage cost\n */\nexport const getProductDefaultStorageCost = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetDefaultStorageCost>(\n { url: `/product-default-storage-cost`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductDefaultStorageCostQueryKey = () =>\n [\"account-server-api\", `/product-default-storage-cost`] as const;\n\nexport const getGetProductDefaultStorageCostQueryOptions = <\n TData = Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryOptions<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductDefaultStorageCostQueryKey();\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>\n > = ({ signal }) => getProductDefaultStorageCost(requestOptions, signal);\n\n return { queryKey, queryFn, ...queryOptions };\n};\n\nexport type GetProductDefaultStorageCostQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>\n>;\nexport type GetProductDefaultStorageCostQueryError = ErrorType<AsError | void>;\n\nexport const useGetProductDefaultStorageCost = <\n TData = Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductDefaultStorageCostQueryOptions(options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Gets Products you have access to, across all **Units** and **Organisations**\n\n * @summary Gets all Products\n */\nexport const getProducts = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductsQueryKey = () => [\"account-server-api\", `/product`] as const;\n\nexport const getGetProductsQueryOptions = <\n TData = Awaited<ReturnType<typeof getProducts>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProducts>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryOptions<Awaited<ReturnType<typeof getProducts>>, TError, TData> & {\n queryKey: QueryKey;\n} => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductsQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProducts>>> = ({\n signal,\n }) => getProducts(requestOptions, signal);\n\n return { queryKey, queryFn, ...queryOptions };\n};\n\nexport type GetProductsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProducts>>\n>;\nexport type GetProductsQueryError = ErrorType<AsError | void>;\n\nexport const useGetProducts = <\n TData = Awaited<ReturnType<typeof getProducts>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProducts>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductsQueryOptions(options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Gets Products you have access to based on an **Organisation**\n\n * @summary Gets Products for an Organisation\n */\nexport const getProductsForOrganisation = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product/organisation/${orgId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductsForOrganisationQueryKey = (orgId: string) =>\n [\"account-server-api\", `/product/organisation/${orgId}`] as const;\n\nexport const getGetProductsForOrganisationQueryOptions = <\n TData = Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductsForOrganisationQueryKey(orgId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductsForOrganisation>>\n > = ({ signal }) => getProductsForOrganisation(orgId, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!orgId, ...queryOptions };\n};\n\nexport type GetProductsForOrganisationQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductsForOrganisation>>\n>;\nexport type GetProductsForOrganisationQueryError = ErrorType<void | AsError>;\n\nexport const useGetProductsForOrganisation = <\n TData = Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductsForOrganisationQueryOptions(\n orgId,\n options\n );\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Products are **Subscriptions** that you create in a Unit and use **Merchant** services like the `DATA_MANAGER`.\n\nTypical subscriptions include `DATA_MANAGER_STORAGE_SUBSCRIPTION` and `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION`.\n\nSome subscriptions, like the `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION` are available in various **flavours** that influence their capabilities. Flavours are typically referred to using the names `BRONZE`, `SILVER` and `GOLD`\n\nTo do this you need to be a member of the **Unit** or the **Organisation**.\n\n * @summary Creates a Product for an Organisational Unit\n */\nexport const createUnitProduct = (\n unitId: string,\n unitProductPostBodyBody: UnitProductPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UnitProductPostResponse>(\n {\n url: `/product/unit/${unitId}`,\n method: \"post\",\n headers: { \"Content-Type\": \"application/json\" },\n data: unitProductPostBodyBody,\n },\n options\n );\n};\n\nexport const getCreateUnitProductMutationOptions = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createUnitProduct>>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof createUnitProduct>>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createUnitProduct>>,\n { unitId: string; data: UnitProductPostBodyBody }\n > = (props) => {\n const { unitId, data } = props ?? {};\n\n return createUnitProduct(unitId, data, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type CreateUnitProductMutationResult = NonNullable<\n Awaited<ReturnType<typeof createUnitProduct>>\n>;\nexport type CreateUnitProductMutationBody = UnitProductPostBodyBody;\nexport type CreateUnitProductMutationError = ErrorType<AsError | void>;\n\nexport const useCreateUnitProduct = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createUnitProduct>>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getCreateUnitProductMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Gets products you have access to based on an Organisational **Unit**\n\n * @summary Gets Products for an Organisational Unit\n */\nexport const getProductsForUnit = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product/unit/${unitId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductsForUnitQueryKey = (unitId: string) =>\n [\"account-server-api\", `/product/unit/${unitId}`] as const;\n\nexport const getGetProductsForUnitQueryOptions = <\n TData = Awaited<ReturnType<typeof getProductsForUnit>>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForUnit>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForUnit>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductsForUnitQueryKey(unitId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductsForUnit>>\n > = ({ signal }) => getProductsForUnit(unitId, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!unitId, ...queryOptions };\n};\n\nexport type GetProductsForUnitQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductsForUnit>>\n>;\nexport type GetProductsForUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetProductsForUnit = <\n TData = Awaited<ReturnType<typeof getProductsForUnit>>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForUnit>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductsForUnitQueryOptions(unitId, options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Gets details of a specific Product that you have access to.\n\n * @summary Gets a Product\n */\nexport const getProduct = (\n productId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductUnitGetResponse>(\n { url: `/product/${productId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductQueryKey = (productId: string) =>\n [\"account-server-api\", `/product/${productId}`] as const;\n\nexport const getGetProductQueryOptions = <\n TData = Awaited<ReturnType<typeof getProduct>>,\n TError = ErrorType<AsError | void>\n>(\n productId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProduct>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<Awaited<ReturnType<typeof getProduct>>, TError, TData> & {\n queryKey: QueryKey;\n} => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductQueryKey(productId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProduct>>> = ({\n signal,\n }) => getProduct(productId, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!productId, ...queryOptions };\n};\n\nexport type GetProductQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProduct>>\n>;\nexport type GetProductQueryError = ErrorType<AsError | void>;\n\nexport const useGetProduct = <\n TData = Awaited<ReturnType<typeof getProduct>>,\n TError = ErrorType<AsError | void>\n>(\n productId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProduct>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductQueryOptions(productId, options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * You need access to the Product and, if the Product is *claimable* the claim must be removed before the Product can be removed. An example claimable Product is a `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION` where the *claimable* commodity is a Data Manager **Project**. In this case you will need to delete the Data Manager **Project** before you can delete the Account Server **Product**.\n\n * @summary Deletes an existing Product\n */\nexport const deleteProduct = (\n productId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/product/${productId}`, method: \"delete\" },\n options\n );\n};\n\nexport const getDeleteProductMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteProduct>>,\n TError,\n { productId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof deleteProduct>>,\n TError,\n { productId: string },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteProduct>>,\n { productId: string }\n > = (props) => {\n const { productId } = props ?? {};\n\n return deleteProduct(productId, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type DeleteProductMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteProduct>>\n>;\n\nexport type DeleteProductMutationError = ErrorType<AsError>;\n\nexport const useDeleteProduct = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteProduct>>,\n TError,\n { productId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getDeleteProductMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Used to update some adjustable parameters of a Product, i.e. to extend its **Allowance** or **Limit**.\n\nAt the moment we only support Products associated with the Data Manager, and these can be patched by changing the `name`, its coin `allowance` or `limit`\n\n * @summary Adjust an existing Product\n */\nexport const patchProduct = (\n productId: string,\n productPatchBodyBody: ProductPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/product/${productId}`,\n method: \"patch\",\n headers: { \"Content-Type\": \"application/json\" },\n data: productPatchBodyBody,\n },\n options\n );\n};\n\nexport const getPatchProductMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchProduct>>,\n TError,\n { productId: string; data: ProductPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof patchProduct>>,\n TError,\n { productId: string; data: ProductPatchBodyBody },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof patchProduct>>,\n { productId: string; data: ProductPatchBodyBody }\n > = (props) => {\n const { productId, data } = props ?? {};\n\n return patchProduct(productId, data, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type PatchProductMutationResult = NonNullable<\n Awaited<ReturnType<typeof patchProduct>>\n>;\nexport type PatchProductMutationBody = ProductPatchBodyBody;\nexport type PatchProductMutationError = ErrorType<AsError>;\n\nexport const usePatchProduct = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchProduct>>,\n TError,\n { productId: string; data: ProductPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getPatchProductMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Get the charges made against a Product with optional **from** (inclusive) and **until** (exclusive) dates. If no dates are provided, the charges for the current billing period are returned.\n\nDates are interpreted using the Python `dateutil` parser, so the input strings are extremely flexible with, for example, `1 December 2021` as an acceptable input.\n\n**From** must be a date (day) prior to **until**. For example, to see the charges for the 11th July 2022 set **from** to `11 July 2022` and **until** to `12 July 2022`. As an alternative to **From** and **Until** you can provide a **Prior Billing Period**, a value that identifies the prior period to retrieve. A value of `-1` would indicate the *prior period* (month) with an oldest retrieval value of `-23` allowing you to obtain charges for up to two years.\n\nYou need to be part of the **Unit** or **Organisation** to use this method\n * @summary Get charges made against a Product\n */\nexport const getProductCharges = (\n productId: string,\n params?: GetProductChargesParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductChargesGetResponse>(\n { url: `/product/${productId}/charges`, method: \"get\", params, signal },\n options\n );\n};\n\nexport const getGetProductChargesQueryKey = (\n productId: string,\n params?: GetProductChargesParams\n) => [\"account-server-api\", `/product/${productId}/charges`, ...(params ? [params] : [])] as const;\n\nexport const getGetProductChargesQueryOptions = <\n TData = Awaited<ReturnType<typeof getProductCharges>>,\n TError = ErrorType<AsError | void>\n>(\n productId: string,\n params?: GetProductChargesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductCharges>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<\n Awaited<ReturnType<typeof getProductCharges>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductChargesQueryKey(productId, params);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductCharges>>\n > = ({ signal }) =>\n getProductCharges(productId, params, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!productId, ...queryOptions };\n};\n\nexport type GetProductChargesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductCharges>>\n>;\nexport type GetProductChargesQueryError = ErrorType<AsError | void>;\n\nexport const useGetProductCharges = <\n TData = Awaited<ReturnType<typeof getProductCharges>>,\n TError = ErrorType<AsError | void>\n>(\n productId: string,\n params?: GetProductChargesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductCharges>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductChargesQueryOptions(\n productId,\n params,\n options\n );\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n"]}
@@ -1,11 +1,11 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
2
  import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from '@tanstack/react-query';
3
- import { aE as customInstance, ae as ProductsGetTypesResponse, aF as ErrorType, aA as AsError, ag as ProductsGetDefaultStorageCost, ai as ProductsGetResponse, m as UnitProductPostBodyBody, a6 as UnitProductPostResponse, ad as ProductUnitGetResponse, P as ProductPatchBodyBody, b as GetProductChargesParams, ak as ProductChargesGetResponse } from '../custom-instance-8a11f2d1.js';
3
+ import { aE as customInstance, ae as ProductsGetTypesResponse, aF as ErrorType, aA as AsError, ag as ProductsGetDefaultStorageCost, ai as ProductsGetResponse, m as UnitProductPostBodyBody, a6 as UnitProductPostResponse, ad as ProductUnitGetResponse, P as ProductPatchBodyBody, b as GetProductChargesParams, ak as ProductChargesGetResponse } from '../custom-instance-f32f6506.js';
4
4
  import 'axios';
5
5
 
6
6
  type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
7
7
  /**
8
- * Gets product types you can purchase
8
+ * Gets Product Types you can purchase (subscribe to)
9
9
 
10
10
  * @summary Gets all Product Types
11
11
  */
@@ -26,6 +26,8 @@ declare const useGetProductTypes: <TData = ProductsGetTypesResponse, TError = Er
26
26
  queryKey: QueryKey;
27
27
  };
28
28
  /**
29
+ * The storage cost is returned along with its measurement units, typically a Coin value based on the the peak storage that was measured on each billable day.
30
+
29
31
  * @summary Gets the default cross-product storage cost
30
32
  */
31
33
  declare const getProductDefaultStorageCost: (options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<ProductsGetDefaultStorageCost>;
@@ -45,7 +47,7 @@ declare const useGetProductDefaultStorageCost: <TData = ProductsGetDefaultStorag
45
47
  queryKey: QueryKey;
46
48
  };
47
49
  /**
48
- * Gets products you have access to, across all Units and Organisations
50
+ * Gets Products you have access to, across all **Units** and **Organisations**
49
51
 
50
52
  * @summary Gets all Products
51
53
  */
@@ -66,7 +68,7 @@ declare const useGetProducts: <TData = ProductsGetResponse, TError = ErrorType<v
66
68
  queryKey: QueryKey;
67
69
  };
68
70
  /**
69
- * Gets products you have access to based on an Organisation
71
+ * Gets Products you have access to based on an **Organisation**
70
72
 
71
73
  * @summary Gets Products for an Organisation
72
74
  */
@@ -91,7 +93,9 @@ declare const useGetProductsForOrganisation: <TData = ProductsGetResponse, TErro
91
93
 
92
94
  Typical subscriptions include `DATA_MANAGER_STORAGE_SUBSCRIPTION` and `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION`.
93
95
 
94
- Some subscriptions, like the `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION` are available i various **flavours** that influence their capabilities. Flavours are typically referred to using the names `BRONZE`, `SILVER` and `GOLD`
96
+ Some subscriptions, like the `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION` are available in various **flavours** that influence their capabilities. Flavours are typically referred to using the names `BRONZE`, `SILVER` and `GOLD`
97
+
98
+ To do this you need to be a member of the **Unit** or the **Organisation**.
95
99
 
96
100
  * @summary Creates a Product for an Organisational Unit
97
101
  */
@@ -120,7 +124,7 @@ declare const useCreateUnitProduct: <TError = ErrorType<void | AsError>, TContex
120
124
  data: UnitProductPostBodyBody;
121
125
  }, TContext>;
122
126
  /**
123
- * Gets products you have access to based on an Organisational Unit
127
+ * Gets products you have access to based on an Organisational **Unit**
124
128
 
125
129
  * @summary Gets Products for an Organisational Unit
126
130
  */
@@ -141,7 +145,7 @@ declare const useGetProductsForUnit: <TData = ProductsGetResponse, TError = Erro
141
145
  queryKey: QueryKey;
142
146
  };
143
147
  /**
144
- * Gets a Product
148
+ * Gets details of a specific Product that you have access to.
145
149
 
146
150
  * @summary Gets a Product
147
151
  */
@@ -162,6 +166,8 @@ declare const useGetProduct: <TData = ProductUnitGetResponse, TError = ErrorType
162
166
  queryKey: QueryKey;
163
167
  };
164
168
  /**
169
+ * You need access to the Product and, if the Product is *claimable* the claim must be removed before the Product can be removed. An example claimable Product is a `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION` where the *claimable* commodity is a Data Manager **Project**. In this case you will need to delete the Data Manager **Project** before you can delete the Account Server **Product**.
170
+
165
171
  * @summary Deletes an existing Product
166
172
  */
167
173
  declare const deleteProduct: (productId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
@@ -184,7 +190,9 @@ declare const useDeleteProduct: <TError = ErrorType<AsError>, TContext = unknown
184
190
  productId: string;
185
191
  }, TContext>;
186
192
  /**
187
- * Used to update some adjustable parameters of a Product, i.e. to extend the Allowance or Limit. At the moment Data Manager products can be patched by changing the `name`, it's coin `allowance` or `limit`
193
+ * Used to update some adjustable parameters of a Product, i.e. to extend its **Allowance** or **Limit**.
194
+
195
+ At the moment we only support Products associated with the Data Manager, and these can be patched by changing the `name`, its coin `allowance` or `limit`
188
196
 
189
197
  * @summary Adjust an existing Product
190
198
  */
@@ -213,11 +221,11 @@ declare const usePatchProduct: <TError = ErrorType<AsError>, TContext = unknown>
213
221
  data: ProductPatchBodyBody;
214
222
  }, TContext>;
215
223
  /**
216
- * Get the charges made against a product with optional **from** (inclusive) and **until** (exclusive) dates. If no dates are provided, the charges for the current billing period are returned.
224
+ * Get the charges made against a Product with optional **from** (inclusive) and **until** (exclusive) dates. If no dates are provided, the charges for the current billing period are returned.
217
225
 
218
- Dates are interpreted using the Python dateutil parser so the input strings are extremely flexible, i.e. `1 December 2021` is an acceptable format.
226
+ Dates are interpreted using the Python `dateutil` parser, so the input strings are extremely flexible with, for example, `1 December 2021` as an acceptable input.
219
227
 
220
- **from** must be a date (day) prior to **until**. For example, to see the charges for the 11th July 2022 set **from** to `11 July 2022` and **until** to `12 July 2022`. As an alternative to **From** and **Until** you can provide a **Prior Billing Period**, a value that identifies the prior period to retrieve. A value of `-1` would indicate the *prior period* (month) with an oldest retrieval value of `-23` (approximately two years).
228
+ **From** must be a date (day) prior to **until**. For example, to see the charges for the 11th July 2022 set **from** to `11 July 2022` and **until** to `12 July 2022`. As an alternative to **From** and **Until** you can provide a **Prior Billing Period**, a value that identifies the prior period to retrieve. A value of `-1` would indicate the *prior period* (month) with an oldest retrieval value of `-23` allowing you to obtain charges for up to two years.
221
229
 
222
230
  You need to be part of the **Unit** or **Organisation** to use this method
223
231
  * @summary Get charges made against a Product
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/product/product.ts"],"sourcesContent":["/**\n * Generated by orval v6.15.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 2.0\n */\nimport { useQuery, useMutation } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n ProductsGetTypesResponse,\n AsError,\n ProductsGetDefaultStorageCost,\n ProductsGetResponse,\n UnitProductPostResponse,\n UnitProductPostBodyBody,\n ProductUnitGetResponse,\n ProductPatchBodyBody,\n ProductChargesGetResponse,\n GetProductChargesParams,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Gets product types you can purchase\n\n * @summary Gets all Product Types\n */\nexport const getProductTypes = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetTypesResponse>(\n { url: `/product-type`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductTypesQueryKey = () => [\"account-server-api\", `/product-type`] as const;\n\nexport const getGetProductTypesQueryOptions = <\n TData = Awaited<ReturnType<typeof getProductTypes>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductTypes>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryOptions<\n Awaited<ReturnType<typeof getProductTypes>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductTypesQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductTypes>>> = ({\n signal,\n }) => getProductTypes(requestOptions, signal);\n\n return { queryKey, queryFn, ...queryOptions };\n};\n\nexport type GetProductTypesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductTypes>>\n>;\nexport type GetProductTypesQueryError = ErrorType<AsError | void>;\n\nexport const useGetProductTypes = <\n TData = Awaited<ReturnType<typeof getProductTypes>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductTypes>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductTypesQueryOptions(options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * @summary Gets the default cross-product storage cost\n */\nexport const getProductDefaultStorageCost = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetDefaultStorageCost>(\n { url: `/product-default-storage-cost`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductDefaultStorageCostQueryKey = () =>\n [\"account-server-api\", `/product-default-storage-cost`] as const;\n\nexport const getGetProductDefaultStorageCostQueryOptions = <\n TData = Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryOptions<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductDefaultStorageCostQueryKey();\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>\n > = ({ signal }) => getProductDefaultStorageCost(requestOptions, signal);\n\n return { queryKey, queryFn, ...queryOptions };\n};\n\nexport type GetProductDefaultStorageCostQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>\n>;\nexport type GetProductDefaultStorageCostQueryError = ErrorType<AsError | void>;\n\nexport const useGetProductDefaultStorageCost = <\n TData = Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductDefaultStorageCostQueryOptions(options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Gets products you have access to, across all Units and Organisations\n\n * @summary Gets all Products\n */\nexport const getProducts = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductsQueryKey = () => [\"account-server-api\", `/product`] as const;\n\nexport const getGetProductsQueryOptions = <\n TData = Awaited<ReturnType<typeof getProducts>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProducts>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryOptions<Awaited<ReturnType<typeof getProducts>>, TError, TData> & {\n queryKey: QueryKey;\n} => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductsQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProducts>>> = ({\n signal,\n }) => getProducts(requestOptions, signal);\n\n return { queryKey, queryFn, ...queryOptions };\n};\n\nexport type GetProductsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProducts>>\n>;\nexport type GetProductsQueryError = ErrorType<AsError | void>;\n\nexport const useGetProducts = <\n TData = Awaited<ReturnType<typeof getProducts>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProducts>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductsQueryOptions(options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Gets products you have access to based on an Organisation\n\n * @summary Gets Products for an Organisation\n */\nexport const getProductsForOrganisation = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product/organisation/${orgId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductsForOrganisationQueryKey = (orgId: string) =>\n [\"account-server-api\", `/product/organisation/${orgId}`] as const;\n\nexport const getGetProductsForOrganisationQueryOptions = <\n TData = Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductsForOrganisationQueryKey(orgId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductsForOrganisation>>\n > = ({ signal }) => getProductsForOrganisation(orgId, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!orgId, ...queryOptions };\n};\n\nexport type GetProductsForOrganisationQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductsForOrganisation>>\n>;\nexport type GetProductsForOrganisationQueryError = ErrorType<void | AsError>;\n\nexport const useGetProductsForOrganisation = <\n TData = Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductsForOrganisationQueryOptions(\n orgId,\n options\n );\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Products are **Subscriptions** that you create in a Unit and use **Merchant** services like the `DATA_MANAGER`.\n\nTypical subscriptions include `DATA_MANAGER_STORAGE_SUBSCRIPTION` and `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION`.\n\nSome subscriptions, like the `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION` are available i various **flavours** that influence their capabilities. Flavours are typically referred to using the names `BRONZE`, `SILVER` and `GOLD`\n\n * @summary Creates a Product for an Organisational Unit\n */\nexport const createUnitProduct = (\n unitId: string,\n unitProductPostBodyBody: UnitProductPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UnitProductPostResponse>(\n {\n url: `/product/unit/${unitId}`,\n method: \"post\",\n headers: { \"Content-Type\": \"application/json\" },\n data: unitProductPostBodyBody,\n },\n options\n );\n};\n\nexport const getCreateUnitProductMutationOptions = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createUnitProduct>>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof createUnitProduct>>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createUnitProduct>>,\n { unitId: string; data: UnitProductPostBodyBody }\n > = (props) => {\n const { unitId, data } = props ?? {};\n\n return createUnitProduct(unitId, data, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type CreateUnitProductMutationResult = NonNullable<\n Awaited<ReturnType<typeof createUnitProduct>>\n>;\nexport type CreateUnitProductMutationBody = UnitProductPostBodyBody;\nexport type CreateUnitProductMutationError = ErrorType<AsError | void>;\n\nexport const useCreateUnitProduct = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createUnitProduct>>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getCreateUnitProductMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Gets products you have access to based on an Organisational Unit\n\n * @summary Gets Products for an Organisational Unit\n */\nexport const getProductsForUnit = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product/unit/${unitId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductsForUnitQueryKey = (unitId: string) =>\n [\"account-server-api\", `/product/unit/${unitId}`] as const;\n\nexport const getGetProductsForUnitQueryOptions = <\n TData = Awaited<ReturnType<typeof getProductsForUnit>>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForUnit>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForUnit>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductsForUnitQueryKey(unitId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductsForUnit>>\n > = ({ signal }) => getProductsForUnit(unitId, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!unitId, ...queryOptions };\n};\n\nexport type GetProductsForUnitQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductsForUnit>>\n>;\nexport type GetProductsForUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetProductsForUnit = <\n TData = Awaited<ReturnType<typeof getProductsForUnit>>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForUnit>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductsForUnitQueryOptions(unitId, options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Gets a Product\n\n * @summary Gets a Product\n */\nexport const getProduct = (\n productId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductUnitGetResponse>(\n { url: `/product/${productId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductQueryKey = (productId: string) =>\n [\"account-server-api\", `/product/${productId}`] as const;\n\nexport const getGetProductQueryOptions = <\n TData = Awaited<ReturnType<typeof getProduct>>,\n TError = ErrorType<AsError | void>\n>(\n productId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProduct>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<Awaited<ReturnType<typeof getProduct>>, TError, TData> & {\n queryKey: QueryKey;\n} => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductQueryKey(productId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProduct>>> = ({\n signal,\n }) => getProduct(productId, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!productId, ...queryOptions };\n};\n\nexport type GetProductQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProduct>>\n>;\nexport type GetProductQueryError = ErrorType<AsError | void>;\n\nexport const useGetProduct = <\n TData = Awaited<ReturnType<typeof getProduct>>,\n TError = ErrorType<AsError | void>\n>(\n productId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProduct>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductQueryOptions(productId, options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * @summary Deletes an existing Product\n */\nexport const deleteProduct = (\n productId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/product/${productId}`, method: \"delete\" },\n options\n );\n};\n\nexport const getDeleteProductMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteProduct>>,\n TError,\n { productId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof deleteProduct>>,\n TError,\n { productId: string },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteProduct>>,\n { productId: string }\n > = (props) => {\n const { productId } = props ?? {};\n\n return deleteProduct(productId, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type DeleteProductMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteProduct>>\n>;\n\nexport type DeleteProductMutationError = ErrorType<AsError>;\n\nexport const useDeleteProduct = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteProduct>>,\n TError,\n { productId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getDeleteProductMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Used to update some adjustable parameters of a Product, i.e. to extend the Allowance or Limit. At the moment Data Manager products can be patched by changing the `name`, it's coin `allowance` or `limit`\n\n * @summary Adjust an existing Product\n */\nexport const patchProduct = (\n productId: string,\n productPatchBodyBody: ProductPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/product/${productId}`,\n method: \"patch\",\n headers: { \"Content-Type\": \"application/json\" },\n data: productPatchBodyBody,\n },\n options\n );\n};\n\nexport const getPatchProductMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchProduct>>,\n TError,\n { productId: string; data: ProductPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof patchProduct>>,\n TError,\n { productId: string; data: ProductPatchBodyBody },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof patchProduct>>,\n { productId: string; data: ProductPatchBodyBody }\n > = (props) => {\n const { productId, data } = props ?? {};\n\n return patchProduct(productId, data, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type PatchProductMutationResult = NonNullable<\n Awaited<ReturnType<typeof patchProduct>>\n>;\nexport type PatchProductMutationBody = ProductPatchBodyBody;\nexport type PatchProductMutationError = ErrorType<AsError>;\n\nexport const usePatchProduct = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchProduct>>,\n TError,\n { productId: string; data: ProductPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getPatchProductMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Get the charges made against a product with optional **from** (inclusive) and **until** (exclusive) dates. If no dates are provided, the charges for the current billing period are returned.\n\nDates are interpreted using the Python dateutil parser so the input strings are extremely flexible, i.e. `1 December 2021` is an acceptable format.\n\n**from** must be a date (day) prior to **until**. For example, to see the charges for the 11th July 2022 set **from** to `11 July 2022` and **until** to `12 July 2022`. As an alternative to **From** and **Until** you can provide a **Prior Billing Period**, a value that identifies the prior period to retrieve. A value of `-1` would indicate the *prior period* (month) with an oldest retrieval value of `-23` (approximately two years).\n\nYou need to be part of the **Unit** or **Organisation** to use this method\n * @summary Get charges made against a Product\n */\nexport const getProductCharges = (\n productId: string,\n params?: GetProductChargesParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductChargesGetResponse>(\n { url: `/product/${productId}/charges`, method: \"get\", params, signal },\n options\n );\n};\n\nexport const getGetProductChargesQueryKey = (\n productId: string,\n params?: GetProductChargesParams\n) => [\"account-server-api\", `/product/${productId}/charges`, ...(params ? [params] : [])] as const;\n\nexport const getGetProductChargesQueryOptions = <\n TData = Awaited<ReturnType<typeof getProductCharges>>,\n TError = ErrorType<AsError | void>\n>(\n productId: string,\n params?: GetProductChargesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductCharges>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<\n Awaited<ReturnType<typeof getProductCharges>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductChargesQueryKey(productId, params);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductCharges>>\n > = ({ signal }) =>\n getProductCharges(productId, params, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!productId, ...queryOptions };\n};\n\nexport type GetProductChargesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductCharges>>\n>;\nexport type GetProductChargesQueryError = ErrorType<AsError | void>;\n\nexport const useGetProductCharges = <\n TData = Awaited<ReturnType<typeof getProductCharges>>,\n TError = ErrorType<AsError | void>\n>(\n productId: string,\n params?: GetProductChargesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductCharges>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductChargesQueryOptions(\n productId,\n params,\n options\n );\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n"],"mappings":";;;;;AAUA,SAAS,UAAU,mBAAmB;AAqC/B,IAAM,kBAAkB,CAC7B,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iBAAiB,QAAQ,OAAO,OAAO;AAAA,IAC9C;AAAA,EACF;AACF;AAEO,IAAM,6BAA6B,MAAM,CAAC,sBAAsB,eAAe;AAE/E,IAAM,iCAAiC,CAG5C,YAW4B;AAC5B,QAAM,EA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rD;AAEA,SAAO,EAAE,YAAY,GAAG,gBAAgB;AAC1C;AAQO,IAAM,kBAAkB,CAG7B,YAQI;AACJ,QAAM,kBAAkB,+BAA+B,OAAO;AAE9D,SAAO,YAAY,eAAe;AACpC;AAWO,IAAM,oBAAoB,CAC/B,WACA,QACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,YAAY,qBAAqB,QAAQ,OAAO,QAAQ,OAAO;AAAA,IACtE;AAAA,EACF;AACF;AAEO,IAAM,+BAA+B,CAC1C,WACA,WACG,CAAC,sBAAsB,YAAY,qBAAqB,GAAI,SAAS,CAAC,MAAM,IAAI,CAAC,CAAE;AAEjF,IAAM,mCAAmC,CAI9C,WACA,QACA,YAY4B;AAC5B,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YACJ,6CAAc,aAAY,6BAA6B,WAAW,MAAM;AAE1E,QAAM,UAEF,CAAC,EAAE,OAAO,MACZ,kBAAkB,WAAW,QAAQ,gBAAgB,MAAM;AAE7D,SAAO,EAAE,UAAU,SAAS,SAAS,CAAC,CAAC,WAAW,GAAG,aAAa;AACpE;AAOO,IAAM,uBAAuB,CAIlC,WACA,QACA,YAQ2D;AAC3D,QAAM,eAAe;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,QAAQ,SAAS,YAAY;AAInC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/product/product.ts"],"sourcesContent":["/**\n * Generated by orval v6.15.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.\n\n * OpenAPI spec version: 2.0\n */\nimport { useQuery, useMutation } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n ProductsGetTypesResponse,\n AsError,\n ProductsGetDefaultStorageCost,\n ProductsGetResponse,\n UnitProductPostResponse,\n UnitProductPostBodyBody,\n ProductUnitGetResponse,\n ProductPatchBodyBody,\n ProductChargesGetResponse,\n GetProductChargesParams,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Gets Product Types you can purchase (subscribe to)\n\n * @summary Gets all Product Types\n */\nexport const getProductTypes = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetTypesResponse>(\n { url: `/product-type`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductTypesQueryKey = () => [\"account-server-api\", `/product-type`] as const;\n\nexport const getGetProductTypesQueryOptions = <\n TData = Awaited<ReturnType<typeof getProductTypes>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductTypes>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryOptions<\n Awaited<ReturnType<typeof getProductTypes>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductTypesQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductTypes>>> = ({\n signal,\n }) => getProductTypes(requestOptions, signal);\n\n return { queryKey, queryFn, ...queryOptions };\n};\n\nexport type GetProductTypesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductTypes>>\n>;\nexport type GetProductTypesQueryError = ErrorType<AsError | void>;\n\nexport const useGetProductTypes = <\n TData = Awaited<ReturnType<typeof getProductTypes>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductTypes>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductTypesQueryOptions(options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * The storage cost is returned along with its measurement units, typically a Coin value based on the the peak storage that was measured on each billable day.\n\n * @summary Gets the default cross-product storage cost\n */\nexport const getProductDefaultStorageCost = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetDefaultStorageCost>(\n { url: `/product-default-storage-cost`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductDefaultStorageCostQueryKey = () =>\n [\"account-server-api\", `/product-default-storage-cost`] as const;\n\nexport const getGetProductDefaultStorageCostQueryOptions = <\n TData = Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryOptions<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductDefaultStorageCostQueryKey();\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>\n > = ({ signal }) => getProductDefaultStorageCost(requestOptions, signal);\n\n return { queryKey, queryFn, ...queryOptions };\n};\n\nexport type GetProductDefaultStorageCostQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>\n>;\nexport type GetProductDefaultStorageCostQueryError = ErrorType<AsError | void>;\n\nexport const useGetProductDefaultStorageCost = <\n TData = Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductDefaultStorageCostQueryOptions(options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Gets Products you have access to, across all **Units** and **Organisations**\n\n * @summary Gets all Products\n */\nexport const getProducts = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductsQueryKey = () => [\"account-server-api\", `/product`] as const;\n\nexport const getGetProductsQueryOptions = <\n TData = Awaited<ReturnType<typeof getProducts>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProducts>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryOptions<Awaited<ReturnType<typeof getProducts>>, TError, TData> & {\n queryKey: QueryKey;\n} => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductsQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProducts>>> = ({\n signal,\n }) => getProducts(requestOptions, signal);\n\n return { queryKey, queryFn, ...queryOptions };\n};\n\nexport type GetProductsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProducts>>\n>;\nexport type GetProductsQueryError = ErrorType<AsError | void>;\n\nexport const useGetProducts = <\n TData = Awaited<ReturnType<typeof getProducts>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProducts>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductsQueryOptions(options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Gets Products you have access to based on an **Organisation**\n\n * @summary Gets Products for an Organisation\n */\nexport const getProductsForOrganisation = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product/organisation/${orgId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductsForOrganisationQueryKey = (orgId: string) =>\n [\"account-server-api\", `/product/organisation/${orgId}`] as const;\n\nexport const getGetProductsForOrganisationQueryOptions = <\n TData = Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductsForOrganisationQueryKey(orgId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductsForOrganisation>>\n > = ({ signal }) => getProductsForOrganisation(orgId, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!orgId, ...queryOptions };\n};\n\nexport type GetProductsForOrganisationQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductsForOrganisation>>\n>;\nexport type GetProductsForOrganisationQueryError = ErrorType<void | AsError>;\n\nexport const useGetProductsForOrganisation = <\n TData = Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductsForOrganisationQueryOptions(\n orgId,\n options\n );\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Products are **Subscriptions** that you create in a Unit and use **Merchant** services like the `DATA_MANAGER`.\n\nTypical subscriptions include `DATA_MANAGER_STORAGE_SUBSCRIPTION` and `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION`.\n\nSome subscriptions, like the `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION` are available in various **flavours** that influence their capabilities. Flavours are typically referred to using the names `BRONZE`, `SILVER` and `GOLD`\n\nTo do this you need to be a member of the **Unit** or the **Organisation**.\n\n * @summary Creates a Product for an Organisational Unit\n */\nexport const createUnitProduct = (\n unitId: string,\n unitProductPostBodyBody: UnitProductPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UnitProductPostResponse>(\n {\n url: `/product/unit/${unitId}`,\n method: \"post\",\n headers: { \"Content-Type\": \"application/json\" },\n data: unitProductPostBodyBody,\n },\n options\n );\n};\n\nexport const getCreateUnitProductMutationOptions = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createUnitProduct>>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof createUnitProduct>>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createUnitProduct>>,\n { unitId: string; data: UnitProductPostBodyBody }\n > = (props) => {\n const { unitId, data } = props ?? {};\n\n return createUnitProduct(unitId, data, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type CreateUnitProductMutationResult = NonNullable<\n Awaited<ReturnType<typeof createUnitProduct>>\n>;\nexport type CreateUnitProductMutationBody = UnitProductPostBodyBody;\nexport type CreateUnitProductMutationError = ErrorType<AsError | void>;\n\nexport const useCreateUnitProduct = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createUnitProduct>>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getCreateUnitProductMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Gets products you have access to based on an Organisational **Unit**\n\n * @summary Gets Products for an Organisational Unit\n */\nexport const getProductsForUnit = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product/unit/${unitId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductsForUnitQueryKey = (unitId: string) =>\n [\"account-server-api\", `/product/unit/${unitId}`] as const;\n\nexport const getGetProductsForUnitQueryOptions = <\n TData = Awaited<ReturnType<typeof getProductsForUnit>>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForUnit>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForUnit>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductsForUnitQueryKey(unitId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductsForUnit>>\n > = ({ signal }) => getProductsForUnit(unitId, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!unitId, ...queryOptions };\n};\n\nexport type GetProductsForUnitQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductsForUnit>>\n>;\nexport type GetProductsForUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetProductsForUnit = <\n TData = Awaited<ReturnType<typeof getProductsForUnit>>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForUnit>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductsForUnitQueryOptions(unitId, options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Gets details of a specific Product that you have access to.\n\n * @summary Gets a Product\n */\nexport const getProduct = (\n productId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductUnitGetResponse>(\n { url: `/product/${productId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductQueryKey = (productId: string) =>\n [\"account-server-api\", `/product/${productId}`] as const;\n\nexport const getGetProductQueryOptions = <\n TData = Awaited<ReturnType<typeof getProduct>>,\n TError = ErrorType<AsError | void>\n>(\n productId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProduct>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<Awaited<ReturnType<typeof getProduct>>, TError, TData> & {\n queryKey: QueryKey;\n} => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductQueryKey(productId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProduct>>> = ({\n signal,\n }) => getProduct(productId, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!productId, ...queryOptions };\n};\n\nexport type GetProductQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProduct>>\n>;\nexport type GetProductQueryError = ErrorType<AsError | void>;\n\nexport const useGetProduct = <\n TData = Awaited<ReturnType<typeof getProduct>>,\n TError = ErrorType<AsError | void>\n>(\n productId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProduct>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductQueryOptions(productId, options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * You need access to the Product and, if the Product is *claimable* the claim must be removed before the Product can be removed. An example claimable Product is a `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION` where the *claimable* commodity is a Data Manager **Project**. In this case you will need to delete the Data Manager **Project** before you can delete the Account Server **Product**.\n\n * @summary Deletes an existing Product\n */\nexport const deleteProduct = (\n productId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/product/${productId}`, method: \"delete\" },\n options\n );\n};\n\nexport const getDeleteProductMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteProduct>>,\n TError,\n { productId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof deleteProduct>>,\n TError,\n { productId: string },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteProduct>>,\n { productId: string }\n > = (props) => {\n const { productId } = props ?? {};\n\n return deleteProduct(productId, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type DeleteProductMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteProduct>>\n>;\n\nexport type DeleteProductMutationError = ErrorType<AsError>;\n\nexport const useDeleteProduct = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteProduct>>,\n TError,\n { productId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getDeleteProductMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Used to update some adjustable parameters of a Product, i.e. to extend its **Allowance** or **Limit**.\n\nAt the moment we only support Products associated with the Data Manager, and these can be patched by changing the `name`, its coin `allowance` or `limit`\n\n * @summary Adjust an existing Product\n */\nexport const patchProduct = (\n productId: string,\n productPatchBodyBody: ProductPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/product/${productId}`,\n method: \"patch\",\n headers: { \"Content-Type\": \"application/json\" },\n data: productPatchBodyBody,\n },\n options\n );\n};\n\nexport const getPatchProductMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchProduct>>,\n TError,\n { productId: string; data: ProductPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof patchProduct>>,\n TError,\n { productId: string; data: ProductPatchBodyBody },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof patchProduct>>,\n { productId: string; data: ProductPatchBodyBody }\n > = (props) => {\n const { productId, data } = props ?? {};\n\n return patchProduct(productId, data, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type PatchProductMutationResult = NonNullable<\n Awaited<ReturnType<typeof patchProduct>>\n>;\nexport type PatchProductMutationBody = ProductPatchBodyBody;\nexport type PatchProductMutationError = ErrorType<AsError>;\n\nexport const usePatchProduct = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchProduct>>,\n TError,\n { productId: string; data: ProductPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getPatchProductMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Get the charges made against a Product with optional **from** (inclusive) and **until** (exclusive) dates. If no dates are provided, the charges for the current billing period are returned.\n\nDates are interpreted using the Python `dateutil` parser, so the input strings are extremely flexible with, for example, `1 December 2021` as an acceptable input.\n\n**From** must be a date (day) prior to **until**. For example, to see the charges for the 11th July 2022 set **from** to `11 July 2022` and **until** to `12 July 2022`. As an alternative to **From** and **Until** you can provide a **Prior Billing Period**, a value that identifies the prior period to retrieve. A value of `-1` would indicate the *prior period* (month) with an oldest retrieval value of `-23` allowing you to obtain charges for up to two years.\n\nYou need to be part of the **Unit** or **Organisation** to use this method\n * @summary Get charges made against a Product\n */\nexport const getProductCharges = (\n productId: string,\n params?: GetProductChargesParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductChargesGetResponse>(\n { url: `/product/${productId}/charges`, method: \"get\", params, signal },\n options\n );\n};\n\nexport const getGetProductChargesQueryKey = (\n productId: string,\n params?: GetProductChargesParams\n) => [\"account-server-api\", `/product/${productId}/charges`, ...(params ? [params] : [])] as const;\n\nexport const getGetProductChargesQueryOptions = <\n TData = Awaited<ReturnType<typeof getProductCharges>>,\n TError = ErrorType<AsError | void>\n>(\n productId: string,\n params?: GetProductChargesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductCharges>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<\n Awaited<ReturnType<typeof getProductCharges>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductChargesQueryKey(productId, params);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductCharges>>\n > = ({ signal }) =>\n getProductCharges(productId, params, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!productId, ...queryOptions };\n};\n\nexport type GetProductChargesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductCharges>>\n>;\nexport type GetProductChargesQueryError = ErrorType<AsError | void>;\n\nexport const useGetProductCharges = <\n TData = Awaited<ReturnType<typeof getProductCharges>>,\n TError = ErrorType<AsError | void>\n>(\n productId: string,\n params?: GetProductChargesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductCharges>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetProductChargesQueryOptions(\n productId,\n params,\n options\n );\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n"],"mappings":";;;;;AAUA,SAAS,UAAU,mBAAmB;AAqC/B,IAAM,kBAAkB,CAC7B,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iBAAiB,QAAQ,OAAO,OAAO;AAAA,IAC9C;AAAA,EACF;AACF;AAEO,IAAM,6BAA6B,MAAM,CAAC,sBAAsB,eAAe;AAE/E,IAAM,iCAAiC,CAG5C,YAW4B;AAC5B,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,2BAA2B;AAEtE,QAAM,UAAsE,CAAC;AAAA,IAC3E;AAAA,EACF,MAAM,gBAAgB,gBAAgB,MAAM;AAE5C,SAAO,EAAE,UAAU,SAAS,GAAG,aAAa;AAC9C;AAOO,IAAM,qBAAqB,CAGhC,YAO4D;AAC5D,QAAM,eAAe,+BAA+B,OAAO;AAE3D,QAAM,QAAQ,SAAS,YAAY;AAInC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;AAOO,IAAM,+BAA+B,CAC1C,SACA,WACG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CAAC,CAAE;AAEjF,IAAM,mCAAmC,CAI9C,WACA,QACA,YAY4B;AAC5B,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YACJ,6CAAc,aAAY,6BAA6B,WAAW,MAAM;AAE1E,QAAM,UAEF,CAAC,EAAE,OAAO,MACZ,kBAAkB,WAAW,QAAQ,gBAAgB,MAAM;AAE7D,SAAO,EAAE,UAAU,SAAS,SAAS,CAAC,CAAC,WAAW,GAAG,aAAa;AACpE;AAOO,IAAM,uBAAuB,CAIlC,WACA,QACA,YAQ2D;AAC3D,QAAM,eAAe;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,QAAQ,SAAS,YAAY;AAInC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;","names":[]}
@@ -4,7 +4,7 @@
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
6
6
 
7
- A service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.
7
+ A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
8
8
 
9
9
  * OpenAPI spec version: 2.0
10
10
  */
@@ -269,6 +269,8 @@ export interface UserAccountDetail {
269
269
  user: UserDetail;
270
270
  /** Whether the caller has admin privilege */
271
271
  caller_has_admin_privilege: boolean;
272
+ /** The roles assigned to the user recognised by the Account Server */
273
+ account_server_roles: string[];
272
274
  }
273
275
 
274
276
  export interface UnitDetail {
@@ -4,7 +4,7 @@
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
6
6
 
7
- A service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.
7
+ A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
8
8
 
9
9
  * OpenAPI spec version: 2.0
10
10
  */
@@ -32,9 +32,9 @@ type SecondParameter<T extends (...args: any) => any> = T extends (
32
32
  : never;
33
33
 
34
34
  /**
35
- * Gets global charges.
35
+ * Gets global Charges.
36
36
 
37
- You need **admin** rights to use this path.
37
+ You need admin rights to use this path.
38
38
 
39
39
  * @summary Gets charges for all Organisations
40
40
  */
@@ -4,7 +4,7 @@
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
6
6
 
7
- A service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.
7
+ A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
8
8
 
9
9
  * OpenAPI spec version: 2.0
10
10
  */
@@ -39,7 +39,11 @@ type SecondParameter<T extends (...args: any) => any> = T extends (
39
39
  : never;
40
40
 
41
41
  /**
42
- * Gets Assets
42
+ * Gets Assets you have access to.
43
+
44
+ Assets are text and file resources that can be attached to (have a *scope* that applies to) **User** accounts, **Products**, **Units**, **Organisations** or can be **Global**. Assets can be requested by **Merchants**. The Data Manager uses assets to provide additional information that's often sensitive to **Job** (and **Application**) **Instances**.
45
+
46
+ Users must *attach* an Asset to a **Merchant** before the **Merchant** can ue it
43
47
 
44
48
  * @summary Gets Assets
45
49
  */
@@ -115,7 +119,7 @@ export const useGetAsset = <
115
119
  };
116
120
 
117
121
  /**
118
- * Creates an Asset, which can be attached to our User account, or a Product, Unit or Organisation you have access to
122
+ * Creates an Asset, which can be attached to a **User** account, a **Product**, **Unit**, **Organisation** or can be made **Global**
119
123
 
120
124
  * @summary Create an Asset
121
125
  */
@@ -205,7 +209,9 @@ export const useCreateAsset = <
205
209
  return useMutation(mutationOptions);
206
210
  };
207
211
  /**
208
- * Used to update or replace an existing asset's **Content** and/or its **Description**. It is important to realise that the value of Assets currently in use will not be affected by the change i.e. a **Merchant** that has obtained an Asset will continue to use the original value until the Merchant requests the asset again.
212
+ * Used to update or replace Asset *Content* or *Description*.
213
+
214
+ The content of an Asset currently in use will not be affected by a change made here. If a **Merchant** has already obtained the Asset it may continue to use the original value until the **Merchant** requests the **Asset** again.
209
215
 
210
216
  * @summary Adjust an existing Asset
211
217
  */
@@ -290,7 +296,7 @@ export const usePatchAsset = <
290
296
  return useMutation(mutationOptions);
291
297
  };
292
298
  /**
293
- * Deletes a known Asset. Assets that are attached to merchants cannot be deleted
299
+ * Deletes a known Asset. Assets that are attached to **Merchants** cannot be deleted
294
300
 
295
301
  * @summary Deletes an Asset
296
302
  */
@@ -494,7 +500,7 @@ export const useEnableAsset = <
494
500
  return useMutation(mutationOptions);
495
501
  };
496
502
  /**
497
- * Attaches an Asset to a merchant
503
+ * Attaches an Asset to a **Merchant**. This allows the **Merchant** to query the Asset. **Merchants** cannot obtain Assets that are not attached to them.
498
504
 
499
505
  * @summary Attaches an Asset to a Merchant
500
506
  */
@@ -563,7 +569,7 @@ export const useAttachAsset = <
563
569
  return useMutation(mutationOptions);
564
570
  };
565
571
  /**
566
- * Detaches an Asset from a merchant
572
+ * Detaches an Asset from a **Merchant**
567
573
 
568
574
  * @summary Detaches an Asset from a Merchant
569
575
  */
@@ -4,7 +4,7 @@
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
6
6
 
7
- A service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.
7
+ A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
8
8
 
9
9
  * OpenAPI spec version: 2.0
10
10
  */
@@ -32,7 +32,9 @@ type SecondParameter<T extends (...args: any) => any> = T extends (
32
32
  : never;
33
33
 
34
34
  /**
35
- * Gets merchants known to the Account Server
35
+ * Gets Merchants known to the Account Server
36
+
37
+ Merchants are software services (SaaS assets) whose facilities are known to and controlled by the Account Server
36
38
 
37
39
  * @summary Gets all Merchants
38
40
  */
@@ -100,7 +102,7 @@ export const useGetMerchants = <
100
102
  };
101
103
 
102
104
  /**
103
- * Gets a known merchant
105
+ * Gets a known Merchant
104
106
 
105
107
  * @summary Gets a specific Merchant
106
108
  */