Vehicles - Gio85/swapi-ts-sdk GitHub Wiki

In order to fetch the data, the following methods can be used;

  • getSchema() which will return the resource schema
  • read() which will return the single resource
  • list() which will return the resources list

Examples:

  // Get the instance of the client
  const client = ApiClient.getInstance()

  const vehicles = await client.vehicles.list({ search: 'Sand Crawler' })
  const vehicles = await client.vehicles.list({ page: 3 })
  const vehiclesSchema = await client.vehicles.getSchema()
  const singleVehicle = await client.vehicles.read('6')