From 94bbe7cb4d30add8d9efe59da837cd32cb61f9f4 Mon Sep 17 00:00:00 2001 From: ThibaultBee Date: Mon, 23 Oct 2023 14:53:35 +0000 Subject: [PATCH] Docs/mobile readme upload token only --- .../oas_apivideo.yaml-defaut-cli.sha256 | 2 +- README.md | 39 ++++++------------- 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/.openapi-generator/oas_apivideo.yaml-defaut-cli.sha256 b/.openapi-generator/oas_apivideo.yaml-defaut-cli.sha256 index 4f31ad3..2c9e058 100644 --- a/.openapi-generator/oas_apivideo.yaml-defaut-cli.sha256 +++ b/.openapi-generator/oas_apivideo.yaml-defaut-cli.sha256 @@ -1 +1 @@ -c2fec7ee1f9063f8d6a0b0e70054bcf32aa36ac56db9d158dc77cb34150c6c62 \ No newline at end of file +032886cdfe39127b6fc7d3d9f5b3ca50c10d0be913d68ea0f1a9de1ff23d24b0 \ No newline at end of file diff --git a/README.md b/README.md index 2709bb9..ef539b1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![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-client?style=social)]()   [![badge](https://img.shields.io/discourse/topics?server=https%3A%2F%2Fcommunity.api.video)](https://community.api.video) ![](https://github.com/apivideo/.github/blob/main/assets/apivideo_banner.png) -

api.video iOS client

+

api.video Swift client

[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. @@ -31,7 +31,7 @@ - [Contribution](#contribution) # Project description -api.video's iOS streamlines the coding process. Chunking files is handled for you, as is pagination and refreshing your tokens. +api.video's Swift for iOS, macOS and tvOS streamlines the coding process. Chunking files is handled for you, as is pagination and refreshing your tokens. # Getting started @@ -59,30 +59,15 @@ Please follow the [installation](#installation) instruction and execute the foll ```swift import ApiVideoClient - ApiVideoClient.apiKey = "YOUR_API_KEY" - // if you rather like to use the sandbox environment: - // ApiVideoClient.basePath = Environment.sandbox.rawValue +// If you rather like to use the sandbox environment: +// ApiVideoClient.basePath = Environment.sandbox.rawValue - let url = URL(string: "My video.mov") - - VideosAPI.create(videoCreationPayload: VideoCreationPayload(title: "my video")) { video, error in +try VideosAPI.uploadWithUploadToken(token: "MY_VIDEO_TOKEN", file: url) { video, error in if let video = video { - do { - try VideosAPI.upload(videoId: video.videoId, - file: url) { video, error in - if let video = video { - // Manage upload success here - } - if let error = error { - // Manage upload error here - } - } - } catch { - // Manage error on file here - } + // Manage upload with upload token success here } if let error = error { - // Manage create error here + // Manage upload with upload token error here } } ``` @@ -347,14 +332,14 @@ Method | HTTP request | Description ### API key Most endpoints required to be authenticated using the API key mechanism described in our [documentation](https://docs.api.video/reference#authentication). -The access token generation mechanism is automatically handled by the client. All you have to do is provide an API key: -```swift -ApiVideoClient.apiKey = YOUR_API_KEY -``` + +You must NOT store your API key in your application code to prevent your API key from being exposed in your source code. +Only the [Public endpoints](#public-endpoints) can be called without authentication. +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. ### Public endpoints -Some endpoints don't require authentication. These one can be called without setting `ApiVideoClient.apiKey`: +Some endpoints don't require authentication. These one can be called without setting `ApiVideoClient.apiKey`. ## Have you gotten use from this API client?