Skip to content

Commit 0e0c79e

Browse files
authored
feat: Add getServiceScopes method to GapicClientTrait (#9372)
1 parent e7ee876 commit 0e0c79e

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

Gax/src/GapicClientTrait.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,16 @@ public function prependMiddleware(callable $middlewareCallable): void
157157
$this->prependMiddlewareCallables[] = $middlewareCallable;
158158
}
159159

160+
/**
161+
* Get the default scopes required by the service.
162+
*
163+
* @return array
164+
*/
165+
public static function getServiceScopes(): array
166+
{
167+
return self::$serviceScopes;
168+
}
169+
160170
/**
161171
* Initiates an orderly shutdown in which preexisting calls continue but new
162172
* calls are immediately cancelled.

Gax/tests/Unit/GapicClientTraitTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,6 +1882,14 @@ private function createTransport(
18821882

18831883
$this->assertTrue($gapic->hasEmulator);
18841884
}
1885+
1886+
public function testGetServiceScopes()
1887+
{
1888+
$this->assertEquals(
1889+
['default-scope-1', 'default-scope-2'],
1890+
DefaultScopeAndAudienceGapicClient::getServiceScopes()
1891+
);
1892+
}
18851893
}
18861894

18871895
class StubGapicClient

0 commit comments

Comments
 (0)