<commit_before>//
//  RepositoryCollaboratorsClient.swift
//  GithubClient
//
//  Created by <NAME> on 8/12/17.
//  Copyright © 2017 GameChanger. All rights reserved.
//

import RxSwift

public final class RepositoryCollaboratorsClient: ApiClient {

  public func listAll(owner: String, repo: String, affiliation: Affiliation? = nil) -> Observable<[User]> {
    return getObject(apiUrl: .repositoryCollaborators(owner: owner, repo: repo), parameters: affiliation)
  }

  public func check(owner: String, repo: String, username: String) -> Observable<Bool> {
    return getBoolean(apiUrl: .repositoryCollaborator(owner: owner, repo: repo, username: username))
  }

  public func add(owner: String, repo: String, username: String, permission: Permission? = nil) -> Completable {
    return put(apiUrl: .repositoryCollaborator(owner: owner, repo: repo, username: username),
               parameters: permission.flatMap({ PermisionParameter(permission: $0) }))
  }

  struct PermisionParameter: Encodable {
    let permission: Permission
  }
}
<commit_msg>Add delete collaborator method<commit_after>//
//  RepositoryCollaboratorsClient.swift
//  GithubClient
//
//  Created by <NAME> on 8/12/17.
//  Copyright © 2017 GameChanger. All rights reserved.
//

import RxSwift

public final class RepositoryCollaboratorsClient: ApiClient {

  public func listAll(owner: String, repo: String, affiliation: Affiliation? = nil) -> Observable<[User]> {
    return getObject(apiUrl: .repositoryCollaborators(owner: owner, repo: repo), parameters: affiliation)
  }

  public func check(owner: String, repo: String, username: String) -> Observable<Bool> {
    return getBoolean(apiUrl: .repositoryCollaborator(owner: owner, repo: repo, username: username))
  }

  public func add(owner: String, repo: String, username: String, permission: Permission? = nil) -> Completable {
    return put(apiUrl: .repositoryCollaborator(owner: owner, repo: repo, username: username),
               parameters: permission.flatMap({ PermisionParameter(permission: $0) }))
  }

  public func delete(owner: String, repo: String, username: String) -> Completable {
    return delete(apiUrl: .repositoryCollaborator(owner: owner, repo: repo, username: username))
  }

  struct PermisionParameter: Encodable {
    let permission: Permission
  }
}

{'fraction_non_alphanumeric': 0.11515151515151516, 'fraction_numerical': 0.008658008658008658, 'mean_word_length': 4.489311163895487, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1685524', 'n_tokens_mistral': 686, 'n_tokens_neox': 646, 'n_words': 194}