1
2
3
4
5
6 package github
7
8 import (
9 "context"
10 "fmt"
11 )
12
13
14
15
16 func (s *InteractionsService) GetRestrictionsForOrg(ctx context.Context, organization string) (*InteractionRestriction, *Response, error) {
17 u := fmt.Sprintf("orgs/%v/interaction-limits", organization)
18 req, err := s.client.NewRequest("GET", u, nil)
19 if err != nil {
20 return nil, nil, err
21 }
22
23
24 req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview)
25
26 organizationInteractions := new(InteractionRestriction)
27
28 resp, err := s.client.Do(ctx, req, organizationInteractions)
29 if err != nil {
30 return nil, resp, err
31 }
32
33 return organizationInteractions, resp, nil
34 }
35
36
37
38
39
40
41
42
43 func (s *InteractionsService) UpdateRestrictionsForOrg(ctx context.Context, organization, limit string) (*InteractionRestriction, *Response, error) {
44 u := fmt.Sprintf("orgs/%v/interaction-limits", organization)
45
46 interaction := &InteractionRestriction{Limit: String(limit)}
47
48 req, err := s.client.NewRequest("PUT", u, interaction)
49 if err != nil {
50 return nil, nil, err
51 }
52
53
54 req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview)
55
56 organizationInteractions := new(InteractionRestriction)
57
58 resp, err := s.client.Do(ctx, req, organizationInteractions)
59 if err != nil {
60 return nil, resp, err
61 }
62
63 return organizationInteractions, resp, nil
64 }
65
66
67
68
69 func (s *InteractionsService) RemoveRestrictionsFromOrg(ctx context.Context, organization string) (*Response, error) {
70 u := fmt.Sprintf("orgs/%v/interaction-limits", organization)
71 req, err := s.client.NewRequest("DELETE", u, nil)
72 if err != nil {
73 return nil, err
74 }
75
76
77 req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview)
78
79 return s.client.Do(ctx, req, nil)
80 }
81
View as plain text