Skip to content

This project contains core logic and the utilities for the APIMatic's Go SDK

License

Notifications You must be signed in to change notification settings

apimatic/go-core-runtime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started with Go Core Runtime

Go Reference GitHub release Licence Tests Test Coverage Maintainability

Introduction

The go-core-runtime is a core library for Apimatic's Go SDK, providing essential utilities and structures for handling API requests and responses using the HTTP protocol. For detailed API documentation and usage examples, visit the GoDoc documentation.

Requirement

This package requires Go v1.18 or higher.

Installation

To install the package, you can use go get:

go get github.com/apimatic/go-core-runtime

Alternatively, you can add the package manually to your go.mod file:

require "github.com/apimatic/go-core-runtime" v0.0.x

Then, run the following command to install the package automatically:

go get ./...

Package Details

Following is a list of all packages. Here each package contains its own test files.

HTTPS

The https package provides logic related to HTTP requests, including building and making the request call. It offers features such as handling form data, file parameters, headers, and interceptors.

File Name Description
API Response Provides a struct around the HTTP response and the data.
API Error Provides a structure to represent error responses from API calls.
Array Serialization Provides constants for array serialization like Indexed, Plain, etc.
Auth Group Provides capability to group authentication keys into groups.
Auth Interface Defines the functionality of an authentication manager.
Call Builder Provides the logic related to the HTTPs request. Includes building and making the request call.
File Wrapper Provides a wrapper for file parameters to use in the HTTPs calls.
Form Data Provides handling of form parameters in the request.
HTTP Client Provides an interface for the HTTP Client to use for making the calls.
HTTP Configuration Provides configurations for the HTTP calls.
HTTP Context Provides a struct that holds request and corresponding response instances.
HTTP Headers Provides handling for headers to send with the request.
Internal Error Provides handling for internal errors that may occur during the API calls.
Interceptors Provides handling to intercept requests.
Retryer Provides handling to automatically retry for failed requests.

Logger

The logger package provides logic related to logging. It offers the Facade Design Pattern for configuring the Logger and SDK Logger. Additionally, it provides the LoggerConfiguration to customize logging behavior.

File Name Description
Console Logger Provides default implementation of Logger Interface to log messages.
Level Provides constants for log level like Level_ERROR, Level_INFO, etc.
Logger Configuration Provides logging configurations for the Sdk Logger.
Response Logger Configuration Provides response logging configurations for the Sdk Logger.
Request Logger Configuration Provides request logging configurations for the Sdk Logger.
Sdk Logger Provides default and null implementation of Sdk Logger Interface to log API requests and responses.

Test Helper

Package testHelper provides helper functions for testing purposes.

File Name Description
BodyMatchers Provides functions to match JSON response bodies with expected bodies.
HeadersMatchers Provides functions to match HTTP headers with expected headers.
StatusCodeMatchers Provides functions to match HTTP status codes with expected status codes.

Types

Package types provides utility types and functions.

File Name Description
Optional Provides a wrapper to use any type as optional and nullable.

Utilities

The utilities package provides utility functions for making HTTP calls.

File Name Description
API Helper Provides helper functions for making the HTTP calls.
Marshal Error Defines a structure for error that will be returned if marshalling/unmarshalling fail.
Union Type Helper Provides helper functions for unmarshalling containers of multiple types.

Contributing

Contributions are welcome! If you encounter any issues or have suggestions for improvement, please open an issue.

License

This project is licensed under the MIT License.

Contact

For any questions or support, please feel free to contact us at [email protected].