@@ -24,7 +24,7 @@ export class PubsubService {
2424
2525 constructor ( ) {
2626 const prevHost = localStorage . getItem ( "host" )
27- if ( prevHost ) {
27+ if ( prevHost ) {
2828 console . log ( 'loaded previous host' , prevHost )
2929 this . _currentHost$ . next ( prevHost )
3030 }
@@ -38,7 +38,7 @@ export class PubsubService {
3838 )
3939 }
4040
41- setHost ( hostUrl : string ) {
41+ setHost ( hostUrl : string ) {
4242 this . _currentHost$ . next ( hostUrl )
4343
4444 localStorage . setItem ( "host" , hostUrl )
@@ -58,7 +58,7 @@ export class PubsubService {
5858 localStorage . setItem ( "projects" , jsonList )
5959 }
6060
61- createTopic ( projectId : string , topicId : string ) {
61+ createTopic ( projectId : string , topicId : string ) {
6262 const url = `${ this . _currentHost$ . value } /v1/projects/${ projectId } /topics/${ topicId } `
6363
6464 return this . http . put < Topic > ( url , { } )
@@ -68,13 +68,13 @@ export class PubsubService {
6868 return this . http . get < { topics : Topic [ ] } > ( `${ this . _currentHost$ . value } /v1/projects/${ projectId } /topics` ) . pipe ( map ( incoming => incoming ?. topics || [ ] ) )
6969 }
7070
71- createSubscription ( projectId : string , request : NewSubscriptionRequest ) {
71+ createSubscription ( projectId : string , request : NewSubscriptionRequest ) {
7272 const url = `${ this . _currentHost$ . value } /v1/projects/${ projectId } /subscriptions/${ request . name } `
7373
74- return this . http . put < Subscription > ( url , { topic : request . topic , pushConfig : request . pushConfig } )
74+ return this . http . put < Subscription > ( url , { topic : request . topic , pushConfig : request . pushConfig } )
7575 }
7676
77- deleteSubscription ( subscriptionPath : string ) {
77+ deleteSubscription ( subscriptionPath : string ) {
7878 const url = `${ this . _currentHost$ . value } /v1/${ subscriptionPath } `
7979 return this . http . delete ( url )
8080 }
@@ -83,8 +83,8 @@ export class PubsubService {
8383 return this . http . get < { subscriptions ?: string [ ] } > ( `${ this . _currentHost$ . value } /v1/projects/${ projectId } /subscriptions` )
8484 . pipe (
8585 map ( incoming => incoming . subscriptions ) , // first we pull out the subscriptions object
86- map ( subNames => subNames ?? [ ] ) ,
87- map ( subNames => subNames . map ( name => ( { name, topic : 'undefined' } as Subscription ) ) ) // now we convert each string to a Subscription object (idk why, I think just wanted to learn rxjs mapping...)
86+ map ( subNames => subNames ?? [ ] ) ,
87+ map ( subNames => subNames . map ( name => ( { name, topic : 'undefined' } as Subscription ) ) ) // now we convert each string to a Subscription object (idk why, I think just wanted to learn rxjs mapping...)
8888 )
8989 }
9090
@@ -95,12 +95,12 @@ export class PubsubService {
9595 return this . http . get < { subscriptions ?: string [ ] } > ( url )
9696 . pipe (
9797 map ( incoming => incoming . subscriptions ) ,
98- map ( subNames => subNames ?? [ ] ) ,
98+ map ( subNames => subNames ?? [ ] ) ,
9999 map ( subNames => subNames . map ( name => ( { name, topic : 'undefined' } as Subscription ) ) ) // now we convert each string to a Subscription object (idk why, I think just wanted to learn rxjs mapping...)
100100 )
101101 }
102102
103- getSubscriptionDetails ( subscriptionPath : string ) {
103+ getSubscriptionDetails ( subscriptionPath : string ) {
104104 const url = `${ this . _currentHost$ . value } /v1/${ subscriptionPath } `
105105 return this . http . get < Subscription > ( url )
106106 }
@@ -113,14 +113,14 @@ export class PubsubService {
113113 ) . pipe ( map ( incoming => incoming . receivedMessages ?? [ ] ) )
114114 }
115115
116- ackMessage ( subscriptionPath :string , ackIds : string [ ] ) {
116+ ackMessage ( subscriptionPath : string , ackIds : string [ ] ) {
117117 const url = `${ this . _currentHost$ . value } /v1/${ subscriptionPath } :acknowledge`
118- return this . http . post ( url , { ackIds} )
118+ return this . http . post ( url , { ackIds } )
119119 }
120120
121- publishMessages ( topicPath : string , messages : PubsubMessage [ ] ) {
121+ publishMessages ( topicPath : string , messages : PubsubMessage [ ] ) {
122122 const url = `${ this . _currentHost$ . value } /v1/${ topicPath } :publish`
123- return this . http . post < { messageIds : string [ ] } > ( url , { messages} )
123+ return this . http . post < { messageIds : string [ ] } > ( url , { messages } )
124124 }
125125}
126126
@@ -141,14 +141,14 @@ export interface ReceivedMessage {
141141}
142142
143143export interface PubsubMessage {
144- data : string
144+ data : string
145145 attributes ?: { [ key : string ] : string }
146146 messageId ?: string
147147 publishTime ?: string
148148 orderingKey ?: string
149149}
150150
151- export interface PushConfig {
151+ export interface PushConfig {
152152 pushEndpoint : string
153- attributes ?: { [ key : string ] : string }
153+ attributes ?: { [ key : string ] : string }
154154}
0 commit comments