Giter Club home page Giter Club logo

Comments (2)

MolotovCherry avatar MolotovCherry commented on May 25, 2024 1

Patching ListChapter with a serde rename is good enough for now to get the api to work again. I have had to add a local cargo patch for this (temporarily until it's fixed in master / gets a new release). (Also, a u16 seems to be a better choice to me considering these are numbers anyways)

#[serde(rename = "chapter")]
#[builder(setter(each = "add_chapter"))]
pub chapters: Vec<u16>,

from mangadex-api.

tonymushah avatar tonymushah commented on May 25, 2024 1

Well, the

#[serde(rename = "chapter")]

fixed the problem for now
but for the u16,
Some chapter can have floating points. (because the uploaders split it in parts)

Examples :

https://api.mangadex.org/chapter?manga=631f996b-3541-470c-9f18-ed02a447c64f&chapter[]=56.1`
{
  "result": "ok",
  "response": "collection",
  "data": [
    {
      "id": "48ce08b9-1609-4a52-8a54-f5cb06357345",
      "type": "chapter",
      "attributes": {
        "volume": null,
        "chapter": "56.1",
        "title": null,
        "translatedLanguage": "en",
        "externalUrl": null,
        "publishAt": "2023-07-27T19:45:47+00:00",
        "readableAt": "2023-07-27T19:45:47+00:00",
        "createdAt": "2023-07-27T19:45:47+00:00",
        "updatedAt": "2023-07-27T19:45:58+00:00",
        "pages": 16,
        "version": 3
      },
      "relationships": [
        {
          "id": "24adf288-d0e3-4d34-b342-bf8c189aacaa",
          "type": "scanlation_group"
        },
        {
          "id": "631f996b-3541-470c-9f18-ed02a447c64f",
          "type": "manga"
        },
        {
          "id": "28c85242-2605-4abf-9fd7-2879dc58f7e6",
          "type": "user"
        }
      ]
    }
  ],
  "limit": 10,
  "offset": 0,
  "total": 1
}
https://api.mangadex.org/chapter?chapter[]=123.2&translatedLanguage[0]=en
{
  "result": "ok",
  "response": "collection",
  "data": [
    {
      "id": "e26400db-df36-4de4-abf5-d9f065d7796a",
      "type": "chapter",
      "attributes": {
        "volume": "13",
        "chapter": "123.2",
        "title": "Guide (2)",
        "translatedLanguage": "en",
        "externalUrl": null,
        "publishAt": "2020-06-09T07:12:47+00:00",
        "readableAt": "2020-06-09T07:12:47+00:00",
        "createdAt": "2020-06-09T07:12:47+00:00",
        "updatedAt": "2020-06-09T07:12:47+00:00",
        "pages": 14,
        "version": 1
      },
      "relationships": [
        {
          "id": "1071e71d-cc55-4fa6-81d1-4b5913a2fde5",
          "type": "scanlation_group"
        },
        {
          "id": "34e45b02-b5c8-4a4b-a21a-7b5059391dc8",
          "type": "manga"
        },
        {
          "id": "416fcfbb-0f5c-40e2-9a4f-5dca25a33514",
          "type": "user"
        }
      ]
    },
    {
      "id": "92ca09ac-78b8-433a-8b9a-43778c388fc5",
      "type": "chapter",
      "attributes": {
        "volume": null,
        "chapter": "123.2",
        "title": "The Massacre",
        "translatedLanguage": "en",
        "externalUrl": null,
        "publishAt": "2020-10-15T12:56:04+00:00",
        "readableAt": "2020-10-15T12:56:04+00:00",
        "createdAt": "2020-10-15T12:56:04+00:00",
        "updatedAt": "2020-10-15T12:56:04+00:00",
        "pages": 28,
        "version": 1
      },
      "relationships": [
        {
          "id": "461047ab-d7a7-4bf2-a24a-94e77b923c9d",
          "type": "scanlation_group"
        },
        {
          "id": "931fd4fd-6c22-485e-b717-2dce335500b1",
          "type": "manga"
        },
        {
          "id": "1f8e10b6-f246-4fa9-be37-a2f9f4e1f65c",
          "type": "user"
        }
      ]
    }
  ],
  "limit": 10,
  "offset": 0,
  "total": 2
}
(you can test the url, if you have doubt)

I was thinking to put it as f32 but
after some testing, i found that some chapters can have a null value in the chapter property in their chapter attribute (it's often for oneshot titles)

Example :

https://api.mangadex.org/chapter?chapter[]=none&translatedLanguage[0]=en
{
  "result": "ok",
  "response": "collection",
  "data": [
    {
      "id": "d186aaeb-3968-4d9f-b6f9-d49b40bda193",
      "type": "chapter",
      "attributes": {
        "volume": null,
        "chapter": null,
        "title": "Oneshot",
        "translatedLanguage": "en",
        "externalUrl": null,
        "publishAt": "2018-01-15T16:59:50+00:00",
        "readableAt": "2018-01-15T16:59:50+00:00",
        "createdAt": "2018-01-15T16:59:50+00:00",
        "updatedAt": "2018-01-15T16:59:50+00:00",
        "pages": 22,
        "version": 1
      },
      "relationships": [
        {
          "id": "caf0d1da-a790-49d0-833c-ce74d651c8a1",
          "type": "scanlation_group"
        },
        {
          "id": "ed7bcfac-fc7e-4c63-9809-f551cbeca429",
          "type": "manga"
        },
        {
          "id": "16cf9cc6-78a4-4037-abdc-abf9145d74c8",
          "type": "user"
        }
      ]
    },
    {
      "id": "0c018f43-9abd-47f2-8cdd-648254247907",
      "type": "chapter",
      "attributes": {
        "volume": null,
        "chapter": null,
        "title": "Oneshot",
        "translatedLanguage": "en",
        "externalUrl": null,
        "publishAt": "2018-01-15T17:04:37+00:00",
        "readableAt": "2018-01-15T17:04:37+00:00",
        "createdAt": "2018-01-15T17:04:37+00:00",
        "updatedAt": "2018-01-15T17:04:37+00:00",
        "pages": 18,
        "version": 1
      },
      "relationships": [
        {
          "id": "caf0d1da-a790-49d0-833c-ce74d651c8a1",
          "type": "scanlation_group"
        },
        {
          "id": "758cf009-962e-4209-86f0-881dc4d907c9",
          "type": "manga"
        },
        {
          "id": "16cf9cc6-78a4-4037-abdc-abf9145d74c8",
          "type": "user"
        }
      ]
    },
    {
      "id": "a9a39c95-4f04-43d7-95f4-4973f1b7fdc4",
      "type": "chapter",
      "attributes": {
        "volume": null,
        "chapter": null,
        "title": "Oneshot",
        "translatedLanguage": "en",
        "externalUrl": null,
        "publishAt": "2018-01-15T18:39:14+00:00",
        "readableAt": "2018-01-15T18:39:14+00:00",
        "createdAt": "2018-01-15T18:39:14+00:00",
        "updatedAt": "2018-01-15T18:39:14+00:00",
        "pages": 34,
        "version": 1
      },
      "relationships": [
        {
          "id": "caf0d1da-a790-49d0-833c-ce74d651c8a1",
          "type": "scanlation_group"
        },
        {
          "id": "c0ffc3e0-4c80-4cf7-9c2f-befb427e8cb1",
          "type": "manga"
        },
        {
          "id": "16cf9cc6-78a4-4037-abdc-abf9145d74c8",
          "type": "user"
        }
      ]
    },
    {
      "id": "04366fab-644c-4af2-9985-4abcb7301bbd",
      "type": "chapter",
      "attributes": {
        "volume": null,
        "chapter": null,
        "title": "Oneshot",
        "translatedLanguage": "en",
        "externalUrl": null,
        "publishAt": "2018-01-15T21:03:44+00:00",
        "readableAt": "2018-01-15T21:03:44+00:00",
        "createdAt": "2018-01-15T21:03:44+00:00",
        "updatedAt": "2018-01-15T21:03:44+00:00",
        "pages": 22,
        "version": 1
      },
      "relationships": [
        {
          "id": "caf0d1da-a790-49d0-833c-ce74d651c8a1",
          "type": "scanlation_group"
        },
        {
          "id": "c13e0d14-dc23-452f-88d6-1024128e8735",
          "type": "manga"
        },
        {
          "id": "16cf9cc6-78a4-4037-abdc-abf9145d74c8",
          "type": "user"
        }
      ]
    },
    {
      "id": "037e9fbf-b442-414c-bc0d-58e4237adbaf",
      "type": "chapter",
      "attributes": {
        "volume": null,
        "chapter": null,
        "title": "Oneshot",
        "translatedLanguage": "en",
        "externalUrl": null,
        "publishAt": "2018-01-15T21:25:55+00:00",
        "readableAt": "2018-01-15T21:25:55+00:00",
        "createdAt": "2018-01-15T21:25:55+00:00",
        "updatedAt": "2018-01-15T21:25:55+00:00",
        "pages": 14,
        "version": 1
      },
      "relationships": [
        {
          "id": "caf0d1da-a790-49d0-833c-ce74d651c8a1",
          "type": "scanlation_group"
        },
        {
          "id": "f567872b-48f6-4ba3-a698-f4c79049a2ef",
          "type": "manga"
        },
        {
          "id": "16cf9cc6-78a4-4037-abdc-abf9145d74c8",
          "type": "user"
        }
      ]
    },
    {
      "id": "381deb72-170b-4258-9243-3655d8ab6eec",
      "type": "chapter",
      "attributes": {
        "volume": null,
        "chapter": null,
        "title": "Oneshot",
        "translatedLanguage": "en",
        "externalUrl": null,
        "publishAt": "2018-01-15T21:34:20+00:00",
        "readableAt": "2018-01-15T21:34:20+00:00",
        "createdAt": "2018-01-15T21:34:20+00:00",
        "updatedAt": "2018-01-15T21:34:20+00:00",
        "pages": 58,
        "version": 1
      },
      "relationships": [
        {
          "id": "caf0d1da-a790-49d0-833c-ce74d651c8a1",
          "type": "scanlation_group"
        },
        {
          "id": "bbfe9259-e78e-4f28-bf0d-066e9378f393",
          "type": "manga"
        },
        {
          "id": "16cf9cc6-78a4-4037-abdc-abf9145d74c8",
          "type": "user"
        }
      ]
    },
    {
      "id": "e2e8ebff-0fd7-4ee4-b2e2-4cec60229e33",
      "type": "chapter",
      "attributes": {
        "volume": "0",
        "chapter": null,
        "title": "Oneshot",
        "translatedLanguage": "en",
        "externalUrl": null,
        "publishAt": "2018-01-18T08:19:15+00:00",
        "readableAt": "2018-01-18T08:19:15+00:00",
        "createdAt": "2018-01-18T08:19:15+00:00",
        "updatedAt": "2018-01-18T08:19:15+00:00",
        "pages": 8,
        "version": 1
      },
      "relationships": [
        {
          "id": "2ad2fa1f-5303-494b-939e-9bbf20fd0e69",
          "type": "scanlation_group"
        },
        {
          "id": "94f4603b-4547-46cd-b1aa-f953b48084eb",
          "type": "manga"
        },
        {
          "id": "e6772ebc-c40d-4d3d-ad37-262bcc10381d",
          "type": "user"
        }
      ]
    },
    {
      "id": "0fcfa7a7-480b-4b7a-9a36-697232cace52",
      "type": "chapter",
      "attributes": {
        "volume": null,
        "chapter": null,
        "title": null,
        "translatedLanguage": "en",
        "externalUrl": null,
        "publishAt": "2018-01-18T08:47:03+00:00",
        "readableAt": "2018-01-18T08:47:03+00:00",
        "createdAt": "2018-01-18T08:47:03+00:00",
        "updatedAt": "2023-01-10T18:25:05+00:00",
        "pages": 28,
        "version": 2
      },
      "relationships": [
        {
          "id": "81d866d5-e900-494d-a6dc-8a00283b5c16",
          "type": "scanlation_group"
        },
        {
          "id": "5ebe4265-da26-4a3f-a2e4-5634af489ce5",
          "type": "manga"
        },
        {
          "id": "e6772ebc-c40d-4d3d-ad37-262bcc10381d",
          "type": "user"
        }
      ]
    },
    {
      "id": "8d04cfba-c7e0-4725-9174-7817a8a38f4a",
      "type": "chapter",
      "attributes": {
        "volume": "0",
        "chapter": null,
        "title": "Oneshot",
        "translatedLanguage": "en",
        "externalUrl": null,
        "publishAt": "2018-01-18T09:19:13+00:00",
        "readableAt": "2018-01-18T09:19:13+00:00",
        "createdAt": "2018-01-18T09:19:13+00:00",
        "updatedAt": "2018-01-18T09:19:13+00:00",
        "pages": 35,
        "version": 1
      },
      "relationships": [
        {
          "id": "2bbabd33-d09a-43f5-a100-69afa5fb12d2",
          "type": "scanlation_group"
        },
        {
          "id": "1b7a841f-6268-4d19-b926-de6cce8fc82d",
          "type": "manga"
        },
        {
          "id": "e6772ebc-c40d-4d3d-ad37-262bcc10381d",
          "type": "user"
        }
      ]
    },
    {
      "id": "7b8d6c6d-3fd1-4fb3-bdc7-f3d2d9e2f922",
      "type": "chapter",
      "attributes": {
        "volume": null,
        "chapter": null,
        "title": "Oneshot",
        "translatedLanguage": "en",
        "externalUrl": null,
        "publishAt": "2018-01-18T11:31:43+00:00",
        "readableAt": "2018-01-18T11:31:43+00:00",
        "createdAt": "2018-01-18T11:31:43+00:00",
        "updatedAt": "2022-07-24T12:30:40+00:00",
        "pages": 33,
        "version": 2
      },
      "relationships": [
        {
          "id": "81d866d5-e900-494d-a6dc-8a00283b5c16",
          "type": "scanlation_group"
        },
        {
          "id": "5867f104-8574-4dd8-a4f8-91bc0e420e36",
          "type": "manga"
        },
        {
          "id": "e6772ebc-c40d-4d3d-ad37-262bcc10381d",
          "type": "user"
        }
      ]
    }
  ],
  "limit": 10,
  "offset": 0,
  "total": 10875
}

So i will put it as String for now.
I wanted to put it as an enum but i don't have any clue of how should i do it.

Note :
Yes, none is null in the Mangadex Url query.
I don't even know why it's none.

from mangadex-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.