165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
|
# File 'fastlane/lib/fastlane/actions/github_api.rb', line 165
def example_code
[
'result = github_api(
server_url: "https://api.github.com",
api_token: ENV["GITHUB_TOKEN"],
http_method: "GET",
path: "/repos/:owner/:repo/readme",
body: { ref: "master" }
)',
'# Alternatively call directly with optional error handling or block usage
GithubApiAction.run(
server_url: "https://api.github.com",
api_token: ENV["GITHUB_TOKEN"],
http_method: "GET",
path: "/repos/:owner/:repo/readme",
error_handlers: {
404 => proc do |result|
UI.message("Something went wrong - I couldn\'t find it...")
end,
\'*\' => proc do |result|
UI.message("Handle all error codes other than 404")
end
}
) do |result|
UI.message("JSON returned: #{result[:json]}")
end
'
]
end
|