Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

hasit/githubjobs-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Github Jobs SDK for Go

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages