{"id":21288509,"url":"https://github.com/wonli/apic","last_synced_at":"2025-03-15T15:42:14.970Z","repository":{"id":252349719,"uuid":"840176374","full_name":"wonli/apic","owner":"wonli","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-03T06:39:33.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-03T07:28:21.017Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wonli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-09T06:10:32.000Z","updated_at":"2025-03-03T06:39:25.000Z","dependencies_parsed_at":"2024-08-09T07:33:09.770Z","dependency_job_id":"950b0f7e-b016-484d-acc7-0ed636e84499","html_url":"https://github.com/wonli/apic","commit_stats":null,"previous_names":["wonli/apic"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wonli%2Fapic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wonli%2Fapic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wonli%2Fapic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wonli%2Fapic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wonli","download_url":"https://codeload.github.com/wonli/apic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243753996,"owners_count":20342537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-21T12:22:12.095Z","updated_at":"2025-03-15T15:42:14.945Z","avatar_url":"https://github.com/wonli.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# API调用工具\n\n快速调用第三方接口\n\n### 用法\n\n先定义结构体，在结构体中定义api路径、参数，如果需要鉴权也可以统一处理。\n\n```go\ntype RandMusicApi struct {\n\t*apic.Apic\n}\n\nfunc (m *RandMusicApi) Url() string {\n\treturn \"https://api.uomg.com\"\n}\n\nfunc (m *RandMusicApi) Path() string {\n\treturn \"/api/rand.music\"\n}\n\nfunc (m *RandMusicApi) Query() url.Values {\n\tu := url.Values{}\n\tu.Add(\"sort\", \"热歌榜\")\n\tu.Add(\"format\", \"json\")\n\n\treturn u\n}\n\nfunc (m *RandMusicApi) HttpMethod() apic.HttpMethod {\n\treturn apic.GET\n}\n\nfunc (m *RandMusicApi) Debug() bool {\n\treturn true\n}\n```\n\n### 使用方法\n\n使用 `apic.Init().CallApi(musicApi, nil)` 请求接口，可以在请求自定义参数，请求结果在`api`返回数据中处理\n\n\n```go\nmusicApi := \u0026apic.ApiId{\n    Name:   \"music\",\n    Client: \u0026RandMusicApi{},\n}\n\napi, err := apic.Init().CallApi(musicApi, nil)\nif err != nil {\n    log.Panicln(err.Error())\n    return\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwonli%2Fapic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwonli%2Fapic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwonli%2Fapic/lists"}