@aac/directory 中文文档教程

发布于 3年前 浏览 24 项目主页 更新于 3年前

Directory ClientReach

将此包添加到您的项目中: npm i @aac/directory

我建议在您的项目中添加一个辅助函数,这样您就不会在每次使用该函数时都传递配置。 配置目录:

const {Directory} = require('@aac/directory');

const directory = (props = {query: ''}) => {
    const {query = {}} = props;
    return new Directory({
        credentials: {
            api: CLIENTREACH_API_URL,
            username: CLIENTREACH_API_USERNAME,
            password: CLIENTREACH_API_PASSWORD,
        },
        specialty: 'addiction-treatment',
        listings_path: 'local',
        facilities_path: 'listings',
        site_name: 'Project Know',
        phone: '',
        query,
    });
};

Directory Parameters:

ParameterDescriptionsDefault
pluginPath.null
seedUsed for generating the facility profile unique ID in the URL for facility pages.
Ex: EX: /listings/greenhouse-treatment-center-1868084797
Rehabs (2), Recovery (3), Detox (3)
2
specialtyUsed for filtering free posts by specialty.
projectknow, detox, drugabuse, recovery, rehab
'rehab'
listings_pathUsed for generating the city/state url path.
EX: /local/california
'local'
facilities_pathUsed for generating the facility profile url path.
EX: /listings/ greenhouse-treatment-center-1868084797
'listings'
aacaccountidUsed in functions that determine/validate if a facility is AAC or not. There are business compliance cases where we cannot show some data on non-aac facilities.'cuJjm8Z5'
credentialsThis object is passed to the ClientReach Class which handles authenticated requests. {username: '', password: ''}null
site_nameThere are helper functions that have output including the site name.null
phoneEach directory has a unique CallRail Phone number associated with it.null
queryCurrently there are helper functions that determine page type based on query parameters, pass the Express context.query if you need those functions. See Directory.getVars for the list of accepted parameters{}

Directory ClientReach

Add this package to your project: npm i @aac/directory

I recommend adding a helper function in your project so that you don't pass configuration everytime you use the function. Configure the directory:

const {Directory} = require('@aac/directory');

const directory = (props = {query: ''}) => {
    const {query = {}} = props;
    return new Directory({
        credentials: {
            api: CLIENTREACH_API_URL,
            username: CLIENTREACH_API_USERNAME,
            password: CLIENTREACH_API_PASSWORD,
        },
        specialty: 'addiction-treatment',
        listings_path: 'local',
        facilities_path: 'listings',
        site_name: 'Project Know',
        phone: '',
        query,
    });
};

Directory Parameters:

ParameterDescriptionsDefault
pluginPath.null
seedUsed for generating the facility profile unique ID in the URL for facility pages.
Ex: EX: /listings/greenhouse-treatment-center-1868084797
Rehabs (2), Recovery (3), Detox (3)
2
specialtyUsed for filtering free posts by specialty.
projectknow, detox, drugabuse, recovery, rehab
'rehab'
listings_pathUsed for generating the city/state url path.
EX: /local/california
'local'
facilities_pathUsed for generating the facility profile url path.
EX: /listings/ greenhouse-treatment-center-1868084797
'listings'
aacaccountidUsed in functions that determine/validate if a facility is AAC or not. There are business compliance cases where we cannot show some data on non-aac facilities.'cuJjm8Z5'
credentialsThis object is passed to the ClientReach Class which handles authenticated requests. {username: '', password: ''}null
site_nameThere are helper functions that have output including the site name.null
phoneEach directory has a unique CallRail Phone number associated with it.null
queryCurrently there are helper functions that determine page type based on query parameters, pass the Express context.query if you need those functions. See Directory.getVars for the list of accepted parameters{}
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文