Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<img align="right" alt="FTAPIKit logo" src="Sources/FTAPIKit/Documentation.docc/Resources/FTAPIKit.svg">
<img align="right" alt="FTAPIKit logo" src="Sources/FTAPIKit/Documentation.docc/Resources/FTAPIKit.svg" height="65">

# FTAPIKit

Expand All @@ -13,6 +13,7 @@
Declarative and generic REST API framework using Codable.
With standard implementation using URLSesssion and JSON encoder/decoder.
Easily extensible for your asynchronous framework or networking stack.
The repository also contains set of Xcode templates, see `Installation`.

## Installation

Expand All @@ -29,6 +30,14 @@ When using CocoaPods add following line to your `Podfile`:
pod 'FTAPIKit', '~> 1.5'
```

The repository includes an API endpoint Xcode template for user convenience. You can install it using make:

```bash
git clone --depth=1 https://github.com/futuredapp/FTAPIKit.git
cd Templates
make
```

## Features

The main feature of this library is to provide documentation-like API
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// ___FILEHEADER___

import FTAPIKit

struct ___VARIABLE_templateName___Endpoint: APIEndpoint {

let path: String = ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// ___FILEHEADER___

import FTAPIKit

struct ___VARIABLE_templateName___Endpoint: APIRequestEndpoint {
typealias Request = ___VARIABLE_templateName___Request

var body: ___VARIABLE_templateName___Request
var path: String
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// ___FILEHEADER___

import Foundation

struct ___VARIABLE_templateName___Request: Encodable {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// ___FILEHEADER___

import FTAPIKit

struct ___VARIABLE_templateName___Endpoint: APIRequestResponseEndpoint {
typealias Response = ___VARIABLE_templateName___Response
typealias Request = ___VARIABLE_templateName___Request

var body: ___VARIABLE_templateName___Request
let path: String = ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// ___FILEHEADER___

import Foundation

struct ___VARIABLE_templateName___Request: Encodable {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// ___FILEHEADER___

import Foundation

struct ___VARIABLE_templateName___Response: Decodable {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// ___FILEHEADER___

import FTAPIKit

struct ___VARIABLE_templateName___Endpoint: APIResponseEndpoint {
typealias Response = ___VARIABLE_templateName___Response

let path: String = ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// ___FILEHEADER___

import Foundation

struct ___VARIABLE_templateName___Response: Decodable {
}
Binary file added Templates/Endpoints.xctemplate/TemplateIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Templates/Endpoints.xctemplate/TemplateIcon@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions Templates/Endpoints.xctemplate/TemplateInfo.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DefaultCompletionName</key>
<string>Endpoint</string>
<key>Description</key>
<string>This generates a new endpoint for use with the APIAdapter from the FTAPIKit.</string>
<key>Kind</key>
<string>Xcode.IDEKit.TextSubstitutionFileTemplateKind</string>
<key>Options</key>
<array>
<dict>
<key>Description</key>
<string>The name of the endpoint</string>
<key>Identifier</key>
<string>endpointName</string>
<key>Name</key>
<string>Endpoint file name:</string>
<key>NotPersisted</key>
<true/>
<key>Required</key>
<true/>
<key>Type</key>
<string>text</string>
</dict>
<dict>
<key>Description</key>
<string>The name of template request.</string>
<key>Identifier</key>
<string>templateName</string>
<key>Name</key>
<string>Template endpoint name:</string>
<key>NotPersisted</key>
<true/>
<key>Required</key>
<true/>
<key>Type</key>
<string>text</string>
</dict>
<dict>
<key>Identifier</key>
<string>hasRequest</string>
<key>Name</key>
<string>Generate Request file</string>
<key>Description</key>
<string>Check whethe you want to create file containing requests.</string>
<key>Type</key>
<string>checkbox</string>
</dict>
<dict>
<key>Identifier</key>
<string>hasResponse</string>
<key>Name</key>
<string>Generate Response file</string>
<key>Description</key>
<string>Check whethe you want to create file containing responses.</string>
<key>Type</key>
<string>checkbox</string>
</dict>
</array>
<key>Platforms</key>
<array>
<string>com.apple.platform.iphoneos</string>
</array>
<key>SortOrder</key>
<string>99</string>
<key>Summary</key>
<string>This generates a new service for use with the ServiceHolder (dependency injection) from the FuturedKit.</string>
</dict>
</plist>
9 changes: 9 additions & 0 deletions Templates/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
TEMPLATE_DIR = $(HOME)/Library/Developer/Xcode/Templates/FTAPIKit

install:
mkdir -p $(TEMPLATE_DIR)
cp -R *.xctemplate $(TEMPLATE_DIR)/
echo "\033[0;32mInstallation was successful!\033[0m"

.PHONY: install
.SILENT: install
Loading