Skip to content

Commit cfcb0f8

Browse files
committed
Initial commit.
0 parents  commit cfcb0f8

File tree

17 files changed

+353
-0
lines changed

17 files changed

+353
-0
lines changed

.circleci/config.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
version: 2.1
2+
3+
orbs:
4+
gor: hubci/[email protected]
5+
osd: circleci/[email protected]
6+
7+
workflows:
8+
main:
9+
jobs:
10+
- test
11+
release:
12+
jobs:
13+
- test:
14+
filters:
15+
branches:
16+
ignore: /.*/
17+
tags:
18+
# Simplified SemVer regex
19+
only: /^v\d+\.\d+\.\d+$/
20+
- gor/release:
21+
version: "0.149.0"
22+
go-version: "1.15.6"
23+
filters:
24+
branches:
25+
ignore: /.*/
26+
tags:
27+
# Simplified SemVer regex
28+
only: /^v\d+\.\d+\.\d+$/
29+
context: main
30+
31+
jobs:
32+
test:
33+
docker:
34+
- image: cimg/go:1.15.6
35+
steps:
36+
- checkout
37+
- restore_cache:
38+
keys:
39+
- go-mod-v1
40+
- run:
41+
name: "Download Dependancies"
42+
command: cd jsonfeed && go mod download
43+
- run:
44+
name: "Run Tests"
45+
command: cd jsonfeed && go test ./...
46+
- save_cache:
47+
key: go-mod-v1
48+
paths:
49+
- "/go/pkg/mod"

.goreleaser.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
project_name: jfeed
2+
3+
builds:
4+
- skip: true

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright ©2020 Ricardo N Feliciano <[email protected]>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# JSON Feed Go Library [![CI Status](https://circleci.com/gh/gopherlibs/jsonfeed.svg?style=shield)](https://app.circleci.com/pipelines/github/gopherlibs/jsonfeed) [![Software License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/gopherlibs/jsonfeed/master/LICENSE)
2+
3+
This is a library to parse and validate a JSON Feed.
4+
JSON Feed is a modern alternative to RSS and Atom.
5+
I'd recommend learning more about it at the [official website][jfeed] if you're unfamiliar.
6+
7+
**Note: This package is pre-1.0 thus the API is still changing as I prepare it for a v1.0 release.**
8+
9+
10+
## Usage
11+
12+
Instructions coming soon.
13+
For now, just look at the code.
14+
15+
16+
## Development
17+
18+
This library is written and tested with Go v1.15+ in mind.
19+
`go fmt` is your friend.
20+
Please feel free to open Issues and PRs as you see fit.
21+
Any PR that requires a good amount of work or is a significant change, it would be best to open an Issue to discuss the change first.
22+
23+
24+
## License & Credits
25+
26+
This module was written by Ricardo N Feliciano (FelicianoTech).
27+
This repository is licensed under the MIT license.
28+
This repo's license can be found [here](./LICENSE).
29+
30+
31+
32+
[jfeed]: https://www.jsonfeed.org/

go.mod

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module github.com/gopherlibs/jsonfeed
2+
3+
go 1.15
4+
5+
require (
6+
github.com/davecgh/go-spew v1.1.1 // indirect
7+
github.com/kr/pretty v0.1.0 // indirect
8+
github.com/magefile/mage v1.10.0
9+
github.com/stretchr/testify v1.4.0
10+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
11+
gopkg.in/yaml.v2 v2.2.8 // indirect
12+
)

go.sum

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
3+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4+
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
5+
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
6+
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
7+
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
8+
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
9+
github.com/magefile/mage v1.10.0 h1:3HiXzCUY12kh9bIuyXShaVe529fJfyqoVM42o/uom2g=
10+
github.com/magefile/mage v1.10.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
11+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
12+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
13+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
14+
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
15+
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
16+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
17+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
18+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
19+
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
20+
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
21+
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
22+
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

jsonfeed/attachment.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package jsonfeed
2+
3+
type Attachment struct {
4+
URL string `json:"url"`
5+
MIMEType string `json:"mime_type"`
6+
Title string `json:"title"`
7+
SizeInBytes uint `json:"size_in_bytes"`
8+
DurationInSeconds uint `json:"duration_in_seconds"`
9+
}

jsonfeed/author.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package jsonfeed
2+
3+
type Author struct {
4+
Name string `json:"name"`
5+
URL string `json:"url"`
6+
Avatar string `json:"avatar"`
7+
}

jsonfeed/feed.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package jsonfeed
2+
3+
import "errors"
4+
5+
type Feed struct {
6+
Version string `json:"version"`
7+
Title string `json:"title"`
8+
HomepageURL string `json:"home_page_url"`
9+
FeedURL string `json:"feed_url"`
10+
Description string `json:"description"`
11+
UserComment string `json:"user_comment"`
12+
NextURL string `json:"next_url"`
13+
Icon string `json:"icon"`
14+
Favicon string `json:"favicon"`
15+
Authors []Author `json:"authors"`
16+
Language string `json:"language"`
17+
Expired bool `json:"expired"`
18+
Hubs []Hub `json:"hubs"`
19+
Items []Item `json:"items"`
20+
Attachments []Attachment `json:"attachments"`
21+
}
22+
23+
func (this *Feed) Validate() []error {
24+
25+
var valErrors []error
26+
27+
if this.Version != "https://jsonfeed.org/version/1.1" {
28+
valErrors = append(valErrors, errors.New("Invalid version."))
29+
30+
return valErrors
31+
}
32+
33+
return valErrors
34+
}

jsonfeed/hub.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package jsonfeed
2+
3+
type Hub struct {
4+
Type string `json:"type"`
5+
URL string `json:type"`
6+
}

0 commit comments

Comments
 (0)