}\r\n onChange={handleChange} value={materialSelectedValue.label}\r\n isOptionEqualToValue={isOptionEqualToValue}\r\n filterOptions={filterOptions}\r\n />\r\n )\r\n \r\n /*return (\r\n \r\n \r\n \r\n );*/\r\n}","import React from 'react';\r\nimport InputLabel from \"@mui/material/InputLabel\";\r\nimport Select from \"@mui/material/Select\";\r\nimport FormControl from \"@mui/material/FormControl\";\r\nimport {MenuItem} from \"@mui/material\";\r\n\r\nfunction getStockLocationCode (locationList, id) {\r\n let code = '';\r\n let stockLocation = locationList.filter((i) => i.id === id);\r\n if(stockLocation.length === 1) {\r\n code = stockLocation[0].code;\r\n if(stockLocation[0].parentId !== null) {\r\n return getStockLocationCode(locationList, stockLocation[0].parentId) + '-' + code;\r\n }\r\n }\r\n return code;\r\n}\r\n\r\nfunction StockLocationList({onStockLocationChange, stockLocationList, stockLocationIdSelected}) {\r\n stockLocationList = stockLocationList.map((location) => {\r\n let loc = location;\r\n location.fullCode = getStockLocationCode(stockLocationList, location.id);\r\n return loc;\r\n }).sort((a,b) => a.fullCode.localeCompare(b.fullCode, 'en', { numeric: true}));\r\n\r\n return (\r\n \r\n Stock Location\r\n \r\n \r\n );\r\n}\r\n\r\nexport default StockLocationList;","import React, { useState, useEffect, Fragment } from 'react';\r\nimport Grid from \"@mui/material/Grid\";\r\nimport {Breadcrumbs, Link} from \"@mui/material\";\r\nimport Typography from \"@mui/material/Typography\";\r\nimport TextField from \"@mui/material/TextField\";\r\nimport InputAdornment from \"@mui/material/InputAdornment\";\r\nimport Button from \"@mui/material/Button\";\r\nimport {Link as RouterLink, useNavigate} from \"react-router-dom\";\r\nimport PageLoadingIndicator from \"../components/ui/PageLoadingIndicator\";\r\nimport MaterialProfileList from \"../components/materials/MaterialProfileList\";\r\nimport MaterialList from \"../components/materials/MaterialList\";\r\nimport StockLocationList from \"../components/inventory/locations/StockLocationList\";\r\n\r\nexport default function AddStock() {\r\n let initialState = {\r\n error: null,\r\n stockLocationLoaded: false,\r\n materialLoaded: false,\r\n stockLocationList: [],\r\n materialProfilesLoaded: false,\r\n materialProfiles: [],\r\n materialList: [],\r\n materialId: '',\r\n stockLocationId: '',\r\n materialProfileId: '',\r\n length: '',\r\n qty: 1,\r\n isLoading: false\r\n }\r\n\r\n let [state, setState] = useState(initialState);\r\n let navigate = useNavigate();\r\n\r\n const getCodesFilteredByProfile = () => {\r\n if(!state.materialProfileId) return state.materialList;\r\n return state.materialList.filter(item => item.materialProfileId === state.materialProfileId);\r\n };\r\n\r\n const onMaterialChanged = (value) => {\r\n setState(s => {\r\n return {\r\n ...s,\r\n materialId: value\r\n }})\r\n };\r\n\r\n const onLengthChanged = (event) => {\r\n let value = event.target.value;\r\n setState(s => {\r\n return {\r\n ...s,\r\n length: value\r\n }});\r\n };\r\n\r\n const onQtyChanged = (event) => {\r\n let value = event.target.value;\r\n setState(s => {\r\n return {\r\n ...s,\r\n qty: value\r\n }});\r\n };\r\n\r\n const onStockLocationChanged = (value) => {\r\n setState(s => {\r\n return {\r\n ...s,\r\n stockLocationId: value\r\n }});\r\n };\r\n \r\n const onMaterialProfileChanged = (value) => {\r\n setState(s => {\r\n return {\r\n ...s,\r\n materialProfileId: value\r\n }});\r\n };\r\n\r\n const addStockItem = () => {\r\n setState(s => {\r\n return {\r\n ...s,\r\n isLoading: true\r\n }});\r\n fetch(`/api/stock`, {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json'\r\n },\r\n body: JSON.stringify(\r\n {\r\n materialId: state.materialId,\r\n stockLocationId: state.stockLocationId,\r\n qty: state.qty,\r\n length: parseInt(state.length, 10)\r\n }\r\n )\r\n }).then( (result) => navigate(`/stock`));\r\n };\r\n\r\n useEffect(() => {\r\n fetch(`/api/stock-locations`)\r\n .then(res => res.json())\r\n .then(\r\n (result) => {\r\n setState(s => { \r\n return {\r\n ...s,\r\n stockLocationLoaded: true,\r\n stockLocationList: result\r\n }});\r\n \r\n }\r\n );\r\n\r\n fetch(`/api/material`)\r\n .then(res => res.json())\r\n .then(\r\n (result) => {\r\n setState(s => { \r\n return {\r\n ...s,\r\n materialLoaded: true,\r\n materialList: result\r\n }});\r\n }\r\n );\r\n\r\n fetch(`/api/material-profiles`)\r\n .then(res => res.json())\r\n .then(\r\n (result) => {\r\n setState(s => { \r\n return {\r\n ...s,\r\n materialProfilesLoaded: true,\r\n materialProfiles: result\r\n }});\r\n }\r\n )\r\n }, []);\r\n\r\n const { error } = state;\r\n if (error) {\r\n return Error: {error.message}
;\r\n } else if (!state.stockLocationLoaded || !state.materialLoaded || !state.materialProfilesLoaded) {\r\n return Loading...
;\r\n } else {\r\n return (\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n Home\r\n \r\n \r\n Stock\r\n \r\n Add Stock\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n )\r\n } \r\n}","import React, { useState, useEffect } from 'react';\r\nimport Grid from \"@mui/material/Grid\";\r\nimport {Breadcrumbs, Link} from \"@mui/material\";\r\nimport Typography from \"@mui/material/Typography\";\r\nimport TextField from \"@mui/material/TextField\";\r\nimport Button from \"@mui/material/Button\";\r\nimport { Link as RouterLink } from 'react-router-dom';\r\nimport { useParams, useNavigate } from 'react-router-dom';\r\n\r\nexport default function StockItem() {\r\n let navigate = useNavigate();\r\n let initialState = {\r\n error: null,\r\n loaded: false,\r\n qty: 1,\r\n item: {},\r\n stockLocationLoaded: false,\r\n stockLocations: []\r\n };\r\n \r\n let [state, setState] = useState(initialState);\r\n let params = useParams();\r\n\r\n const onQtyChanged = (event) => {\r\n let value = event.target.value;\r\n setState(s => ({\r\n ...s,\r\n qty: value\r\n }))\r\n };\r\n\r\n const pullStockItem = () => {\r\n fetch(`/api/stock/pull?stockId=${params.id}&qty=${state.qty}`, {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json'\r\n }\r\n }).then( (result) => {\r\n navigate(`/stock`);\r\n })\r\n }\r\n\r\n useEffect(() => {\r\n fetch(`/api/stock/${params.id}`)\r\n .then(res => res.json())\r\n .then(\r\n (result) => {\r\n setState(s => ({\r\n ...s,\r\n loaded: true,\r\n item: result\r\n }));\r\n }\r\n )\r\n\r\n fetch(`/api/stock-locations`)\r\n .then(res => res.json())\r\n .then(\r\n (result) => {\r\n setState(s => ({\r\n ...s,\r\n stockLocationLoaded: true,\r\n stockLocations: result\r\n }));\r\n }\r\n );\r\n }, [params.id]);\r\n\r\n const getStockLocationCode = (id) => {\r\n let code = '';\r\n let stockLocation = state.stockLocations.filter((i) => i.id === id);\r\n if(stockLocation.length === 1) {\r\n code = stockLocation[0].code;\r\n if(stockLocation[0].parentId !== null) {\r\n return getStockLocationCode(stockLocation[0].parentId) + '-' + code;\r\n }\r\n }\r\n return code;\r\n };\r\n\r\n const { error } = state;\r\n if (error) {\r\n return Error: {error.message}
;\r\n } else if (!state.loaded || !state.stockLocationLoaded) {\r\n return Loading...
;\r\n } else {\r\n return (\r\n \r\n \r\n \r\n \r\n Home\r\n \r\n \r\n Stock\r\n \r\n Stock Item\r\n \r\n \r\n \r\n Product Code: {state.item.code}
\r\n Length: {state.item.length}mm
\r\n Quantity Available: {state.item.qty}
\r\n Location: {getStockLocationCode(state.item.stockLocationId)}
\r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n );\r\n }\r\n}","import React from 'react';\r\nimport FormControl from \"@mui/material/FormControl\";\r\nimport Select from \"@mui/material/Select\";\r\nimport {InputLabel, MenuItem} from \"@mui/material\";\r\n\r\nexport default function MaterialTypeList({ onMaterialTypeChange, materialTypeIdSelected, materialTypeList }) {\r\n materialTypeList.sort((a, b) => a.name.localeCompare(b.name, 'en', { numeric: true}));\r\n return (\r\n \r\n Material Type\r\n \r\n \r\n );\r\n}","import React from 'react';\r\nimport makeStyles from '@mui/styles/makeStyles';\r\n\r\nconst useStyles = makeStyles({\r\n mmStyle: {\r\n fontSize: '.8em'\r\n }\r\n});\r\n\r\nexport default function DistanceMeasurement({ value }) {\r\n let styles = useStyles();\r\n return {value} mm\r\n}","import React from 'react';\r\nimport makeStyles from '@mui/styles/makeStyles';\r\n\r\nconst useStyles = makeStyles({\r\n kg: {\r\n fontSize: '.8em'\r\n }\r\n});\r\n\r\nexport default function WeightMeasurement({ value }) {\r\n let styles = useStyles();\r\n return {value} kg\r\n}","import React, { useState, Fragment, useEffect } from 'react';\r\nimport {Breadcrumbs, Link, TableHead} from \"@mui/material\";\r\nimport TableRow from \"@mui/material/TableRow\";\r\nimport TableCell from \"@mui/material/TableCell\";\r\nimport TableBody from \"@mui/material/TableBody\";\r\nimport Table from \"@mui/material/Table\";\r\nimport Typography from \"@mui/material/Typography\";\r\nimport Button from \"@mui/material/Button\";\r\nimport Paper from \"@mui/material/Paper\";\r\nimport Grid from \"@mui/material/Grid\";\r\nimport { Link as RouterLink, useLocation, useNavigate } from 'react-router-dom'\r\nimport StockLocationList from \"../components/inventory/locations/StockLocationList\";\r\nimport MaterialList from \"../components/materials/MaterialList\";\r\nimport MaterialProfileList from \"../components/materials/MaterialProfileList\";\r\nimport MaterialTypeList from \"../components/materials/MaterialTypeList\";\r\nimport DistanceMeasurement from \"../components/DistanceMeasurement\";\r\nimport WeightMeasurement from \"../components/WeightMeasurement\";\r\ntype StockListProps = {\r\n \r\n} \r\n\r\ntype StockItemResult = {\r\n id: string,\r\n code: string,\r\n qty: number,\r\n stockLocationId: string,\r\n length: number,\r\n materialProfileId: string,\r\n materialId: string,\r\n weight: number\r\n}\r\n\r\ntype Material = {\r\n id: string,\r\n code: string,\r\n materialProfileId: string\r\n materialTypeId: string\r\n}\r\n\r\ntype MaterialType = {\r\n id: string,\r\n name: string\r\n}\r\n\r\ntype StockLocation = {\r\n id: string,\r\n code: string,\r\n parentId: string | null\r\n}\r\n\r\ntype MaterialProfile = {\r\n id: string,\r\n code: string,\r\n name: string\r\n}\r\n\r\ntype StockListState = {\r\n error: { message: string },\r\n isLoaded: boolean,\r\n items: StockItemResult[],\r\n materialLoaded: boolean,\r\n materialList: Material[],\r\n materialIdSelected: string,\r\n materialTypesLoaded: boolean,\r\n materialTypesList: MaterialType[],\r\n materialTypeIdSelected: string,\r\n stockLocationIdSelected: string,\r\n stockLocationsLoaded: boolean,\r\n stockLocations: StockLocation[],\r\n materialProfilesLoaded: boolean,\r\n materialProfiles: MaterialProfile[],\r\n materialProfileIdSelected: string \r\n}\r\n\r\nfunction StockList(props: StockListProps)\r\n{\r\n let params = new URLSearchParams(useLocation().search);\r\n let stockLocationId = params.get('stockLocationId');\r\n let navigate = useNavigate();\r\n let initialState: StockListState = {\r\n error: { message: ''},\r\n isLoaded: false,\r\n items: [],\r\n materialLoaded: false,\r\n materialList: [],\r\n materialIdSelected: '',\r\n materialTypesLoaded: false,\r\n materialTypesList: [],\r\n materialTypeIdSelected: '',\r\n stockLocationIdSelected: stockLocationId ? stockLocationId : '',\r\n stockLocationsLoaded: false,\r\n materialProfilesLoaded: false,\r\n materialProfiles: [],\r\n stockLocations: [],\r\n materialProfileIdSelected: ''\r\n };\r\n\r\n let [state, setState] = useState(initialState);\r\n \r\n const getCodesFilteredByProfile = () => {\r\n let results: Material[] = state.materialList;\r\n if(state.materialProfileIdSelected) results = results.filter(item => item.materialProfileId === state.materialProfileIdSelected);\r\n if(state.materialTypeIdSelected) results = results.filter(item => item.materialTypeId === state.materialTypeIdSelected);\r\n return results;\r\n };\r\n\r\n const updateStockByFilter = (materialId: string, stockLocationId: string, materialProfileId: string, materialTypeId: string) => {\r\n if(materialTypeId !== state.materialTypeIdSelected && materialTypeId) {\r\n materialId = '';\r\n materialProfileId = '';\r\n }\r\n if(materialProfileId !== state.materialProfileIdSelected && materialProfileId) materialId = '';\r\n setState(s => ({\r\n ...s,\r\n isLoaded: false,\r\n items: [],\r\n materialIdSelected: materialId,\r\n stockLocationIdSelected: stockLocationId,\r\n materialProfileIdSelected: materialProfileId,\r\n materialTypeIdSelected: materialTypeId\r\n }));\r\n\r\n fetch(`/api/stock?materialId=${materialId}&stockLocationId=${stockLocationId}&materialProfileId=${materialProfileId}&materialTypeId=${materialTypeId}`)\r\n .then(res => res.json())\r\n .then(\r\n (result) => {\r\n setState(s => ({\r\n ...s,\r\n isLoaded: true,\r\n items: result\r\n }));\r\n },\r\n (error) => {\r\n setState(s => ({\r\n ...s,\r\n isLoaded: true,\r\n error\r\n }));\r\n }\r\n )\r\n };\r\n\r\n useEffect(() => {\r\n fetch(`/api/stock`)\r\n .then(res => res.json())\r\n .then(\r\n (result) => {\r\n setState(s => ({\r\n ...s,\r\n isLoaded: true,\r\n items: result\r\n }));\r\n },\r\n (error) => {\r\n setState(s => ({\r\n ...s,\r\n isLoaded: true,\r\n error\r\n }));\r\n }\r\n );\r\n\r\n fetch(`/api/material`)\r\n .then(res => res.json())\r\n .then(\r\n (result) => {\r\n setState(s => ({\r\n ...s,\r\n materialLoaded: true,\r\n materialList: result\r\n }));\r\n }\r\n );\r\n\r\n fetch(`/api/material-types`)\r\n .then(res => res.json())\r\n .then(\r\n (result) => {\r\n setState(s => ({\r\n ...s,\r\n materialTypesLoaded: true,\r\n materialTypesList: result\r\n }));\r\n }\r\n );\r\n\r\n fetch(`/api/stock-locations`)\r\n .then(res => res.json())\r\n .then(\r\n (result) => {\r\n setState(s => ({\r\n ...s,\r\n stockLocationsLoaded: true,\r\n stockLocations: result\r\n }));\r\n }\r\n );\r\n\r\n fetch(`/api/material-profiles`)\r\n .then(res => res.json())\r\n .then(\r\n (result) => {\r\n setState(s => ({\r\n ...s,\r\n materialProfilesLoaded: true,\r\n materialProfiles: result\r\n }));\r\n }\r\n )\r\n }, []);\r\n \r\n\r\n const navigateToStockItem = (id: string) => {\r\n navigate(`/stock/${id}`);\r\n };\r\n \r\n const getStockLocationCode = (id: string): string => {\r\n let code = '';\r\n let stockLocation = state.stockLocations.filter((i: StockLocation) => i.id === id);\r\n if(stockLocation.length === 1) {\r\n code = stockLocation[0].code;\r\n if(stockLocation[0].parentId !== null) {\r\n return getStockLocationCode(stockLocation[0].parentId) + '-' + code;\r\n }\r\n }\r\n return code;\r\n };\r\n\r\n let totals = { weight: 0, qty: 0};\r\n if(state && state.items && state.items.length > 0) {\r\n totals = state.items.reduce((prev,current) => {\r\n prev.qty = prev.qty + current.qty;\r\n prev.weight = prev.weight + (current.qty * current.weight);\r\n return prev;\r\n },{weight: 0, qty: 0});\r\n }\r\n \r\n const { error, isLoaded, items } = state;\r\n if (error.message.length > 0) {\r\n return Error: {error.message}
;\r\n } else if (!isLoaded) {\r\n return Loading...
;\r\n } else {\r\n return (\r\n \r\n \r\n \r\n \r\n Home\r\n \r\n Stock List\r\n \r\n \r\n \r\n \r\n Stock List\r\n \r\n \r\n \r\n \r\n Filters\r\n {state.materialTypesLoaded && updateStockByFilter(state.materialIdSelected, state.stockLocationIdSelected, state.materialProfileIdSelected, val)}/>}\r\n {state.materialProfilesLoaded && {console.log(val); updateStockByFilter(state.materialIdSelected, state.stockLocationIdSelected, val, state.materialTypeIdSelected)}}/>}\r\n {state.materialLoaded && updateStockByFilter(val, state.stockLocationIdSelected, state.materialProfileIdSelected, state.materialTypeIdSelected)}/>}\r\n {state.stockLocationsLoaded && updateStockByFilter(state.materialIdSelected, val, state.materialProfileIdSelected, state.materialTypeIdSelected)}/>}\r\n \r\n \r\n \r\n \r\n \r\n Code\r\n Length\r\n Qty\r\n Weight\r\n Location\r\n \r\n \r\n \r\n {items.length === 0 &&\r\n No stock found}\r\n {\r\n state.materialProfiles.map((materialProfile) => {\r\n let itemsForMaterialProfile = items.filter((item) => {\r\n return item.materialProfileId === materialProfile.id\r\n }).sort((a,b) => {\r\n let res = a.code.localeCompare(b.code, 'en', { numeric: true });\r\n if(res === 0) return a.length - b.length;\r\n return res;\r\n }\r\n );\r\n let weightAndQty = itemsForMaterialProfile.reduce((prev,current) => {\r\n prev.qty = prev.qty + current.qty;\r\n prev.weight = prev.weight + (current.qty * current.weight);\r\n return prev;\r\n },{weight: 0, qty: 0});\r\n if(itemsForMaterialProfile.length > 0) {\r\n return (\r\n \r\n \r\n {materialProfile.code} ({materialProfile.name})\r\n {weightAndQty.qty}\r\n \r\n \r\n \r\n {itemsForMaterialProfile.map((item: StockItemResult) => (\r\n navigateToStockItem(item.id)}>\r\n {item.code}\r\n \r\n {item.qty}\r\n \r\n {getStockLocationCode(item.stockLocationId)}\r\n \r\n ))}\r\n \r\n )\r\n \r\n }\r\n else {\r\n return null;\r\n }\r\n \r\n })\r\n }\r\n \r\n Total\r\n {totals.qty}\r\n {totals.weight/100}\r\n \r\n \r\n \r\n
\r\n \r\n\r\n \r\n );\r\n }\r\n}\r\n\r\nexport default StockList;","import React, { useEffect, useState, useCallback } from 'react';\r\nimport Table from '@mui/material/Table'\r\nimport Typography from \"@mui/material/Typography\";\r\nimport Grid from \"@mui/material/Grid\";\r\nimport Button from \"@mui/material/Button\";\r\nimport TableCell from \"@mui/material/TableCell\";\r\nimport TableRow from \"@mui/material/TableRow\";\r\nimport TableHead from \"@mui/material/TableHead\";\r\nimport TableBody from \"@mui/material/TableBody\";\r\nimport MenuItem from \"@mui/material/MenuItem\";\r\nimport Menu from \"@mui/material/Menu\";\r\nimport IconButton from \"@mui/material/IconButton\";\r\nimport MoreVertIcon from '@mui/icons-material/MoreVert';\r\nimport Dialog from \"@mui/material/Dialog\";\r\nimport DialogTitle from \"@mui/material/DialogTitle\";\r\nimport DialogContent from \"@mui/material/DialogContent\";\r\nimport DialogContentText from \"@mui/material/DialogContentText\";\r\nimport TextField from \"@mui/material/TextField\";\r\nimport DialogActions from \"@mui/material/DialogActions\";\r\nimport InputAdornment from \"@mui/material/InputAdornment\";\r\nimport { Link as RouterLink } from 'react-router-dom';\r\n\r\ntype StockLocation = {\r\n id: string,\r\n code: string,\r\n parentId: string | null,\r\n children: StockLocation[]\r\n}\r\n\r\ntype StockLocationsState = {\r\n error: { message: string },\r\n isLoaded: boolean,\r\n stockLocations: StockLocation[],\r\n deleteStockLocationDialogOpen: boolean,\r\n addStockLocationDialogOpen: boolean,\r\n editStockLocationDialogOpen: boolean,\r\n addStockLocationId: string | null,\r\n deleteStockLocationId: string | null,\r\n editStockLocationId: string | null,\r\n addStockLocationFullCode: string | null,\r\n deleteStockLocationFullCode: string | null,\r\n editStockLocationParentCode: string | null,\r\n editStockLocationCode: string | null\r\n \r\n}\r\n\r\nfunction AddStockLocationFormDialog(props: any) {\r\n const [locations, setLocations] = React.useState('');\r\n const handleCancel = () => {\r\n props.onClose();\r\n };\r\n \r\n const handleAdd = () => {\r\n props.onAdd(props.locationId, locations);\r\n props.onClose();\r\n };\r\n\r\n const updateLocationCodes = (event: any) => {\r\n setLocations(event.target.value);\r\n } \r\n\r\n return (\r\n \r\n \r\n
\r\n );\r\n}\r\n\r\nfunction DeleteStockLocationFormDialog(props: any) {\r\n const handleCancel = () => {\r\n props.onClose();\r\n };\r\n\r\n const handleDelete = () => {\r\n props.onDelete(props.locationId);\r\n props.onClose();\r\n };\r\n\r\n return (\r\n \r\n \r\n
\r\n );\r\n}\r\n\r\nfunction EditStockLocationFormDialog(props: any) {\r\n const [code, setCode] = React.useState('');\r\n useEffect(() => {\r\n setCode(props.code)\r\n }, [props.code]);\r\n const handleCancel = () => {\r\n props.onClose();\r\n };\r\n\r\n const handleEdit = () => {\r\n props.onEdit(props.locationId, code);\r\n props.onClose();\r\n };\r\n \r\n const updateLocationCodes = (event: any) => {\r\n setCode(event.target.value);\r\n }\r\n return (\r\n \r\n \r\n
\r\n );\r\n}\r\n\r\nfunction StockLocationRow(props: { item: StockLocation , parentCode: string | null, depth: number, onDeleteClick: any, onAddClick: any, onEditClick: any}) {\r\n \r\n const [anchorEl, setAnchorEl] = React.useState(null);\r\n\r\n const handleClick = (event: any) => {\r\n setAnchorEl(event.currentTarget);\r\n };\r\n \r\n let handleClose = () => {\r\n setAnchorEl(null);\r\n };\r\n \r\n let handleDeleteClick = () => {\r\n handleClose();\r\n props.onDeleteClick(props.item.id, fullCode);\r\n };\r\n\r\n let handleAddClick = () => {\r\n handleClose();\r\n props.onAddClick(props.item.id, fullCode);\r\n };\r\n\r\n let handleEditClick = () => {\r\n handleClose();\r\n props.onEditClick(props.item.id, props.parentCode, props.item.code);\r\n };\r\n let fullCode = props.item.code;\r\n if(props.parentCode != null) { fullCode = props.parentCode + '-' + props.item.code}\r\n return (\r\n <>\r\n \r\n {fullCode}\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n {props.item.children.map((item: StockLocation) => (\r\n ))}\r\n >\r\n )\r\n}\r\n\r\nexport default function StockLocations()\r\n{\r\n let initialState: StockLocationsState = {\r\n error: { message: ''},\r\n isLoaded: false,\r\n stockLocations: [],\r\n deleteStockLocationDialogOpen: false,\r\n addStockLocationDialogOpen: false,\r\n editStockLocationDialogOpen: false,\r\n deleteStockLocationId: null,\r\n addStockLocationId: null,\r\n editStockLocationId: null,\r\n deleteStockLocationFullCode: null,\r\n addStockLocationFullCode: null,\r\n editStockLocationParentCode: null,\r\n editStockLocationCode: null\r\n };\r\n\r\n let [state, setState] = useState(initialState);\r\n \r\n \r\n\r\n const updateStockLocations = useCallback(() => {\r\n const getStockLocationChildren = (stockLocations: StockLocation[], parentId: string | null) => {\r\n return stockLocations.filter(i => i.parentId === parentId).map(i => {\r\n i.children = getStockLocationChildren(stockLocations, i.id);\r\n return i;\r\n }).sort((a, b) => a.code.localeCompare(b.code, 'en', {numeric: true } ));\r\n };\r\n \r\n const sortStockLocationResult = (stockLocations: StockLocation[]) : StockLocation[] => {\r\n return getStockLocationChildren(stockLocations, null);\r\n }\r\n\r\n fetch(`/api/stock-locations`)\r\n .then(res => res.json())\r\n .then(\r\n (result) => {\r\n setState(s => {\r\n return {\r\n ...s,\r\n isLoaded: true,\r\n stockLocations: sortStockLocationResult(result)\r\n }\r\n });\r\n },\r\n (error) => {\r\n }\r\n )\r\n }, []);\r\n\r\n useEffect(() => {\r\n updateStockLocations();\r\n }, [updateStockLocations]);\r\n\r\n const handleDelete = (itemId: string, fullCode: string) => {\r\n setState(s => ({ ...s, deleteStockLocationDialogOpen: true, deleteStockLocationId: itemId, deleteStockLocationFullCode: fullCode }));\r\n };\r\n\r\n const handleAdd = (itemId: string | null, fullCode: string) => {\r\n setState(s => ({ ...s, addStockLocationDialogOpen: true, addStockLocationId: itemId, addStockLocationFullCode: fullCode }));\r\n };\r\n\r\n const handleEdit = (itemId: string, parentCode: string, code: string) => {\r\n setState(s => ({ ...s, editStockLocationDialogOpen: true, editStockLocationId: itemId, editStockLocationParentCode: parentCode, editStockLocationCode: code }));\r\n };\r\n\r\n const addStockLocations = (id: string, locations: string) => {\r\n fetch(`/api/stock-locations`, {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json'\r\n },\r\n body: JSON.stringify({parentId: id, code: locations})\r\n }).then( () => {\r\n setState(s => ({\r\n ...s,\r\n isLoaded: false,\r\n stockLocations: []\r\n }));\r\n updateStockLocations();\r\n })\r\n };\r\n\r\n const deleteStockLocation = (id: string) => {\r\n fetch(`/api/stock-locations/${id}`, {\r\n method: 'DELETE',\r\n headers: {\r\n 'Content-Type': 'application/json'\r\n },\r\n }).then( (result) => {\r\n setState(s => ({\r\n ...s,\r\n isLoaded: false,\r\n stockLocations: []\r\n }));\r\n updateStockLocations();\r\n })\r\n };\r\n\r\n const editStockLocation = (id: string, code: string) => {\r\n fetch(`/api/stock-locations/${id}`, {\r\n method: 'PUT',\r\n headers: {\r\n 'Content-Type': 'application/json'\r\n },\r\n body: JSON.stringify({id: id, code: code})\r\n }).then( () => {\r\n setState(s => ({\r\n ...s,\r\n isLoaded: false,\r\n stockLocations: []\r\n }));\r\n updateStockLocations();\r\n })\r\n };\r\n\r\n const onDeleteStockDialogClose = () => {\r\n setState(s => ({ ...s, deleteStockLocationDialogOpen: false, deleteStockLocationId: null, deleteStockLocationFullCode: null }));\r\n };\r\n\r\n const onAddStockDialogClose = () => {\r\n setState(s => ({ ...s, addStockLocationDialogOpen: false, addStockLocationId: null, addStockLocationFullCode: null }));\r\n };\r\n\r\n const onEditStockDialogClose = () => {\r\n setState(s => ({ ...s, editStockLocationDialogOpen: false, editStockLocationId: null, editStockLocationCode: null, editStockLocationParentCode: null }));\r\n };\r\n\r\n const { error, isLoaded, stockLocations } = state;\r\n if (error.message.length > 0) {\r\n return Error: {error.message}
;\r\n } else if (!isLoaded) {\r\n return Loading...
;\r\n } else {\r\n return (\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n Location Code\r\n \r\n \r\n \r\n \r\n {stockLocations.length === 0 &&\r\n No stock locations found}\r\n {stockLocations.map((item: StockLocation) => (\r\n \r\n ))}\r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n );\r\n }\r\n}","export const ApplicationName = 'FabShopManager';\r\n\r\nexport const QueryParameterNames = {\r\n ReturnUrl: 'returnUrl',\r\n Message: 'message'\r\n};\r\n\r\nexport const LogoutActions = {\r\n LogoutCallback: 'logout-callback',\r\n Logout: 'logout',\r\n LoggedOut: 'logged-out'\r\n};\r\n\r\nexport const LoginActions = {\r\n Login: 'login',\r\n LoginCallback: 'login-callback',\r\n LoginFailed: 'login-failed',\r\n Profile: 'profile',\r\n Register: 'register'\r\n};\r\n\r\nconst prefix = '/authentication';\r\n\r\nexport const ApplicationPaths = {\r\n DefaultLoginRedirectPath: '/',\r\n ApiAuthorizationClientConfigurationUrl: `_configuration/${ApplicationName}`,\r\n ApiAuthorizationPrefix: prefix,\r\n Login: `${prefix}/${LoginActions.Login}`,\r\n LoginFailed: `${prefix}/${LoginActions.LoginFailed}`,\r\n LoginCallback: `${prefix}/${LoginActions.LoginCallback}`,\r\n Register: `${prefix}/${LoginActions.Register}`,\r\n Profile: `${prefix}/${LoginActions.Profile}`,\r\n LogOut: `${prefix}/${LogoutActions.Logout}`,\r\n LoggedOut: `${prefix}/${LogoutActions.LoggedOut}`,\r\n LogOutCallback: `${prefix}/${LogoutActions.LogoutCallback}`,\r\n IdentityRegisterPath: 'Identity/Account/Register',\r\n IdentityManagePath: 'Identity/Account/Manage'\r\n};\r\n","import { UserManager, WebStorageStateStore } from 'oidc-client';\r\nimport { ApplicationPaths, ApplicationName } from './ApiAuthorizationConstants';\r\n\r\nexport class AuthorizeService {\r\n _callbacks = [];\r\n _nextSubscriptionId = 0;\r\n _user = null;\r\n _isAuthenticated = false;\r\n\r\n // By default pop ups are disabled because they don't work properly on Edge.\r\n // If you want to enable pop up authentication simply set this flag to false.\r\n _popUpDisabled = true;\r\n\r\n async isAuthenticated() {\r\n const user = await this.getUser();\r\n return !!user;\r\n }\r\n\r\n async getUser() {\r\n if (this._user && this._user.profile) {\r\n return this._user.profile;\r\n }\r\n\r\n await this.ensureUserManagerInitialized();\r\n const user = await this.userManager.getUser();\r\n return user && user.profile;\r\n }\r\n\r\n async getAccessToken() {\r\n await this.ensureUserManagerInitialized();\r\n const user = await this.userManager.getUser();\r\n return user && user.access_token;\r\n }\r\n\r\n // We try to authenticate the user in three different ways:\r\n // 1) We try to see if we can authenticate the user silently. This happens\r\n // when the user is already logged in on the IdP and is done using a hidden iframe\r\n // on the client.\r\n // 2) We try to authenticate the user using a PopUp Window. This might fail if there is a\r\n // Pop-Up blocker or the user has disabled PopUps.\r\n // 3) If the two methods above fail, we redirect the browser to the IdP to perform a traditional\r\n // redirect flow.\r\n async signIn(state) {\r\n await this.ensureUserManagerInitialized();\r\n try {\r\n const silentUser = await this.userManager.signinSilent(this.createArguments());\r\n this.updateState(silentUser);\r\n return this.success(state);\r\n } catch (silentError) {\r\n // User might not be authenticated, fallback to popup authentication\r\n console.log(\"Silent authentication error: \", silentError);\r\n\r\n try {\r\n if (this._popUpDisabled) {\r\n throw new Error('Popup disabled. Change \\'AuthorizeService.js:AuthorizeService._popupDisabled\\' to false to enable it.')\r\n }\r\n\r\n const popUpUser = await this.userManager.signinPopup(this.createArguments());\r\n this.updateState(popUpUser);\r\n return this.success(state);\r\n } catch (popUpError) {\r\n if (popUpError.message === \"Popup window closed\") {\r\n // The user explicitly cancelled the login action by closing an opened popup.\r\n return this.error(\"The user closed the window.\");\r\n } else if (!this._popUpDisabled) {\r\n console.log(\"Popup authentication error: \", popUpError);\r\n }\r\n\r\n // PopUps might be blocked by the user, fallback to redirect\r\n try {\r\n await this.userManager.signinRedirect(this.createArguments(state));\r\n return this.redirect();\r\n } catch (redirectError) {\r\n console.log(\"Redirect authentication error: \", redirectError);\r\n return this.error(redirectError);\r\n }\r\n }\r\n }\r\n }\r\n\r\n async completeSignIn(url) {\r\n try {\r\n await this.ensureUserManagerInitialized();\r\n const user = await this.userManager.signinCallback(url);\r\n this.updateState(user);\r\n return this.success(user && user.state);\r\n } catch (error) {\r\n console.log('There was an error signing in: ', error);\r\n return this.error('There was an error signing in.');\r\n }\r\n }\r\n\r\n // We try to sign out the user in two different ways:\r\n // 1) We try to do a sign-out using a PopUp Window. This might fail if there is a\r\n // Pop-Up blocker or the user has disabled PopUps.\r\n // 2) If the method above fails, we redirect the browser to the IdP to perform a traditional\r\n // post logout redirect flow.\r\n async signOut(state) {\r\n await this.ensureUserManagerInitialized();\r\n try {\r\n if (this._popUpDisabled) {\r\n throw new Error('Popup disabled. Change \\'AuthorizeService.js:AuthorizeService._popupDisabled\\' to false to enable it.')\r\n }\r\n\r\n await this.userManager.signoutPopup(this.createArguments());\r\n this.updateState(undefined);\r\n return this.success(state);\r\n } catch (popupSignOutError) {\r\n console.log(\"Popup signout error: \", popupSignOutError);\r\n try {\r\n await this.userManager.signoutRedirect(this.createArguments(state));\r\n return this.redirect();\r\n } catch (redirectSignOutError) {\r\n console.log(\"Redirect signout error: \", redirectSignOutError);\r\n return this.error(redirectSignOutError);\r\n }\r\n }\r\n }\r\n\r\n async completeSignOut(url) {\r\n await this.ensureUserManagerInitialized();\r\n try {\r\n const response = await this.userManager.signoutCallback(url);\r\n this.updateState(null);\r\n return this.success(response && response.data);\r\n } catch (error) {\r\n console.log(`There was an error trying to log out '${error}'.`);\r\n return this.error(error);\r\n }\r\n }\r\n\r\n updateState(user) {\r\n this._user = user;\r\n this._isAuthenticated = !!this._user;\r\n this.notifySubscribers();\r\n }\r\n\r\n subscribe(callback) {\r\n this._callbacks.push({ callback, subscription: this._nextSubscriptionId++ });\r\n return this._nextSubscriptionId - 1;\r\n }\r\n\r\n unsubscribe(subscriptionId) {\r\n const subscriptionIndex = this._callbacks\r\n .map((element, index) => element.subscription === subscriptionId ? { found: true, index } : { found: false })\r\n .filter(element => element.found === true);\r\n if (subscriptionIndex.length !== 1) {\r\n throw new Error(`Found an invalid number of subscriptions ${subscriptionIndex.length}`);\r\n }\r\n\r\n this._callbacks.splice(subscriptionIndex[0].index, 1);\r\n }\r\n\r\n notifySubscribers() {\r\n for (let i = 0; i < this._callbacks.length; i++) {\r\n const callback = this._callbacks[i].callback;\r\n callback();\r\n }\r\n }\r\n\r\n createArguments(state) {\r\n return { useReplaceToNavigate: true, data: state };\r\n }\r\n\r\n error(message) {\r\n return { status: AuthenticationResultStatus.Fail, message };\r\n }\r\n\r\n success(state) {\r\n return { status: AuthenticationResultStatus.Success, state };\r\n }\r\n\r\n redirect() {\r\n return { status: AuthenticationResultStatus.Redirect };\r\n }\r\n\r\n async ensureUserManagerInitialized() {\r\n if (this.userManager !== undefined) {\r\n return;\r\n }\r\n\r\n let response = await fetch(ApplicationPaths.ApiAuthorizationClientConfigurationUrl);\r\n if (!response.ok) {\r\n throw new Error(`Could not load settings for '${ApplicationName}'`);\r\n }\r\n\r\n let settings = await response.json();\r\n settings.automaticSilentRenew = true;\r\n settings.includeIdTokenInSilentRenew = true;\r\n settings.userStore = new WebStorageStateStore({\r\n prefix: ApplicationName\r\n });\r\n\r\n this.userManager = new UserManager(settings);\r\n\r\n this.userManager.events.addUserSignedOut(async () => {\r\n await this.userManager.removeUser();\r\n this.updateState(undefined);\r\n });\r\n }\r\n\r\n async userInRole(role) {\r\n let userProfile = await this.getUser();\r\n if(userProfile && userProfile.role === role) return true;\r\n return false;\r\n }\r\n\r\n static get instance() { return authService }\r\n}\r\n\r\nconst authService = new AuthorizeService();\r\n\r\nexport default authService;\r\n\r\nexport const AuthenticationResultStatus = {\r\n Redirect: 'redirect',\r\n Success: 'success',\r\n Fail: 'fail'\r\n};\r\n","import React, { Component, Fragment } from 'react';\r\nimport { Link } from 'react-router-dom';\r\nimport authService from './AuthorizeService';\r\nimport { ApplicationPaths } from './ApiAuthorizationConstants';\r\nimport Button from \"@mui/material/Button\";\r\n\r\nexport class LoginMenu extends Component {\r\n constructor(props) {\r\n super(props);\r\n\r\n this.state = {\r\n isAuthenticated: false,\r\n userName: null\r\n };\r\n }\r\n\r\n componentDidMount() {\r\n this._subscription = authService.subscribe(() => this.populateState());\r\n this.populateState();\r\n }\r\n\r\n componentWillUnmount() {\r\n authService.unsubscribe(this._subscription);\r\n }\r\n\r\n async populateState() {\r\n const [isAuthenticated, user] = await Promise.all([authService.isAuthenticated(), authService.getUser()])\r\n this.setState({\r\n isAuthenticated,\r\n userName: user && user.name\r\n });\r\n }\r\n\r\n render() {\r\n const { isAuthenticated, userName } = this.state;\r\n if (!isAuthenticated) {\r\n const registerPath = `${ApplicationPaths.Register}`;\r\n const loginPath = `${ApplicationPaths.Login}`;\r\n return this.anonymousView(registerPath, loginPath);\r\n } else {\r\n const profilePath = `${ApplicationPaths.Profile}`;\r\n const logoutPath = { pathname: `${ApplicationPaths.LogOut}`, state: { local: true } };\r\n return this.authenticatedView(userName, profilePath, logoutPath);\r\n }\r\n }\r\n\r\n authenticatedView(userName, profilePath, logoutPath) {\r\n return (\r\n \r\n \r\n );\r\n\r\n }\r\n\r\n anonymousView(registerPath, loginPath) {\r\n return (\r\n \r\n\r\n \r\n );\r\n }\r\n}","/* tslint:disable */\r\n/* eslint-disable */\r\n//----------------------\r\n// \r\n// Generated using the NSwag toolchain v (http://NSwag.org)\r\n// \r\n//----------------------\r\n// ReSharper disable InconsistentNaming\r\n\r\nimport authService from \"../auth/AuthorizeService\";\r\nimport axios, { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, CancelToken } from 'axios';\r\n\r\nexport class ServiceConfiguration {\r\n \r\n}\r\n\r\nexport class BaseService {\r\n private readonly config: ServiceConfiguration;\r\n \r\n constructor(config: ServiceConfiguration) {\r\n this.config = config;\r\n }\r\n\r\n protected transformOptions = (options: AxiosRequestConfig): Promise => {\r\n return new Promise(resolve => {\r\n authService.getAccessToken().then(token => {\r\n if (!!token && BaseService.isSameOriginUrl(options)) {\r\n options.headers = {\r\n ...options.headers,\r\n 'Authorization': `Bearer ${token}`\r\n };\r\n }\r\n resolve(options);\r\n });\r\n });\r\n };\r\n\r\n protected transformResult(url: string, response: AxiosResponse, processor: (response: AxiosResponse) => any) {\r\n // TODO: Return own result or throw exception to change default processing behavior, \r\n // or call processor function to run the default processing logic\r\n\r\n return processor(response);\r\n }\r\n\r\n private static isSameOriginUrl(req: any) {\r\n // It's an absolute url with the same origin.\r\n if (req.url.startsWith(`${window.location.origin}/`)) {\r\n return true;\r\n }\r\n\r\n // It's a protocol relative url with the same origin.\r\n // For example: //www.example.com/api/Products\r\n if (req.url.startsWith(`//${window.location.host}/`)) {\r\n return true;\r\n }\r\n\r\n // It's a relative url like /api/Products\r\n if (/^\\/[^\\/].*/.test(req.url)) {\r\n return true;\r\n }\r\n\r\n // It's an absolute or protocol relative url that\r\n // doesn't have the same origin.\r\n return false;\r\n }\r\n}\r\n\r\nexport interface IContactsService {\r\n getContacts(): Promise;\r\n createContact(contact: CreateContactCommand): Promise;\r\n getContact(id: string): Promise;\r\n}\r\n\r\nexport class ContactsService extends BaseService implements IContactsService {\r\n private instance: AxiosInstance;\r\n private baseUrl: string;\r\n protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;\r\n\r\n constructor(configuration: ServiceConfiguration, baseUrl?: string, instance?: AxiosInstance) {\r\n\r\n super(configuration);\r\n\r\n this.instance = instance ? instance : axios.create();\r\n\r\n this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : \"\";\r\n\r\n }\r\n\r\n getContacts( cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/contacts\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n method: \"GET\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/json\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processGetContacts(_response));\r\n });\r\n }\r\n\r\n protected processGetContacts(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200) {\r\n const _responseText = response.data;\r\n let result200: any = null;\r\n let resultData200 = _responseText;\r\n result200 = GetContactsResponse.fromJS(resultData200);\r\n return Promise.resolve(result200);\r\n\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n createContact(contact: CreateContactCommand , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/contacts\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n const content_ = JSON.stringify(contact);\r\n\r\n let options_ = {\r\n data: content_,\r\n method: \"POST\",\r\n url: url_,\r\n headers: {\r\n \"Content-Type\": \"application/json\",\r\n \"Accept\": \"application/json\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processCreateContact(_response));\r\n });\r\n }\r\n\r\n protected processCreateContact(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 201) {\r\n const _responseText = response.data;\r\n let result201: any = null;\r\n let resultData201 = _responseText;\r\n result201 = CreateContactResponse.fromJS(resultData201);\r\n return Promise.resolve(result201);\r\n\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n getContact(id: string , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/contacts/{id}\";\r\n if (id === undefined || id === null)\r\n throw new Error(\"The parameter 'id' must be defined.\");\r\n url_ = url_.replace(\"{id}\", encodeURIComponent(\"\" + id));\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n method: \"GET\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/json\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processGetContact(_response));\r\n });\r\n }\r\n\r\n protected processGetContact(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200) {\r\n const _responseText = response.data;\r\n let result200: any = null;\r\n let resultData200 = _responseText;\r\n result200 = GetContactResponse.fromJS(resultData200);\r\n return Promise.resolve(result200);\r\n\r\n } else if (status === 404) {\r\n const _responseText = response.data;\r\n let result404: any = null;\r\n let resultData404 = _responseText;\r\n result404 = ProblemDetails.fromJS(resultData404);\r\n return throwException(\"A server side error occurred.\", status, _responseText, _headers, result404);\r\n\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n}\r\n\r\nexport interface IMaterialService {\r\n get(): Promise;\r\n importMaterials(csvFile: FileParameter | null | undefined): Promise;\r\n importMaterialAliases(file: FileParameter | null | undefined): Promise;\r\n}\r\n\r\nexport class MaterialService extends BaseService implements IMaterialService {\r\n private instance: AxiosInstance;\r\n private baseUrl: string;\r\n protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;\r\n\r\n constructor(configuration: ServiceConfiguration, baseUrl?: string, instance?: AxiosInstance) {\r\n\r\n super(configuration);\r\n\r\n this.instance = instance ? instance : axios.create();\r\n\r\n this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : \"\";\r\n\r\n }\r\n\r\n get( cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/material\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n method: \"GET\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/json\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processGet(_response));\r\n });\r\n }\r\n\r\n protected processGet(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200) {\r\n const _responseText = response.data;\r\n let result200: any = null;\r\n let resultData200 = _responseText;\r\n if (Array.isArray(resultData200)) {\r\n result200 = [] as any;\r\n for (let item of resultData200)\r\n result200!.push(Material.fromJS(item));\r\n }\r\n else {\r\n result200 = null;\r\n }\r\n return Promise.resolve(result200);\r\n\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n importMaterials(csvFile: FileParameter | null | undefined , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/material/import\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n const content_ = new FormData();\r\n if (csvFile !== null && csvFile !== undefined)\r\n content_.append(\"csvFile\", csvFile.data, csvFile.fileName ? csvFile.fileName : \"csvFile\");\r\n\r\n let options_ = {\r\n data: content_,\r\n method: \"POST\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/json\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processImportMaterials(_response));\r\n });\r\n }\r\n\r\n protected processImportMaterials(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200) {\r\n const _responseText = response.data;\r\n let result200: any = null;\r\n let resultData200 = _responseText;\r\n if (Array.isArray(resultData200)) {\r\n result200 = [] as any;\r\n for (let item of resultData200)\r\n result200!.push(ImportMaterialsRow.fromJS(item));\r\n }\r\n else {\r\n result200 = null;\r\n }\r\n return Promise.resolve(result200);\r\n\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n importMaterialAliases(file: FileParameter | null | undefined , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/material/import-aliases\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n const content_ = new FormData();\r\n if (file !== null && file !== undefined)\r\n content_.append(\"file\", file.data, file.fileName ? file.fileName : \"file\");\r\n\r\n let options_ = {\r\n data: content_,\r\n method: \"POST\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/json\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processImportMaterialAliases(_response));\r\n });\r\n }\r\n\r\n protected processImportMaterialAliases(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200) {\r\n const _responseText = response.data;\r\n let result200: any = null;\r\n let resultData200 = _responseText;\r\n if (Array.isArray(resultData200)) {\r\n result200 = [] as any;\r\n for (let item of resultData200)\r\n result200!.push(MaterialAlias.fromJS(item));\r\n }\r\n else {\r\n result200 = null;\r\n }\r\n return Promise.resolve(result200);\r\n\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n}\r\n\r\nexport interface IMaterialProfileService {\r\n get(): Promise;\r\n}\r\n\r\nexport class MaterialProfileService extends BaseService implements IMaterialProfileService {\r\n private instance: AxiosInstance;\r\n private baseUrl: string;\r\n protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;\r\n\r\n constructor(configuration: ServiceConfiguration, baseUrl?: string, instance?: AxiosInstance) {\r\n\r\n super(configuration);\r\n\r\n this.instance = instance ? instance : axios.create();\r\n\r\n this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : \"\";\r\n\r\n }\r\n\r\n get( cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/material-profiles\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n method: \"GET\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/json\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processGet(_response));\r\n });\r\n }\r\n\r\n protected processGet(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200) {\r\n const _responseText = response.data;\r\n let result200: any = null;\r\n let resultData200 = _responseText;\r\n if (Array.isArray(resultData200)) {\r\n result200 = [] as any;\r\n for (let item of resultData200)\r\n result200!.push(MaterialProfile.fromJS(item));\r\n }\r\n else {\r\n result200 = null;\r\n }\r\n return Promise.resolve(result200);\r\n\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n}\r\n\r\nexport interface IMaterialSchedulesService {\r\n get(): Promise;\r\n create(): Promise;\r\n}\r\n\r\nexport class MaterialSchedulesService extends BaseService implements IMaterialSchedulesService {\r\n private instance: AxiosInstance;\r\n private baseUrl: string;\r\n protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;\r\n\r\n constructor(configuration: ServiceConfiguration, baseUrl?: string, instance?: AxiosInstance) {\r\n\r\n super(configuration);\r\n\r\n this.instance = instance ? instance : axios.create();\r\n\r\n this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : \"\";\r\n\r\n }\r\n\r\n get( cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/material-schedules\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n method: \"GET\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/json\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processGet(_response));\r\n });\r\n }\r\n\r\n protected processGet(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200) {\r\n const _responseText = response.data;\r\n let result200: any = null;\r\n let resultData200 = _responseText;\r\n if (Array.isArray(resultData200)) {\r\n result200 = [] as any;\r\n for (let item of resultData200)\r\n result200!.push(Material.fromJS(item));\r\n }\r\n else {\r\n result200 = null;\r\n }\r\n return Promise.resolve(result200);\r\n\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n create( cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/material-schedules\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n responseType: \"blob\",\r\n method: \"POST\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/octet-stream\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processCreate(_response));\r\n });\r\n }\r\n\r\n protected processCreate(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200 || status === 206) {\r\n const contentDisposition = response.headers ? response.headers[\"content-disposition\"] : undefined;\r\n const fileNameMatch = contentDisposition ? /filename=\"?([^\"]*?)\"?(;|$)/g.exec(contentDisposition) : undefined;\r\n const fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined;\r\n return Promise.resolve({ fileName: fileName, status: status, data: new Blob([response.data]), headers: _headers });\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n}\r\n\r\nexport interface IMaterialTypeService {\r\n get(): Promise;\r\n}\r\n\r\nexport class MaterialTypeService extends BaseService implements IMaterialTypeService {\r\n private instance: AxiosInstance;\r\n private baseUrl: string;\r\n protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;\r\n\r\n constructor(configuration: ServiceConfiguration, baseUrl?: string, instance?: AxiosInstance) {\r\n\r\n super(configuration);\r\n\r\n this.instance = instance ? instance : axios.create();\r\n\r\n this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : \"\";\r\n\r\n }\r\n\r\n get( cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/material-types\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n method: \"GET\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/json\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processGet(_response));\r\n });\r\n }\r\n\r\n protected processGet(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200) {\r\n const _responseText = response.data;\r\n let result200: any = null;\r\n let resultData200 = _responseText;\r\n if (Array.isArray(resultData200)) {\r\n result200 = [] as any;\r\n for (let item of resultData200)\r\n result200!.push(MaterialType.fromJS(item));\r\n }\r\n else {\r\n result200 = null;\r\n }\r\n return Promise.resolve(result200);\r\n\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n}\r\n\r\nexport interface IOidcConfigurationService {\r\n getClientRequestParameters(clientId: string | null): Promise;\r\n}\r\n\r\nexport class OidcConfigurationService extends BaseService implements IOidcConfigurationService {\r\n private instance: AxiosInstance;\r\n private baseUrl: string;\r\n protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;\r\n\r\n constructor(configuration: ServiceConfiguration, baseUrl?: string, instance?: AxiosInstance) {\r\n\r\n super(configuration);\r\n\r\n this.instance = instance ? instance : axios.create();\r\n\r\n this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : \"\";\r\n\r\n }\r\n\r\n getClientRequestParameters(clientId: string | null , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/_configuration/{clientId}\";\r\n if (clientId === undefined || clientId === null)\r\n throw new Error(\"The parameter 'clientId' must be defined.\");\r\n url_ = url_.replace(\"{clientId}\", encodeURIComponent(\"\" + clientId));\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n responseType: \"blob\",\r\n method: \"GET\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/octet-stream\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processGetClientRequestParameters(_response));\r\n });\r\n }\r\n\r\n protected processGetClientRequestParameters(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200 || status === 206) {\r\n const contentDisposition = response.headers ? response.headers[\"content-disposition\"] : undefined;\r\n const fileNameMatch = contentDisposition ? /filename=\"?([^\"]*?)\"?(;|$)/g.exec(contentDisposition) : undefined;\r\n const fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined;\r\n return Promise.resolve({ fileName: fileName, status: status, data: new Blob([response.data]), headers: _headers });\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n}\r\n\r\nexport interface IProjectAssemblyService {\r\n getAssemblies(projectId: string): Promise;\r\n getAssembly(assemblyId: string, projectId: string): Promise;\r\n}\r\n\r\nexport class ProjectAssemblyService extends BaseService implements IProjectAssemblyService {\r\n private instance: AxiosInstance;\r\n private baseUrl: string;\r\n protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;\r\n\r\n constructor(configuration: ServiceConfiguration, baseUrl?: string, instance?: AxiosInstance) {\r\n\r\n super(configuration);\r\n\r\n this.instance = instance ? instance : axios.create();\r\n\r\n this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : \"\";\r\n\r\n }\r\n\r\n getAssemblies(projectId: string , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/projects/{projectId}/assemblies\";\r\n if (projectId === undefined || projectId === null)\r\n throw new Error(\"The parameter 'projectId' must be defined.\");\r\n url_ = url_.replace(\"{projectId}\", encodeURIComponent(\"\" + projectId));\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n method: \"GET\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/json\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processGetAssemblies(_response));\r\n });\r\n }\r\n\r\n protected processGetAssemblies(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200) {\r\n const _responseText = response.data;\r\n let result200: any = null;\r\n let resultData200 = _responseText;\r\n if (Array.isArray(resultData200)) {\r\n result200 = [] as any;\r\n for (let item of resultData200)\r\n result200!.push(ProjectAssembly.fromJS(item));\r\n }\r\n else {\r\n result200 = null;\r\n }\r\n return Promise.resolve(result200);\r\n\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n getAssembly(assemblyId: string, projectId: string , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/projects/{projectId}/assemblies/{assemblyId}\";\r\n if (assemblyId === undefined || assemblyId === null)\r\n throw new Error(\"The parameter 'assemblyId' must be defined.\");\r\n url_ = url_.replace(\"{assemblyId}\", encodeURIComponent(\"\" + assemblyId));\r\n if (projectId === undefined || projectId === null)\r\n throw new Error(\"The parameter 'projectId' must be defined.\");\r\n url_ = url_.replace(\"{projectId}\", encodeURIComponent(\"\" + projectId));\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n method: \"GET\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/json\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processGetAssembly(_response));\r\n });\r\n }\r\n\r\n protected processGetAssembly(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200) {\r\n const _responseText = response.data;\r\n let result200: any = null;\r\n let resultData200 = _responseText;\r\n result200 = ProjectAssembly.fromJS(resultData200);\r\n return Promise.resolve(result200);\r\n\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n}\r\n\r\nexport interface IProjectDefaultDirectoriesService {\r\n getDefaultDirectories(): Promise;\r\n updateDefaultDirectory(id: string | undefined, name: string | null | undefined): Promise;\r\n createDefaultDirectory(name: string | null | undefined): Promise;\r\n deleteDefaultDirectory(directoryId: string | undefined): Promise;\r\n setFabricationDrawingDirectory(directoryId: string | undefined): Promise;\r\n}\r\n\r\nexport class ProjectDefaultDirectoriesService extends BaseService implements IProjectDefaultDirectoriesService {\r\n private instance: AxiosInstance;\r\n private baseUrl: string;\r\n protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;\r\n\r\n constructor(configuration: ServiceConfiguration, baseUrl?: string, instance?: AxiosInstance) {\r\n\r\n super(configuration);\r\n\r\n this.instance = instance ? instance : axios.create();\r\n\r\n this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : \"\";\r\n\r\n }\r\n\r\n getDefaultDirectories( cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/settings/projects/default-directories\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n method: \"GET\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/json\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processGetDefaultDirectories(_response));\r\n });\r\n }\r\n\r\n protected processGetDefaultDirectories(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200) {\r\n const _responseText = response.data;\r\n let result200: any = null;\r\n let resultData200 = _responseText;\r\n if (Array.isArray(resultData200)) {\r\n result200 = [] as any;\r\n for (let item of resultData200)\r\n result200!.push(DefaultDirectoryResult.fromJS(item));\r\n }\r\n else {\r\n result200 = null;\r\n }\r\n return Promise.resolve(result200);\r\n\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n updateDefaultDirectory(id: string | undefined, name: string | null | undefined , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/settings/projects/default-directories?\";\r\n if (id === null)\r\n throw new Error(\"The parameter 'id' cannot be null.\");\r\n else if (id !== undefined)\r\n url_ += \"Id=\" + encodeURIComponent(\"\" + id) + \"&\";\r\n if (name !== undefined && name !== null)\r\n url_ += \"Name=\" + encodeURIComponent(\"\" + name) + \"&\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n responseType: \"blob\",\r\n method: \"PUT\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/octet-stream\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processUpdateDefaultDirectory(_response));\r\n });\r\n }\r\n\r\n protected processUpdateDefaultDirectory(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200 || status === 206) {\r\n const contentDisposition = response.headers ? response.headers[\"content-disposition\"] : undefined;\r\n const fileNameMatch = contentDisposition ? /filename=\"?([^\"]*?)\"?(;|$)/g.exec(contentDisposition) : undefined;\r\n const fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined;\r\n return Promise.resolve({ fileName: fileName, status: status, data: new Blob([response.data]), headers: _headers });\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n createDefaultDirectory(name: string | null | undefined , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/settings/projects/default-directories?\";\r\n if (name !== undefined && name !== null)\r\n url_ += \"Name=\" + encodeURIComponent(\"\" + name) + \"&\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n responseType: \"blob\",\r\n method: \"POST\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/octet-stream\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processCreateDefaultDirectory(_response));\r\n });\r\n }\r\n\r\n protected processCreateDefaultDirectory(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200 || status === 206) {\r\n const contentDisposition = response.headers ? response.headers[\"content-disposition\"] : undefined;\r\n const fileNameMatch = contentDisposition ? /filename=\"?([^\"]*?)\"?(;|$)/g.exec(contentDisposition) : undefined;\r\n const fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined;\r\n return Promise.resolve({ fileName: fileName, status: status, data: new Blob([response.data]), headers: _headers });\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n deleteDefaultDirectory(directoryId: string | undefined , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/settings/projects/default-directories?\";\r\n if (directoryId === null)\r\n throw new Error(\"The parameter 'directoryId' cannot be null.\");\r\n else if (directoryId !== undefined)\r\n url_ += \"directoryId=\" + encodeURIComponent(\"\" + directoryId) + \"&\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n responseType: \"blob\",\r\n method: \"DELETE\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/octet-stream\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processDeleteDefaultDirectory(_response));\r\n });\r\n }\r\n\r\n protected processDeleteDefaultDirectory(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200 || status === 206) {\r\n const contentDisposition = response.headers ? response.headers[\"content-disposition\"] : undefined;\r\n const fileNameMatch = contentDisposition ? /filename=\"?([^\"]*?)\"?(;|$)/g.exec(contentDisposition) : undefined;\r\n const fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined;\r\n return Promise.resolve({ fileName: fileName, status: status, data: new Blob([response.data]), headers: _headers });\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n setFabricationDrawingDirectory(directoryId: string | undefined , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/settings/projects/default-directories/set-fabrication-directory?\";\r\n if (directoryId === null)\r\n throw new Error(\"The parameter 'directoryId' cannot be null.\");\r\n else if (directoryId !== undefined)\r\n url_ += \"directoryId=\" + encodeURIComponent(\"\" + directoryId) + \"&\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n responseType: \"blob\",\r\n method: \"POST\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/octet-stream\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processSetFabricationDrawingDirectory(_response));\r\n });\r\n }\r\n\r\n protected processSetFabricationDrawingDirectory(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200 || status === 206) {\r\n const contentDisposition = response.headers ? response.headers[\"content-disposition\"] : undefined;\r\n const fileNameMatch = contentDisposition ? /filename=\"?([^\"]*?)\"?(;|$)/g.exec(contentDisposition) : undefined;\r\n const fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined;\r\n return Promise.resolve({ fileName: fileName, status: status, data: new Blob([response.data]), headers: _headers });\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n}\r\n\r\nexport interface IProjectFileDirectoriesService {\r\n deleteDirectory(directoryId: string | undefined, projectId: string): Promise;\r\n getDirectories(projectId: string): Promise;\r\n createDirectory(projectId: string, parentDirectoryId: string | null | undefined, name: string | null | undefined): Promise;\r\n setCurrentFabricationDrawingDirectory(projectId: string, directoryId: string | undefined): Promise;\r\n}\r\n\r\nexport class ProjectFileDirectoriesService extends BaseService implements IProjectFileDirectoriesService {\r\n private instance: AxiosInstance;\r\n private baseUrl: string;\r\n protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;\r\n\r\n constructor(configuration: ServiceConfiguration, baseUrl?: string, instance?: AxiosInstance) {\r\n\r\n super(configuration);\r\n\r\n this.instance = instance ? instance : axios.create();\r\n\r\n this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : \"\";\r\n\r\n }\r\n\r\n deleteDirectory(directoryId: string | undefined, projectId: string , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/projects/{projectId}/files/directories?\";\r\n if (projectId === undefined || projectId === null)\r\n throw new Error(\"The parameter 'projectId' must be defined.\");\r\n url_ = url_.replace(\"{projectId}\", encodeURIComponent(\"\" + projectId));\r\n if (directoryId === null)\r\n throw new Error(\"The parameter 'directoryId' cannot be null.\");\r\n else if (directoryId !== undefined)\r\n url_ += \"directoryId=\" + encodeURIComponent(\"\" + directoryId) + \"&\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n method: \"DELETE\",\r\n url: url_,\r\n headers: {\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processDeleteDirectory(_response));\r\n });\r\n }\r\n\r\n protected processDeleteDirectory(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200) {\r\n const _responseText = response.data;\r\n return Promise.resolve(null);\r\n\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n getDirectories(projectId: string , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/projects/{projectId}/files/directories\";\r\n if (projectId === undefined || projectId === null)\r\n throw new Error(\"The parameter 'projectId' must be defined.\");\r\n url_ = url_.replace(\"{projectId}\", encodeURIComponent(\"\" + projectId));\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n method: \"GET\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/json\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processGetDirectories(_response));\r\n });\r\n }\r\n\r\n protected processGetDirectories(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200) {\r\n const _responseText = response.data;\r\n let result200: any = null;\r\n let resultData200 = _responseText;\r\n result200 = GetDirectoriesResult.fromJS(resultData200);\r\n return Promise.resolve(result200);\r\n\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n createDirectory(projectId: string, parentDirectoryId: string | null | undefined, name: string | null | undefined , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/projects/{projectId}/files/directories?\";\r\n if (projectId === undefined || projectId === null)\r\n throw new Error(\"The parameter 'projectId' must be defined.\");\r\n url_ = url_.replace(\"{projectId}\", encodeURIComponent(\"\" + projectId));\r\n if (parentDirectoryId !== undefined && parentDirectoryId !== null)\r\n url_ += \"parentDirectoryId=\" + encodeURIComponent(\"\" + parentDirectoryId) + \"&\";\r\n if (name !== undefined && name !== null)\r\n url_ += \"name=\" + encodeURIComponent(\"\" + name) + \"&\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n method: \"POST\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/json\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processCreateDirectory(_response));\r\n });\r\n }\r\n\r\n protected processCreateDirectory(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200) {\r\n const _responseText = response.data;\r\n let result200: any = null;\r\n let resultData200 = _responseText;\r\n result200 = CreateDirectoryResult.fromJS(resultData200);\r\n return Promise.resolve(result200);\r\n\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n setCurrentFabricationDrawingDirectory(projectId: string, directoryId: string | undefined , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/projects/{projectId}/files/directories/set-fabrication-directory?\";\r\n if (projectId === undefined || projectId === null)\r\n throw new Error(\"The parameter 'projectId' must be defined.\");\r\n url_ = url_.replace(\"{projectId}\", encodeURIComponent(\"\" + projectId));\r\n if (directoryId === null)\r\n throw new Error(\"The parameter 'directoryId' cannot be null.\");\r\n else if (directoryId !== undefined)\r\n url_ += \"directoryId=\" + encodeURIComponent(\"\" + directoryId) + \"&\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n responseType: \"blob\",\r\n method: \"POST\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/octet-stream\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processSetCurrentFabricationDrawingDirectory(_response));\r\n });\r\n }\r\n\r\n protected processSetCurrentFabricationDrawingDirectory(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200 || status === 206) {\r\n const contentDisposition = response.headers ? response.headers[\"content-disposition\"] : undefined;\r\n const fileNameMatch = contentDisposition ? /filename=\"?([^\"]*?)\"?(;|$)/g.exec(contentDisposition) : undefined;\r\n const fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined;\r\n return Promise.resolve({ fileName: fileName, status: status, data: new Blob([response.data]), headers: _headers });\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n}\r\n\r\nexport interface IProjectFilesService {\r\n download(fileId: string, projectId: string): Promise;\r\n open(fileId: string, projectId: string): Promise;\r\n deleteFiles(projectId: string, request: DeleteFilesReqeuest): Promise;\r\n getFiles(projectId: string, directoryId: string | null | undefined): Promise;\r\n uploadFile(projectId: string, directoryId: string | null | undefined, extractZip: boolean | undefined, file: FileParameter | null | undefined): Promise;\r\n createDirectory(projectId: string, parentDirectoryId: string | null | undefined, name: string | null | undefined): Promise;\r\n move(projectId: string, request: MoveFilesRequest): Promise;\r\n}\r\n\r\nexport class ProjectFilesService extends BaseService implements IProjectFilesService {\r\n private instance: AxiosInstance;\r\n private baseUrl: string;\r\n protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;\r\n\r\n constructor(configuration: ServiceConfiguration, baseUrl?: string, instance?: AxiosInstance) {\r\n\r\n super(configuration);\r\n\r\n this.instance = instance ? instance : axios.create();\r\n\r\n this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : \"\";\r\n\r\n }\r\n\r\n download(fileId: string, projectId: string , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/projects/{projectId}/files/download/{fileId}\";\r\n if (fileId === undefined || fileId === null)\r\n throw new Error(\"The parameter 'fileId' must be defined.\");\r\n url_ = url_.replace(\"{fileId}\", encodeURIComponent(\"\" + fileId));\r\n if (projectId === undefined || projectId === null)\r\n throw new Error(\"The parameter 'projectId' must be defined.\");\r\n url_ = url_.replace(\"{projectId}\", encodeURIComponent(\"\" + projectId));\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n responseType: \"blob\",\r\n method: \"GET\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/octet-stream\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processDownload(_response));\r\n });\r\n }\r\n\r\n protected processDownload(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200 || status === 206) {\r\n const contentDisposition = response.headers ? response.headers[\"content-disposition\"] : undefined;\r\n const fileNameMatch = contentDisposition ? /filename=\"?([^\"]*?)\"?(;|$)/g.exec(contentDisposition) : undefined;\r\n const fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined;\r\n return Promise.resolve({ fileName: fileName, status: status, data: new Blob([response.data]), headers: _headers });\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n open(fileId: string, projectId: string , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/projects/{projectId}/files/{fileId}\";\r\n if (fileId === undefined || fileId === null)\r\n throw new Error(\"The parameter 'fileId' must be defined.\");\r\n url_ = url_.replace(\"{fileId}\", encodeURIComponent(\"\" + fileId));\r\n if (projectId === undefined || projectId === null)\r\n throw new Error(\"The parameter 'projectId' must be defined.\");\r\n url_ = url_.replace(\"{projectId}\", encodeURIComponent(\"\" + projectId));\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n responseType: \"blob\",\r\n method: \"GET\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/octet-stream\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processOpen(_response));\r\n });\r\n }\r\n\r\n protected processOpen(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200 || status === 206) {\r\n const contentDisposition = response.headers ? response.headers[\"content-disposition\"] : undefined;\r\n const fileNameMatch = contentDisposition ? /filename=\"?([^\"]*?)\"?(;|$)/g.exec(contentDisposition) : undefined;\r\n const fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined;\r\n return Promise.resolve({ fileName: fileName, status: status, data: new Blob([response.data]), headers: _headers });\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n deleteFiles(projectId: string, request: DeleteFilesReqeuest , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/projects/{projectId}/files/delete\";\r\n if (projectId === undefined || projectId === null)\r\n throw new Error(\"The parameter 'projectId' must be defined.\");\r\n url_ = url_.replace(\"{projectId}\", encodeURIComponent(\"\" + projectId));\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n const content_ = JSON.stringify(request);\r\n\r\n let options_ = {\r\n data: content_,\r\n responseType: \"blob\",\r\n method: \"DELETE\",\r\n url: url_,\r\n headers: {\r\n \"Content-Type\": \"application/json\",\r\n \"Accept\": \"application/octet-stream\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processDeleteFiles(_response));\r\n });\r\n }\r\n\r\n protected processDeleteFiles(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200 || status === 206) {\r\n const contentDisposition = response.headers ? response.headers[\"content-disposition\"] : undefined;\r\n const fileNameMatch = contentDisposition ? /filename=\"?([^\"]*?)\"?(;|$)/g.exec(contentDisposition) : undefined;\r\n const fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined;\r\n return Promise.resolve({ fileName: fileName, status: status, data: new Blob([response.data]), headers: _headers });\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n getFiles(projectId: string, directoryId: string | null | undefined , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/projects/{projectId}/files?\";\r\n if (projectId === undefined || projectId === null)\r\n throw new Error(\"The parameter 'projectId' must be defined.\");\r\n url_ = url_.replace(\"{projectId}\", encodeURIComponent(\"\" + projectId));\r\n if (directoryId !== undefined && directoryId !== null)\r\n url_ += \"directoryId=\" + encodeURIComponent(\"\" + directoryId) + \"&\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n method: \"GET\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/json\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processGetFiles(_response));\r\n });\r\n }\r\n\r\n protected processGetFiles(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200) {\r\n const _responseText = response.data;\r\n let result200: any = null;\r\n let resultData200 = _responseText;\r\n if (Array.isArray(resultData200)) {\r\n result200 = [] as any;\r\n for (let item of resultData200)\r\n result200!.push(ProjectFile.fromJS(item));\r\n }\r\n else {\r\n result200 = null;\r\n }\r\n return Promise.resolve(result200);\r\n\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n uploadFile(projectId: string, directoryId: string | null | undefined, extractZip: boolean | undefined, file: FileParameter | null | undefined , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/projects/{projectId}/files?\";\r\n if (projectId === undefined || projectId === null)\r\n throw new Error(\"The parameter 'projectId' must be defined.\");\r\n url_ = url_.replace(\"{projectId}\", encodeURIComponent(\"\" + projectId));\r\n if (directoryId !== undefined && directoryId !== null)\r\n url_ += \"directoryId=\" + encodeURIComponent(\"\" + directoryId) + \"&\";\r\n if (extractZip === null)\r\n throw new Error(\"The parameter 'extractZip' cannot be null.\");\r\n else if (extractZip !== undefined)\r\n url_ += \"extractZip=\" + encodeURIComponent(\"\" + extractZip) + \"&\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n const content_ = new FormData();\r\n if (file !== null && file !== undefined)\r\n content_.append(\"file\", file.data, file.fileName ? file.fileName : \"file\");\r\n\r\n let options_ = {\r\n data: content_,\r\n method: \"POST\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/json\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processUploadFile(_response));\r\n });\r\n }\r\n\r\n protected processUploadFile(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200) {\r\n const _responseText = response.data;\r\n let result200: any = null;\r\n let resultData200 = _responseText;\r\n result200 = resultData200 !== undefined ? resultData200 : null;\r\n \r\n return Promise.resolve(result200);\r\n\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n createDirectory(projectId: string, parentDirectoryId: string | null | undefined, name: string | null | undefined , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/projects/{projectId}/files/directory?\";\r\n if (projectId === undefined || projectId === null)\r\n throw new Error(\"The parameter 'projectId' must be defined.\");\r\n url_ = url_.replace(\"{projectId}\", encodeURIComponent(\"\" + projectId));\r\n if (parentDirectoryId !== undefined && parentDirectoryId !== null)\r\n url_ += \"parentDirectoryId=\" + encodeURIComponent(\"\" + parentDirectoryId) + \"&\";\r\n if (name !== undefined && name !== null)\r\n url_ += \"name=\" + encodeURIComponent(\"\" + name) + \"&\";\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n method: \"POST\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/json\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processCreateDirectory(_response));\r\n });\r\n }\r\n\r\n protected processCreateDirectory(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200) {\r\n const _responseText = response.data;\r\n let result200: any = null;\r\n let resultData200 = _responseText;\r\n result200 = resultData200 !== undefined ? resultData200 : null;\r\n \r\n return Promise.resolve(result200);\r\n\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n move(projectId: string, request: MoveFilesRequest , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/projects/{projectId}/files/move\";\r\n if (projectId === undefined || projectId === null)\r\n throw new Error(\"The parameter 'projectId' must be defined.\");\r\n url_ = url_.replace(\"{projectId}\", encodeURIComponent(\"\" + projectId));\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n const content_ = JSON.stringify(request);\r\n\r\n let options_ = {\r\n data: content_,\r\n responseType: \"blob\",\r\n method: \"POST\",\r\n url: url_,\r\n headers: {\r\n \"Content-Type\": \"application/json\",\r\n \"Accept\": \"application/octet-stream\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processMove(_response));\r\n });\r\n }\r\n\r\n protected processMove(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200 || status === 206) {\r\n const contentDisposition = response.headers ? response.headers[\"content-disposition\"] : undefined;\r\n const fileNameMatch = contentDisposition ? /filename=\"?([^\"]*?)\"?(;|$)/g.exec(contentDisposition) : undefined;\r\n const fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined;\r\n return Promise.resolve({ fileName: fileName, status: status, data: new Blob([response.data]), headers: _headers });\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n}\r\n\r\nexport interface IProjectPartsService {\r\n import(projectId: string, file: FileParameter | null | undefined): Promise;\r\n getParts(projectId: string): Promise;\r\n importAssemblies(projectId: string, file: FileParameter | null | undefined): Promise;\r\n importAssemblyParts(projectId: string, file: FileParameter | null | undefined): Promise;\r\n}\r\n\r\nexport class ProjectPartsService extends BaseService implements IProjectPartsService {\r\n private instance: AxiosInstance;\r\n private baseUrl: string;\r\n protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;\r\n\r\n constructor(configuration: ServiceConfiguration, baseUrl?: string, instance?: AxiosInstance) {\r\n\r\n super(configuration);\r\n\r\n this.instance = instance ? instance : axios.create();\r\n\r\n this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : \"\";\r\n\r\n }\r\n\r\n import(projectId: string, file: FileParameter | null | undefined , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/projects/{projectId}/parts/import\";\r\n if (projectId === undefined || projectId === null)\r\n throw new Error(\"The parameter 'projectId' must be defined.\");\r\n url_ = url_.replace(\"{projectId}\", encodeURIComponent(\"\" + projectId));\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n const content_ = new FormData();\r\n if (file !== null && file !== undefined)\r\n content_.append(\"file\", file.data, file.fileName ? file.fileName : \"file\");\r\n\r\n let options_ = {\r\n data: content_,\r\n method: \"POST\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/json\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processImport(_response));\r\n });\r\n }\r\n\r\n protected processImport(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200) {\r\n const _responseText = response.data;\r\n let result200: any = null;\r\n let resultData200 = _responseText;\r\n if (Array.isArray(resultData200)) {\r\n result200 = [] as any;\r\n for (let item of resultData200)\r\n result200!.push(ProjectPart.fromJS(item));\r\n }\r\n else {\r\n result200 = null;\r\n }\r\n return Promise.resolve(result200);\r\n\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n getParts(projectId: string , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/projects/{projectId}/parts\";\r\n if (projectId === undefined || projectId === null)\r\n throw new Error(\"The parameter 'projectId' must be defined.\");\r\n url_ = url_.replace(\"{projectId}\", encodeURIComponent(\"\" + projectId));\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n method: \"GET\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/json\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processGetParts(_response));\r\n });\r\n }\r\n\r\n protected processGetParts(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200) {\r\n const _responseText = response.data;\r\n let result200: any = null;\r\n let resultData200 = _responseText;\r\n if (Array.isArray(resultData200)) {\r\n result200 = [] as any;\r\n for (let item of resultData200)\r\n result200!.push(ProjectPart.fromJS(item));\r\n }\r\n else {\r\n result200 = null;\r\n }\r\n return Promise.resolve(result200);\r\n\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n importAssemblies(projectId: string, file: FileParameter | null | undefined , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/projects/{projectId}/parts/import-assemblies\";\r\n if (projectId === undefined || projectId === null)\r\n throw new Error(\"The parameter 'projectId' must be defined.\");\r\n url_ = url_.replace(\"{projectId}\", encodeURIComponent(\"\" + projectId));\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n const content_ = new FormData();\r\n if (file !== null && file !== undefined)\r\n content_.append(\"file\", file.data, file.fileName ? file.fileName : \"file\");\r\n\r\n let options_ = {\r\n data: content_,\r\n method: \"POST\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/json\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processImportAssemblies(_response));\r\n });\r\n }\r\n\r\n protected processImportAssemblies(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200) {\r\n const _responseText = response.data;\r\n let result200: any = null;\r\n let resultData200 = _responseText;\r\n if (Array.isArray(resultData200)) {\r\n result200 = [] as any;\r\n for (let item of resultData200)\r\n result200!.push(ProjectAssembly.fromJS(item));\r\n }\r\n else {\r\n result200 = null;\r\n }\r\n return Promise.resolve(result200);\r\n\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n importAssemblyParts(projectId: string, file: FileParameter | null | undefined , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/projects/{projectId}/parts/import-assembly-parts\";\r\n if (projectId === undefined || projectId === null)\r\n throw new Error(\"The parameter 'projectId' must be defined.\");\r\n url_ = url_.replace(\"{projectId}\", encodeURIComponent(\"\" + projectId));\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n const content_ = new FormData();\r\n if (file !== null && file !== undefined)\r\n content_.append(\"file\", file.data, file.fileName ? file.fileName : \"file\");\r\n\r\n let options_ = {\r\n data: content_,\r\n method: \"POST\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/json\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processImportAssemblyParts(_response));\r\n });\r\n }\r\n\r\n protected processImportAssemblyParts(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200) {\r\n const _responseText = response.data;\r\n let result200: any = null;\r\n let resultData200 = _responseText;\r\n if (Array.isArray(resultData200)) {\r\n result200 = [] as any;\r\n for (let item of resultData200)\r\n result200!.push(item);\r\n }\r\n else {\r\n result200 = null;\r\n }\r\n return Promise.resolve(result200);\r\n\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n}\r\n\r\nexport interface IProjectsService {\r\n getProject(projectId: string): Promise;\r\n editProject(projectId: string, request: EditProjectCommand): Promise;\r\n getProjects(search: string | null | undefined): Promise;\r\n createProject(request: CreateProjectCommand): Promise;\r\n getStatuses(): Promise;\r\n updateStatus(projectId: string, request: UpdateProjectStatusRequest): Promise;\r\n updateAssignedUser(projectId: string, userId: string | undefined): Promise;\r\n}\r\n\r\nexport class ProjectsService extends BaseService implements IProjectsService {\r\n private instance: AxiosInstance;\r\n private baseUrl: string;\r\n protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;\r\n\r\n constructor(configuration: ServiceConfiguration, baseUrl?: string, instance?: AxiosInstance) {\r\n\r\n super(configuration);\r\n\r\n this.instance = instance ? instance : axios.create();\r\n\r\n this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : \"\";\r\n\r\n }\r\n\r\n getProject(projectId: string , cancelToken?: CancelToken | undefined): Promise {\r\n let url_ = this.baseUrl + \"/api/projects/{projectId}\";\r\n if (projectId === undefined || projectId === null)\r\n throw new Error(\"The parameter 'projectId' must be defined.\");\r\n url_ = url_.replace(\"{projectId}\", encodeURIComponent(\"\" + projectId));\r\n url_ = url_.replace(/[?&]$/, \"\");\r\n\r\n let options_ = {\r\n method: \"GET\",\r\n url: url_,\r\n headers: {\r\n \"Accept\": \"application/json\"\r\n },\r\n cancelToken\r\n };\r\n\r\n return this.transformOptions(options_).then(transformedOptions_ => {\r\n return this.instance.request(transformedOptions_);\r\n }).catch((_error: any) => {\r\n if (isAxiosError(_error) && _error.response) {\r\n return _error.response;\r\n } else {\r\n throw _error;\r\n }\r\n }).then((_response: AxiosResponse) => {\r\n return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processGetProject(_response));\r\n });\r\n }\r\n\r\n protected processGetProject(response: AxiosResponse): Promise {\r\n const status = response.status;\r\n let _headers: any = {};\r\n if (response.headers && typeof response.headers === \"object\") {\r\n for (let k in response.headers) {\r\n if (response.headers.hasOwnProperty(k)) {\r\n _headers[k] = response.headers[k];\r\n }\r\n }\r\n }\r\n if (status === 200) {\r\n const _responseText = response.data;\r\n let result200: any = null;\r\n let resultData200 = _responseText;\r\n result200 = GetProjectResult.fromJS(resultData200);\r\n return Promise.resolve(result200);\r\n\r\n } else if (status !== 200 && status !== 204) {\r\n const _responseText = response.data;\r\n return throwException(\"An unexpected server error occurred.\", status, _responseText, _headers);\r\n }\r\n return Promise.resolve(null);\r\n }\r\n\r\n editProject(projectId: string, request: EditProjectCommand , cancelToken?: CancelToken | undefined): Promise