@tutorbot/api-client
v2.5.8
Published
The API client for requests in tutorbot's services
Downloads
1,254
Keywords
Readme
API
The API client for reqeusts in tutorbot's services
Install
yarn add @tutorbot/api-client
Group
| Name | Argument | Return | |-------------------------|-----------------|---------------------------------| | getGroupData | groupId: string | Promise<object|null> | | getGroupActiveTeacherId | groupId: string | Ids: Promise<Array<string>> |
Partner
| Name | Argument | Return | |----------------------|-----------------------------------|---------| | getPartnerMemberData | partnerId: string, userId: string | Promise |
Attendance
| Name | Argument | Return | |----------------------|--------------------------------------|-------------------------| | getStudentAttendance | attendanceId: string, userId: string | Promise<object|null> |
Salary
| Name | Argument | Return | |--------------------------------------|---------------------------------------------------------------|-------------------------| | getGroupTeacherDailySalary | groupId: string, teacherId: string, date: string (YYYY-MM-DD) | Promise<object|null> | | setOrUpdateGroupTeacherDailySalary | dailySalary: object | Promise<void> | | deleteGroupTeacherDailySalary | dailySalaryId: string | Promise<void> | | getGroupTeacherMonthlySalary | groupId: string, teacherId: string, period: number | Promise<void> | | setOrUpdateGroupTeacherMonthlySalary | monthlySalary: object | Promise<void> | | deleteGroupTeacherMonthlySalary | monthlySalaryId: string | Promise<object|null> |
Student Balance
| Name | Argument | Return | |----------------------------------------------------------|-----------------------------------------------------------------------------------------------------------|-------------------------| | createStudentBalanceUnlessExists | studentId: string, groupId: string, partnerId: string | Promise<void> | | setOrUpdateStudentBalanceTransaction | studentId: string, groupId: string, date: string (ISO format), amount: number, type: string, note: string | Promise<void> | | deleteStudentBalanceTransaction | studentId: string, groupId: string, date: string (ISO format), type: string | Promise<void> | | setOrUpdateStudentBalanceBonusTransaction | studentId: string, groupId: string, date: string (ISO format), amount: number, type: string, note: string | Promise<void> | | deleteStudentBalanceBonusTransaction | studentId: string, groupId: string, date: string (ISO format), type: string | Promise<void> |
Student Balance - const
| Name | Value | |------------------------------|--------------------| | BALANCE_TYPE_ATTENDANCE | Attendance | | BALANCE_TYPE_DISCOUNT | Discount | | BALANCE_TYPE_PAID | Paid | | BONUS_TYPE_EXCUSE_ATTENDANCE | Excuse Attendance |
new api usage
backend
const { LearningApiClient, CrmApiClient } = require("@tutorbot/api-client/src/api-clients/back");
LearningApiClient.course.findOne('your-id-here').then(res);
CrmApiClient.request.findOne('your-id-here').then(res);
use environment variables
CRM_API_URL
CRM_API_KEY
LEARNING_API_URL
LEARNING_API_KEY
frontend
import { learningApiClient, crmApiClient } from "@tutorbot/api-client/src/api-clients/front";
LearningApiClient({url: 'your-api-url-here', jwt: 'your-jwt-here'}).course.findOne('your-id-here').then(res);
CrmApiClient({url: 'your-api-url-here', jwt: 'your-jwt-here'}).request.findOne('your-id-here').then(res);