Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method to add date without translation to unixtimestamp #1579

Open
Rahovski opened this issue Aug 21, 2023 · 0 comments
Open

Add method to add date without translation to unixtimestamp #1579

Rahovski opened this issue Aug 21, 2023 · 0 comments
Milestone

Comments

@Rahovski
Copy link
Contributor

Problem

For example method market.get take parametrs date_from and date_to in native format.

Example:

Request with error

https://api.vk.com/method/market.get?access_token={token}&owner_id=-85689507&v=5.131&offset=0&count=1&date_from=1660083630

Answer

{
    "error": {
        "error_code": 100,
        "error_msg": "One of the parameters specified was missing or invalid: period, date_from is invalid",
        "request_params": [
            {
                "key": "method",
                "value": "market.get"
            },
            {
                "key": "oauth",
                "value": "1"
            },
            {
                "key": "owner_id",
                "value": "-85689507"
            },
            {
                "key": "count",
                "value": "1"
            },
            {
                "key": "offset",
                "value": "0"
            },
            {
                "key": "date_from",
                "value": "1660083630"
            },
            {
                "key": "need_variants",
                "value": "0"
            },
            {
                "key": "with_disabled",
                "value": "0"
            },
            {
                "key": "v",
                "value": "5.131"
            }
        ]
    }
}

Correct request

https://api.vk.com/method/market.get?access_token={token}&owner_id=-85689507&v=5.131&offset=0&count=1&date_from=10.08.2022

Answer

{
    "response": {
        "count": 33,
        "items": [
            {
                "availability": 0,
                "category": {
                    "id": 30417,
                    "name": "Скейтборды и лонгборды",
                    "section": {
                        "id": 10005,
                        "name": "Спорт и отдых"
                    }
                },
                "description": "Длина: 48\nШирина: 9.5\nКонкейв: U-образный\nФлекс: мягкий, средний, жесткий\nТейлы: 13, 14, 15см\nПолиуретановая защита по всему периметру\nДизайн: Катя Войнова",
                "id": 6996779,
                "owner_id": -85689507,
                "price": {
                    "amount": "2090000",
                    "currency": {
                        "id": 643,
                        "name": "RUB",
                        "title": ""
                    },
                    "text": "20900 ₽"
                },
                "title": "Inari Limited",
                "is_owner": false,
                "is_adult": false,
                "thumb_photo": "https://sun1-86.userapi.com/impg/8hNEdxiX4SVRvdWfoq2w3M1bNAec26YMJfo89g/oRnEDxKMbAI.jpg?crop=0,0.217,1,0.566&size=400x0&quality=95&sign=dff7829b1287259e04e06f5feb939f24&c_uniq_tag=vl-y7yC5xLSi8BLJTJyIf4ZTzI8dx3X1bvto-nfbo-A",
                "cart_quantity": 0,
                "item_rating": {
                    "rating": 0,
                    "reviews_count": 0,
                    "reviews_count_text": "Нет отзывов"
                }
            }
        ]
    }
}

Where problem

In file VkParameters.cs method

public void Add(string name, DateTime? nullableDateTime)

Convert DateTime arg to unix time format, but some methods in api request native datetime

Possible solution

  1. Add override method to convert Datetime to correct string
  2. Rebuild this method from unit time format to native datetime format
@inyutin-maxim inyutin-maxim added this to the v1.77.0 milestone Sep 11, 2023
@inyutin-maxim inyutin-maxim modified the milestones: v1.77.0, v1.78.0 Nov 24, 2023
@inyutin-maxim inyutin-maxim modified the milestones: v1.78.0, v1.79.0 Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants