primitivesocial / nestio-api-wrapper
Nestio API Wrapper
Requires
- php: >=7.1.0
- guzzlehttp/guzzle: ^6.3
- illuminate/config: ~5.0
- illuminate/support: ~5.0
- nesbot/carbon: ^1.39
Requires (Dev)
- mockery/mockery: ^1.1
- orchestra/testbench: ~3.0
- phpunit/phpunit: ~8.0
- sempro/phpunit-pretty-print: ^1.0
This package is auto-updated.
Last update: 2024-09-16 04:24:28 UTC
README
安装
composer require primitivesocial/nestio-api-wrapper
php artisan vendor:publish
发布配置
配置
在您的 .env 中添加 NESTIO_API_KEY=
并输入您的 Nestio API 密钥。
方法
列表
要使用列表对象,在您的文件中包含 use PrimitiveSocial\NestioApiWrapper\Listings;
获取所有列表
Nestio API 链接: https://developers.nestio.com/api/v2/listings.html#listings-search
$client = new Listings($apiKey);
$output = $client->all();
参数
这些是作为客户端链式函数调用的。例如
$client->commercialUse('industrial')
->listingType('sales')
->hasPhotos()
->all();
这里是一个列表
- agents
- geometry
- listingType
- propertyType
- commercialUse
- building
- buildingNameAddress
- buildingOwnership
- company
- exclusive
- minPrice
- maxPrice
- elevator
- doorman
- pets
- layout
- bathrooms
- neighborhoods
- postalCode
- dateAvailableBefore
- dateAvailableAfter
- hasPhotos
- incentives
- openHouseBegin
- openHouseEnd
- featured
- source
- city
- isRenovated
- dishwasher
- microwave
- exposedBrick
- hardwoodFloors
- virtualDoorman
- storage
- shortTerm
- liveInSuper
- lastListedAtBefore
- lastListedAtAfter
- parking
- includePrivate
- sort
- displayAgent
布尔参数可以在没有参数的情况下调用;该软件包将假定,如果您调用它,您想要它。您也可以指定 false
。
byId
Nestio API 文档在此:https://developers.nestio.com/api/v2/listings.html#single-listing
这是您想查看的具体列表。上述所有参数都可以调用。
$client = new Listings('APIKEY');
$output = $client->all();
$listingFromOutput = $output['items'][0];
$listing = $client->byId($listingFromOutput['id']);
residentialRentals
此函数作为 all
函数使用,获取所有住宅出租。
$client = new Listings($apiKey);
$output = $client->residentialRentals();
residentialSales
此函数作为 all
函数使用,获取所有住宅销售。
$client = new Listings($apiKey);
$output = $client->residentialSales();
commercialRentals
此函数作为 all
函数使用,获取所有商业出租。
$client = new Listings($apiKey);
$output = $client->commercialRentals();
commercialSales
此函数作为 all
函数使用,获取所有商业销售。
$client = new Listings($apiKey);
$output = $client->commercialSales();
代理商
要使用代理商对象,在您的文件中包含 use PrimitiveSocial\NestioApiWrapper\Agents;
获取所有代理商
Nestio API 链接: https://developers.nestio.com/api/v2/agents.html#company-agents
$client = new Agents('APIKEY');
$output = $client->all();
此调用没有参数分配。
通过 ID 获取代理商
Nestio API 链接: https://developers.nestio.com/api/v2/agents.html#single-agent
$output = $client->all();
$this->assertNotNull($output);
$agentFromInitial = $output['items'][0];
$agent = $client->byId($agentFromInitial['id']);
此调用没有参数分配。
建筑
要使用建筑对象,在您的文件中包含 use PrimitiveSocial\NestioApiWrapper\Buildings;
Nestio API 链接: https://developers.nestio.com/api/v2/buildings.html
$client = new Buildings('APIKEY');
$output = $client->all();
此调用没有参数。
社区
要使用社区对象,在您的文件中包含 use PrimitiveSocial\NestioApiWrapper\Neighborhoods;
Nestio API 链接: https://developers.nestio.com/api/v2/neighborhoods.html#neighborhoods
$client = new Neighborhoods('APIKEY');
$output = $client->all();
参数
- city
- state
$client = new Neighborhoods('APIKEY');
$output = $client->city('Philadelphia')
->state('PA')
->all();
客户端
此调用是向 Nestio 创建客户端的 POST 调用。
要使用Clients对象,请在您的文件中包含 use PrimitiveSocial\NestioApiWrapper\Clients;
。
Nestio API链接:https://developers.nestio.com/api/v2/clients.html
$client = new Clients('APIKEY');
// Create persons
$client->person([
'first_name' => 'Gerbil',
'last_name' => 'McPherson',
'email' => 'nestio@example.com',
'phone_1' => '215-555-5555',
'is_primary' => true
]);
$client->person([
'first_name' => 'Albert',
'last_name' => 'Bundy',
'email' => 'al@example.com',
'phone_1' => '215-555-5551',
'is_primary' => false
]);
$client->moveInDate('2019-06-01')
->group('1234')
->layout('1br')
->clientReferral('Ted McGinley')
->discoverySource('zillow')
->device('phone')
->sourceType('organic');
$output = $client->submit();
要创建一个客户端,您必须拥有
- 一个具有first_name和last_name的人
- 分配的组号。
您可以根据需要添加任意数量的person
。每次对person
函数的调用都会在客户端中创建一个新的People
对象。
参数
- person
- moveInDate
- layout
- price_floor
- price_ceiling
- notes
- group
- brokerCompany
- brokerEmail
- brokerFirstName
- brokerLastName
- brokerPhone
- clientReferral
- campaignInfo
- unit
- discoverySource
- leadSource
- device
- sourceType
客户端状态
您也可以通过使用Nestio客户端ID和状态来更新客户端状态
$client = new Clients('APIKEY');
$output = $client->id($nestioClientId)
->status($status)
->update();
状态可以设置为
- 线索
- 参观过
- 申请人
- 居民
- 非潜在客户
贡献者
在向此仓库贡献时,请先通过问题、电子邮件或任何其他方式与仓库所有者讨论您希望进行的更改,然后再进行更改。
请注意,我们有一项行为准则,请在与项目的所有互动中遵循。
拉取请求流程
- 在进行构建时,请确保在层的末尾之前删除任何安装或构建依赖项。
- 更新README.md,其中包含接口更改的详细信息,包括新的环境变量、公开端口、有用的文件位置和容器参数。
- 在任何示例文件和README.md中增加版本号,以表示此拉取请求代表的新版本。我们使用的版本化方案是SemVer。
- 一旦您获得两名其他开发者的批准,或者如果您没有权限这么做,您可以请求第二位审查者为您合并。
行为准则
我们的承诺
为了促进一个开放和欢迎的环境,我们作为贡献者和维护者承诺,无论年龄、体型、残疾、种族、性别认同和表达、经验水平、国籍、个人外观、种族、宗教或性取向和取向如何,都让每个人都能在我们的项目和社区中参与,体验无骚扰。
我们的标准
有助于创造积极环境的示例行为包括
- 使用欢迎和包容性的语言
- 尊重不同的观点和经验
- 优雅地接受建设性批评
- 专注于对社区最有益的事情
- 对其他社区成员表示同情
参与者不可接受的行为示例包括
- 使用性化的语言或图像,以及不受欢迎的性注意或推进
- 骚扰、侮辱/贬低性评论、个人或政治攻击
- 公开或私下骚扰
- 未经明确许可发布他人的私人信息,如物理或电子地址
- 在专业环境中可能被认为不适当的其他行为
我们的责任
项目维护者负责阐明可接受行为的标准,并应采取适当和公平的纠正措施来应对任何不可接受行为的情况。
项目维护者有权和责任移除、编辑或拒绝与该行为准则不一致的评论、提交、代码、维基编辑、问题和其他贡献,或者禁止暂时或永久禁止任何他们认为不适当、威胁性、冒犯性或有害的贡献者。
范围
本行为准则适用于项目空间以及个人代表项目或其社区时的公共空间。代表项目或社区的行为包括使用官方项目电子邮件地址、通过官方社交媒体账号发布信息或在在线或离线活动中担任指定代表。项目维护者可以对项目代表的定义进行进一步说明和澄清。
执行
对于不当的、骚扰性的或不可接受的行为,可以通过联系项目团队至 HELLO@PRIMITIVESOCIAL.COM 进行举报。所有投诉都将被审查和调查,并产生必要的和适当的回应。项目团队有义务对事件举报者的身份保密。具体执行政策的更详细信息可能会单独发布。
不遵守或认真执行行为准则的项目维护者可能会面临其他项目领导成员决定的临时或永久性后果。
归属
本行为准则改编自 Contributor Covenant,版本 1.4,可在 http://contributor-covenant.org/version/1/4 查找。
许可
MIT。更多信息请参阅LICENSE。