You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,12 @@
1
1
# Telegraph API Go Package
2
2
3
-
Telegra.ph is a minimalist publishing tool that allows you to create richly formatted posts and push them to the Web in just a click. Telegraph posts also get beautiful Instant View pages on Telegram. So, this Go wrapper enables you to do all that easily.
*This photo was originally uploaded at [Telegraph](https://telegra.ph/api)*
4
5
5
-
To maintain the purity of the basic interface, we launched the @Telegraph bot for those who require advanced features. This bot can help you manage your articles across any number of devices and get page view statistics for any Telegraph page.
6
+
Telegra.ph is a minimalist publishing tool that allows you to create richly formatted posts to the Web.
7
+
Telegraph posts also get beautiful Instant View pages on Telegram. So, this Go wrapper enables you to do all that easily.
6
8
7
-
Anyone can enjoy the simplicity of Telegraph publishing, not just Telegram users. For this reason, all developers are welcome to use this Telegraph API to create bots like @Telegraph for any other platform, or even standalone interfaces.
9
+
Anyone can enjoy the simplicity of Telegraph publishing, not just Telegram users. For this reason, all developers are welcome to use this Telegraph API to create bots like @Telegraph for any other platform, or even standalone interfaces and this package is to make their work easier.
// returned path is everything that comes after 'https://telegra.ph' in the url, for example in our case, returned path was '/file/a086583f5b7b25cd428fb.jpg' which can be viewed at 'https://telegra.ph/file/a086583f5b7b25cd428fb.jpg'
53
+
fmt.Println("Uploaded photo can be viewed at:", "https://telegra.ph"+path)
Copy file name to clipboardExpand all lines: types.go
+28-22Lines changed: 28 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -9,29 +9,29 @@ type Account struct {
9
9
// Profile link, opened when users click on the author's name below the title. Can be any link, not necessarily to a Telegram profile or channel.
10
10
AuthorUrlstring`json:"author_url"`
11
11
// Optional. Only returned by the createAccount and revokeAccessToken method. Access token of the Telegraph account.
12
-
AccessTokenstring`json:"access_token"`
12
+
AccessTokenstring`json:"access_token,omitempty"`
13
13
// Optional. URL to authorize a browser on telegra.ph and connect it to a Telegraph account. This URL is valid for only one use and for 5 minutes only.
14
-
AuthUrlstring`json:"auth_url"`
14
+
AuthUrlstring`json:"auth_url,omitempty"`
15
15
// Optional. Number of pages belonging to the Telegraph account.
16
-
PageCountint64`json:"page_count"`
16
+
PageCountint64`json:"page_count,omitempty"`
17
17
}
18
18
19
19
// Optional parameters for createAccount.
20
20
typeCreateAccountOptsstruct {
21
21
// Default author name used when creating new articles.
22
-
AuthorNamestring`json:"author_name"`
22
+
AuthorNamestring`json:"author_name,omitempty"`
23
23
// Optional. URL to authorize a browser on telegra.ph and connect it to a Telegraph account. This URL is valid for only one use and for 5 minutes only.
24
-
AuthorUrlstring`json:"author_url"`
24
+
AuthorUrlstring`json:"author_url,omitempty"`
25
25
}
26
26
27
27
// Optional parameters for editAccountInfo.
28
28
typeEditAccountInfoOptsstruct {
29
29
// Account name, helps users with several accounts remember which they are currently using. Displayed to the user above the "Edit/Publish" button on Telegra.ph, other users don't see this name.
30
-
ShortNamestring`json:"short_name"`
30
+
ShortNamestring`json:"short_name,omitempty"`
31
31
// Default author name used when creating new articles.
32
-
AuthorNamestring`json:"author_name"`
32
+
AuthorNamestring`json:"author_name,omitempty"`
33
33
// Profile link, opened when users click on the author's name below the title. Can be any link, not necessarily to a Telegram profile or channel.
34
-
AuthorUrlstring`json:"author_url"`
34
+
AuthorUrlstring`json:"author_url,omitempty"`
35
35
}
36
36
37
37
// This object represents a page on Telegraph.
@@ -45,27 +45,27 @@ type Page struct {
45
45
// Description of the page.
46
46
Descriptionstring`json:"description"`
47
47
// Optional. Name of the author, displayed below the title.
48
-
AuthorNamestring`json:"author_name"`
48
+
AuthorNamestring`json:"author_name,omitempty"`
49
49
// Optional. Profile link, opened when users click on the author's name below the title. Can be any link, not necessarily to a Telegram profile or channel.
50
-
AuthorUrlstring`json:"author_url"`
50
+
AuthorUrlstring`json:"author_url,omitempty"`
51
51
// Optional. Image URL of the page.
52
-
ImageUrlstring`json:"image_url"`
52
+
ImageUrlstring`json:"image_url,omitempty"`
53
53
// Optional. Content of the page.
54
-
Content []Node`json:"content"`
54
+
Content []Node`json:"content,omitempty"`
55
55
// Number of page views for the page.
56
56
Viewsint64`json:"views"`
57
57
// Optional. Only returned if access_token passed. True, if the target Telegraph account can edit the page.
58
-
CanEditbool`json:"can_edit"`
58
+
CanEditbool`json:"can_edit,omitempty"`
59
59
}
60
60
61
61
// Optional parameters for getPage and editPage.
62
62
typePageOptsstruct {
63
63
// Optional. Name of the author, displayed below the title.
64
-
AuthorNamestring`json:"author_name"`
64
+
AuthorNamestring`json:"author_name,omitempty"`
65
65
// Optional. Profile link, opened when users click on the author's name below the title. Can be any link, not necessarily to a Telegram profile or channel.
66
-
AuthorUrlstring`json:"author_url"`
66
+
AuthorUrlstring`json:"author_url,omitempty"`
67
67
// If true, a content field will be returned in the Page object (see: Content format).
0 commit comments