Skip to content

divar-ir/kenar-sdk-javascript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kenar-api-client

KenarApiClient - JavaScript client for kenar-api-client No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 1.0
  • Package version: 0.1.0
  • Generator version: 7.13.0
  • Build package: org.openapitools.codegen.languages.JavascriptClientCodegen

Installation

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install kenar-api-client --save

Finally, you need to build the module:

npm run build
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

To use the link you just defined in your project, switch to the directory you want to use your kenar-api-client from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

Finally, you need to build the module:

npm run build

git

If the library is hosted at a git repository, e.g.https://github.com/divar-ir/kenar-sdk-javascript then install it via:

    npm install divar-ir/kenar-sdk-javascript --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var KenarApiClient = require('kenar-api-client');

var defaultClient = KenarApiClient.ApiClient.instance;
// Configure API key authorization: APIKey
var APIKey = defaultClient.authentications['APIKey'];
APIKey.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APIKey.apiKeyPrefix['X-API-Key'] = "Token"

var api = new KenarApiClient.AddonsApi()
var businessToken = "businessToken_example"; // {String} 
var addonsCreateBusinessAddonBody = new KenarApiClient.AddonsCreateBusinessAddonBody(); // {AddonsCreateBusinessAddonBody} 
api.addonsCreateBusinessAddon(businessToken, addonsCreateBusinessAddonBody).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Documentation for API Endpoints

All URIs are relative to https://open-api.divar.ir

Class Method HTTP request Description
KenarApiClient.AddonsApi addonsCreateBusinessAddon POST /v1/open-platform/addons/business/{business_token} افزودن افزونه جدید به آگهی‌های کسب‌و‌کار
KenarApiClient.AddonsApi addonsCreatePostAddonV2 POST /v2/open-platform/addons/post/{token} افزودن افزونه جدید به آگهی
KenarApiClient.AddonsApi addonsCreateUserAddonV2 POST /v2/open-platform/addons/user/{phone} افزودن افزونه جدید به کاربر
KenarApiClient.AddonsApi addonsCreateUserAddonV22 POST /v2/open-platform/addons/users/{divar_user_id} افزودن افزونه جدید به کاربر
KenarApiClient.AddonsApi addonsDeletePostAddon DELETE /v1/open-platform/add-ons/post/{token} حذف افزونه از آگهی
KenarApiClient.AddonsApi addonsDeletePostAddon2 DELETE /v1/open-platform/addons/post/{token} حذف افزونه از آگهی
KenarApiClient.AddonsApi addonsDeleteUserAddon DELETE /v1/open-platform/addons/user/{id} حذف افزونه کاربر
KenarApiClient.AddonsApi addonsGetUserAddons GET /v1/open-platform/addons/user/{phone} دریافت تمام افزونه‌های کاربر
KenarApiClient.AddonsApi addonsGetUserAddons2 GET /v2/open-platform/addons/users/{divar_user_id} دریافت تمام افزونه‌های کاربر
KenarApiClient.AssetsApi assetsGetBodyStatuses GET /v1/open-platform/assets/body-status دریافت گزینه‌های وضعیت بدنه موجود در دسته‌بندی‌های خودرو دیوار
KenarApiClient.AssetsApi assetsGetBrandModels GET /v1/open-platform/assets/brand-model/{category} دریافت مدل‌های برند در دسته‌بندی دیوار
KenarApiClient.AssetsApi assetsGetCategories GET /v1/open-platform/assets/category دریافت دسته‌بندی‌های دیوار
KenarApiClient.AssetsApi assetsGetCities GET /v1/open-platform/assets/city دریافت شهرهای دیوار
KenarApiClient.AssetsApi assetsGetColors GET /v1/open-platform/assets/color/{category} دریافت رنگ‌ها در دسته‌بندی دیوار
KenarApiClient.AssetsApi assetsGetDistricts GET /v1/open-platform/assets/district دریافت مناطق دیوار
KenarApiClient.AssetsApi assetsGetDistricts2 GET /v1/open-platform/assets/district/{city_slug} دریافت مناطق دیوار
KenarApiClient.AssetsApi assetsGetInternalStorages GET /v1/open-platform/assets/internal-storage دریافت گزینه‌های حافظه داخلی موجود در دسته‌بندی‌های موبایل/تبلت/لپ‌تاپ دیوار
KenarApiClient.AssetsApi assetsGetOAuthScopes GET /v1/open-platform/assets/oauth-scope دریافت دامنه‌های OAuth کنار دیوار
KenarApiClient.AssetsApi assetsGetPermissions GET /v1/open-platform/assets/permission دریافت مجوزهای کنار دیوار
KenarApiClient.AssetsApi assetsGetRamMemories GET /v1/open-platform/assets/ram-memory دریافت گزینه‌های حافظه رم موجود در دسته‌بندی‌های موبایل/تبلت/لپ‌تاپ دیوار
KenarApiClient.AssetsApi assetsGetServiceTypes GET /v1/open-platform/assets/service-type دریافت انواع سرویس موجود در کنار دیوار
KenarApiClient.ChatAPIApi chatAPIChatBotSendMessage POST /v1/open-platform/chat/bot/conversations/{conversation_id}/messages ارسال پیام به مکالمه ChatBot
KenarApiClient.ChatAPIApi chatAPIChatBotSendMessage2 POST /v1/open-platform/chat/bot/users/{user_id}/messages ارسال پیام به مکالمه ChatBot
KenarApiClient.ChatAPIApi chatAPIChatBotSendMessage3 POST /experimental/open-platform/chatbot-conversations/{conversation_id}/messages ارسال پیام به مکالمه ChatBot
KenarApiClient.ChatAPIApi chatAPIChatBotSendMessage4 POST /experimental/open-platform/chat/bot/users/{user_id}/messages ارسال پیام به مکالمه ChatBot
KenarApiClient.ChatAPIApi chatAPIChatBotSendMessage5 POST /experimental/open-platform/chat/bot/conversations/{conversation_id}/messages ارسال پیام به مکالمه ChatBot
KenarApiClient.ChatAPIApi chatAPIConversationSendMessage POST /v2/open-platform/conversations/{conversation_id}/messages ارسال پیام به مکالمه
KenarApiClient.ChatAPIApi chatAPIGenerateUploadToken POST /experimental/open-platform/chat/upload تولید توکن آپلود
KenarApiClient.ChatAPIApi chatAPIGetConversation GET /v1/open-platform/chat/conversations/{conversation_id} دریافت مکالمه با شناسه آن
KenarApiClient.EventsApi eventsRegisterEventSubscription POST /v1/open-platform/events/subscriptions اشتراک در رویداد
KenarApiClient.FinderApi finderGetPost GET /v1/open-platform/finder/post/{token} دریافت آگهی دیوار
KenarApiClient.FinderApi finderGetUser POST /v1/open-platform/users دریافت اطلاعات کاربر
KenarApiClient.FinderApi finderGetUser2 GET /v1/open-platform/users دریافت اطلاعات کاربر
KenarApiClient.FinderApi finderGetUserPosts GET /v1/open-platform/finder/user-posts دریافت آگهی‌های کاربر
KenarApiClient.FinderApi finderSearchPostV2 POST /v2/open-platform/finder/post جستجو آگهی‌های دیوار با فیلترهایی
KenarApiClient.LimitedApi paymentGetBalance GET /experimental/open-platform/balance
KenarApiClient.LimitedApi paymentGetPostPricing GET /v1/open-platform/post/{post_token}/pricing دریافت هزینه سرویس
KenarApiClient.LimitedApi paymentGetTransaction GET /experimental/open-platform/transactions/{id}
KenarApiClient.LimitedApi paymentListTransactions GET /experimental/open-platform/transactions
KenarApiClient.LimitedApi paymentReorderPost POST /experimental/open-platform/post/{post_token}/reorder
KenarApiClient.PaymentTicketApi paymentTicketValidate POST /v1/open-platform/payment-ticket/validate اعتبارسنجی بلیط پرداخت
KenarApiClient.PostApi postEditPost PUT /v1/open-platform/post/{post_token} ویرایش آگهی
KenarApiClient.PostApi postGetImageUploadURL GET /v1/open-platform/post/image-upload-url دریافت URL آپلود تصویر
KenarApiClient.PostApi postGetPostStats GET /experimental/open-platform/posts/{post_token}/stats دریافت آمارهای آگهی
KenarApiClient.SemanticApi semanticCreatePostSemantic POST /experimental/open-platform/semantic/post/{token} ایجاد اطلاعات معنایی آگهی
KenarApiClient.SemanticApi semanticCreateUserSemantic POST /v1/open-platform/semantic/user/{phone} ایجاد اطلاعات معنایی کاربر
KenarApiClient.SemanticApi semanticCreateUserSemantic2 POST /v1/open-platform/semantic/users/{divar_user_id} ایجاد اطلاعات معنایی کاربر
KenarApiClient.SemanticApi semanticDeleteUserSemantic DELETE /v1/open-platform/semantic/user/{phone} حذف اطلاعات معنایی کاربر
KenarApiClient.SemanticApi semanticDeleteUserSemantic2 DELETE /v1/open-platform/semantic/users/{divar_user_id} حذف اطلاعات معنایی کاربر

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

APIKey

  • Type: API key
  • API key parameter name: X-API-Key
  • Location: HTTP header

OAuth

  • Type: OAuth
  • Flow: accessCode
  • Authorization URL: oauth.divar.ir/oauth2/auth
  • Scopes:
    • BUSINESS_ADDON_CREATE.resource_id: BUSINESS_ADDON_CREATE.resource_id
    • CHAT_BOT_USER_MESSAGE_SEND: CHAT_BOT_USER_MESSAGE_SEND
    • CHAT_CONVERSATION_READ.resource_id: CHAT_CONVERSATION_READ.resource_id
    • CHAT_MESSAGE_SEND.resource_id: CHAT_MESSAGE_SEND.resource_id
    • CHAT_POST_CONVERSATIONS_MESSAGE_SEND.resource_id: CHAT_POST_CONVERSATIONS_MESSAGE_SEND.resource_id
    • CHAT_POST_CONVERSATIONS_READ.resource_id: CHAT_POST_CONVERSATIONS_READ.resource_id
    • CHAT_SUPPLIER_ALL_CONVERSATIONS_MESSAGE_SEND: CHAT_SUPPLIER_ALL_CONVERSATIONS_MESSAGE_SEND
    • CHAT_SUPPLIER_ALL_CONVERSATIONS_READ: CHAT_SUPPLIER_ALL_CONVERSATIONS_READ
    • CONVERSATION_SEND_MESSAGE.resource_id: CONVERSATION_SEND_MESSAGE.resource_id
    • MANAGEMENT_APPS_READ.resource_id: MANAGEMENT_APPS_READ.resource_id
    • MANAGEMENT_APPS_WRITE.resource_id: MANAGEMENT_APPS_WRITE.resource_id
    • NOTIFICATION_ACCESS_REVOCATION: NOTIFICATION_ACCESS_REVOCATION
    • PAYMENT_ALL_POSTS_PRICING_READ: PAYMENT_ALL_POSTS_PRICING_READ
    • PAYMENT_ALL_POSTS_REORDER: PAYMENT_ALL_POSTS_REORDER
    • POST_ADDON_CREATE.resource_id: POST_ADDON_CREATE.resource_id
    • POST_EDIT.resource_id: POST_EDIT.resource_id
    • POST_ONGOING_IMAGES_GET.resource_id: POST_ONGOING_IMAGES_GET.resource_id
    • POST_SEMANTIC_CREATE.resource_id: POST_SEMANTIC_CREATE.resource_id
    • USER_ADDON_CREATE: USER_ADDON_CREATE
    • USER_ID: USER_ID
    • USER_PHONE: USER_PHONE
    • USER_POSTS_ADDON_CREATE: USER_POSTS_ADDON_CREATE
    • USER_POSTS_GET: USER_POSTS_GET
    • USER_VERIFICATION_CREATE: USER_VERIFICATION_CREATE
    • offline_access: offline_access
    • openid: openid

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published