Skip to content

Commit 02a2b67

Browse files
feat(swift5): use Basic auth instead of Bearer
1 parent 356ea6f commit 02a2b67

File tree

1 file changed

+67
-57
lines changed

1 file changed

+67
-57
lines changed
Lines changed: 67 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,77 @@
1-
---
2-
title: api.video Swift video uploader
3-
meta:
4-
description: The official api.video Swift video uploader for api.video. [api.video](https://api.video/) is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.
5-
---
6-
7-
# api.video Swift video uploader
8-
9-
[api.video](https://api.video/) is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.
10-
11-
## Project description
12-
13-
api.video's Swift uploader uploads videos using delegated upload token or API Key.
1+
[![badge](https://img.shields.io/twitter/follow/api_video?style=social)](https://twitter.com/intent/follow?screen_name=api_video)   [![badge](https://img.shields.io/github/stars/apivideo/api.video-swift-uploader?style=social)]()   [![badge](https://img.shields.io/discourse/topics?server=https%3A%2F%2Fcommunity.api.video)](https://community.api.video)
2+
![](https://github.com/apivideo/.github/blob/main/assets/apivideo_banner.png)
3+
<h1 align="center">api.video Swift uploader</h1>
4+
5+
[api.video](https://api.video) is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.
6+
7+
# Table of contents
8+
9+
- [Project description](#project-description)
10+
- [Getting started](#getting-started)
11+
- [Installation](#installation)
12+
- [Carthage](#carthage)
13+
- [CocoaPods](#cocoaPods)
14+
- [Code sample](#code-sample)
15+
- [Documentation](#documentation)
16+
- [API Endpoints](#api-endpoints)
17+
- [VideosAPI](#VideosAPI)
18+
- [Models](#models)
19+
- [Authorization](#documentation-for-authorization)
20+
- [API key](#api-key)
21+
- [Public endpoints](#public-endpoints)
22+
- [Have you gotten use from this API client?](#have-you-gotten-use-from-this-api-client)
23+
- [Contribution](#contribution)
24+
25+
# Project description
26+
27+
api.video's Swift for iOS, macOS and tvOS uploads videos to api.video using delegated upload token or API Key.
1428

1529
It allows you to upload videos in two ways:
1630
- standard upload: to send a whole video file in one go
1731
- progressive upload: to send a video file by chunks, without needing to know the final size of the video file
1832

19-
## Getting started
33+
# Getting started
2034

21-
### Installation
35+
## Installation
2236

23-
#### Carthage
37+
### Carthage
2438

2539
Specify it in your `Cartfile`:
2640

2741
```
28-
github "apivideo/api.video-swift-uploader" ~> 1.2.1
42+
github "apivideo/api.video-swift-uploader" ~> 1.2.2
2943
```
3044

3145
Run `carthage update`
3246

33-
#### CocoaPods
47+
### CocoaPods
3448

35-
Add `pod 'ApiVideoUploader', '1.2.1'` in your `Podfile`
49+
Add `pod 'ApiVideoUploader', '1.2.2'` in your `Podfile`
3650

3751
Run `pod install`
3852

39-
### Code sample
53+
## Code sample
4054

4155
Please follow the [installation](#installation) instruction and execute the following Swift code:
4256
```swift
4357
import ApiVideoUploader
4458

59+
// If you rather like to use the sandbox environment:
60+
// ApiVideoUploader.basePath = Environment.sandbox.rawValue
4561

46-
// If you rather like to use the sandbox environment:
47-
// ApiVideoUploader.basePath = Environment.sandbox.rawValue
48-
// If you rather like to upload with your "YOUR_API_KEY" (upload)
49-
// ApiVideoUploader.apiKey = "YOUR_API_KEY"
50-
51-
try VideosAPI.uploadWithUploadToken(token: "MY_VIDEO_TOKEN", file: url) { video, error in
52-
if let video = video {
53-
// Manage upload with upload token success here
54-
}
55-
if let error = error {
56-
// Manage upload with upload token error here
57-
}
62+
try VideosAPI.uploadWithUploadToken(token: "MY_VIDEO_TOKEN", file: url) { video, error in
63+
if let video = video {
64+
// Manage upload with upload token success here
5865
}
59-
66+
if let error = error {
67+
// Manage upload with upload token error here
68+
}
69+
}
6070
```
6171

62-
## Documentation
72+
# Documentation
6373

64-
### API Endpoints
74+
## API Endpoints
6575

6676
All URIs are relative to *https://ws.api.video*
6777

@@ -78,47 +88,47 @@ VideosAPI
7888

7989
Method | HTTP request | Description
8090
------------- | ------------- | -------------
81-
[**upload**](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/VideosAPI.md#upload) | **POST** /videos/{videoId}/source | Upload a video
82-
[**uploadWithUploadToken**](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/VideosAPI.md#uploadWithUploadToken) | **POST** /upload | Upload with an delegated upload token
91+
[**upload**](docs/VideosAPI.md#upload) | **POST** /videos/{videoId}/source | Upload a video
92+
[**uploadWithUploadToken**](docs/VideosAPI.md#uploadWithUploadToken) | **POST** /upload | Upload with an delegated upload token
8393

8494

8595

86-
### Models
96+
## Models
8797

88-
- [AccessToken](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/AccessToken.md)
89-
- [AdditionalBadRequestErrors](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/AdditionalBadRequestErrors.md)
90-
- [AuthenticatePayload](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/AuthenticatePayload.md)
91-
- [BadRequest](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/BadRequest.md)
92-
- [Metadata](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/Metadata.md)
93-
- [NotFound](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/NotFound.md)
94-
- [RefreshTokenPayload](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/RefreshTokenPayload.md)
95-
- [Video](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/Video.md)
96-
- [VideoAssets](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/VideoAssets.md)
97-
- [VideoSource](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/VideoSource.md)
98-
- [VideoSourceLiveStream](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/VideoSourceLiveStream.md)
99-
- [VideoSourceLiveStreamLink](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/VideoSourceLiveStreamLink.md)
98+
- [AccessToken](docs/AccessToken.md)
99+
- [AdditionalBadRequestErrors](docs/AdditionalBadRequestErrors.md)
100+
- [AuthenticatePayload](docs/AuthenticatePayload.md)
101+
- [BadRequest](docs/BadRequest.md)
102+
- [Metadata](docs/Metadata.md)
103+
- [NotFound](docs/NotFound.md)
104+
- [RefreshTokenPayload](docs/RefreshTokenPayload.md)
105+
- [Video](docs/Video.md)
106+
- [VideoAssets](docs/VideoAssets.md)
107+
- [VideoSource](docs/VideoSource.md)
108+
- [VideoSourceLiveStream](docs/VideoSourceLiveStream.md)
109+
- [VideoSourceLiveStreamLink](docs/VideoSourceLiveStreamLink.md)
100110

101111

102112
## Documentation for Authorization
103113

104114
### API key
105115

106116
Most endpoints required to be authenticated using the API key mechanism described in our [documentation](https://docs.api.video/reference#authentication).
107-
The access token generation mechanism is automatically handled by the client. All you have to do is provide an API key:
108-
```swift
109-
ApiVideoUploader.apiKey = YOUR_API_KEY
110-
```
117+
118+
You must NOT store your API key in your application code to prevent your API key from being exposed in your source code.
119+
Only the [Public endpoints](#public-endpoints) can be called without authentication.
120+
In the case, you want to call an endpoint that requires authentication, you will have to use a backend server. See [Security best practices](https://docs.api.video/sdks/security) for more details.
111121

112122
### Public endpoints
113123

114-
Some endpoints don't require authentication. These one can be called without setting `ApiVideoUploader.apiKey`:
124+
Some endpoints don't require authentication. These one can be called without setting `ApiVideoUploader.apiKey`.
115125

116126
## Have you gotten use from this API client?
117127

118128
Please take a moment to leave a star on the client ⭐
119129

120130
This helps other users to find the clients and also helps us understand which clients are most popular. Thank you!
121131

122-
## Contribution
132+
# Contribution
123133

124-
Since this API client is generated from an OpenAPI description, we cannot accept pull requests made directly to the repository. If you want to contribute, you can open a pull request on the repository of our [client generator](https://github.com/apivideo/api-client-generator). Otherwise, you can also simply open an issue detailing your need on this repository.
134+
Since this API client is generated from an OpenAPI description, we cannot accept pull requests made directly to the repository. If you want to contribute, you can open a pull request on the repository of our [client generator](https://github.com/apivideo/api-client-generator). Otherwise, you can also simply open an issue detailing your need on this repository.

0 commit comments

Comments
 (0)