🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

amocrm-nestjs

Package Overview
Dependencies
Maintainers
0
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amocrm-nestjs

NestJS library AmoCRM

1.0.17
latest
npm
Version published
Weekly downloads
3
-87.5%
Maintainers
0
Weekly downloads
 
Created
Source

Установка

Через npm:

npm install amocrm-nestjs

Через yarn:

yarn add amocrm-nestjs

Использование

Импортировать модуль:

import { AmoModule } from 'amocrm-nestjs';

Два способа зарегистрировать модуль через forRoot или forRootAsync

ForRoot:

@Module({
    imports: [
        AmoModule.forRoot({
          href: 'https://***.amocrm.ru/',
          client_id: '***-***-***-***-***',
          client_secret: '***',
          redirect_uri: 'https://***.amocrm.ru/',
          code: '***',
          access_token: '***',
          refresh_token: '***',
        }),
    ],
    controllers: [AppController],
    providers: [AppService],
})
export class AppModule {}

ForRootAsync:

@Module({
    imports: [
        ConfigModule.forRoot({
            isGlobal: true,
        }),
        AmoModule.forRootAsync({
            inject: [ConfigService],
            useFactory: (configService: ConfigService) => ({
                href: configService.get<string>('HREF'),
                client_id: configService.get<string>('CLIENT_ID'),
                client_secret: configService.get<string>('CLIENT_SECRET'),
                redirect_uri: configService.get<string>('REDIRECT_URI'),
                code: configService.get<string>('CODE'),
                access_token: configService.get<string>('ACCESS_TOKEN'),
                refresh_token: configService.get<string>('REFRESH_TOKEN'),
            }),
        }),
    ],
    controllers: [AppController],
    providers: [AppService],
})
export class AppModule {}

Два способа авторизации через code или access_token и refresh_token, code в приоритете

Внедрить зависимости:

import { AmoService } from 'amocrm-nestjs';

@Injectable()
export class AppService {
    constructor(private amoService: AmoService) {
        (async () => {
            // Получим информацию по аккаунту
            const account = await this.amoService.getAccount();
            console.log(account);
        })();
    }
}

Доступные методы:

  • token (ТОКЕН)
  • account (ПАРАМЕТРЫ АККАУНТА)
  • file (ФАЙЛЫ)
  • lead (СДЕЛКИ)
  • contact (КОНТАКТЫ)
  • company (КОМПАНИИ)
  • task (ЗАДАЧИ)
  • tag (ТЕГИ)
  • webhook (ВЕБХУКИ)
  • user (ПОЛЬЗОВАТЕЛИ)
  • role (РОЛИ ПОЛЬЗОВАТЕЛЕЙ)
  • pipeline (ВОРОНКИ)
  • status (ЭТАПЫ)
  • catalog (СПИСКИ)
  • element (ЭЛЕМЕНТЫ СПИСКА)
  • field (ПОЛЯ)
  • group (ГРУППЫ ПОЛЕЙ)
  • links (СВЯЗИ СУЩНОСТЕЙ)
  • notes (ПРИМЕЧАНИЯ)

API REFERENCE

Вы можете отправить свой вопрос, отзыв, предложение на адрес электронной почты: webproject67nodejs@gmail.com

FAQs

Package last updated on 11 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts