Created
June 4, 2018 22:08
-
-
Save matthewbelisle-wf/8aa6fff93719aa1ad0d420e9232835a3 to your computer and use it in GitHub Desktop.
Throw away client for grc-services createOrUpdatePBCRequest()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:frugal/frugal.dart'; | |
import 'package:messaging_sdk/messaging_sdk.dart'; | |
import 'package:w_session/w_session.dart'; | |
import 'package:grc_services_frugal/grc_service.dart'; | |
import 'package:grc_services_frugal/pbc_data_types.dart'; | |
const String _iamHost = 'https://olympus.wdesk.com'; | |
const String _messagingHost = 'https://messaging.olympus.wdesk.com'; | |
main() async { | |
// Setup a client | |
Session session = new Session( | |
sessionHost: Uri.parse(_iamHost), | |
scope: ['sox|r', 'sox|w', 'tasker|r', 'tasker|w']); | |
await session.start(); | |
FrontendConfig config = new FrontendConfig(_messagingHost); | |
NatsMessagingClient client = new NatsMessagingClient(session, config); | |
ServiceDescriptor service = newServiceDescriptor(natsSubject: 'grc-services'); | |
await client.open(); | |
FServiceProvider provider = client.newClient(service); | |
await provider.transport.open(); | |
FGRCServiceClient grcClient = new FGRCServiceClient( | |
provider, | |
[newTokenFetcherMiddleware(client.authSession)]); | |
// Do something | |
Request request = await grcClient.createOrUpdatePBCRequest( | |
new FContext(), | |
null, | |
new RequestParameters() | |
..kind = RequestKind.GENERAL | |
..title = "Test unauthorized PBC request" | |
); | |
print(request); | |
// Close the client | |
await provider.transport.close(); | |
await client.close(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies: | |
frugal: | |
hosted: | |
name: frugal | |
url: https://pub.workiva.org | |
version: ^2.7.0 | |
logging: ^0.11.2 | |
messaging_sdk: | |
hosted: | |
name: messaging_sdk | |
url: https://pub.workiva.org | |
version: ^2.22.0 | |
file_services_sdk: | |
hosted: | |
name: file_services_sdk | |
url: https://pub.workiva.org | |
version: ^2.8.1 | |
grc_services_frugal: | |
hosted: | |
name: grc_services_frugal | |
url: https://pub.workiva.org | |
version: ^1.68.0 | |
environment: | |
sdk: ^1.12.0 | |
name: fs_example | |
version: 0.0.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment