boosty

Форк
0
/
blog.go 
75 строк · 2.5 Кб
1
package boosty
2

3
import (
4
	"fmt"
5
	"net/http"
6
	"net/url"
7
)
8

9
type Blog struct {
10
	Owner struct {
11
		ID        int    `json:"id"`
12
		HasAvatar bool   `json:"hasAvatar"`
13
		Name      string `json:"name"`
14
		AvatarURL string `json:"avatarUrl"`
15
	} `json:"owner"`
16
	Title      string `json:"title"`
17
	IsReadOnly bool   `json:"isReadOnly"`
18
	Flags      struct {
19
		ShowPostDonations      bool `json:"showPostDonations"`
20
		AllowGoogleIndex       bool `json:"allowGoogleIndex"`
21
		HasTargets             bool `json:"hasTargets"`
22
		AcceptDonationMessages bool `json:"acceptDonationMessages"`
23
		AllowIndex             bool `json:"allowIndex"`
24
		IsRssFeedEnabled       bool `json:"isRssFeedEnabled"`
25
		HasSubscriptionLevels  bool `json:"hasSubscriptionLevels"`
26
	} `json:"flags"`
27
	SignedQuery         string      `json:"signedQuery"`
28
	IsBlackListedByUser bool        `json:"isBlackListedByUser"`
29
	IsSubscribed        bool        `json:"isSubscribed"`
30
	Subscription        interface{} `json:"subscription"`
31
	IsTotalBaned        bool        `json:"isTotalBaned"`
32
	AccessRights        struct {
33
		CanSetPayout      bool `json:"canSetPayout"`
34
		CanCreateComments bool `json:"canCreateComments"`
35
		CanEdit           bool `json:"canEdit"`
36
		CanView           bool `json:"canView"`
37
		CanDeleteComments bool `json:"canDeleteComments"`
38
		CanCreate         bool `json:"canCreate"`
39
	} `json:"accessRights"`
40
	Count struct {
41
		Subscribers int `json:"subscribers"`
42
		Posts       int `json:"posts"`
43
	} `json:"count"`
44
	BlogURL                string   `json:"blogUrl"`
45
	IsOwner                bool     `json:"isOwner"`
46
	PublicWebSocketChannel string   `json:"publicWebSocketChannel"`
47
	SubscriptionKind       string   `json:"subscriptionKind"`
48
	IsBlackListed          bool     `json:"isBlackListed"`
49
	AllowedPromoTypes      []string `json:"allowedPromoTypes"`
50
	Description            []struct {
51
		Type        string `json:"type"`
52
		Content     string `json:"content"`
53
		Explicit    bool   `json:"explicit,omitempty"`
54
		URL         string `json:"url,omitempty"`
55
		Modificator string `json:"modificator,omitempty"`
56
	} `json:"description"`
57
	SocialLinks []struct {
58
		URL  string `json:"url"`
59
		Type string `json:"type"`
60
	} `json:"socialLinks"`
61
	HasAdultContent bool   `json:"hasAdultContent"`
62
	CoverURL        string `json:"coverUrl"`
63
}
64

65
func (b *Boosty) Blog() (*Blog, error) {
66
	u := fmt.Sprintf("/v1/blog/%s", b.blog)
67
	m := Method[Blog]{
68
		request: b.request,
69
		method:  http.MethodGet,
70
		url:     u,
71
		values:  url.Values{},
72
	}
73

74
	return m.Call(Blog{})
75
}
76

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.