githubjobs

package module
Version: v0.0.0-...-ea45579 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2016 License: MIT Imports: 7 Imported by: 0

README

githubjobs-go

Go Report Card GoDoc

Github Jobs SDK for Go.

Install

go get github.com/hasit/githubjobs-go

Usage

Assuming that you have installed githubjobs package correctly, simply import it to start using. Head over to the githubjobs GoDoc page for more reference.

package main

import "github.com/hasit/githubjobs-go"

...

You can play with examples in the examples folder as well.

Get a single position by ID
package main

import (
	"fmt"
	"log"

	"github.com/hasit/githubjobs-go"
)

func main() {
	p, err := githubjobs.GetPositionByID("<simple-sample>")
	if err != nil {
		log.Fatal(err)
	}
    // p now contains the job position with <simple-sample> ID.
	fmt.Println(p)
}
Get a list of positions

By description

Call githubjobs.GetPositions() with empty location parameter.

package main

import (
	"fmt"
	"log"

	"github.com/hasit/githubjobs-go"
)

func main() {
	p, err := githubjobs.GetPositions("go", "", false)
	if err != nil {
		log.Fatal(err)
	}
    // p now contains all positions with "go" in their descriptions. 
	fmt.Println(p[0])
}

By location

Call githubjobs.GetPositions() with empty description parameter.

package main

import (
	"fmt"
	"log"

	"github.com/hasit/githubjobs-go"
)

func main() {
	p, err := githubjobs.GetPositions("", "seattle", true)
	if err != nil {
		log.Fatal(err)
	}
    // p now contains all positions with "seattle" as their location. 
	fmt.Println(p[0])
}

By geographical coordinates

Call githubjobs.GetPositionsByCoordinates with the coordinates (latitude and longitude) of location. It is important to note that the latitude and longitude values are in decimal degrees. You can use a service like LatLong.net for finding the coordinates of a location of your choice.

package main

import (
	"fmt"
	"log"

	"github.com/hasit/githubjobs-go"
)

func main() {
    // geographical coordinates of Seattle are 47.6062100° and -122.3320700° in decimal degrees.
	p, err := githubjobs.GetPositionsByCoordinates("47.6062100", "-122.3320700")
	if err != nil {
		log.Fatal(err)
	}
    // p now contains all positions with 47.6062100° and -122.3320700° as their geographical coordinates.  
	fmt.Println(p)
}

Contributing

Questions, comments, bug reports, and pull requests are all welcome.

Author

Hasit Mistry

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Message string `json:"message"`
	Code    int    `json:"code"`
}

Error defines an error received when making a request to the API.

func (Error) Error

func (e Error) Error() string

Error returns a string representing the error, satisfying the error interface.

type Position

type Position struct {
	ID          string `json:"id"`
	CreatedAt   string `json:"created_at"`
	Title       string `json:"title"`
	Location    string `json:"location"`
	Type        string `json:"type"`
	Description string `json:"description"`
	HowToApply  string `json:"how_to_apply"`
	Company     string `json:"company"`
	CompanyURL  string `json:"company_url"`
	URL         string `json:"url"`
}

Position defines a position returned by Github Jobs.

func GetPositionByID

func GetPositionByID(ID string) (*Position, error)

GetPositionByID gets a single job posting from Github Jobs by ID.

func GetPositions

func GetPositions(description, location string, fullTime bool) ([]*Position, error)

GetPositions gets positions from Github Jobs by description and location.

func GetPositionsByCoordinates

func GetPositionsByCoordinates(latitude, longitude string) ([]*Position, error)

GetPositionsByCoordinates gets positions from Github Jobs by coordinates (latitude and longitude) in decimal degrees.

func (Position) String

func (p Position) String() string

Source Files

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto