Skip to content

I can't find some API method or parameter in library

Alexey Kudryavtsev edited this page Mar 24, 2019 · 1 revision

If you can't find API method or parameter in library, you have several options to solve this:


Add new method to the library and make pull request (recommended)

You can add new section/method/parameter to the library and make pull request with these changes. Bellow text describes how to make changes in different cases.

NOTE: If you have never made pull requests on Github, please read this topic

If you need to add new parameter:

  1. Open ./Library/Sources/API Supporting/Parameters file.
  2. Scroll to end of Parameter enum.
  3. Add new method like this:
case nameOfMethodInCamelCase = "name_of_method_in_snake_case"

If you need to add new method:

  1. Go to ./Library/Sources/API/. Files in this section matches with VK API method sections.
  2. Open file where to add new method.
  3. Add new parameter like this:
case newMethodNameInCamelCase(Parameters)

If you need to add new section of methods:

  1. Go to ./Library/Sources/API/. Files in this section matches with VK API method sections.
  2. Add new file like this:
extension APIScope {
    /// https://vk.com/dev/nameOfSection
    public enum NameOfSection: APIMethod {
        // List of methods like this
        case methodNameInCamelCase(Parameters)
    }
}
  1. Add all section's methods to new file.

Use untyped API call and make issue

It's fastest and easiest way if you don't want to create pull request. But it's not recommended way because it's avoid swift's strong typed nature, and it's local crutch which make you code worse.

VK.API.Custom.method(name: "sectiion.method", parameters: ["parameter": "value"])

After this, please create issue about it here. It allows to add new method or parameter into library in next releases.