No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.
- API version: 1.0
- Package version: 0.1.0
- Generator version: 7.13.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/contextPut the package under your project folder and add the following in import:
import kenarapi "github.com/divar-ir/kenar-sdk-go"To use a proxy, set the environment variable HTTP_PROXY:
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.
For using other server than the one defined on index 0 set context value kenarapi.ContextServerIndex of type int.
ctx := context.WithValue(context.Background(), kenarapi.ContextServerIndex, 1)Templated server URL is formatted using default variables from configuration or from context value kenarapi.ContextServerVariables of type map[string]string.
ctx := context.WithValue(context.Background(), kenarapi.ContextServerVariables, map[string]string{
"basePath": "v2",
})Note, enum values are always validated and all unused variables are silently ignored.
Each operation can use different server URL defined using OperationServers map in the Configuration.
An operation is uniquely identified by "{classname}Service.{nickname}" string.
Similar rules for overriding default operation server index and variables applies by using kenarapi.ContextOperationServerIndices and kenarapi.ContextOperationServerVariables context maps.
ctx := context.WithValue(context.Background(), kenarapi.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), kenarapi.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})All URIs are relative to https://open-api.divar.ir
| Class | Method | HTTP request | Description |
|---|---|---|---|
| AddonsAPI | AddonsCreateBusinessAddon | Post /v1/open-platform/addons/business/{business_token} | ایجاد افزونه کسبوکار |
| AddonsAPI | AddonsCreatePostAddonV2 | Post /v2/open-platform/addons/post/{token} | ایجاد افزونه آگهی |
| AddonsAPI | AddonsCreateUserAddonV2 | Post /v2/open-platform/addons/user/{phone} | ایجاد افزونه کاربر |
| AddonsAPI | AddonsCreateUserAddonV22 | Post /v2/open-platform/addons/users/{divar_user_id} | ایجاد افزونه کاربر |
| AddonsAPI | AddonsDeletePostAddon | Delete /v1/open-platform/add-ons/post/{token} | حذف افزونه آگهی |
| AddonsAPI | AddonsDeletePostAddon2 | Delete /v1/open-platform/addons/post/{token} | حذف افزونه آگهی |
| AddonsAPI | AddonsDeleteUserAddon | Delete /v1/open-platform/addons/user/{id} | حذف افزونه کاربر |
| AssetsAPI | AssetsGetBodyStatuses | Get /v1/open-platform/assets/body-status | لیست گزینههای وضعیت بدنه |
| AssetsAPI | AssetsGetBrandModels | Get /v1/open-platform/assets/brand-model/{category} | لیست مدل برندها بر اساس دستهبندی |
| AssetsAPI | AssetsGetCategories | Get /v1/open-platform/assets/category | لیست همه دستهبندیها |
| AssetsAPI | AssetsGetCities | Get /v1/open-platform/assets/city | لیست همه شهرها |
| AssetsAPI | AssetsGetColors | Get /v1/open-platform/assets/color/{category} | لیست رنگها بر اساس دستهبندی |
| AssetsAPI | AssetsGetDistricts | Get /v1/open-platform/assets/district | لیست محلهها |
| AssetsAPI | AssetsGetDistricts2 | Get /v1/open-platform/assets/district/{city_slug} | لیست محلهها |
| AssetsAPI | AssetsGetInternalStorages | Get /v1/open-platform/assets/internal-storage | لیست گزینههای حافظه داخلی |
| AssetsAPI | AssetsGetOAuthScopes | Get /v1/open-platform/assets/oauth-scope | لیست دامنههای OAuth |
| AssetsAPI | AssetsGetPermissions | Get /v1/open-platform/assets/permission | لیست مجوزهای کنار دیوار |
| AssetsAPI | AssetsGetRamMemories | Get /v1/open-platform/assets/ram-memory | لیست گزینههای حافظه RAM |
| AssetsAPI | AssetsGetServiceTypes | Get /v1/open-platform/assets/service-type | لیست انواع سرویس |
| AssetsAPI | AssetsGetSubmitSchema | Get /v1/open-platform/assets/submit-schema/{category_slug} | دریافت schema ثبت آگهی |
| ChatAPIAPI | ChatAPIChatBotSendMessage | Post /v1/open-platform/chat/bot/conversations/{conversation_id}/messages | ارسال پیام به مکالمه چتبات |
| ChatAPIAPI | ChatAPIChatBotSendMessage2 | Post /v1/open-platform/chat/bot/users/{user_id}/messages | ارسال پیام به مکالمه چتبات |
| ChatAPIAPI | ChatAPIChatBotSendMessage3 | Post /experimental/open-platform/chatbot-conversations/{conversation_id}/messages | ارسال پیام به مکالمه چتبات |
| ChatAPIAPI | ChatAPIChatBotSendMessage4 | Post /experimental/open-platform/chat/bot/users/{user_id}/messages | ارسال پیام به مکالمه چتبات |
| ChatAPIAPI | ChatAPIChatBotSendMessage5 | Post /experimental/open-platform/chat/bot/conversations/{conversation_id}/messages | ارسال پیام به مکالمه چتبات |
| ChatAPIAPI | ChatAPIConversationSendMessage | Post /v2/open-platform/conversations/{conversation_id}/messages | ارسال پیام به مکالمه |
| ChatAPIAPI | ChatAPIGenerateUploadToken | Post /experimental/open-platform/chat/upload | تولید توکن آپلود |
| ChatAPIAPI | ChatAPIGetConversation | Get /v1/open-platform/chat/conversations/{conversation_id} | دریافت مکالمه |
| EventsAPI | EventsRegisterEventSubscription | Post /v1/open-platform/events/subscriptions | اشتراک در رویداد |
| FinderAPI | FinderGetPost | Get /v1/open-platform/finder/post/{token} | دریافت آگهی دیوار |
| FinderAPI | FinderGetUser | Post /v1/open-platform/users | دریافت اطلاعات کاربر |
| FinderAPI | FinderGetUser2 | Get /v1/open-platform/users | دریافت اطلاعات کاربر |
| FinderAPI | FinderGetUserBusinesses | Get /v1/open-platform/user/businesses | دریافت کسبوکارهای کاربر |
| FinderAPI | FinderGetUserIDByPhone | Post /v1/open-platform/get-user-id-by-phone | دریافت شناسه کاربر |
| FinderAPI | FinderGetUserPosts | Get /v1/open-platform/finder/user-posts | دریافت آگهیهای کاربر |
| FinderAPI | FinderSearchPostV2 | Post /v2/open-platform/finder/post | جستجوی آگهیهای دیوار |
| PaymentAPI | PaymentCommitWalletTransaction | Post /experimental/open-platform/wallet/payments/commit | نهایی کردن تراکنش کیف پول |
| PaymentAPI | PaymentCreateWalletPayment | Post /experimental/open-platform/wallet/payments/create | ایجاد پرداخت کیف پول |
| PaymentAPI | PaymentGetBalance | Get /experimental/open-platform/balance | دریافت موجودی اپلیکیشن |
| PaymentAPI | PaymentGetPostPricing | Get /v1/open-platform/post/{post_token}/pricing | دریافت قیمت خدمات آگهی |
| PaymentAPI | PaymentGetTransaction | Get /experimental/open-platform/transactions/{id} | دریافت جزئیات تراکنش |
| PaymentAPI | PaymentListTransactions | Get /experimental/open-platform/transactions | لیست تراکنشها |
| PaymentAPI | PaymentPublishUserPost | Post /experimental/open-platform/post/{post_token}/publish | انتشار آگهی کاربر (پرداخت توسط ارائهدهنده) |
| PaymentAPI | PaymentRenewPost | Post /experimental/open-platform/post/{post_token}/renew | تمدید آگهی |
| PaymentAPI | PaymentReorderPost | Post /experimental/open-platform/post/{post_token}/reorder | نردبان آگهی |
| PaymentAPI | PaymentRetrieveWalletTransaction | Get /experimental/open-platform/wallet/payments/{token} | دریافت تراکنش کیف پول |
| PaymentAPI | PaymentSubmitUserPayment | Post /v1/open-platform/user-payments | ثبت رکورد پرداخت کاربر |
| PaymentTicketAPI | PaymentTicketValidate | Post /v1/open-platform/payment-ticket/validate | اعتبارسنجی تیکت پرداخت |
| PostAPI | PostCanUserSubmitPost | Get /experimental/open-platform/user-posts/can-submit | بررسی اینکه آیا کاربر میتواند آگهی ارسال کند |
| PostAPI | PostCreateBusinessCustomizedButton | Post /experimental/open-platform/business/{business_token}/customized-button | ایجاد دکمه اختصاصی برای آگهیهای کسبوکار |
| PostAPI | PostDeleteBusinessCustomizedButton | Delete /experimental/open-platform/business/{business_token}/customized-button | حذف دکمه اختصاصی از آگهیهای کسبوکار |
| PostAPI | PostDeletePostCustomizedButton | Delete /experimental/open-platform/posts/{post_token}/customized-button | حذف دکمه اختصاصی از آگهی |
| PostAPI | PostDeleteUserPost | Delete /v1/open-platform/post/{post_token} | حذف آگهی |
| PostAPI | PostEditPost | Put /v1/open-platform/post/{post_token} | ویرایش آگهی |
| PostAPI | PostEditPostV2 | Put /v2/open-platform/post/{post_token} | ویرایش آگهی (پیشرفته) |
| PostAPI | PostGetImageUploadURL | Get /v1/open-platform/post/image-upload-url | دریافت آدرس اپلود تصاویر آگهی (منسوخ شده) |
| PostAPI | PostGetPostStats | Get /experimental/open-platform/posts/{post_token}/stats | دریافت آمارهای آگهی |
| PostAPI | PostGetUploadURLsV2 | Get /v2/open-platform/post/upload-urls | دریافت آدرس آپلود تصاویر و ویدیو |
| PostAPI | PostGetUserPost | Get /v1/open-platform/user-post/{token} | دریافت آگهی با توکن |
| PostAPI | PostSetPostCustomizedButton | Post /experimental/open-platform/posts/{post_token}/customized-button | تنظیم دکمه اختصاصی روی آگهی |
| PostAPI | PostSubmitPostV2 | Post /experimental/open-platform/posts/new-v2 | ثبت آگهی |
| PostAPI | PostSubmitUserPost | Post /experimental/open-platform/user-posts/new | ثبت آگهی به عنوان کاربر |
| SemanticAPI | SemanticCreatePostSemantic | Post /experimental/open-platform/semantic/post/{token} | ایجاد اطلاعات معنایی آگهی |
| SemanticAPI | SemanticCreateUserSemantic | Post /v1/open-platform/semantic/user/{phone} | ایجاد اطلاعات معنایی کاربر |
| SemanticAPI | SemanticCreateUserSemantic2 | Post /v1/open-platform/semantic/users/{divar_user_id} | ایجاد اطلاعات معنایی کاربر |
| SemanticAPI | SemanticDeleteUserSemantic | Delete /v1/open-platform/semantic/user/{phone} | حذف اطلاعات معنایی کاربر |
| SemanticAPI | SemanticDeleteUserSemantic2 | Delete /v1/open-platform/semantic/users/{divar_user_id} | حذف اطلاعات معنایی کاربر |
- AddonSemanticCarVerificationStage
- AddonSemanticIdentityVerificationResult
- AddonSemanticIdentityVerificationStage
- AddonSemanticInspectionResult
- AddonSemanticNewFaceVerificationResult
- AddonSemanticOnlineReservationCapability
- AddonSemanticOwnershipResult
- AddonSemanticPostVerificationResult
- AddonsAction
- AddonsAddonLinkage
- AddonsAddonMetaData
- AddonsAddonSecondaryLinkage
- AddonsAddonSecondaryLinkagePosition
- AddonsAddonSecondaryLinks
- AddonsAddonSelector
- AddonsAddonSemantic
- AddonsAddonSemanticPaymentMethod
- AddonsAddonSemanticStatus
- AddonsBusinessAddon
- AddonsButtonBar
- AddonsCreateBusinessAddonBody
- AddonsCreateBusinessAddonResponse
- AddonsCreatePostAddonRequest
- AddonsCreatePostAddonV2Body
- AddonsCreateUserAddonResponseV2
- AddonsCreateUserAddonV2Body
- AddonsDescriptionRow
- AddonsEvaluationRow
- AddonsEvaluationRowSection
- AddonsEventRow
- AddonsGetBusinessAddonsResponse
- AddonsGetDynamicAction
- AddonsGetPostAddonsResponse
- AddonsGetUserAddonsResponse
- AddonsGetUserPostAddonsResponse
- AddonsGroupInfoRow
- AddonsGroupInfoRowGroupInfoItem
- AddonsImageCarouselRow
- AddonsOpenPostManagePage
- AddonsOpenPostPage
- AddonsOpenServerLink
- AddonsPostAddon
- AddonsScoreRow
- AddonsSelectorRow
- AddonsStatus
- AddonsSubtitleRow
- AddonsTitleRow
- AddonsUserAddon
- AddonsUserAddonFilters
- AddonsWidget
- AddonsWidgetColor
- AppsApp
- AppsAppStatus
- AppsAppStatusStatus
- AppsServiceTag
- AppsServiceType
- AssetsEnumOption
- AssetsGetBodyStatusesResponse
- AssetsGetBrandModelsResponse
- AssetsGetCategoriesResponse
- AssetsGetCitiesResponse
- AssetsGetColorsResponse
- AssetsGetDistrictsResponse
- AssetsGetInternalStoragesResponse
- AssetsGetOAuthScopesResponse
- AssetsGetOAuthScopesResponseAppOauthScope
- AssetsGetOAuthScopesResponseLifeCycleState
- AssetsGetPermissionsResponse
- AssetsGetPermissionsResponseLifeCycleState
- AssetsGetPermissionsResponsePermission
- AssetsGetRamMemoriesResponse
- AssetsGetServiceTypesResponse
- AssetsGetSubmitSchemaResponse
- AuthorizationAPICallerInfo
- AuthorizationOAuthScope
- BaseBusinessType
- ChatAPIChatBotSendMessageBody
- ChatAPIConversationSendMessageBody
- ChatapiChatBotSendMessageResponse
- ChatapiChatButton
- ChatapiChatButtonGrid
- ChatapiChatButtonRow
- ChatapiConversation
- ChatapiConversationSendMessageResponse
- ChatapiConversationType
- ChatapiGenerateUploadTokenResponse
- ChatapiGetConversationResponse
- ChatapiMessage
- ChatapiMessageSenderSide
- ChatapiMessageSenderType
- ChatapiMessageType
- DivarIconsIconName
- EventsRegisterEventSubscriptionRequest
- EventsRegisterEventSubscriptionRequestEventType
- FinderGetAllDevelopmentPostsResponse
- FinderGetPostResponse
- FinderGetPostResponseBusinessData
- FinderGetUserBusinessesResponse
- FinderGetUserBusinessesResponseBusiness
- FinderGetUserIDByPhoneRequest
- FinderGetUserIDByPhoneResponse
- FinderGetUserPostsResponse
- FinderGetUserPostsResponsePost
- FinderPostExtState
- FinderSearchPostItem
- FinderSearchPostV2Response
- FinderSearchPostsV2Request
- FinderSearchQuery
- FinderSearchQueryNumberRange
- FinderUser
- GetPostPricingResponseRenew
- GetPostPricingResponseReorder
- GetPostPricingResponseSubmit
- GetPostStatsResponseDailyStats
- GetPostStatsResponsePostStats
- GetServiceTypesResponseServiceTypeData
- GetUploadURLsV2ResponseUploadFormat
- GooglerpcStatus
- ImageCarouselRowImageItem
- ManagementDevelopmentPost
- MessageContactData
- MessageFileData
- MessageImageData
- MessageLocationData
- MessageSender
- MessageVideoData
- MessageVoiceData
- OAuthScopeScope
- OpenPlatformpostHTTPMethod
- OpenPlatformpostPostState
- PaymentCommitWalletTransactionRequest
- PaymentCommitWalletTransactionResponse
- PaymentCreateWalletPaymentRequest
- PaymentCreateWalletPaymentResponse
- PaymentGetBalanceResponse
- PaymentGetPostPricingResponse
- PaymentGetTransactionResponse
- PaymentListTransactionsResponse
- PaymentPublishUserPostBody
- PaymentPublishUserPostResponse
- PaymentRenewPostBody
- PaymentRenewPostResponse
- PaymentReorderPostBody
- PaymentReorderPostResponse
- PaymentRetrieveWalletTransactionResponse
- PaymentSubmitUserPaymentRequest
- PaymentTicketGenerateResponse
- PaymentTicketValidateRequest
- PaymentTicketValidateResponse
- PaymentTransaction
- PaymentTransactionState
- PaymentTransactionType
- PaymentWalletTransaction
- PaymentWalletTransactionStatus
- PostCanUserSubmitPostResponse
- PostCreateBusinessCustomizedButtonBody
- PostCustomizedButton
- PostCustomizedButtonType
- PostEditPostBody
- PostEditPostV2Body
- PostGeneralDataPostVideo
- PostGetBusinessCustomizedButtonResponse
- PostGetImageUploadURLResponse
- PostGetPostStatsResponse
- PostGetUploadURLsV2Response
- PostGetUserPostResponse
- PostGetUserPostResponseBusinessData
- PostLocationType
- PostPostGeneralData
- PostSetPostCustomizedButtonBody
- PostSubmitPostResponse
- PostSubmitPostV2Request
- PostSubmitUserPostRequest
- PremiumPanelBusinessDataSubBusinessType
- PremiumPanelUserRole
- ProtobufAny
- SearchPostItemPrice
- SearchPostItemRealEstateFields
- SearchPostItemVehiclesFields
- SemanticCreatePostSemanticBody
- SemanticCreateUserSemanticBody
- SemanticCreateUserSemanticResponse
- SemanticPostSemanticDeleted
- SemanticUserSemanticDeleted
Authentication schemes defined for the API:
- Type: API key
- API key parameter name: X-API-Key
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey where the key is: APIKey and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
kenarapi.ContextAPIKeys,
map[string]kenarapi.APIKey{
"APIKey": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)- Type: OAuth
- Flow: accessCode
- Authorization URL: oauth.divar.ir/oauth2/auth
- Scopes:
- BUSINESS_ADDON_CREATE.resource_id: BUSINESS_ADDON_CREATE.resource_id
- BUSINESS_CREATE_CUSTOMIZED_BUTTON.resource_id: BUSINESS_CREATE_CUSTOMIZED_BUTTON.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
- CREATE_WALLET_PAYMENT: CREATE_WALLET_PAYMENT
- DELETE_USER_POST: DELETE_USER_POST
- EDIT_USER_POST: EDIT_USER_POST
- 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_RENEW: PAYMENT_ALL_POSTS_RENEW
- 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
- SEND_EVENT: SEND_EVENT
- SUBMIT_USER_PAYMENT: SUBMIT_USER_PAYMENT
- SUBMIT_USER_POST: SUBMIT_USER_POST
- USER_ADDON_CREATE: USER_ADDON_CREATE
- USER_BUSINESSES_READ: USER_BUSINESSES_READ
- USER_ID: USER_ID
- USER_PHONE: USER_PHONE
- USER_POSTS_ADDON_CREATE: USER_POSTS_ADDON_CREATE
- USER_POSTS_GET: USER_POSTS_GET
- USER_POSTS_STATS_READ: USER_POSTS_STATS_READ
- USER_SET_CUSTOMIZED_BUTTON: USER_SET_CUSTOMIZED_BUTTON
- USER_VERIFICATION_CREATE: USER_VERIFICATION_CREATE
- offline_access: offline_access
- openid: openid
Example
auth := context.WithValue(context.Background(), kenarapi.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)Or via OAuth2 module to automatically refresh tokens and perform user authentication.
import "golang.org/x/oauth2"
/* Perform OAuth2 round trip request and obtain a token */
tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, kenarapi.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:
PtrBoolPtrIntPtrInt32PtrInt64PtrFloatPtrFloat32PtrFloat64PtrStringPtrTime