Xojo API client for OpenAPIClient

This is a sample server Petstore server. For this sample, you can use the api key special-key to test the authorization filters.

Overview

This API client was generated by the OpenAPI Generator project. By using the openapi-spec from a remote server, you can easily generate an API client.

  • API version: 1.0.0
  • Package version:
  • Build package: org.openapitools.codegen.languages.XojoClientCodegen

Installation

This project contains generated code suitable for both Desktop and Console applications on all operating systems.

The code is generated for Xojo's API v1.

The generated code is packaged into a single Module (OpenAPIClient), which we suggest copying to your project after opening the generated OpenAPIClient.xojo_project in Xojo. Working in the generated Xojo project is not recommended.

See also Xojo's Sharing code among multiple projects.

This project depends on Xoson v2.2.0 (and above). Download it to your computer:

git clone 'https://github.com/Topheee/xoson.git'

Open the Xoson.xojo_project from the cloned git repository with Xojo and copy the Xoson module to your project. Similarily, open the OpenAPIClient.xojo_project file with Xojo and copy OpenAPIClient to your project.

Since Xojo currently has no package manager, you need to manually copy both the Xoson and the OpenAPIClient modules to your Xojo project.

Both modules must not be copied into another module, but must reside at the top level of your project.

Customization

The generator can be configured with the following options.

Option Used Description
projectName OpenAPIClient The name of the generated project and module.
nonPublicApi false Generate Protected instead of Public methods, if set.
library httpsocket Internal Xojo standard library object to use. Currently only httpsocket (HTTPSocket class) is supported.
serializationLibrary {xoson Internal library to use for serialization. Currently only xoson (Xoson library) is supported.
supportsAsync true If true, generated APIs will use callbacks instead of blocking the main thread.

Usage

Communication with the OpenAPI server is done by instantiating one of the classes below OpenAPIClient.APIs, configuring it - by setting BasePath, UseHTTPS, and Port - and invoking the Public methods. The methods always return immediately and the network communication is done in the background. To obtain the results and errors of each request, you need to implement the respective CallbackHandler interfaces:

  • OpenAPIClient.APIs.PetApiCallbackHandler
  • OpenAPIClient.APIs.StoreApiCallbackHandler
  • OpenAPIClient.APIs.UserApiCallbackHandler

Create an object of your implementing class and assign it to the CallbackHandler property of the API object.

This callback handler has exactly one method definition for each operation. This method is invoked when the operation finishes. It's first parameter status As OpenAPIClient.OpenAPIClientException is always set. If status.IsError is False, the operation succeeded and the return value (either data or file) - if available - contains valid information.

The property AdditionalHeaders allows sending further headers with each request. Set it to a new Dictionary, with the Keys being the header names and the values either being a single String or an array of Strings.

Error handling, as well as status reporting, is done via class OpenAPIClient.OpenAPIClientException. Note that an instance of this class does not always indicate an error - check IsError to find out.

  • ErrorNumber is set to one of the OpenAPIClient.kError constants, or 0 in case of no error.
  • HTTPStatus is set to the HTTP status code as returned by the server. If the error is unrelated to HTTP, this property is -1.
  • SocketCode contains the socket error, if any; otherwise 0.

Documentation for API Endpoints

All URIs are relative to http://petstore.swagger.io/v2

Class Method HTTP request Description
OpenAPIClient.APIs.PetApi AddPet POST /pet Add a new pet to the store
OpenAPIClient.APIs.PetApi DeletePet DELETE /pet/{petId} Deletes a pet
OpenAPIClient.APIs.PetApi FindPetsByStatus GET /pet/findByStatus Finds Pets by status
OpenAPIClient.APIs.PetApi FindPetsByTags GET /pet/findByTags Finds Pets by tags
OpenAPIClient.APIs.PetApi GetPetById GET /pet/{petId} Find pet by ID
OpenAPIClient.APIs.PetApi UpdatePet PUT /pet Update an existing pet
OpenAPIClient.APIs.PetApi UpdatePetWithForm POST /pet/{petId} Updates a pet in the store with form data
OpenAPIClient.APIs.PetApi UploadFile POST /pet/{petId}/uploadImage uploads an image
OpenAPIClient.APIs.StoreApi DeleteOrder DELETE /store/order/{orderId} Delete purchase order by ID
OpenAPIClient.APIs.StoreApi GetInventory GET /store/inventory Returns pet inventories by status
OpenAPIClient.APIs.StoreApi GetOrderById GET /store/order/{orderId} Find purchase order by ID
OpenAPIClient.APIs.StoreApi PlaceOrder POST /store/order Place an order for a pet
OpenAPIClient.APIs.UserApi CreateUser POST /user Create user
OpenAPIClient.APIs.UserApi CreateUsersWithArrayInput POST /user/createWithArray Creates list of users with given input array
OpenAPIClient.APIs.UserApi CreateUsersWithListInput POST /user/createWithList Creates list of users with given input array
OpenAPIClient.APIs.UserApi DeleteUser DELETE /user/{username} Delete user
OpenAPIClient.APIs.UserApi GetUserByName GET /user/{username} Get user by user name
OpenAPIClient.APIs.UserApi LoginUser GET /user/login Logs user into the system
OpenAPIClient.APIs.UserApi LogoutUser GET /user/logout Logs out current logged in user session
OpenAPIClient.APIs.UserApi UpdateUser PUT /user/{username} Updated user

Documentation For Models

Documentation For Authorization

petstore_auth

api_key

  • Type: API key
  • API key parameter name: api_key
  • Location: HTTP header

Author