Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature API REST #9

Merged
merged 28 commits into from
Oct 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
329d833
build(carthage): add dependencie to Alamofire
Oct 18, 2017
c45b9e7
feat(api): create URLRequest for init session with token
Oct 18, 2017
6a6a50e
feat(api): request to init session with user token
Oct 18, 2017
738bffe
test(example): add swiftint to sample project
Oct 18, 2017
73aac60
test(example): request to init session with user token
Oct 18, 2017
18559ef
feat(api): allow to start session with app token
Oct 20, 2017
ca8d084
feat(api): request init session with basic authorization
Oct 20, 2017
8d4e0a0
refactor(api): convert to class methods
Oct 20, 2017
4a1f6ff
feat(api): store token session after to start session
Oct 20, 2017
afb9fa1
feat(api): request kill current session
Oct 20, 2017
9c96019
feat(api): request get my profiles
Oct 20, 2017
1d40f04
feat(api): request get active profile
Oct 20, 2017
8acc8ac
feat(api): request get my entities
Oct 20, 2017
dadbead
feat(api): request get active entities
Oct 20, 2017
839c62d
feat(api): request get Glpi configuration
Oct 20, 2017
9e39361
feat(api): request get multiple items
Oct 20, 2017
bcc89db
build(settings): add YAML file for bot settings
Naylin15 Oct 18, 2017
28fdda8
docs(github): add pull request template
Naylin15 Oct 18, 2017
594a2a5
docs(github): add issue template
Naylin15 Oct 18, 2017
7ec60f2
docs(readme): update content
Naylin15 Oct 18, 2017
593b1ce
docs(contributing): add contribute guidelines
Naylin15 Oct 18, 2017
00050a3
docs(readme): update content
Naylin15 Oct 20, 2017
dbd9e83
docs(contributing): update content
Naylin15 Oct 20, 2017
ff87b35
build(config): add app to invite contributors
Naylin15 Oct 20, 2017
6abbb18
docs(settings): update homepage and name
Naylin15 Oct 20, 2017
acfa4d4
docs(github): update content
Naylin15 Oct 20, 2017
e62e5be
docs(github): update content
Naylin15 Oct 20, 2017
732bb78
ci(circle): configure carthage
Oct 20, 2017
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
37 changes: 37 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!--
PLEASE HELP US PROCESS GITHUB ISSUES FASTER BY PROVIDING THE FOLLOWING INFORMATION.
-->

## I'm submitting a...
<!-- Check one of the following options with "x" -->

- [ ] Regression (a behavior that used to work and stopped working in a new release)
- [ ] Bug report <!-- Please search GitHub for a similar issue or PR before submitting -->
- [ ] Feature request
- [ ] Documentation issue or request
- [ ] Support request => Please do not submit support request here, instead see https://github.com/glpi-project/swift-library-glpi/blob/develop/CONTRIBUTING.md#questions-or-doubts


## Current behavior
<!-- Describe how the issue manifests. -->


## Expected behavior
<!-- Describe what the desired behavior would be. -->


## Minimal reproduction of the problem with instructions
<!--
For bug reports please provide the *STEPS TO REPRODUCE* and if possible a *MINIMAL DEMO* of the problem or similar.
-->

## What is the motivation / use case for changing the behavior?
<!-- Describe the motivation or the concrete use case. -->


## Environment
<pre><code>
Library Version: X.Y.Z
<!-- Check whether this is still an issue in the most recent version, and add relevant information like Operating system version, Device model ... -->
</code></pre>

38 changes: 38 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## Checklist
Please check if your PR fulfills the following requirements:

- [ ] The commit message follows our guidelines: [Conventional Commit](http://conventionalcommits.org/)
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)

## PR Type
What kind of change does this PR introduce?
<!-- Please check the one that applies to this PR using "x". -->

- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Documentation content changes
- [ ] Other... Please describe:

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->

Issue # N/A


## What is the new behavior?


## Does this PR introduce a breaking change?

- [ ] Yes
- [ ] No

<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->


## Other information
2 changes: 2 additions & 0 deletions .github/invite-contributors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Team Name
contributors
46 changes: 46 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
repository:
name: swift-library-glpi
description: GLPI API Client Library for Swift
homepage: https://glpi-project.github.io/swift-library-glpi/
topics: glpi-api, swift, library
private: false
has_issues: true
has_wiki: false
has_downloads: true
default_branch: develop
allow_squash_merge: true
allow_merge_commit: false
allow_rebase_merge: true
labels:
- name: bug
color: f44336
- name: build
color: 795548
- name: ci
color: fbca04
- name: documentation
color: 607d8b
- name: duplicate
color: 9e9e9e
- name: feature
color: 3f51b5
- name: hacktoberfest
color: ff625f
- name: invalid
color: cddc39
- name: performance
color: 009688
- name: question
color: ff5722
- name: refactor
color: 9c27b0
- name: style
color: 2196f3
- name: test
color: 8bc34a
- name: wontfix
color: ffffff
- name: help wanted
color: 33aa3f
- name: good first issue
color: 7057ff
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ playground.xcworkspace
# Carthage/Checkouts

Carthage/Build
Carthage/Checkouts

# fastlane
#
Expand Down
132 changes: 132 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# How to contribute

Welcome to our ever growing community! We are more than happy to accept external contributions to the project in the form of feedback, bug reports and even better, pull requests!

As a contributor, we present you the guidelines to start contributing in any of the GLPI projects.

* [Code of Conduct](#code-of-conduct)
* [Questions or Doubts?](#questions-or-doubts)
* [Bugs](#found-a-bug)
* [Proposed Features](#new-feature)
* [Submitting issues and Pull Requests](#submitting)
* [Coding Rules](#coding-rules)

### Code of Conduct

As contributors and maintainers of the GLPI projects, we pledge to respect everyone who contributes by posting issues, updating documentation, submitting pull requests, providing feedback in comments, and any other activities.

Communication through any of our channels (GitHub, Telegram, mailing lists, Google+, Twitter, etc.) must be constructive and never resort to personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.

We promise to extend courtesy and respect to everyone involved in this project regardless of gender, gender identity, sexual orientation, disability, age, race, ethnicity, religion, or level of experience. We expect anyone contributing to the GLPI projects to do the same.

If any member of the community violates this code of conduct, the maintainers of the GLPI projects may take action, removing issues, comments, and PRs or blocking accounts as deemed appropriate.

If you are subject to or witness unacceptable behavior, or have any other concerns, please email us at glpi@teclib.com

### Questions or Doubts

If you require general support assistance, you can find us in [Telegram](https://t.me/glpien), and we'll help you as soon as possible.

For notices about major changes and general discussion of GLPI development, subscribe to the [/r/glpi](https://www.reddit.com/r/glpi/) subreddit. You can also chat with us via IRC in [#GLPI on freenode](http://webchat.freenode.net/?channels=GLPI).

This is in order to keep GitHub issues for bug reports and new features only.

### Found a bug?

You can let us know in our [issue Dashboard](#submit-an-issue).

Know how to fix it? Great! Then submit a [pull request](#submit-a-pull-request).

### New feature?

You can _**request**_ a new feature by submitting an issue, and if you would like to _**implement**_ a new feature, please submit an issue with a proposal for your work first, to be sure that we can use it, this will allow us to better coordinate our efforts, prevent duplication of work, and help you to craft the change so that it is successfully accepted into the project. Please consider what kind of change it is:

* For a Major Feature, first open an issue and outline your proposal so it can be discussed.
* Small Features can be crafted and directly submitted as a Pull Request.

## Submitting

### Submit an Issue

Before submitting the issue please check the [issue tracker](https://github.com/glpi-project/swift-library-glpi/issues), there exists the possibility that the bug was already reported by other contributor.

This way you help us to maximize the effort we can spend fixing issues and adding new features, by not reporting duplicate issues.

We'll work very hard to fix all the issues without delay, but before fixing it we need to confirm it, for that we require you to provide us of the following information:

* Overview of the Issue - if an error is being thrown a description of the problem is extremely helpful
* Motivation for or Use Case - explain why this is a bug for you
* Library Version(s)
* Device Operating System & Model - is this a problem with all devices or only specific ones?
* Reproduce the Error - provide a live example or an unambiguous set of steps.
* Related Issues - has a similar issue been reported before?
* Suggest a Fix - if you can't fix the bug yourself, perhaps you can point to what might be causing the problem (line of code or commit)

You can file new issues by filling out our [new issue form](https://github.com/glpi-project/swift-library-glpi/issues/new).

### Submit a Pull Request

Before submitting your Pull Request check for an open or closed PR that relates to your submission. We don't want to duplicate efforts.

* Make your changes in a new branch, the project is organized according to the branch model [Git Flow](http://git-flow.readthedocs.io/en/latest/), though this is not mandatory it's really useful:

```console
git checkout -b my-fix-branch develop
```

* Follow our [Coding Rules](#coding-rules).

* Commit your changes using a descriptive commit message that follows the [Conventional Commit](http://conventionalcommits.org/). This is **indispensable** since the release notes and changelogs are automatically generated from these messages.

* Push your branch to GitHub:

```console
git push origin my-fix-branch
```

* In GitHub, send a pull request to our [Repository](https://github.com/glpi-project/swift-library-glpi/).
* If we suggest changes then:

* Make the required updates.

* Rebase your branch and force push to your GitHub repository (this will update your Pull Request):

**That's it! :tada: Thank you for your contribution!**

#### After your pull request is merged

You can safely delete your branch and pull the changes from the main (upstream) repository:

* Delete the remote branch on GitHub either through the GitHub web UI or your local shell as you prefer.

## Coding Rules

To ensure consistency throughout the source code, keep these rules in mind as you are working:

* All features or bug fixes must be [tested](#test-and-build) by one or more specs (unit-tests).
* All methods must be documented.

## Test and Build

There are currently three ways of running the unit test, you can only select one as you prefer.

#### From Fastlane

fastlane scan

That's all you need to run your tests. If you want more control, here are some available parameters:

fastlane scan —workspace "Example.xcworkspace" —scheme "AppName" —device "iPhone 6" —clean

#### From Xcode

Here is a detailed guide of [Testing with Xcode](https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/testing_with_xcode/chapters/05-running_tests.html), that will show you the commands and building settings for testing Apps and libraries.

#### From Command line

xcodebuild \
-workspace MyApp.xcworkspace \
-scheme "MyApp" \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 6,OS=8.1' \
test
1 change: 1 addition & 0 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github "Alamofire/Alamofire"
1 change: 1 addition & 0 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github "Alamofire/Alamofire" "4.5.1"
8 changes: 8 additions & 0 deletions Example/.swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
disabled_rules: # rule identifiers to exclude from running
- function_body_length
- line_length
- identifier_name
- empty_enum_arguments
- trailing_whitespace
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Pods
4 changes: 0 additions & 4 deletions Example/Source/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

window = UIWindow(frame: UIScreen.main.bounds)
Expand Down Expand Up @@ -65,7 +64,4 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}


}

11 changes: 7 additions & 4 deletions Example/Source/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,18 @@ import Glpi
class ViewController: UIViewController {

override func viewDidLoad() {

GlpiRequest.initSession(userToken: "user_token") { result in
if let data = result {
print(data)
}
}

super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}


}

Loading