wikiwiki 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +36 -0
  3. data/README.ja.md +100 -3
  4. data/README.md +100 -3
  5. data/exe/wikiwiki +8 -0
  6. data/lib/wikiwiki/api.rb +42 -6
  7. data/lib/wikiwiki/auth/token.rb +23 -0
  8. data/lib/wikiwiki/auth.rb +6 -0
  9. data/lib/wikiwiki/cli/commands/attachment/delete.rb +34 -0
  10. data/lib/wikiwiki/cli/commands/attachment/get.rb +45 -0
  11. data/lib/wikiwiki/cli/commands/attachment/list.rb +37 -0
  12. data/lib/wikiwiki/cli/commands/attachment/put.rb +55 -0
  13. data/lib/wikiwiki/cli/commands/attachment/show.rb +44 -0
  14. data/lib/wikiwiki/cli/commands/auth.rb +32 -0
  15. data/lib/wikiwiki/cli/commands/base.rb +64 -0
  16. data/lib/wikiwiki/cli/commands/page/delete.rb +32 -0
  17. data/lib/wikiwiki/cli/commands/page/get.rb +46 -0
  18. data/lib/wikiwiki/cli/commands/page/list.rb +36 -0
  19. data/lib/wikiwiki/cli/commands/page/put.rb +44 -0
  20. data/lib/wikiwiki/cli/commands/page/show.rb +44 -0
  21. data/lib/wikiwiki/cli/formatter/json.rb +18 -0
  22. data/lib/wikiwiki/cli.rb +49 -0
  23. data/lib/wikiwiki/rate_limiter.rb +4 -12
  24. data/lib/wikiwiki/sliding_window.rb +1 -3
  25. data/lib/wikiwiki/version.rb +1 -1
  26. data/lib/wikiwiki/wiki.rb +22 -3
  27. data/lib/wikiwiki.rb +5 -1
  28. data/sig/dry/cli.rbs +9 -0
  29. data/sig/wikiwiki/api.rbs +5 -3
  30. data/sig/wikiwiki/auth/token.rbs +9 -0
  31. data/sig/wikiwiki/auth.rbs +2 -0
  32. data/sig/wikiwiki/cli/commands/attachment.rbs +87 -0
  33. data/sig/wikiwiki/cli/commands/auth.rbs +9 -0
  34. data/sig/wikiwiki/cli/commands/base.rbs +27 -0
  35. data/sig/wikiwiki/cli/commands/page.rbs +82 -0
  36. data/sig/wikiwiki/cli/formatter/json.rbs +9 -0
  37. data/sig/wikiwiki/cli.rbs +11 -0
  38. data/sig/wikiwiki/wiki.rbs +5 -1
  39. data/sig/wikiwiki.rbs +3 -0
  40. metadata +60 -8
  41. data/LICENSE.txt +0 -21
  42. data/mise.toml +0 -6
  43. data/rbs_collection.yaml +0 -12
@@ -0,0 +1,82 @@
1
+ module Wikiwiki
2
+ class CLI
3
+ module Commands
4
+ module Page
5
+ class List < Base
6
+ def call: (
7
+ ?out: IO,
8
+ ?err: IO,
9
+ ?wiki_id: String?,
10
+ ?api_key_id: String?,
11
+ ?secret: String?,
12
+ ?password: String?,
13
+ ?json: bool,
14
+ ?verbose: bool,
15
+ ?debug: bool
16
+ ) -> void
17
+ end
18
+
19
+ class Show < Base
20
+ def call: (
21
+ page_name: String,
22
+ ?out: IO,
23
+ ?err: IO,
24
+ ?wiki_id: String?,
25
+ ?api_key_id: String?,
26
+ ?secret: String?,
27
+ ?password: String?,
28
+ ?json: bool,
29
+ ?verbose: bool,
30
+ ?debug: bool
31
+ ) -> void
32
+ end
33
+
34
+ class Get < Base
35
+ def call: (
36
+ page_name: String,
37
+ ?output_file: String?,
38
+ ?force: bool,
39
+ ?out: IO,
40
+ ?err: IO,
41
+ ?wiki_id: String?,
42
+ ?api_key_id: String?,
43
+ ?secret: String?,
44
+ ?password: String?,
45
+ ?verbose: bool,
46
+ ?debug: bool
47
+ ) -> void
48
+ end
49
+
50
+ class Put < Base
51
+ def call: (
52
+ page_name: String,
53
+ ?input_file: String?,
54
+ ?out: IO,
55
+ ?err: IO,
56
+ ?wiki_id: String?,
57
+ ?api_key_id: String?,
58
+ ?secret: String?,
59
+ ?password: String?,
60
+ ?verbose: bool,
61
+ ?debug: bool
62
+ ) -> void
63
+ end
64
+
65
+ class Delete < Base
66
+ def call: (
67
+ page_name: String,
68
+ ?out: IO,
69
+ ?err: IO,
70
+ ?wiki_id: String?,
71
+ ?api_key_id: String?,
72
+ ?secret: String?,
73
+ ?password: String?,
74
+ ?token: String?,
75
+ ?verbose: bool,
76
+ ?debug: bool
77
+ ) -> void
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,9 @@
1
+ module Wikiwiki
2
+ class CLI
3
+ module Formatter
4
+ class JSON
5
+ def format: (untyped data) -> String
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ module Wikiwiki
2
+ class CLI
3
+ def initialize: (?out: IO, ?err: IO) -> void
4
+
5
+ def run: (Array[String] argv) -> Integer
6
+
7
+ private
8
+
9
+ def handle_error: (Exception error) -> void
10
+ end
11
+ end
@@ -2,7 +2,9 @@ module Wikiwiki
2
2
  class Wiki
3
3
  attr_reader logger: Logger
4
4
 
5
- def initialize: (wiki_id: String, auth: Auth::Password | Auth::ApiKey, ?rate_limiter: RateLimiter, ?logger: Logger) -> void
5
+ def initialize: (wiki_id: String, auth: Auth::Password | Auth::ApiKey | Auth::Token, ?rate_limiter: RateLimiter, ?logger: Logger) -> void
6
+
7
+ def token: () -> String
6
8
 
7
9
  def url: () -> URI::HTTPS
8
10
 
@@ -12,6 +14,8 @@ module Wikiwiki
12
14
 
13
15
  def update_page: (page_name: String, source: String) -> void
14
16
 
17
+ def delete_page: (page_name: String) -> void
18
+
15
19
  def attachment_names: (page_name: String) -> Array[String]
16
20
 
17
21
  def attachment: (page_name: String, attachment_name: String, ?rev: String?) -> Attachment
data/sig/wikiwiki.rbs CHANGED
@@ -19,6 +19,9 @@ module Wikiwiki
19
19
  class ResourceNotFoundError < APIError
20
20
  end
21
21
 
22
+ class ConflictError < APIError
23
+ end
24
+
22
25
  class ServerError < APIError
23
26
  end
24
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wikiwiki
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OZAWA Sakuro
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-10-31 00:00:00.000000000 Z
11
+ date: 2025-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: dry-cli
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: jwt
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: zeitwerk
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -38,36 +66,60 @@ dependencies:
38
66
  - - "~>"
39
67
  - !ruby/object:Gem::Version
40
68
  version: '2.7'
41
- description: wikiwiki
69
+ description: |
70
+ A Ruby gem providing both a client library and command-line interface for interacting with Wikiwiki.jp REST API.
71
+ Supports page and attachment operations with authentication via password or API key.
42
72
  email:
43
73
  - 10973+sakuro@users.noreply.github.com
44
- executables: []
74
+ executables:
75
+ - wikiwiki
45
76
  extensions: []
46
77
  extra_rdoc_files: []
47
78
  files:
48
79
  - CHANGELOG.md
