Skip to content

Simple API client sample in Swift that retrieves a list of collections

License

Notifications You must be signed in to change notification settings

lab5e/swift-simple

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Span API client sample in Swift

Build the sample with swift build.

To run it, create a new API token in the Span dashboard and run

swift run span-sample --api-token=[API token]

Generating the client

Rather than using a prebuilt client the OpenAPI generator is a plugin in the project as described in this tutorial from Apple.

You'll have to add the openapi.yaml file from the service but it's relatively easy to update the yaml file as part of your build process.

The two YAML files in the Sources is used by the OpenAPI generator plugin to build the client. The Packages.swift file contains the required dependencies.

Getting the OpenAPI spec

The OpenAPI spec is available in several other repositories; you can download it with wget before building. This will download the latest version of the specification:

cd Sources
rm -f openapi.yaml
wget https://raw.githubusercontent.com/lab5e/go-spanapi/main/api/openapi.yaml

About

Simple API client sample in Swift that retrieves a list of collections

Topics

Resources

License

Stars

Watchers

Forks

Languages