nimph/thehub

  Source   Edit

Types

HubCommitMeta = object
  url*: Uri
  author*: HubContact
  committer*: HubContact
  message*: string
  commentCount*: int
  tree*: HubTree
  Source   Edit
HubContact = object
  name*: string
  email*: string
  date*: DateTime
  Source   Edit
HubGroup = ref object of Group[Uri, HubResult]
  Source   Edit
HubKind = enum
  HubRelease, HubTag, HubCommit, HubRepo, HubIssue, HubPull, HubUser, HubCode
  Source   Edit
HubResult = ref object
  htmlUrl*: Uri
  id*: int
  number*: int
  title*: string
  body*: string
  state*: string
  name*: string
  user*: HubResult
  tagName*: string
  targetCommitish*: string
  sha*: string
  created*: DateTime
  updated*: DateTime
  case kind*: HubKind
  of HubCommit:
      tree*: HubTree
      author*: HubResult
      committer*: HubResult
      parents*: seq[HubTree]
      commit*: HubCommitMeta

  of HubTag:
      tagger*: HubContact
      `object`*: HubTree

  of HubRelease:
      draft*: bool
      prerelease*: bool

  of HubUser:
      login*: string

  of HubIssue:
      closedBy*: HubResult

  of HubPull:
      mergedBy*: HubResult
      merged*: bool

  of HubCode:
      path*: string
      repository*: HubResult

  of HubRepo:
      fullname*: string
      description*: string
      watchers*: int
      stars*: int
      forks*: int
      owner*: string
      size*: int
      pushed*: DateTime
      issues*: int
      clone*: Uri
      git*: Uri
      ssh*: Uri
      web*: Uri
      license*: string
      branch*: string
      original*: bool
      score*: float

  
  Source   Edit
HubSort {.pure.} = enum
  Ascending = "asc", Descending = "desc"
  Source   Edit
HubSortBy {.pure.} = enum
  Best = "", Stars = "stars", Forks = "forks", Updated = "updated"
  Source   Edit
HubTree = object
  sha*: string
  url*: Uri
  `type`*: string
  Source   Edit
HubVerification = object
  verified*: bool
  reason*: string
  signature*: string
  payload*: string
  Source   Edit

Consts

hubTime = (patterns: [22, 33, 1, 45, 11, 33, 1, 45, 1, 33, 1, 84, 7, 33, 1, 58,
                      9, 33, 1, 58, 15, 33, 1, 90],
           formatStr: "yyyy-MM-dd\'T\'HH:mm:ss\'Z\'")
  Source   Edit

Procs

proc add(group: var HubGroup; hub: HubResult) {....raises: [], tags: [].}
  Source   Edit
proc authorize(request: Recallable): bool {.
    ...raises: [Exception, IOError, KeyError],
    tags: [ReadEnvEffect, ReadIOEffect, RootEffect, ReadDirEffect].}
find and inject credentials into a github request   Source   Edit
proc findGithubToken(): Option[string] {....raises: [Exception, IOError],
    tags: [ReadEnvEffect, ReadIOEffect, RootEffect, ReadDirEffect].}
find a github token in one of several places   Source   Edit
proc forkHub(owner: string; repo: string): Option[HubResult] {....raises: [
    KeyError, Exception, IOError, ValueError, RestError, OSError,
    JsonParsingError, TimeParseError], tags: [RootEffect, ReadEnvEffect,
    ReadIOEffect, ReadDirEffect, TimeEffect, WriteIOEffect].}
attempt to fork an existing repository   Source   Edit
proc getGitHubUser(): Option[HubResult] {....raises: [Exception, IOError, KeyError,
    RestError, ValueError, OSError, JsonParsingError, TimeParseError], tags: [
    RootEffect, ReadEnvEffect, ReadIOEffect, ReadDirEffect, TimeEffect,
    WriteIOEffect].}
attempt to retrieve the authorized user   Source   Edit
proc init(result: var HubResult; js: JsonNode) {....raises: [KeyError, Exception],
    tags: [RootEffect].}
instantiate a new hub object using a jsonnode   Source   Edit
proc newHubCommitMeta(js: JsonNode): HubCommitMeta {.
    ...raises: [KeyError, TimeParseError], tags: [TimeEffect].}
collect some ingredients found in a typical commit   Source   Edit
proc newHubContact(js: JsonNode): HubContact {.
    ...raises: [KeyError, TimeParseError], tags: [TimeEffect].}
parse some json into a simple contact record   Source   Edit
proc newHubGroup(flags: set[Flag] = defaultFlags): HubGroup {....raises: [],
    tags: [].}
  Source   Edit
proc newHubResult(kind: HubKind; js: JsonNode): HubResult {.
    ...raises: [KeyError, TimeParseError, Exception],
    tags: [TimeEffect, RootEffect].}
  Source   Edit
proc newHubTree(js: JsonNode): HubTree {....raises: [KeyError], tags: [].}
parse something like a commit tree   Source   Edit
proc renderShortly(r: HubResult): string {....raises: [ValueError], tags: [].}
  Source   Edit
proc searchHub(keywords: seq[string]; sort = Best; order = Descending): Option[
    HubGroup] {....raises: [Exception, IOError, ValueError, KeyError, RestError,
                         OSError, JsonParsingError], tags: [RootEffect,
    ReadEnvEffect, ReadIOEffect, ReadDirEffect, TimeEffect, WriteIOEffect].}
search github for packages   Source   Edit