Skip to content

smartfile/client-objectivec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SmartFile

A SmartFile Open Source project. Read more about how SmartFile uses and contributes to Open Source software.

Summary

This library includes two API clients. Each one represents one of the supported authentication methods. SFBasicClient is used for HTTP Basic authentication, using an API key and password. SFOAuth1Client is used for OAuth (version 1) authentication, using tokens, which will require user interaction to complete authentication with the API.

Both clients provide a wrapper around AFNetworking library, taking care of some of the mundane details for you. The intended use of this library is to refer to the API documentation to discover the API endpoint you wish to call, then use the client library to invoke this call.

SmartFile API information is available at the SmartFile developer site.

Installation

Get the source code from GitHub.

$ git clone https://github.com/smartfile/client-objectivec.git smartfile
$ cd smartfile

You can see following directory structure.

Example
SmartFile
SmartFileTests
README.rst

Copy SmartFile folder to your project. In your source code import

#import "SFBasicClient.h"

or

#import "SFOAuth1Client.h"

depending on which authentication method you want to use.

More information is available at GitHub.

Usage

Choose between Basic and OAuth authentication methods, then continue to use the SmartFile API. Check the Example project which implements a simple SmartFile browser or SmartFileTests project that has dosen of SmartFile API call examples.

Running Example

Before running Example application ensure that SM_API_URL and SM_API_VERSION are set to appropriate values in SFCredentials.h. Otherwise the exception will be raised.

Running Tests

Before running tests ensure that SM_API_URL and SM_API_VERSION as well as SM_BASIC_API_KEY SM_BASIC_API_PASSWORD are set in Credentials.h. Otherwise tests will fail.

Basic Authentication

Basic authentication is quite simple and requires you to provide API key and password.

OAuth Authentication

Authentication using OAuth authentication is bit more complicated, as it involves tokens and secrets.

Calling endpoints

Once you instantiate a client, you can use the get/put/post/delete methods to make the corresponding HTTP requests to the API. There is also a shortcut for using the GET method, which is to simply invoke the client.

Some endpoints accept an ID, this might be a numeric value, a path, or name, depending on the object type. For example, a user's id is their unique username. For a file path, the id is it's full path.

Result will be similar to:

{u'acl': {u'list': True, u'read': True, u'remove': True, u'write': True},
 u'attributes': {},
 u'extension': u'',
 u'id': 7,
 u'isdir': True,
 u'isfile': False,
 u'items': 348,
 u'mime': u'application/x-directory',
 u'name': u'',
 u'owner': None,
 u'path': u'/',
 u'size': 220429838,
 u'tags': [],
 u'time': u'2013-02-23T22:49:30',
 u'url': u'http://localhost:8000/path/info/'}

File transfers

Uploading and downloading files is supported.

To upload files, pass array of file paths in local filesystem.

Downloading:

Tasks

Operations are long-running jobs that are not executed within the time frame of an API call. For such operations, a task is created, and the API can be used to poll the status of the task.

Releases

No releases published

Packages

No packages published