{"_id":"@aptuitiv/rets-client","_rev":"2-54794a7f92cd1559f3186680548d884f","name":"@aptuitiv/rets-client","dist-tags":{"latest":"0.2.0"},"versions":{"6.3.0":{"name":"@aptuitiv/rets-client","version":"6.3.0","description":"A RETS client (Real Estate Transaction Standard).","main":"index.js","types":"dts/index.d.ts","dependencies":{"base64-stream":"^1.0.0","bufferstream":"^0.6.2","debug":"^4.3.4","es6-promise-try":"^1.0.2","formidable":"~2.0.1","node-expat":"^2.4.0","request":"^2.88.2","request-debug":"^0.2.0","request-promise-native":"^1.0.9","sax":"^1.2.4","stream-buffers":"^3.0.2","through2":"^4.0.2"},"devDependencies":{"@types/chai":"^4.3.3","@types/mocha":"^9.1.1","@types/node":"^18.7.15","chai":"^4.3.6","coffeescript":"^2.7.0","mocha":"^10.0.0","source-map-support":"^0.5.21","ts-node":"^10.9.1","typescript":"^4.8.2"},"scripts":{"test":"node_modules/mocha/bin/_mocha --require ts-node/register test/*.ts","pretest":"coffee --compile --output dist/ lib/ && tsc --noEmit","prepare":"npm run test","dev":"coffee --watch --output dist lib/"},"repository":{"type":"git","url":"git+https://github.com/aptuitiv/rets-client.git"},"keywords":["rets","Real Estate Transaction Standard","client","real","estate","transaction","standard","promise","mls","stream","streams","streaming"],"author":{"name":"Joe Ibershoff","email":"joe@ibershoff.com"},"contributors":[{"name":"Joe Ibershoff","email":"joe@ibershoff.com"},{"name":"Steve Bruno","email":"stevenrbruno@icloud.com"},{"name":"Abbas Mashayekh","email":"martianboy2005@gmail.com"}],"license":"MIT","bugs":{"url":"https://github.com/aptuitiv/rets-client/issues"},"gitHead":"ad8571bab177d0a280257b653def66df8073727d","homepage":"https://github.com/aptuitiv/rets-client#readme","_id":"@aptuitiv/rets-client@6.3.0","_nodeVersion":"17.2.0","_npmVersion":"8.1.4","dist":{"integrity":"sha512-ISoFjC2HwmkGmIIX5cO4dEGGjRtAHMVg4Q19E8XwuIxekeRrBTVQ4sFZwyXNIiJWstQiQfjeZ8tOKzuNyKdwhg==","shasum":"0dafbb82303062cb9fc69ca3e4b0011a86b52c36","tarball":"https://registry.npmjs.org/@aptuitiv/rets-client/-/rets-client-6.3.0.tgz","fileCount":27,"unpackedSize":117385,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGH/0WeUijrDYb11yIEA/vpuy+EO2yhcaHDKz4/5W6TIAiEA1vSLTSWlT7+Jtv9kSY9HY7M9zXVOj7nPz6QbSuStdPc="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjF610ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrhtxAAkDyimlxyQUbVzrRB9F30PPKJNsdW1miB9suK80w0P8mWY7ru\r\nB+b8edJ0qS7wgoYujChtCjHCSaT/E2qbhY8o/3pfDMebKEfNUuydFY7ds0oU\r\nl+WqAzcmICfN4hDuUEuKsrMCeYYGa+5V5VyO2pf298L54qaP8qoWDWMEXFly\r\nX6s4ljEEqcrzhnCN4FLqn9SR5rzijqdYxztCelMXsEv+pkOUXarkBU75ios8\r\nZTft2AfDx8ssDZICiY5FHFvqMojoyucxvu7Y19XFrUKeqht1ddbi0dgMcw5u\r\nIVFlGTFF15UI8fmjv7dZU7Tx5hzLtR/WyXNy6DmZ2V1sXJ/eeAe4nWSjD9hO\r\ng8/uTkNSf4QAW+KqLP2jtcSjf0mJBqaMq8xzucEO8s6hRnBql75wQt59YkgA\r\nh4mkKNxRF/HxIYwPAaaxbTWv8YZHj8/7urzUNxtzzigno7J2liqf7uHIUwHJ\r\nQgTX0LxMZ53FjTrmuoTu90jYApPwojQB/C8fJFR+vLQILv6TFD8vOd029Wq+\r\nno81NXMHDFowBOXFbAnAQjN8wuXO1whYn/9ET0xEVqCfc+7kfPhy7Z4BMIQg\r\nSfnjdPnwZrgVvIFITZO483gLrMtXTuq+ABI29hmg9vgGKbOKlHGFQEY3lyoO\r\n5DG/t1K3QKcEgw3ilY2GTpRR0kBxzm0VCl8=\r\n=aLFt\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"erictompkins","email":"eric@aptuitiv.com"},"directories":{},"maintainers":[{"name":"erictompkins","email":"eric@aptuitiv.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rets-client_6.3.0_1662496115827_0.45821389840394344"},"_hasShrinkwrap":false},"0.1.0":{"name":"@aptuitiv/rets-client","version":"0.1.0","description":"NodeJS library for interfacing with RETS servers","source":"src/index.ts","main":"dist/index.js","type":"module","engines":{"node":">= 16"},"scripts":{"build":"node scripts/build.js","lint":"eslint --fix --ext .js,.ts .","test":"mocha","ts-build":"tsc","ts-dev":"tsc -w","watch":"node scripts/watch.js"},"repository":{"type":"git","url":"git+https://github.com/aptuitiv/rets-client3.git"},"license":"MIT","bugs":{"url":"https://github.com/aptuitiv/rets-client3/issues"},"homepage":"https://github.com/aptuitiv/rets-client3#readme","devDependencies":{"@types/chai":"^4.3.3","@types/dicer":"^0.2.2","@types/mocha":"^9.1.1","@types/stream-buffers":"^3.0.4","@types/tough-cookie":"^4.0.2","@typescript-eslint/eslint-plugin":"^5.36.2","@typescript-eslint/parser":"^5.36.2","chai":"^4.3.6","chalk":"^5.0.1","esbuild":"^0.15.7","esbuild-plugin-eslint":"^0.1.1","eslint":"^8.23.0","eslint-config-airbnb-base":"^15.0.0","log-symbols":"^5.1.0","mocha":"^10.0.0","ts-node":"^10.9.1","typescript":"^4.8.2"},"dependencies":{"axios":"^0.27.2","axios-cookiejar-support":"^4.0.3","dicer":"^0.3.1","fast-xml-parser":"^4.0.9","stream-buffers":"^3.0.2","tough-cookie":"^4.1.2"},"gitHead":"1f72e70fefecacc309635ea633379642a588a7bf","_id":"@aptuitiv/rets-client@0.1.0","_nodeVersion":"17.2.0","_npmVersion":"8.1.4","dist":{"integrity":"sha512-Rq8gvmeBZPIiCN6sOCiEvFDMLCufUNVwYmLD1/8Dcz8uzlAl/FXpcb7dTbHjqysXm/GkQuhIWC0x1abaVLULEg==","shasum":"935970d1d92e7836b29e51a9d1cbb7faca58a1cd","tarball":"https://registry.npmjs.org/@aptuitiv/rets-client/-/rets-client-0.1.0.tgz","fileCount":21,"unpackedSize":75636,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE4KCC8p5DtegTfIBQ2TwdZqp1EiV0jAJddoLXwfrQLcAiEAklAEPcwMe1UD4dmOyHFhpLiokSoffqCH5dRduty8/m0="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjKho0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrAsw//VIsJ35qtRt2wtGvpInj3J7GI5V53H3JS1jm37CPeIqQemm4J\r\noEa33SCEYrLuSogDl5ZSybWiAHkOW5hv5lTdebq4JCXDXs/JoNOdw3a64kSI\r\nqLx1UFXPMgBfclBt5yJzCY5umuSCxNqh0/OmfqLIh0XIi4ilpjVOTQj4gE/l\r\n4S88HxHKMseKGT55WUCYckz2AggpVNDWvo4aSUIWvLTbVLjeCGaad8l2C+Mp\r\nEM9JKBatAYUO2dMv2jZeUHQxI6UPBGskzOmfecRhyIE3BbboGf5e2MCEQZ4w\r\no+6KESI6MD8reagVYyiMnhKBkfRz7JcNWsEMpZ6upzT3QpT/Akd6MNyMTy3v\r\nhsJh8r0yB1obvwXpTeTpDZBRsrqJ3cEmeS8pTx2PYka529Zd6qvKSkzfMGb7\r\nz/nKdh8z9BLcW7N5AsxBIBaZqt9LOvnkU568Ox2hIFphiq17R/MAwUXlhkuK\r\ncY1Yne4HSnFMZ2DLflCxLNLXxNDwnhBkQTNB6Ts4KEBmFGGufMXPDLTLnumX\r\nqru96yPcRh7tEJ29kHpCwoizuQKC0htOcDbqlibWZ/tOLEE6mbKFR/mKnn/n\r\nD6L6vgDrykMRy+G8l+2pg14UT5CDXl3zKoUmo+gJV2xGac96f760rYcR5ySY\r\nTf0oSqqoLYGqjqSx18krBVX66HHE4kcM35c=\r\n=dtI+\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"erictompkins","email":"eric@aptuitiv.com"},"directories":{},"maintainers":[{"name":"erictompkins","email":"eric@aptuitiv.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rets-client_0.1.0_1663703603852_0.6669761496485023"},"_hasShrinkwrap":false},"0.2.0":{"name":"@aptuitiv/rets-client","version":"0.2.0","description":"NodeJS library for interfacing with RETS servers","source":"src/index.ts","main":"dist/index.js","type":"module","engines":{"node":">= 16"},"scripts":{"build":"node scripts/build.js","lint":"eslint --fix --ext .js,.ts .","test":"mocha","ts-build":"tsc","ts-dev":"tsc -w","watch":"node scripts/watch.js"},"repository":{"type":"git","url":"git+https://github.com/aptuitiv/rets-client3.git"},"license":"MIT","bugs":{"url":"https://github.com/aptuitiv/rets-client3/issues"},"homepage":"https://github.com/aptuitiv/rets-client3#readme","devDependencies":{"@types/chai":"^4.3.3","@types/dicer":"^0.2.2","@types/mocha":"^9.1.1","@types/stream-buffers":"^3.0.4","@types/tough-cookie":"^4.0.2","@typescript-eslint/eslint-plugin":"^5.36.2","@typescript-eslint/parser":"^5.36.2","chai":"^4.3.6","chalk":"^5.0.1","esbuild":"^0.15.7","esbuild-plugin-eslint":"^0.1.1","eslint":"^8.23.0","eslint-config-airbnb-base":"^15.0.0","log-symbols":"^5.1.0","mocha":"^10.0.0","ts-node":"^10.9.1","typescript":"^4.8.2"},"dependencies":{"axios":"^0.27.2","axios-cookiejar-support":"^4.0.3","dicer":"^0.3.1","fast-xml-parser":"^4.0.9","stream-buffers":"^3.0.2","tough-cookie":"^4.1.2"},"gitHead":"906312837ed46f8b39f7714b35815013936830e9","_id":"@aptuitiv/rets-client@0.2.0","_nodeVersion":"17.2.0","_npmVersion":"8.1.4","dist":{"integrity":"sha512-aGhKX7MYKRzCItYPoh3JL5xkOo6lGVTW8lzj8Z4ALLVSZ/kYEERYnQ2rqtvg3jGnv1reaykYQp4E41XSYU9xaA==","shasum":"4b1cfa0ea829ad0bd2c7f38f105d43a03edcade2","tarball":"https://registry.npmjs.org/@aptuitiv/rets-client/-/rets-client-0.2.0.tgz","fileCount":21,"unpackedSize":76994,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDz/qHpfcJaD8jSMUOmVJOT59+rgpeSK/wvPJRqdbtMowIhANHrcnpa8uEFQ469MsWTVMwhchZRuk+1t2i+G1Z5yRfn"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjKxe0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrKfBAAimaKE83sbe1BDDFM53SReewGaUqS0CIb9CVyUvMmtcYjIeap\r\nszjSrDTSA8aVvrT5NeUYhQjiNi7ikftpr855MfPRlA/W84/5CAcczDKCX1d/\r\nnja7CADO2/ICKHeib+1+Qeo8idj7cMtPGhCSSRF/7mvB6LKey1X2GyyhBJAB\r\nDn3DbdnLSPdzus2WM4bQ/C8SriNKHhJ0ayi5gG8zKGTH4dkgM5KCGH54y0Bj\r\n5JmdpYreR1bPdyY0+qLTKAaQSH1el6uRmsDqxHjwkqKeoF+qiExyREGV9WeO\r\n99my050OoEhVcS4avPlZyP5Hiq9wp2FLtdmImONc0BDmOZFDITuWKf0Dqe2a\r\nscUgU44ecQrHk/qIzWP080gBxVrI2sbqcx7fib/XYxUsQirdDcbfV7pFEVX+\r\nWdN28jJHHTDcAL6NLutyD3mjJxniqhZjAQQVMxtVj7NPThZyKP5DNcmTZIgZ\r\ntbXH5p2qim7ekEB2QYDWUvFBZdUSNJAZNs05KYwjKo+s//cLdWcw3CUWAqNV\r\n1yjOuzJmyPpnllvd1gj3U3Vu6c9QRERbelAxZ74IVc8MnGf2zdmxT4Fu+cDs\r\ntqb+3QJK1bQZ4Uz++dKXiANO16DXPGgt4Xn6OHUCfQ33sRlBVklG6cHRFRy+\r\n8O1IOJ/Bb62DGvuPp6fnyjIOBSXSauH0RZU=\r\n=1o5t\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"erictompkins","email":"eric@aptuitiv.com"},"directories":{},"maintainers":[{"name":"erictompkins","email":"eric@aptuitiv.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rets-client_0.2.0_1663768500086_0.5523766140126749"},"_hasShrinkwrap":false}},"time":{"created":"2022-09-06T20:28:35.718Z","6.3.0":"2022-09-06T20:28:35.986Z","modified":"2022-09-21T13:55:00.364Z","0.1.0":"2022-09-20T19:53:24.050Z","0.2.0":"2022-09-21T13:55:00.264Z"},"maintainers":[{"name":"erictompkins","email":"eric@aptuitiv.com"}],"description":"NodeJS library for interfacing with RETS servers","homepage":"https://github.com/aptuitiv/rets-client3#readme","repository":{"type":"git","url":"git+https://github.com/aptuitiv/rets-client3.git"},"bugs":{"url":"https://github.com/aptuitiv/rets-client3/issues"},"license":"MIT","readme":"# RETS client for NodeJS\n\n- [RETS client for NodeJS](#rets-client-for-nodejs)\n  - [TODO](#todo)\n  - [Initialize the RETS client object](#initialize-the-rets-client-object)\n    - [Settings](#settings)\n  - [Logging in and logging out](#logging-in-and-logging-out)\n    - [login() return data](#login-return-data)\n    - [logout() return data](#logout-return-data)\n  - [Getting objects](#getting-objects)\n    - [Get a single object](#get-a-single-object)\n      - [getObject() Parameters](#getobject-parameters)\n      - [getObject() return value](#getobject-return-value)\n      - [getObject() example](#getobject-example)\n    - [Get multiple objects](#get-multiple-objects)\n      - [getObjects() Parameters](#getobjects-parameters)\n      - [ids](#ids)\n      - [options](#options)\n    - [getObjects() return value](#getobjects-return-value)\n      - [getObjects() example](#getobjects-example)\n  - [Getting images](#getting-images)\n    - [Get a single image](#get-a-single-image)\n      - [getImage() Parameters](#getimage-parameters)\n      - [getImage() return value](#getimage-return-value)\n    - [Get multiple images](#get-multiple-images)\n      - [getImages() Parameters](#getimages-parameters)\n      - [getImages() return value](#getimages-return-value)\n      - [getImages() example](#getimages-example)\n  - [Testing](#testing)\n\n`rets-client` provides an interface to log in and retrieve data from a RETS server.\n\nInspired by:\n\n- [aeq/rets-client](https://github.com/aeq/rets-client)\n- [martianboy/rets-client](https://github.com/martianboy/rets-client)\n- [zacronos/rets-client](https://github.com/zacronos/rets-client)\n\nSpec is based on <https://www.nar.realtor/retsorg.nsf/retsproto1.7d6.pdf> and <https://www.reso.org/rets-specifications/>.\n\n## TODO\n\n- get metadata\n- search\n\n## Initialize the RETS client object\n\nThe Client constructor takes the login URL and a settings object.\n\n`new Client(loginUrl: string, options: object)`\n\n### Settings\n\n| Setting | Required | Description |\n|---|---|---|\n| headers | No | An object of custom headers to use in the RETS requests. |\n| password | Yes* | The RETS password. *Required if `userAgentPassword` is not used. |\n| product | Yes | The name of the software product that is interfacing with the RETS server. This is used to create the `User-Agent` header. |\n| productVersion | No | The product version for the software product that is interfacing with the RETS server. This is used to create the `User-Agent` header. |\n| retsVersion | Yes | The version of RETS to use. |\n| username | Yes* | The RETS username.  *Required if `userAgentPassword` is not used. |\n| userAgentPassword | No | The password value to use if the RETS server requires user agent authentication. |\n\n```javascript\nimport Client from '@aptuitiv/rets-client';\n\nconst clientSettings = {\n    username: 'myUserName',\n    password: 'myPassword',\n    headers: {\n        'Custom-Header': 'headerValue'\n    },\n    product: 'YourProductName',\n    retsVersion: 'RETS/1.7.2',\n};\n\nconst client = new Client('https://retsdomain.com/path/Login', clientSettings);\n```\n\n## Logging in and logging out\n\n`.login(): Promise<boolean>`\n\n`.logout(): Promise<boolean>`\n\n```javascript\nclient.login()\n    .then(() => {\n        // Do something here.\n\n        // Log out\n        client.logout()\n            .catch((error) => {\n                console.error('Error logging out: ', error);\n            })\n    })\n    .catch((error) => {\n        console.error('Error logging in: ', error);\n    });\n```\n\nAlternately, you could use `await`.\n\n```javascript\ntry {\n    await client.login();\n    // Do something here\n\n    // Log out\n    await client.logout();\n} catch (error) {\n    console.error(error);\n}\n```\n\n### login() return data\n\nThe `login` method will return a Promise. The resolved value is `true`.\n\n### logout() return data\n\nThe `logout` method will return a Promise. The resolved value is `true`.\n\n## Getting objects\n\nWhen getting objects you have the choice to get one object, multiple objects, or all of the objects for a resource.\n\n### Get a single object\n\n`.getObject(resourceType: string, type: string, resourceId: string|number, objectId: string|number): Promise<object>`\n\nThis will retrieve and return a single object.\n\nWhere [getObjects](#get-multiple-objects) returns an array of objects, this will return a single object. Even if multiple objects are retrieved, only the first object is returned.\n\n#### getObject() Parameters\n\n| Name | Type | Description |\n|---|---|---|\n| resourceType | string | The resource type. For example, \"Property\" |\n| type | string | The object type. Example: \"Photo\" or \"Thumbnail\" |\n| resourceId | string or number | The ids of the objects to retrieve combined with the resource id. |\n| objectId | string or number | The identifier for the object. |\n\n#### getObject() return value\n\nThe `getObject` method will return a promise. The resolved value is an object containing the retrieved object.\n\n```javascript\n{\n    contentType: string,\n    data: Buffer or string,\n    headers: object\n}\n```\n\n| Name | Type | Description |\n|---|---|---|\n| contentType | string | The value of the `Content-Type` header. |\n| data | Buffer or object | If the object is a media type like an image then the value is a Buffer. If the returned object is XML then this will be a JSON representation of that XML. |\n| headers | object | An object containing all of the headers in the response. The header names are normalized to lowercase. The key is the header name. The value is the header value. |\n\nIf the object has already been retrieved recently the RETS server may return an XML response indicating that nothing has changed since the last request.\n\n#### getObject() example\n\n```javascript\nclient.getObject('Property', 'Thumbnail', parts[3], parseInt(parts[4], 10))\n    .then((objects) => {\n        if (!objects.contentType.includes('xml')) {\n            const writeStream = fs.createWriteStream(parts[4]);\n            writeStream.write(objects.data, 'base64');\n        }\n        client.logout()\n            .then(() => {\n                console.log('LOGGED OUT');\n            })\n            .catch((error) => {\n                console.log('error logging out');\n            });\n    })\n    .catch((error) => {\n        console.log('error getting image: ', error);\n    })\n\n```\n\n### Get multiple objects\n\n`.getObjects(resourceType: string, type: string, ids: string|string[]|object): Promise<object[]>`\n\n#### getObjects() Parameters\n\n| Name | Type | Description |\n|---|---|---|\n| resourceType | string | The resource type. For example, \"Property\" |\n| type | string | The object type. Example: \"Photo\" or \"Thumbnail\" |\n| ids | string, array, or object | The ids of the objects to retrieve combined with the resource id. |\n| options | object | Configuration for getting objects |\n\n#### ids\n\nThe `ids` value is a combination of the resource id and the identifier for the object to return For example, with images, it's typically the image number to return. \"3\" would refer to the third image. [3, 5] would refer to the third and fifth images.\n\nThe `ids` value can be set in a few different ways.\n\nFor the examples below we will use `1234567890` for the resource id and `3` for the object id. In this case it'll be the image id for the third image.\n\n**In each case the resource id should be a string. If it's a number and it's large like most resource ids are, then it may get interpreted by Javascript as an exponent.**\n\n- string: In this case only the single object that matches the identifier will be returned. It should be in this format: `RESOURCE_ID:OBJECT_ID`. For example `1234567890:3`.\n- \"*\": This is a special string value that tells the RETS server to return all of the object type for the resource. It should be in this format: `RESOURCE_ID:*`. For example `'1234567890:*'`.\n- array: This should be an array `RESOURCE_ID:OBJECT_ID` pairs. This will retrieve the objects that match the ids. For example: `['1234567890:1', '1234567890:2', '1234567890:3']`.\n- object: This format is also for retrieving multiple objects. The key for is the resource id. The value could be a single object id, an array of object ids, or `*`. The resource id does not have to be the same value.\n\nBelow are some examples of how the `object` format could be used.\n\nSingle object id\n\n```javascript\n{\n    RESOURCE_ID:OBJECT_ID\n}\n\n{\n    '1234567890':3\n}\n\n{\n    '1234567890':1,\n    '1234567890':2,\n    '1234567890':3\n}\n```\n\nArray of object ids:\n\n```javascript\n{\n    RESOURCE_ID:[OBJECT_ID, OBJECT_ID]\n}\n\n{\n    '1234567890':[3,4,5],\n    '2222244444':[1,2,3]\n}\n```\n\nAll objects with `*`\n\n```javascript\n{\n    RESOURCE_ID:*\n}\n\n{\n    '1234567890':'*'\n}\n```\n\n#### options\n\nThe following values are available for the `options` parameter.\n\n| Name | Type | Description |\n|---|---|---|\n| location | integer | Whether to include the location (URL) data for the object only. 0 or 1. Defaults to 0. If 1, then only the URL for the object will be returned. |\n| mime | string | The mime type to accept. This is used to build out the `Accept` header. If not set then `*/*` is used. |\n\n### getObjects() return value\n\nThe `getObjects` method will return a promise. The resolved value is an array containing the data for one or more retrieved objects.\n\n```javascript\n[\n    {\n        contentType: string,\n        data: Buffer or string,\n        headers: object\n    }\n]\n```\n\n| Name | Type | Description |\n|---|---|---|\n| contentType | string | The value of the `Content-Type` header. |\n| data | Buffer or object | If the object is a media type like an image then the value is a Buffer. If the returned object is XML then this will be a JSON representation of that XML. |\n| headers | object | An object containing all of the headers in the response. The header names are normalized to lowercase. The key is the header name. The value is the header value. |\n\nIf the object has already been retrieved recently the RETS server may return an XML response indicating that nothing has changed since the last request.\n\n#### getObjects() example\n\n```javascript\nimport fs from 'fs';\n\nclient.getObjects('Property', 'Photo', {\n    '10190712134022552561000000':[1,2,3,4,5],\n    '10190602181039375284000000':'7',\n    '10190808180154120205000000':8\n})\n    .then((objects) => {\n        if (Array.isArray(objects)) {\n            objects.forEach((object) => {\n                if (!object.contentType.includes('xml')) {\n                    console.log('write to: ', `${object.headers['object-id']}.jpg`);\n                    const writeStream = fs.createWriteStream(`${object.headers['object-id']}.jpg`);\n                    writeStream.write(object.data, 'base64');\n                } \n            });\n        }\n        client.logout()\n            .then(() => {\n                console.log('LOGGED OUT');\n            })\n            .catch((error) => {\n                console.log('error logging out');\n            })\n    })\n    .catch((error) => {\n        console.log('error getting image: ', error);\n    })\n```\n\n## Getting images\n\nImages are a specific type of object that you can get. There are two helper functions to make it a little easier to get images.\n\n- `getImage`: Get a single image\n- `getImages`: Get one or more images.\n\n### Get a single image\n\n`.getImage(resourceType: string, imageType: string, resourceId: string|number, imageNumber: string|number): Promise<object>`\n\nIf you are only going to get a single image then it is recommended to use `getImage`. This will return an object with the image data.\n\n#### getImage() Parameters\n\n| Name | Type | Description |\n|---|---|---|\n| resourceType | string | The resource type. For example, \"Property\" |\n| imageType | string | The image type. Example: \"Photo\" or \"Thumbnail\" |\n| resourceId | string or number | The ids of the objects to retrieve combined with the resource id. |\n| imageNumber | string or number | The identifier for the image. |\n\n#### getImage() return value\n\nThe `getImage` method will return a promise. The resolved value is an object containing the retrieved image.\n\n```javascript\n{\n    contentType: string,\n    data: Buffer or string,\n    headers: object\n}\n```\n\n| Name | Type | Description |\n|---|---|---|\n| contentType | string | The value of the `Content-Type` header. |\n| data | Buffer or object | If the object is a media type like an image then the value is a Buffer. If the returned object is XML then this will be a JSON representation of that XML. |\n| headers | object | An object containing all of the headers in the response. The header names are normalized to lowercase. The key is the header name. The value is the header value. |\n\nIf the image has already been retrieved recently the RETS server may return an XML response indicating that nothing has changed since the last request.\n\n```javascript\nimport fs from 'fs';\n\nclient.getImage('Property', 'Photo', '2013823934923493249324', '2')\n    .then((image) => {\n        if (!image.contentType.includes('xml')) {\n            const writeStream = fs.createWriteStream('my-image.jpg');\n            writeStream.write(object.data, 'base64');\n        }\n    })\n```\n\nAlternately, you could use `await`.\n\n```javascript\nimport fs from 'fs';\n\ntry {\n    const image = await client.getImage('Property', 'Thumbnail', '2013823934923493249324', '2');\n    if (!image.contentType.includes('xml')) {\n        const writeStream = fs.createWriteStream('my-image.jpg');\n        writeStream.write(object.data, 'base64');\n    }\n} catch (error) {\n    console.error(error);\n}\n```\n\n### Get multiple images\n\n`.getImages(resourceType: string, imageType: string, resourceId: string|number, imageNumber: string|number|string[]|number[]): Promise<object[]>`\n\nThe `getImages` method lets you get one or more images.\n\n#### getImages() Parameters\n\n| Name | Type | Description |\n|---|---|---|\n| resourceType | string | The resource type. For example, \"Property\" |\n| type | string | The object type. Example: \"Photo\" or \"Thumbnail\" |\n| resourceId | string or number | The ids of the objects to retrieve combined with the resource id. |\n| imageNumber | string, number, array | The identifiers of the images to retrieve. |\n\nThe `imageNumber` parameter could be in the following format:\n\n- *string*: `'3'`\n- *number': `3`\n- *array': `['3', '4']` or `[3, 4, 5]`, or `[3, '10', 11]`\n- `*` to indicate all images for the resource.\n\n#### getImages() return value\n\nThe `getImages` method will return a promise. The resolved value is an array containing the data for one or more retrieved objects.\n\n```javascript\n[\n    {\n        contentType: string,\n        data: Buffer or string,\n        headers: object\n    }\n]\n```\n\n| Name | Type | Description |\n|---|---|---|\n| contentType | string | The value of the `Content-Type` header. |\n| data | Buffer or object | If the object is a media type like an image then the value is a Buffer. If the returned object is XML then this will be a JSON representation of that XML. |\n| headers | object | An object containing all of the headers in the response. The header names are normalized to lowercase. The key is the header name. The value is the header value. |\n\nIf the image has already been retrieved recently the RETS server may return an XML response indicating that nothing has changed since the last request.\n\n#### getImages() example\n\n```javascript\nimport fs from 'fs';\n\nclient.getImages('Property', 'Photo', '2013823934923493249324', [1, 2, 3, 4, 5])\n    .then((images) => {\n        images.forEach((image) => {\n            if (!image.contentType.includes('xml')) {\n                const writeStream = fs.createWriteStream(`${image.headers['object-id']}.jpg`);\n                writeStream.write(image.data, 'base64');\n            }\n        });\n    })\n```\n\nAlternately, you could use `await`.\n\n```javascript\nimport fs from 'fs';\n\ntry {\n    const images = await client.getImages('Property', 'Photo', '2013823934923493249324', [1, 2, 3, 4, 5]);\n    images.forEach((image) => {\n        if (!image.contentType.includes('xml')) {\n            const writeStream = fs.createWriteStream(`${image.headers['object-id']}.jpg`);\n            writeStream.write(image.data, 'base64');\n        }\n    });\n} catch (error) {\n    console.error(error);\n}\n```\n\n## Testing\n\nTests use [Mocha](https://mochajs.org/) and [Chai](https://www.chaijs.com/).\n\nThe tests are located in the `test` folder. They can be run with `npm run test`.\n","readmeFilename":"README.md"}