Skip to content

Commit 761e47c

Browse files
Merge #80
80: release v0.6.0 r=Emilgardis a=Emilgardis πŸŽ‰ πŸŽ‰ ### Breaking changes * All types associated with tokens are now defined in this crate. This is a consequence of the `oauth2` dependency being removed from tree. Additionally, as another consequence, clients are now able to be specified as a `for<'a> &'a T where T: Client<'a>`, meaning `twitch_api2` can use its clients as an interface to token requests, and clients can persist instead of being rebuilt every call. Care should be taken when making clients, as SSRF and similar attacks are possible with improper client configurations. ### Added * Added types/braids `ClientId`, `ClientSecret`, `AccessToken`, `RefreshToken` and `CsrfToken`. * Added way to interact with the Twitch-CLI [mock API](https://github.com/twitchdev/twitch-cli/blob/main/docs/mock-api.md) using environment variables. See static variables `AUTH_URL`, `TOKEN_URL`, `VALIDATE_URL` and `REVOKE_URL` for more information. * Added `impl Borrow<str> for Scope`, meaning it can be used in places it couldn't be used before. Primarily, it allows the following code to work: ```rust let scopes = vec![Scope::ChatEdit, Scope::ChatRead]; let space_separated_scope: String = scopes.as_slice().join(" "); ``` * Added scope `channel:read:goals` ### Changed * Requests to `id.twitch.tv` now follow the documentation, instead of following a subset of the RFC for oauth2. * URLs are now initialized lazily and specified as `url::Url`s. ### Removed * Removed `oauth2` dependency. Co-authored-by: Emil GardstrΓΆm <emil.gardstrom@gmail.com>
2 parents ced6aee + 70e13c6 commit 761e47c

File tree

9 files changed

+395
-405
lines changed

9 files changed

+395
-405
lines changed

β€Ž.github/workflows/audit.yml

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
1-
name: Audit
2-
3-
on:
4-
push:
5-
pull_request:
6-
paths:
7-
- "**/Cargo.toml"
8-
- "**/Cargo.lock"
9-
schedule:
10-
- cron: "0 0 * * *"
11-
12-
jobs:
13-
audit:
14-
needs: [security-audit, cargo-deny]
15-
runs-on: ubuntu-latest
16-
steps:
17-
- name: Done
18-
run: exit 0
19-
security-audit:
20-
name: Security Audit
21-
runs-on: ubuntu-latest
22-
steps:
23-
- uses: actions/checkout@v2
24-
- uses: actions-rs/audit-check@v1
25-
with:
26-
token: ${{ secrets.GITHUB_TOKEN }}
27-
cargo-deny:
28-
name: Cargo Deny
29-
runs-on: ubuntu-latest
30-
strategy:
31-
matrix:
32-
checks:
33-
- advisories
34-
- bans
35-
- licenses
36-
- sources
37-
steps:
38-
- uses: actions/checkout@v2
39-
- uses: EmbarkStudios/cargo-deny-action@v1
40-
with:
41-
command: check ${{ matrix.checks }} -s
42-
arguments: --all-features
1+
name: Audit
2+
3+
on:
4+
push:
5+
pull_request:
6+
paths:
7+
- "**/Cargo.toml"
8+
- "**/Cargo.lock"
9+
schedule:
10+
- cron: "0 0 * * *"
11+
12+
jobs:
13+
audit:
14+
needs: [security-audit, cargo-deny]
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Done
18+
run: exit 0
19+
security-audit:
20+
name: Security Audit
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v2
24+
- uses: actions-rs/audit-check@v1
25+
with:
26+
token: ${{ secrets.GITHUB_TOKEN }}
27+
cargo-deny:
28+
name: Cargo Deny
29+
runs-on: ubuntu-latest
30+
strategy:
31+
matrix:
32+
checks:
33+
- advisories
34+
- bans
35+
- licenses
36+
- sources
37+
steps:
38+
- uses: actions/checkout@v2
39+
- uses: EmbarkStudios/cargo-deny-action@v1
40+
with:
41+
command: check ${{ matrix.checks }} -s
42+
arguments: --all-features
4343
log-level: warn

β€Ž.github/workflows/ci.yml

Lines changed: 145 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -1,143 +1,146 @@
1-
name: CI
2-
env:
3-
CI_TWITCH_OAUTH2_FEATURES: "all mock_api"
4-
on:
5-
pull_request:
6-
branches: [master]
7-
types: [opened, reopened, synchronize]
8-
push:
9-
branches: [master, staging, trying]
10-
jobs:
11-
ci:
12-
name: CI
13-
needs: [test, fmt, clippy, docs]
14-
runs-on: ubuntu-latest
15-
steps:
16-
- name: Done
17-
run: exit 0
18-
test:
19-
name: Tests
20-
strategy:
21-
fail-fast: false
22-
matrix:
23-
os: [windows-latest, ubuntu-latest]
24-
rust: [1.51, nightly]
25-
runs-on: ${{ matrix.os }}
26-
steps:
27-
- name: Checkout
28-
uses: actions/checkout@v2
29-
- name: Install rust
30-
uses: actions-rs/toolchain@v1
31-
with:
32-
toolchain: ${{ matrix.rust }}
33-
override: true
34-
- name: Ready cache
35-
if: matrix.os == 'ubuntu-latest'
36-
run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/
37-
- name: Cache cargo
38-
uses: actions/cache@v1
39-
id: cache
40-
with:
41-
path: |
42-
~/.cargo/registry/index
43-
~/.cargo/registry/cache
44-
~/.cargo/git
45-
target
46-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
47-
- name: Test twitch_oauth2
48-
uses: actions-rs/cargo@v1
49-
with:
50-
command: test
51-
args: --all-targets --features "${{ env.CI_TWITCH_OAUTH2_FEATURES }}"
52-
fmt:
53-
name: Rustfmt
54-
runs-on: ubuntu-latest
55-
steps:
56-
- uses: actions/checkout@v2
57-
- uses: actions-rs/toolchain@v1
58-
with:
59-
profile: minimal
60-
toolchain: nightly
61-
override: true
62-
components: rustfmt
63-
- name: Run fmt --all -- --check
64-
uses: actions-rs/cargo@v1
65-
with:
66-
command: fmt
67-
args: --all -- --check
68-
69-
clippy:
70-
name: Clippy
71-
runs-on: ubuntu-latest
72-
steps:
73-
- uses: actions/checkout@v2
74-
- uses: actions-rs/toolchain@v1
75-
with:
76-
profile: minimal
77-
toolchain: nightly
78-
override: true
79-
components: clippy
80-
- name: Cache cargo
81-
uses: actions/cache@v1
82-
id: cache
83-
with:
84-
path: |
85-
~/.cargo/registry/index
86-
~/.cargo/registry/cache
87-
~/.cargo/git
88-
target
89-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
90-
- name: Run clippy --all-targets --all-features -- -D warnings
91-
uses: actions-rs/cargo@v1
92-
with:
93-
command: clippy
94-
args: --locked --all-targets --all-features -- -D warnings
95-
docs:
96-
name: Docs
97-
runs-on: ubuntu-latest
98-
steps:
99-
- uses: actions/checkout@v2
100-
- uses: actions-rs/toolchain@v1
101-
with:
102-
profile: minimal
103-
toolchain: nightly
104-
override: true
105-
- name: Cache cargo
106-
uses: actions/cache@v1
107-
id: cache
108-
with:
109-
path: |
110-
~/.cargo/registry/index
111-
~/.cargo/registry/cache
112-
~/.cargo/git
113-
target
114-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
115-
# We do the following to make sure docs.rs can document properly without anything broken, and that docs are working.
116-
- name: Run doc tests
117-
uses: actions-rs/cargo@v1
118-
with:
119-
command: test
120-
args: --doc --all-features
121-
- name: Check twitch_oauth2 docs
122-
uses: actions-rs/cargo@v1
123-
with:
124-
command: doc
125-
args: --locked --no-deps --features "${{ env.CI_TWITCH_OAUTH2_FEATURES }}"
126-
release:
127-
name: Release
128-
runs-on: ubuntu-latest
129-
if: startsWith(github.head_ref, 'release-') || startsWith(github.ref, 'release-')
130-
steps:
131-
- uses: actions/checkout@v2
132-
with:
133-
submodules: false
134-
- uses: actions-rs/toolchain@v1
135-
with:
136-
profile: minimal
137-
toolchain: nightly
138-
override: true
139-
- name: Run dry run publish
140-
uses: actions-rs/cargo@v1
141-
with:
142-
command: publish
1+
name: CI
2+
env:
3+
CI_TWITCH_OAUTH2_FEATURES: "all mock_api"
4+
on:
5+
pull_request:
6+
branches: [master]
7+
types: [opened, reopened, synchronize]
8+
push:
9+
branches: [master, staging, trying]
10+
jobs:
11+
ci:
12+
name: CI
13+
needs: [test, fmt, clippy, docs]
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Done
17+
run: exit 0
18+
test:
19+
name: Tests
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
os: [windows-latest, ubuntu-latest]
24+
rust: [1.51, nightly]
25+
runs-on: ${{ matrix.os }}
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v2
29+
- name: Install rust
30+
uses: actions-rs/toolchain@v1
31+
with:
32+
toolchain: ${{ matrix.rust }}
33+
override: true
34+
- name: Ready cache
35+
if: matrix.os == 'ubuntu-latest'
36+
run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/
37+
- name: Cache cargo
38+
uses: actions/cache@v1
39+
id: cache
40+
with:
41+
path: |
42+
~/.cargo/registry/index
43+
~/.cargo/registry/cache
44+
~/.cargo/git
45+
target
46+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
47+
- name: Test twitch_oauth2
48+
uses: actions-rs/cargo@v1
49+
with:
50+
command: test
51+
args: --all-targets --features "${{ env.CI_TWITCH_OAUTH2_FEATURES }}"
52+
fmt:
53+
name: Rustfmt
54+
runs-on: ubuntu-latest
55+
steps:
56+
- uses: actions/checkout@v2
57+
- uses: actions-rs/toolchain@v1
58+
with:
59+
profile: minimal
60+
toolchain: nightly
61+
override: true
62+
components: rustfmt
63+
- name: Run fmt --all -- --check
64+
uses: actions-rs/cargo@v1
65+
with:
66+
command: fmt
67+
args: --all -- --check
68+
69+
clippy:
70+
name: Clippy
71+
runs-on: ubuntu-latest
72+
steps:
73+
- uses: actions/checkout@v2
74+
- uses: actions-rs/toolchain@v1
75+
with:
76+
profile: minimal
77+
toolchain: nightly
78+
override: true
79+
components: clippy
80+
- name: Cache cargo
81+
uses: actions/cache@v1
82+
id: cache
83+
with:
84+
path: |
85+
~/.cargo/registry/index
86+
~/.cargo/registry/cache
87+
~/.cargo/git
88+
target
89+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
90+
- name: Run clippy --all-targets --all-features -- -D warnings
91+
uses: actions-rs/cargo@v1
92+
with:
93+
command: clippy
94+
args: --locked --all-targets --all-features -- -D warnings
95+
docs:
96+
name: Docs
97+
runs-on: ubuntu-latest
98+
steps:
99+
- uses: actions/checkout@v2
100+
- uses: actions-rs/toolchain@v1
101+
with:
102+
profile: minimal
103+
toolchain: nightly
104+
override: true
105+
- name: Cache cargo
106+
uses: actions/cache@v1
107+
id: cache
108+
with:
109+
path: |
110+
~/.cargo/registry/index
111+
~/.cargo/registry/cache
112+
~/.cargo/git
113+
target
114+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
115+
# We do the following to make sure docs.rs can document properly without anything broken, and that docs are working.
116+
- name: Run doc tests
117+
uses: actions-rs/cargo@v1
118+
with:
119+
command: test
120+
args: --doc --all-features
121+
- name: Check twitch_oauth2 docs
122+
uses: actions-rs/cargo@v1
123+
env:
124+
RUSTDOCFLAGS: "--cfg nightly"
125+
RUSTFLAGS: "--cfg nightly"
126+
with:
127+
command: doc
128+
args: --locked --no-deps --features "${{ env.CI_TWITCH_OAUTH2_FEATURES }}"
129+
release:
130+
name: Release
131+
runs-on: ubuntu-latest
132+
if: startsWith(github.head_ref, 'release-') || startsWith(github.ref, 'release-')
133+
steps:
134+
- uses: actions/checkout@v2
135+
with:
136+
submodules: false
137+
- uses: actions-rs/toolchain@v1
138+
with:
139+
profile: minimal
140+
toolchain: nightly
141+
override: true
142+
- name: Run dry run publish
143+
uses: actions-rs/cargo@v1
144+
with:
145+
command: publish
143146
args: --dry-run --features "${{ env.CI_TWITCH_OAUTH2_FEATURES }}"

0 commit comments

Comments
Β (0)