logologo
البدء
الدليل
التطوير
الإضافات
API
English
简体中文
日本語
한국어
Deutsch
Français
Español
Português
Русский
Italiano
Türkçe
Українська
Tiếng Việt
Bahasa Indonesia
ไทย
Polski
Nederlands
Čeština
العربية
עברית
हिन्दी
Svenska
البدء
الدليل
التطوير
الإضافات
API
logologo
API Overview

@nocobase/auth

AuthManager
Auth
BaseAuth

@nocobase/cache

CacheManager
التخزين المؤقت

@nocobase/cli

NocoBase CLI
متغيرات البيئة العامة

@nocobase/client

التطبيق
إضافة

@nocobase/database

مجموعة
الحقل

interfaces

BaseInterface
عوامل التصفية

RelationRepository

BelongsToManyRepository
belongs-to-repository
HasManyRepository
HasOneRepository
المستودع (Repository)

shared

create-options
destroy-options
find-one
transaction
update-options

@nocobase/data-source-manager

DataSourceManager
DataSource (تجريدي)
ICollectionManager
ICollection
IField
IModel
IRepository

@nocobase/flow-engine

مدير مصدر البيانات
سياق سير العمل
FlowEngine
FlowModel
مصدر سير العمل

@nocobase/logger

المسجل

@nocobase/server

AppCommand
التطبيق
AuditManager
السياق
الهجرة
إضافة

@nocobase/sdk

Auth
التخزين

@nocobase/telemetry

المقياس
Telemetry
التتبع
Previous Pageإضافة
Next PageAuth
إشعار الترجمة بالذكاء الاصطناعي

تمت ترجمة هذه الوثائق تلقائيًا بواسطة الذكاء الاصطناعي.

#APIClient

#نظرة عامة

APIClient هو غلاف مبني على axios، يُستخدم لطلب عمليات موارد NocoBase من جانب العميل عبر HTTP.

#الاستخدام الأساسي

class PluginSampleAPIClient extends Plugin {
  async load() {
    const res = await this.app.apiClient.request({
      // ...
    });
  }
}

#خصائص الكائن

#axios

كائن axios، والذي يمكن استخدامه للوصول إلى واجهة برمجة تطبيقات axios، على سبيل المثال، apiClient.axios.interceptors.

#auth

فئة المصادقة من جانب العميل، راجع Auth.

#storage

فئة التخزين من جانب العميل، راجع Storage.

#دوال الفئة

#constructor()

دالة البناء، تنشئ كائن APIClient.

#التوقيع

  • constructor(instance?: APIClientOptions)

#النوع

interface ExtendedOptions {
  authClass?: any;
  storageClass?: any;
}

export type APIClientOptions =
  | AxiosInstance
  | (AxiosRequestConfig & ExtendedOptions);

#request()

تُطلق طلب HTTP.

#التوقيع

  • request<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D> | ResourceActionOptions): Promise<R>

#النوع

type ResourceActionOptions<P = any> = {
  resource?: string;
  resourceOf?: any;
  action?: string;
  params?: P;
};

#التفاصيل

#AxiosRequestConfig

معلمات طلب axios العامة. راجع Request Config.

const res = await apiClient.request({ url: '' });
#ResourceActionOptions

معلمات طلب عمليات موارد NocoBase.

const res = await apiClient.request({
  resource: 'users',
  action: 'list',
  params: {
    pageSize: 10,
  },
});

| الخاصية | النوع | الوصف ```

#`resource()```

Gets the NocoBase resource action method object.

const resource = apiClient.resource('users');

await resource.create({
  values: {
    username: 'admin',
  },
});

const res = await resource.list({
  page: 2,
  pageSize: 20,
});

#Signature

  • resource(name: string, of?: any, headers?: AxiosRequestHeaders): IResource

#Type

export interface ActionParams {
  filterByTk?: any;
  [key: string]: any;
}

type ResourceAction = (params?: ActionParams) => Promise<any>;

export type IResource = {
  [key: string]: ResourceAction;
};

#Details

ParameterTypeDescription
namestring1. Resource name, e.g., a
2. Name of the resource's associated object, e.g., a.b
ofanyWhen name is the name of the resource's associated object, it is the primary key value of the resource. For example, for a.b, it represents the primary key value of a.
headersAxiosRequestHeadersHTTP headers to include in subsequent resource action requests.