GithubHelp home page GithubHelp logo

quange / aliyunpan-ios-sdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alibaba/aliyunpan-ios-sdk

0.0 0.0 0.0 745 KB

阿里云盘 OpenSDK-iOS

License: MIT License

Ruby 0.56% Objective-C 0.40% Swift 99.04%

aliyunpan-ios-sdk's Introduction

AliyunpanSDK

pod version

This is the open-source SDK for Aliyunpan OpenAPI.

Getting Started

To begin using the sdk, visit our guide that will walk you through the setup process:

👉 Guide

Quick start

1. Create a client

You can create a client either by using PKCE or server credentials.

// Using PKCE
let client: AliyunpanClient = AliyunpanClient(
    .init(
        appId: "YOUR_APP_ID",
        scope: "YOUR_SCOPE", // e.g. user:base,file:all:read
        credentials: .pkce))

// Using server credentials
class YOUR_SERVER_CLASS: AliyunpanBizServer {
    ...
}
let client: AliyunpanClient = AliyunpanClient(
    .init(
        appId: "YOUR_APP_ID",
        scope: "YOUR_SCOPE", // e.g. user:base,file:all:read
        credentials: .server(YOUR_SERVER_CLASS())))

2. Send Commands

With this SDK, you can easily interface all openAPIs and their request/response models.

// Concurrency
try await client.send(
    AliyunpanScope.User.GetUsersInfo()) // -> GetUsersInfo.Response

try await client.send(
    AliyunpanScope.File.GetFileList(
        .init(drive_id: driveId, parent_file_id: "root")))) // -> GetFileList.Response
        
// Closure
client.send(
    AliyunpanScope.User.GetUsersInfo()) { result in
    /// do something
}

Advanced Usage

This SDK also provides advanced functionalities to make your development faster and smoother.

Download

let downloader = client.downloader(file, to: destination)

downloader.download { progress in
    // do something..
} completionHandle: { result in
    if let url = try? result.get() {
        // File is downloaded, process the file
    } else {
        // Handle other cases
    }
}

downloader.networkSpeedMonitor = { bytesReceived in
    // This closure is called with the number of bytes downloaded in the last second.
    // You can use `bytesReceived` to update the UI or perform other actions based on the current network speed.
}

Requirements

  • iOS 13.0+
  • Swift 5.0+

Installation

Swift Package Manager

  • File > Swift Packages > Add Package Dependency
  • Add https://github.com/alibaba/aliyunpan-ios-sdk.git

CocoaPods

target 'MyApp' do
  pod 'AliyunpanSDK', '~> 0.1.0'
end

Documents

👉 Documents

License

This project is licensed under the MIT License.

aliyunpan-ios-sdk's People

Contributors

wzxha avatar quange avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.