49
- - LICENSE.txt
50
80
  - README.ja.md
51
81
  - README.md
82
+ - exe/wikiwiki
52
83
  - lib/wikiwiki.rb
53
84
  - lib/wikiwiki/api.rb
54
85
  - lib/wikiwiki/attachment.rb
55
86
  - lib/wikiwiki/auth.rb
56
87
  - lib/wikiwiki/auth/api_key.rb
57
88
  - lib/wikiwiki/auth/password.rb
89
+ - lib/wikiwiki/auth/token.rb
90
+ - lib/wikiwiki/cli.rb
91
+ - lib/wikiwiki/cli/commands/attachment/delete.rb
92
+ - lib/wikiwiki/cli/commands/attachment/get.rb
93
+ - lib/wikiwiki/cli/commands/attachment/list.rb
94
+ - lib/wikiwiki/cli/commands/attachment/put.rb
95
+ - lib/wikiwiki/cli/commands/attachment/show.rb
96
+ - lib/wikiwiki/cli/commands/auth.rb
97
+ - lib/wikiwiki/cli/commands/base.rb
98
+ - lib/wikiwiki/cli/commands/page/delete.rb
99
+ - lib/wikiwiki/cli/commands/page/get.rb
100
+ - lib/wikiwiki/cli/commands/page/list.rb
101
+ - lib/wikiwiki/cli/commands/page/put.rb
102
+ - lib/wikiwiki/cli/commands/page/show.rb
103
+ - lib/wikiwiki/cli/formatter/json.rb
58
104
  - lib/wikiwiki/page.rb
59
105
  - lib/wikiwiki/rate_limiter.rb
60
106
  - lib/wikiwiki/sliding_window.rb
61
107
  - lib/wikiwiki/version.rb
62
108
  - lib/wikiwiki/wiki.rb
63
- - mise.toml
64
- - rbs_collection.yaml
109
+ - sig/dry/cli.rbs
65
110
  - sig/wikiwiki.rbs
66
111
  - sig/wikiwiki/api.rbs
67
112
  - sig/wikiwiki/attachment.rbs
68
113
  - sig/wikiwiki/auth.rbs
69
114
  - sig/wikiwiki/auth/api_key.rbs
70
115
  - sig/wikiwiki/auth/password.rbs
116
+ - sig/wikiwiki/auth/token.rbs
117
+ - sig/wikiwiki/cli.rbs
118
+ - sig/wikiwiki/cli/commands/attachment.rbs
119
+ - sig/wikiwiki/cli/commands/auth.rbs
120
+ - sig/wikiwiki/cli/commands/base.rbs
121
+ - sig/wikiwiki/cli/commands/page.rbs
122
+ - sig/wikiwiki/cli/formatter/json.rbs
71
123
  - sig/wikiwiki/page.rbs
72
124
  - sig/wikiwiki/rate_limiter.rbs
73
125
  - sig/wikiwiki/sliding_window.rbs
@@ -98,5 +150,5 @@ requirements: []
98
150
  rubygems_version: 3.4.19
99
151
  signing_key:
100
152
  specification_version: 4
101
- summary: wikiwiki
153
+ summary: Ruby client library and CLI for Wikiwiki REST API
102
154
  test_files: []
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2025 OZAWA Sakuro
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.
data/mise.toml DELETED
@@ -1,6 +0,0 @@
1
- [tools]
2
- ruby = "3.2"
3
-
4
- [env]
5
- _.path = ["bin", "exe"]
6
- _.file = '.env'
data/rbs_collection.yaml DELETED
@@ -1,12 +0,0 @@
1
- # Download sources
2
- sources:
3
- - type: stdlib
4
-
5
- # A directory to install the downloaded RBSs
6
- path: .gem_rbs_collection
7
-
8
- # A directory to install the downloaded RBSs
9
- gems:
10
- # Use standard library type definitions
11
- - name: net-http
12
- - name: uri